Changeset df3179c for fedd


Ignore:
Timestamp:
May 19, 2010 7:21:24 AM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
4b68c58
Parents:
966c620
Message:

Whoops. Allow unspecified capacities in ns output

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/topdl.py

    r966c620 rdf3179c  
    716716    for idx, s in enumerate(t.substrates):
    717717        loss = s.get_attribute('loss')
    718         if s.latency:
    719             delay = s.latency.time
    720         else:
    721             delay = 0
     718        if s.latency: delay = s.latency.time
     719        else: delay = 0
     720
     721        if s.capacity: rate = s.capacity.rate
     722        else: rate = 100000
    722723        name = to_tcl_name(s.name or "sub%d" % idx)
    723724
     
    727728                    for i in s.interfaces]
    728729            out += 'set %s [$ns make-lan "%s" %fkb %fms ]\n' % \
    729                     (name, " ".join(members), s.capacity.rate, delay)
     730                    (name, " ".join(members), rate, delay)
    730731            if loss:
    731732                "tb-set-lan-loss ${%s} %f\n" % (name, float(loss))
     
    737738                    out += "tb-set-ip-lan ${%s} ${%s} %s\n" % \
    738739                            (to_tcl_name(e.name), name, ip)
    739                 if i.capacity and i.capacity.rate != s.capacity.rate:
     740                if i.capacity and i.capacity.rate != rate:
    740741                    out += "tb-set-node-lan-bandwidth ${%s} ${%s} %fkb\n" % \
    741742                            (to_tcl_name(e.name), name, i.capacity.rate)
     
    754755            out += "set %s [$ns duplex-link ${%s} ${%s} %fkb %fms DropTail]\n" %\
    755756                    (name, to_tcl_name(f.element.name),
    756                             to_tcl_name(t.element.name),
    757                             s.capacity.rate, delay)
     757                            to_tcl_name(t.element.name), rate, delay)
    758758            if loss:
    759759                out += "tb-set-link-loss ${%s} %f\n" % (name, float(loss))
     
    762762                lloss = i.get_attribute("loss")
    763763                cap_override = i.capacity and \
    764                         i.capacity.rate != s.capacity.rate
     764                        i.capacity.rate != rate
    765765                delay_override = i.latency and \
    766766                        i.latency.time != delay
     
    768768                if cap_override or delay_override or loss_override:
    769769                    if i.capacity: cap = i.capacity.rate
    770                     else: cap = s.capacity.rate
     770                    else: cap = rate
    771771
    772772                    if i.latency: delay = i.latency.time
Note: See TracChangeset for help on using the changeset viewer.