providing url field while adding slice
[sfa.git] / geni / util / api.py
index 08e1134..6bc82a6 100644 (file)
@@ -241,16 +241,22 @@ class GeniAPI:
     # @param pl_fields dictionary of PLC fields (output)
 
     def geni_fields_to_pl_fields(self, type, hrn, record):
+
+        def convert_ints(tmpdict, int_fields):
+            for field in int_fields:
+                if field in tmpdict:
+                    tmpdict[field] = int(tmpdict[field])
+
         pl_record = {}
-        for field in record:
-            pl_record[field] = record[field]
+        #for field in record:
+        #    pl_record[field] = record[field]
  
         if type == "slice":
             if not "instantiation" in pl_record:
-                pl_record["instantiation"] = "delegated"  # "plc-instantiated"
-            if not "max_nodes" in pl_record:
-                pl_record["max_nodes"] = 10
+                pl_record["instantiation"] = "plc-instantiated"
             pl_record["name"] = hrn_to_pl_slicename(hrn)
+           if "url" in record:
+               pl_record["url"] = record["url"]
 
         elif type == "node":
             if not "hostname" in pl_record:
@@ -401,7 +407,10 @@ class GeniAPI:
 
     def update_membership_list(self, oldRecord, record, listName, addFunc, delFunc):
         # get a list of the HRNs tht are members of the old and new records
-        oldList = oldRecord.get(listName, [])
+        if oldRecord:
+            oldList = oldRecord.get(listName, [])
+        else:
+            oldList = []     
         newList = record.get(listName, [])
 
         # if the lists are the same, then we don't have to update anything