verify_slice_links() should exit if links are not supported at the aggregate
[sfa.git] / sfa / planetlab / plslices.py
index 30cb539..7e74592 100644 (file)
@@ -4,10 +4,9 @@ from collections import defaultdict
 from sfa.util.sfatime import utcparse, datetime_to_epoch
 from sfa.util.sfalogging import logger
 from sfa.util.xrn import Xrn, get_leaf, get_authority, urn_to_hrn
-
 from sfa.rspecs.rspec import RSpec
-
 from sfa.planetlab.vlink import VLink
+from sfa.planetlab.topology import Topology
 from sfa.planetlab.plxrn import PlXrn, hrn_to_pl_slicename
 
 MAXINT =  2L**31-1
@@ -215,10 +214,15 @@ class PlSlices:
         return str(key)
 
     def verify_slice_links(self, slice, requested_links, nodes):
-        # nodes is undefined here
+         
         if not requested_links:
             return
-   
+
+        # exit if links are not supported here
+        topology = Topology()
+        if not topology:
+            return 
+
         # build dict of nodes 
         nodes_dict = {}
         interface_ids = []
@@ -246,7 +250,11 @@ class PlSlices:
         for link in requested_links:
             # get the ip address of the first node in the link
             ifname1 = Xrn(link['interface1']['component_id']).get_leaf()
-            (node_raw, device) = ifname1.split(':')
+            ifname_parts = ifname1.split(':')
+            node_raw = ifname_parts[0]
+            device = None
+            if len(ifname_parts) > 1:
+                device = ifname_parts[1] 
             node_id = int(node_raw.replace('node', ''))
             node = nodes_dict[node_id]
             if1 = interfaces_dict[node['interface_ids'][0]]