Allow VIO extended PCI address for the port_mapping 38/2138/3 v2.0
authortierno <alfonso.tiernosepulveda@telefonica.com>
Fri, 8 Sep 2017 10:44:15 +0000 (12:44 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 13 Sep 2017 08:40:35 +0000 (10:40 +0200)
Change-Id: I518f33f3f07b278145c458436ee13b3c56a5a147
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
osm_openvim/ovim.py
osm_openvim/vim_schema.py

index fe2748f..53a39eb 100755 (executable)
@@ -43,8 +43,8 @@ import openflow_conn
 
 __author__ = "Alfonso Tierno, Leonardo Mirabal"
 __date__ = "$06-Feb-2017 12:07:15$"
-__version__ = "0.5.18-r534"
-version_date = "Jun 2017"
+__version__ = "0.5.20-r536"
+version_date = "Sep 2017"
 database_version = 21      #needed database schema version
 
 HTTP_Bad_Request =          400
@@ -1361,6 +1361,8 @@ class ovim():
                 map['switch_dpid'] = switch_dpid
             if region:
                 map['region'] = region
+            if map.get("pci"):
+                map["pci"] = map["pci"].lower()
 
         for of_map in of_maps:
             result, uuid = self.db.new_row('of_port_mappings', of_map, True)
index 9440872..697b4e9 100644 (file)
@@ -32,27 +32,36 @@ __date__ ="$10-jul-2014 12:07:15$"
 #
 
 path_schema = {"type": "string", "maxLength": 255, "pattern": "^(\.){0,2}(/[^/\"':{}\(\)]+)+$"}
-http_schema={"type":"string", "pattern":"^https?://[^'\"=]+$"}
-port_schema={"type":"integer","minimum":1,"maximun":65534}
-ip_schema={"type":"string","pattern":"^([0-9]{1,3}.){3}[0-9]{1,3}$"}
-cidr_schema={"type":"string","pattern":"^([0-9]{1,3}.){3}[0-9]{1,3}/[0-9]{1,2}$"}
-name_schema={"type" : "string", "minLength":1, "maxLength":255, "pattern" : "^[^,;()'\"]+$"}
-nameshort_schema={"type" : "string", "minLength":1, "maxLength":64, "pattern" : "^[^,;()'\"]+$"}
-nametiny_schema={"type" : "string", "minLength":1, "maxLength":12, "pattern" : "^[^,;()'\"]+$"}
-xml_text_schema={"type" : "string", "minLength":1, "maxLength":1000, "pattern" : "^[^']+$"}
-description_schema={"type" : ["string","null"], "maxLength":255, "pattern" : "^[^'\"]+$"}
-id_schema_fake = {"type" : "string", "minLength":2, "maxLength":36 }  #"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
-id_schema = {"type" : "string", "pattern": "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$"}
-pci_schema={"type":"string", "pattern":"^[0-9a-fA-F]{4}(:[0-9a-fA-F]{2}){2}\.[0-9a-fA-F]$"}
-bandwidth_schema={"type":"string", "pattern" : "^[0-9]+ *([MG]bps)?$"}
-integer0_schema={"type":"integer","minimum":0}
-integer1_schema={"type":"integer","minimum":1}
-vlan_schema={"type":"integer","minimum":1,"maximun":4095}
-vlan1000_schema={"type":"integer","minimum":1000,"maximun":4095}
-mac_schema={"type":"string", "pattern":"^[0-9a-fA-F][02468aceACE](:[0-9a-fA-F]{2}){5}$"}  #must be unicast LSB bit of MSB byte ==0 
-net_bind_schema={"oneOf":[{"type":"null"},{"type":"string", "pattern":"^(default|((bridge|macvtap):[0-9a-zA-Z\.\-]{1,50})|openflow:[/0-9a-zA-Z\.\-]{1,50}(:vlan)?)$"}]}
-yes_no_schema={"type":"string", "enum":["yes", "no"]}
-log_level_schema={"type":"string", "enum":["DEBUG", "INFO", "WARNING","ERROR","CRITICAL"]}
+http_schema = {"type": "string", "pattern": "^https?://[^'\"=]+$"}
+port_schema = {"type": "integer","minimum": 1, "maximun": 65534}
+ip_schema = {"type": "string", "pattern": "^([0-9]{1,3}.){3}[0-9]{1,3}$"}
+cidr_schema = {"type": "string", "pattern": "^([0-9]{1,3}.){3}[0-9]{1,3}/[0-9]{1,2}$"}
+name_schema = {"type": "string", "minLength": 1, "maxLength": 255, "pattern": "^[^,;()'\"]+$"}
+nameshort_schema = {"type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[^,;()'\"]+$"}
+nametiny_schema = {"type": "string", "minLength": 1, "maxLength": 12, "pattern": "^[^,;()'\"]+$"}
+xml_text_schema = {"type": "string", "minLength": 1, "maxLength": 1000, "pattern": "^[^']+$"}
+description_schema = {"type": ["string", "null"], "maxLength": 255, "pattern": "^[^'\"]+$"}
+id_schema_fake = {"type": "string", "minLength": 2, "maxLength": 36}
+                  # "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
+id_schema = {"type": "string", "pattern": "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$"}
+pci_schema = {"type": "string", "pattern": "^[0-9a-fA-F]{4}(:[0-9a-fA-F]{2}){2}\.[0-9a-fA-F]$"}
+# used by VIO neutron-port-show <host_moid>-<domain>:<bus>:<device>.<function>-<VF-id>
+pci_extended_schema = {"type": "string", "pattern": "^([0-9a-fA-F]{4}-)?[0-9a-fA-F]{4}(:[0-9a-fA-F]{2}){2}"
+                                                     "\.[0-9a-fA-F](-[0-9a-fA-F]{3})?$"}
+bandwidth_schema = {"type": "string", "pattern": "^[0-9]+ *([MG]bps)?$"}
+integer0_schema = {"type": "integer", "minimum": 0}
+integer1_schema = {"type": "integer", "minimum": 1}
+vlan_schema = {"type": "integer", "minimum": 1, "maximun": 4095}
+vlan1000_schema = {"type": "integer", "minimum": 1000, "maximun": 4095}
+mac_schema = {"type": "string", "pattern": "^[0-9a-fA-F][02468aceACE](:[0-9a-fA-F]{2}){5}$"}
+            # must be unicast LSB bit of MSB byte ==0
+net_bind_schema = {"oneOf": [
+    {"type": "null"},
+    {"type": "string", "pattern":
+        "^(default|((bridge|macvtap):[0-9a-zA-Z\.\-]{1,50})|openflow:[/0-9a-zA-Z\.\-]{1,50}(:vlan)?)$"}
+]}
+yes_no_schema = {"type": "string", "enum": ["yes", "no"]}
+log_level_schema = {"type": "string", "enum":["DEBUG", "INFO", "WARNING","ERROR","CRITICAL"]}
 
 config_schema = {
     "title": "main configuration information schema",
@@ -765,7 +774,7 @@ of_port_new_schema = {
         "ofc_id": id_schema,
         "region": nameshort_schema,
         "compute_node": nameshort_schema,
-        "pci": pci_schema,
+        "pci": pci_extended_schema,
         "switch_dpid": nameshort_schema,
         "switch_port": nameshort_schema,
         "switch_mac": mac_schema