Support GetLinkSpecs
[sfa.git] / geni / util / specdict.py
index 0fe52c9..8f0b597 100644 (file)
@@ -48,7 +48,12 @@ class SpecDict(dict):
                         value = [expected(value) for value in spec_dict[plc_field]]
             spec[field] = value
         return {self.type: spec}
-    
+
+#
+# fields = { geni_field:  type.  Could be class for nested classes, otherwise prob str}
+# plc_fields = {geni_field : plc_field}
+#
 class IfSpecDict(SpecDict):
     type = 'IfSpec'
     fields = {'name': '',
@@ -59,9 +64,29 @@ class IfSpecDict(SpecDict):
               'max_rate': '',
               'max_kbyte': '',
               'ip_spoof': ''}
-    plc_fields = {'name': 'is_primary',
+    plc_fields = {'name': 'is_primary', # XXX needs munging to return name instead of True or False
                  'addr': 'ip',
                  'type': 'type'}
+class LinkSpecDict(SpecDict):
+    type = 'LinkSpec'
+    fields = {'min_alloc': '', 
+              'max_alloc': '', 
+              'type': '', 
+              'start_time': '', 
+              'bw': '', 
+              'duration': '', 
+              'init_params': '',
+              'endpoints': [IfSpecDict]}
+    plc_fields = {'min_alloc': 'min_alloc',
+              'max_alloc': 'max_alloc', 
+              'type': 'type', 
+              'start_time': 'start_time', 
+              'bw': 'bw', 
+              'duration': 'duration', 
+              'init_params': 'init_params',
+              'endpoints': 'endpoints'}
+  
             
 class NodeSpecDict(SpecDict):
     type = 'NodeSpec'