X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=create-topo-attributes.py;h=b9536eb659e022ff244fdb9d781f49552858633f;hb=0206b7aa8e458cd414b1adf722b7ef94a8ff9938;hp=ab4680ef0795a1d24f9df039116734f92d7a2685;hpb=8fee093853af7576f959c64a87e8e8ebb78d1718;p=nodemanager-topo.git diff --git a/create-topo-attributes.py b/create-topo-attributes.py index ab4680e..b9536eb 100755 --- a/create-topo-attributes.py +++ b/create-topo-attributes.py @@ -2,7 +2,7 @@ # $URL$ """ -Scan the VINI Central database and create topology "rspec" attributes for +Scan the VINI Central database and create topology "rspec" tags for slices that have an EGRE key. This script to be run from a cron job. """ @@ -110,13 +110,13 @@ nodes = get_nodes() adj_matrix = get_adjacency_matrix(links) for slice in GetSlices(): - # Create dictionary of the slice's attributes + # Create dictionary of the slice's tags attrs ={} topo_attr = {} - for attribute in GetSliceAttributes(slice['slice_attribute_ids']): - attrs[attribute['name']] = attribute['slice_attribute_id'] - if attribute['name'] == 'topo_rspec' and attribute['node_id']: - topo_attr[attribute['node_id']] = attribute['slice_attribute_id'] + for tag in GetSliceTags(slice['slice_tag_ids']): + attrs[tag['tagname']] = tag['slice_tag_id'] + if tag['tagname'] == 'topo_rspec' and tag['node_id']: + topo_attr[tag['node_id']] = tag['slice_tag_id'] if dryrun and slice['name'] == 'pl_trellis': attrs['egre_key'] = 101 @@ -149,19 +149,19 @@ for slice in GetSlices(): if dryrun: print node, topo_str elif node in topo_attr: - UpdateSliceAttribute(topo_attr[node], topo_str) + UpdateSliceTag(topo_attr[node], topo_str) del topo_attr[node] else: id = slice['slice_id'] - AddSliceAttribute(id, 'topo_rspec', topo_str, node) + AddSliceTag(id, 'topo_rspec', topo_str, node) if dryrun: print hosts elif 'hosts' in attrs: - UpdateSliceAttribute(attrs['hosts'], hosts) + UpdateSliceTag(attrs['hosts'], hosts) else: id = slice['slice_id'] - AddSliceAttribute(id, 'hosts', hosts) + AddSliceTag(id, 'hosts', hosts) else: if dryrun: print "No EGRE key for %s" % slice['name'] @@ -170,6 +170,6 @@ for slice in GetSlices(): if not dryrun: for node in topo_attr: - DeleteSliceAttribute(topo_attr[node]) + DeleteSliceTag(topo_attr[node])