Fix attribute placement in RSpec
authorAndy Bavier <acb@acb-imac.cs.princeton.edu>
Tue, 8 Feb 2011 19:33:40 +0000 (14:33 -0500)
committerAndy Bavier <acb@acb-imac.cs.princeton.edu>
Tue, 8 Feb 2011 19:33:40 +0000 (14:33 -0500)
Fix issue where slice tags assigned to specific nodes were showing up
under the <sliver_defaults> tag in the RSpec

sfa/plc/network.py

index dd0b4b4..ee04381 100644 (file)
@@ -133,9 +133,12 @@ class Slice:
         for i in self.slice_tag_ids:
             try: 
                 tag = self.network.lookupSliceTag(i)                 
-                if tag.tagname == tagname: 
-                    if not (node and node.id != tag.node_id): 
-                        tags.append(tag) 
+                if tag.tagname == tagname:
+                    if node:
+                        if node.id == tag.node_id:
+                            tags.append(tag)
+                    elif not tag.node_id:
+                        tags.append(tag)
             except InvalidRSpec, e: 
                 # As they're not needed, we ignore some tag types from 
                 # GetSliceTags call. See Slicetag.ignore_tags 
@@ -150,7 +153,10 @@ class Slice:
             for i in self.slice_tag_ids: 
                 tag = self.network.lookupSliceTag(i) 
                 if tag.tagname == tagname: 
-                    if (not node) or (node.id == tag.node_id): 
+                    if node:
+                        if node.id == tag.node_id:
+                            return tag
+                    elif not tag.node_id:
                         return tag 
         except InvalidRSpec, e: 
             # As they're not needed, we ignore some tag types from