renaming SliceAttribute into SliceTag and InterfaceSetting into InterfaceTag
Thierry Parmentelat [Fri, 28 Nov 2008 14:36:02 +0000 (14:36 +0000)]
federation/TestPeers.py
system/TestApiserver.py
system/TestNode.py
system/TestSlice.py
system/plcsh-stress-test.py

index 5013317..4bbd265 100755 (executable)
@@ -743,38 +743,38 @@ def test05_sat (args=[1,2]):
     for i in args:
         name = sat_name(i)
         try:
-            sat_id=s[i].GetSliceAttributeTypes ([name])[0]
+            sat_id=s[i].GetSliceTagTypes ([name])[0]
         except:
             description="custom sat on plc%d"%i
             min_role_id=10
-            sat_id=s[i].AddSliceAttributeType ({ 'name':name,
+            sat_id=s[i].AddSliceTagType ({ 'name':name,
                                                  'description': description,
                                                  'min_role_id' : min_role_id})
             if sat_id:
-                print '%02d:== created SliceAttributeType = %d'%(i,sat_id)
+                print '%02d:== created SliceTagType = %d'%(i,sat_id)
 
-# for test, we create 4 slice_attributes
+# for test, we create 4 slice_tags
 # on slice1 - sat=custom_made (see above) - all nodes
 # on slice1 - sat=custom_made (see above) - node=n1
 # on slice1 - sat='net_max' - all nodes
 # on slice1 - sat='net_max' - node=n1
 
 def test05_sa_atom (slice_name,sat_name,value,node,i):
-    sa_id=s[i].GetSliceAttributes({'name':sat_name,
+    sa_id=s[i].GetSliceTags({'name':sat_name,
                                    'value':value})
     if not sa_id:
         if node:
-            sa_id=s[i].AddSliceAttribute(slice_name,
+            sa_id=s[i].AddSliceTag(slice_name,
                                          sat_name,
                                          value,
                                          node)
         else:
             print 'slice_name',slice_name,'sat_name',sat_name
-            sa_id=s[i].AddSliceAttribute(slice_name,
+            sa_id=s[i].AddSliceTag(slice_name,
                                          sat_name,
                                          value)
         if sa_id:
-            print '%02d:== created SliceAttribute = %d'%(i,sa_id),
+            print '%02d:== created SliceTag = %d'%(i,sa_id),
             print 'On slice',slice_name,'and node',node
         
 def test05_sa (args=[1,2]):
@@ -801,7 +801,7 @@ def p_node(n):
 
 def p_slice(s):
     print 'name: %-12s'%s['name'],'id: %02d'%s['slice_id'],'peer:',s['peer_id'],'nodes=',s['node_ids'],'persons=',s['person_ids']
-    print '---','sa_ids=',s['slice_attribute_ids'],'creator: %03r'%s['creator_person_id']
+    print '---','sa_ids=',s['slice_tag_ids'],'creator: %03r'%s['creator_person_id']
     print "--- 'expires':",s['expires']
 
 def p_sat(sat):
@@ -810,7 +810,7 @@ def p_sat(sat):
 
 def p_sa (sa):
         print 'name: %-12s'%sa['name'], 
-        print 'sa_id: %02d'%sa['slice_attribute_id'],'sat_id: %02d'%sa['attribute_type_id'],
+        print 'sa_id: %02d'%sa['slice_tag_id'],'sat_id: %02d'%sa['attribute_type_id'],
         print 'sl=%02d'%sa['slice_id'],'v=',sa['value'],'n=',sa['node_id']
 
 import pprint
@@ -843,9 +843,9 @@ def dump (args=[1,2]):
         print '%02d: SLICES'%i
         [p_slice(x) for x in s[i].GetSlices()]
         print '%02d: Slice Attribute Types'%i
-        [p_sat(x) for x in s[i].GetSliceAttributeTypes()]
+        [p_sat(x) for x in s[i].GetSliceTagTypes()]
         print '%02d: Slice Attributes'%i
-        [p_sa(x) for x in s[i].GetSliceAttributes()]
+        [p_sa(x) for x in s[i].GetSliceTags()]
         timer_show()
         snodes=min(3,number_nodes)
         print '%02d: SLIVERS for first %d nodes'%(i,snodes)
@@ -878,11 +878,11 @@ def ps ():
         p_slice(x)
 
 def psat():
-    for x in GetSliceAttributeTypes():
+    for x in GetSliceTagTypes():
         p_sat(x)
         
 def psa():
-    for x in GetSliceAttributes():
+    for x in GetSliceTags():
         p_sa(x)
         
 def pv ():
@@ -1057,7 +1057,7 @@ def test_all_slices ():
     
 def test_all_sats ():
     test05_sat ()
-    test00_refresh("after SliceAttributeType creation")                   
+    test00_refresh("after SliceTagType creation")                   
 
 def test_all ():
     test_all_init ()
index 41823e2..0ad8935 100644 (file)
@@ -12,7 +12,7 @@ server_methods = [ ('GetNodes' ,  []),
                    ('GetInterfaces' , True),
                    ('GetTagTypes' , []),
                    ('AddTagType' , True),
-                   ('AddInterfaceSetting' , True),
+                   ('AddInterfaceTag' , True),
                    ('GetBootMedium' , True),
                    ('GetNodeGroups' , True),
                    ('AddNodeGroup' , True),
@@ -29,7 +29,7 @@ server_methods = [ ('GetNodes' ,  []),
                    ('AddSlice' , True),
                    ('AddPersonToSlice' , True),
                    ('AddSliceToNodes' , True),
-                   ('AddSliceAttribute' , True),
+                   ('AddSliceTag' , True),
                    ('AddPerson' , True),
                    ('UpdatePerson' , True),
                    ('AddRoleToPerson' , True),
index e6f5784..ab51bb7 100644 (file)
@@ -78,21 +78,20 @@ class TestNode:
         # populate network interfaces - others
         if self.node_spec.has_key('extra_interfaces'):
             for interface in self.node_spec['extra_interfaces']:
-                server.AddInterface(userauth,self.name(),
-                                                    interface['interface_fields'])
+                server.AddInterface(userauth,self.name(), interface['interface_fields'])
                 if interface.has_key('settings'):
                     for (attribute,value) in interface['settings'].iteritems():
                         # locate node network
-                        nn = server.GetInterfaces(userauth,{'ip':interface['interface_fields']['ip']})[0]
-                        nnid=nn['interface_id']
+                        interface = server.GetInterfaces(userauth,{'ip':interface['interface_fields']['ip']})[0]
+                        interface_id=interface['interface_id']
                         # locate or create node network attribute type
                         try:
-                            nnst = server.GetTagTypes(userauth,{'name':attribute})[0]
+                            interface_tagtype = server.GetTagTypes(userauth,{'name':attribute})[0]
                         except:
-                            nnst = server.AddTagType(rootauth,{'category':'test',
-                                                               'tagname':attribute})
+                            interface_tagtype = server.AddTagType(rootauth,{'category':'test',
+                                                                            'tagname':attribute})
                         # attach value
-                        server.AddInterfaceSetting(userauth,nnid,attribute,value)
+                        server.AddInterfaceTag(userauth,interface_id,attribute,value)
 
     def delete_node (self):
         # uses the right auth as far as poss.
index 1420a53..5b89b08 100644 (file)
@@ -55,10 +55,10 @@ class TestSlice:
         if self.slice_spec.has_key('initscriptname'):
             isname=self.slice_spec['initscriptname']
             utils.header("Adding initscript %s in %s"%(isname,slice_name))
-            self.test_plc.apiserver.AddSliceAttribute(self.test_plc.auth_root(), slice_name,'initscript',isname)
+            self.test_plc.apiserver.AddSliceTag(self.test_plc.auth_root(), slice_name,'initscript',isname)
         if self.slice_spec.has_key ('vref'):
             vref_value=self.slice_spec['vref']
-            self.test_plc.apiserver.AddSliceAttribute(self.test_plc.auth_root(), slice_name,'vref',vref_value)
+            self.test_plc.apiserver.AddSliceTag(self.test_plc.auth_root(), slice_name,'vref',vref_value)
         
     def locate_key(self):
         # locate the first avail. key
index 5015166..73a7509 100755 (executable)
@@ -216,7 +216,7 @@ class Test:
         'addresses_per_site': 1,
         'persons_per_site': 1,
         'keys_per_person': 1,
-        'slice_attributes': 1,
+        'slice_tags': 1,
         'nodegroups': 1,
         'nodes_per_site': 1,
         'interfaces_per_node': 1,
@@ -233,7 +233,7 @@ class Test:
         'addresses_per_site': 2,
         'persons_per_site': 4,
         'keys_per_person': 2,
-        'slice_attributes': 10,
+        'slice_tags': 10,
         'nodegroups': 10,
         'nodes_per_site': 2,
         'interfaces_per_node': 1,
@@ -265,7 +265,7 @@ class Test:
         self.pcu_ids = []
         self.conf_file_ids = []
         self.slice_ids = []
-        self.slice_attribute_ids = []
+        self.slice_tag_ids = []
 
     def Run(self, **kwds):
         """
@@ -303,7 +303,7 @@ class Test:
         self.AddAddresses(params['addresses_per_site'])
         self.AddPersons(params['persons_per_site'])
         self.AddKeys(params['keys_per_person'])
-        self.AddTagTypes(params['slice_attributes'],params['nodegroups'],params['ilinks'])
+        self.AddTagTypes(params['slice_tags'],params['nodegroups'],params['ilinks'])
         self.AddNodeGroups(params['nodegroups'])
         self.AddNodes(params['nodes_per_site'])
         self.AddInterfaces(params['interfaces_per_node'])
@@ -311,7 +311,7 @@ class Test:
         self.AddPCUs(params['pcus_per_site'])
         self.AddConfFiles(params['conf_files'])
         self.AddSlices(params['slices_per_site'])
-        self.AddSliceAttributes(params['attributes_per_slice'])
+        self.AddSliceTags(params['attributes_per_slice'])
 
     def Update(self):
         self.UpdateSites()
@@ -327,10 +327,10 @@ class Test:
         self.UpdatePCUs()
         self.UpdateConfFiles()
         self.UpdateSlices()
-        self.UpdateSliceAttributes()
+        self.UpdateSliceTags()
 
     def Delete(self):
-        self.DeleteSliceAttributes()
+        self.DeleteSliceTags()
         self.DeleteSlices()
         self.DeleteKeys()
         self.DeleteConfFiles()
@@ -1451,7 +1451,7 @@ class Test:
 
         self.slice_ids = []
 
-    def AddSliceAttributes(self, per_slice = 2):
+    def AddSliceTags(self, per_slice = 2):
         """
         Add a number of random slices per site.
         """
@@ -1474,61 +1474,61 @@ class Test:
 
                     # Add slice attribute
                     if node_id is None:
-                        slice_attribute_id = self.api.AddSliceAttribute(slice_id, tag_type_id, value)
+                        slice_tag_id = self.api.AddSliceTag(slice_id, tag_type_id, value)
                     else:
-                        slice_attribute_id = self.api.AddSliceAttribute(slice_id, tag_type_id, value, node_id)
+                        slice_tag_id = self.api.AddSliceTag(slice_id, tag_type_id, value, node_id)
 
-                    # Should return a unique slice_attribute_id
-                    assert slice_attribute_id not in self.slice_attribute_ids
-                    self.slice_attribute_ids.append(slice_attribute_id)
+                    # Should return a unique slice_tag_id
+                    assert slice_tag_id not in self.slice_tag_ids
+                    self.slice_tag_ids.append(slice_tag_id)
 
                     if self.check:
                         # Check slice attribute
-                        slice_attribute = self.api.GetSliceAttributes([slice_attribute_id])[0]
-                        for field in 'tag_type_id', 'slice_id', 'node_id', 'slice_attribute_id', 'value':
-                            assert slice_attribute[field] == locals()[field]
+                        slice_tag = self.api.GetSliceTags([slice_tag_id])[0]
+                        for field in 'tag_type_id', 'slice_id', 'node_id', 'slice_tag_id', 'value':
+                            assert slice_tag[field] == locals()[field]
 
                     if self.verbose:
-                        print "Added slice attribute", slice_attribute_id, "of type", tag_type_id,
+                        print "Added slice attribute", slice_tag_id, "of type", tag_type_id,
                         if node_id is not None:
                             print "to node", node_id,
                         print
                         
-    def UpdateSliceAttributes(self):
+    def UpdateSliceTags(self):
         """
         Make random changes to any slice attributes we may have added.
         """
 
-        for slice_attribute_id in self.slice_attribute_ids:
+        for slice_tag_id in self.slice_tag_ids:
             # Update slice attribute
             value = randstr(16, letters + '_' + digits)
-            self.api.UpdateSliceAttribute(slice_attribute_id, value)
+            self.api.UpdateSliceTag(slice_tag_id, value)
 
             # Check slice attribute again
-            slice_attribute = self.api.GetSliceAttributes([slice_attribute_id])[0]
-            assert slice_attribute['value'] == value
+            slice_tag = self.api.GetSliceTags([slice_tag_id])[0]
+            assert slice_tag['value'] == value
 
             if self.verbose:
-                print "Updated slice attribute", slice_attribute_id
+                print "Updated slice attribute", slice_tag_id
 
-    def DeleteSliceAttributes(self):
+    def DeleteSliceTags(self):
         """
         Delete any random slice attributes we may have added.
         """
 
-        for slice_attribute_id in self.slice_attribute_ids:
-            self.api.DeleteSliceAttribute(slice_attribute_id)
+        for slice_tag_id in self.slice_tag_ids:
+            self.api.DeleteSliceTag(slice_tag_id)
 
             if self.check:
-                assert not self.api.GetSliceAttributes([slice_attribute_id])
+                assert not self.api.GetSliceTags([slice_tag_id])
 
             if self.verbose:
-                print "Deleted slice attribute", slice_attribute_id
+                print "Deleted slice attribute", slice_tag_id
 
         if self.check:
-            assert not self.api.GetSliceAttributes(self.slice_attribute_ids)
+            assert not self.api.GetSliceTags(self.slice_tag_ids)
 
-        self.slice_attribute_ids = []
+        self.slice_tag_ids = []
 
 def main():
     parser = OptionParser()