id ipaddress attribute to interface tag
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Sun, 30 Oct 2011 15:43:52 +0000 (11:43 -0400)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Sun, 30 Oct 2011 15:43:52 +0000 (11:43 -0400)
sfa/plc/aggregate.py
sfa/rspecs/elements/versions/pgv2Link.py
sfa/rspecs/versions/sfav1.py

index 8b1d221..3512309 100644 (file)
@@ -74,10 +74,12 @@ class Aggregate:
                 # set interfaces
                 # just get first interface of the first node
                 if1_xrn = PlXrn(auth=self.api.hrn, interface='node%s:eth0' % (node1['node_id']))
+                if1_ipv4 = self.interfaces[node1['interface_ids'][0]]['ip']
                 if2_xrn = PlXrn(auth=self.api.hrn, interface='node%s:eth0' % (node2['node_id']))
+                if2_ipv4 = self.interfaces[node2['interface_ids'][0]]['ip']
 
-                if1 = Interface({'component_id': if1_xrn.urn} )
-                if2 = Interface({'component_id': if2_xrn.urn} )
+                if1 = Interface({'component_id': if1_xrn.urn, 'ipv4': if1_ipv4} )
+                if2 = Interface({'component_id': if2_xrn.urn, 'ipv4': if2_ipv4} )
 
                 # set link
                 link = Link({'capacity': '1000000', 'latency': '0', 'packet_loss': '0', 'type': 'ipv4'})
@@ -135,6 +137,7 @@ class Aggregate:
             slices = self.api.plshell.GetSlices(self.api.plauth, slice_name)
             if slices:
                 slice = slices[0]
+            self.prepare(slice=slice)
         else:
             self.prepare()
             
index e39ef35..851fd6e 100644 (file)
@@ -38,7 +38,6 @@ class PGv2Link:
                 latency=link['latency'], packet_loss=link['packet_loss'])
             if 'type' in link and link['type']:
                 type_elem = etree.SubElement(link_elem, 'link_type', name=link['type'])             
-   
     @staticmethod 
     def get_links(xml):
         links = []
index f938463..8f2c603 100644 (file)
@@ -218,7 +218,8 @@ class SFAv1(BaseVersion):
                     if 'bwlimit' in interface and interface['bwlimit']:
                         bwlimit = etree.SubElement(node_tag, 'bw_limit', units='kbps').text = str(interface['bwlimit']/1000)
                     comp_id = PlXrn(auth=network, interface='node%s:eth%s' % (node['node_id'], i)).get_urn() 
-                    interface_tag = etree.SubElement(node_tag, 'interface', component_id=comp_id)
+                    ipaddr = interface['ip'] 
+                    interface_tag = etree.SubElement(node_tag, 'interface', component_id=comp_id, ipv4=ipaddr)
                     i+=1
             if 'bw_unallocated' in node:
                 bw_unallocated = etree.SubElement(node_tag, 'bw_unallocated', units='kbps').text = str(node['bw_unallocated']/1000)