Do not erase manual topology
[nodemanager-topo.git] / create-topo-attributes.py
index f0c95e2..5f42684 100755 (executable)
@@ -119,8 +119,8 @@ class Slice:
         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
@@ -167,7 +167,7 @@ class Slice:
                 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)
@@ -297,8 +297,8 @@ def get_slice_tags():
 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))
@@ -378,9 +378,10 @@ for i in slices:
             print "Slice %s not using IIAS" % slice.name
 
     if topo_type == 'manual' and slice.get_tag('egre_key', slicetags):
-        topo_tag = slice.get_tag('topo_rspec', slicetags)
-        if topo_tag:
-            topo_tag.updated = True
+        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: