Changeset f671ef7
- Timestamp:
- Dec 1, 2011 9:57:47 AM (13 years ago)
- Branches:
- compt_changes, info-ops, master
- Children:
- 218ffe0
- Parents:
- 1ae1aa2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/experiment_control.py
r1ae1aa2 rf671ef7 979 979 980 980 def annotate_topology(self, top, data): 981 def add_new(ann, attr): 982 for a in ann: 983 if a not in attr: attr.append(a) 981 # These routines do various parts of the annotation 982 def add_new_names(nl, l): 983 """ add any names in nl to the list in l """ 984 for n in nl: 985 if n not in l: l.append(n) 986 987 def merge_services(ne, e): 988 for ns in ne.service: 989 # NB: the else is on the for 990 for s in e.service: 991 if ns.name == s.name: 992 s.importer = ns.importer 993 s.param = ns.param 994 s.description = ns.description 995 s.status = ns.status 996 break 997 else: 998 e.service.append(ns) 999 1000 def merge_oses(ne, e): 1001 """ 1002 Merge the operating system entries of ne into e 1003 """ 1004 for nos in ne.os: 1005 # NB: the else is on the for 1006 for os in e.os: 1007 if nos.name == eos.name: 1008 eos.version = nos.version 1009 eos.version = nos.distribution 1010 eos.version = nos.distributionversion 1011 for a in nos.attribute: 1012 eos.set_attribute(a.attribute, a.value) 1013 break 1014 else: 1015 e.os.append(nos) 984 1016 985 1017 # Annotate the topology with embedding info … … 987 1019 if isinstance(e, topdl.Computer): 988 1020 for s in data: 989 ann = s.node.get(e.name, None) 990 if ann is not None: 991 add_new(ann.localname, e.localname) 992 e.status = ann.status 993 add_new(ann.service, e.service) 994 add_new(ann.operation, e.operation) 995 if ann.os: 996 e.os = ann.os 1021 ne = s.node.get(e.name, None) 1022 if ne is not None: 1023 add_new_names(ne.localname, e.localname) 1024 e.status = ne.status 1025 merge_services(ne, e) 1026 add_new_names(ne.operation, e.operation) 1027 if ne.os: merge_oses(ne, e) 997 1028 break 998 1029
Note: See TracChangeset
for help on using the changeset viewer.