Changeset 8ce4e5c
- Timestamp:
- Jan 12, 2012 7:35:37 PM (13 years ago)
- Branches:
- compt_changes, info-ops, master
- Children:
- 0fb2973
- Parents:
- 6886c5a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/topdl.py
r6886c5a r8ce4e5c 928 928 929 929 for eidx, e in enumerate(t.elements): 930 if e.name: name = e.name 931 else: name = "unnamed_node%d" % eidx 932 933 ips = [ ] 934 for idx, i in enumerate(e.interface): 935 ip = i.get_attribute('ip4_address') 936 ips.append(ip) 937 port = "%s:%d" % (name, idx) 938 for idx, s in enumerate(i.subs): 939 bw = 100000 940 delay = 0.0 941 if s.capacity: 942 bw = s.capacity.rate 943 if i.capacity: 944 bw = i.capacity.rate 945 946 if s.latency: 947 delay = s.latency.time 948 if i.latency: 949 bw = i.latency.time 950 951 lans.append({ 952 'member': port, 953 'vname': s.name, 954 'ip': ip, 955 'vnode': name, 956 'delay': delay, 957 'bandwidth': bw, 958 }) 959 nodes.append({ 960 'ips': ":".join(ips), 961 'vname': name, 962 }) 930 if isinstance(e, topdl.Computer): 931 if e.name: name = e.name 932 else: name = "unnamed_node%d" % eidx 933 934 ips = [ ] 935 for idx, i in enumerate(e.interface): 936 ip = i.get_attribute('ip4_address') 937 ips.append(ip) 938 port = "%s:%d" % (name, idx) 939 for idx, s in enumerate(i.subs): 940 bw = 100000 941 delay = 0.0 942 if s.capacity: 943 bw = s.capacity.rate 944 if i.capacity: 945 bw = i.capacity.rate 946 947 if s.latency: 948 delay = s.latency.time 949 if i.latency: 950 bw = i.latency.time 951 952 lans.append({ 953 'member': port, 954 'vname': s.name, 955 'ip': ip, 956 'vnode': name, 957 'delay': delay, 958 'bandwidth': bw, 959 }) 960 nodes.append({ 961 'ips': ":".join(ips), 962 'vname': name, 963 }) 963 964 964 965 return { 'node': nodes, 'lan': lans }
Note: See TracChangeset
for help on using the changeset viewer.