record = {'slice_tag_id':None, 'slice_id':self.id, 'tagname':tagname, 'value':value}
if node:
record['node_id'] = node.id
+ else:
+ record['node_id'] = None
tag = Slicetag(record)
- slicetags[id] = tag
- self.slice_tag_ids.append(id)
+ slicetags[tag.id] = tag
+ self.slice_tag_ids.append(tag.id)
tag.changed = True
tag.updated = True
return tag
if cap == "CAP_NET_ADMIN":
return
else:
- newcaps = "CAP_NET_ADMIN," + caps
+ newcaps = "CAP_NET_ADMIN," + tag.value
self.update_tag('capabilities', newcaps, slicetags)
else:
self.add_tag('capabilities', 'CAP_NET_ADMIN', slicetags)
Find a free EGRE key
"""
def free_egre_key(slicetags):
+ used = set()
for i in slicetags:
- used = set()
tag = slicetags[i]
if tag.tagname == 'egre_key':
used.add(int(tag.value))
else:
topo_type = None
- if topo_type == 'vsys' or topo_type == 'iias':
+ """
+ Valid values of topo_type:
+ 'vsys': Use vsys topology scripts to set up virtual links
+ 'iias': Automatically create a virtual topology mirroring the physical one
+ 'manual': Don't modify the topo_rspec tags if present
+ None: No virtual topology
+ """
+ if topo_type in ['vsys', 'iias', 'manual']:
slice.assign_egre_key(slicetags)
slice.turn_on_netns(slicetags)
slice.add_cap_net_admin(slicetags)
if dryrun:
print "Slice %s not using IIAS" % slice.name
+ if topo_type == 'manual' and slice.get_tag('egre_key', slicetags):
+ for node in slice.get_nodes(nodes):
+ topo_tag = slice.get_tag('topo_rspec', slicetags, node)
+ if topo_tag:
+ topo_tag.updated = True
+
# Update the tag values in the database
for i in slicetags:
tag = slicetags[i]