Enable pylint, black and flake8 in tox.ini
[osm/NBI.git] / osm_nbi / validation.py
index a17e241..58ecaf7 100644 (file)
@@ -96,7 +96,7 @@ ip_schema = {
 }
 ipv6_schema = {
     "type": "string",
-    "pattern": "(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))",
+    "pattern": "(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))",  # noqa: W605
 }
 ip_prefix_schema = {
     "type": "string",
@@ -449,7 +449,12 @@ ns_update = {
         "nsInstanceId": id_schema,
         "timeout_ns_update": integer1_schema,
         "updateType": {
-            "enum": ["CHANGE_VNFPKG", "REMOVE_VNF", "MODIFY_VNF_INFORMATION", "OPERATE_VNF"]
+            "enum": [
+                "CHANGE_VNFPKG",
+                "REMOVE_VNF",
+                "MODIFY_VNF_INFORMATION",
+                "OPERATE_VNF",
+            ]
         },
         "modifyVnfInfoData": {
             "type": "object",
@@ -482,10 +487,10 @@ ns_update = {
                     },
                     "required": ["vdu_id", "count-index"],
                     "additionalProperties": False,
-                }
+                },
             },
             "required": ["vnfInstanceId", "changeStateTo"],
-        }
+        },
     },
     "required": ["updateType"],
     "additionalProperties": False,
@@ -556,16 +561,16 @@ ns_migrate = {
         "migrateToHost": string_schema,
         "vdu": {
             "type": "object",
-                "properties": {
-                    "vduId": name_schema,
-                    "vduCountIndex": integer0_schema,
-                },
-                "required": ["vduId"],
-                "additionalProperties": False,
+            "properties": {
+                "vduId": name_schema,
+                "vduCountIndex": integer0_schema,
+            },
+            "required": ["vduId"],
+            "additionalProperties": False,
         },
     },
     "required": ["vnfInstanceId"],
-    "additionalProperties": False
+    "additionalProperties": False,
 }
 
 ns_heal = {
@@ -633,13 +638,13 @@ ns_verticalscale = {
                         "virtualMemory": integer1_schema,
                         "sizeOfStorage": integer0_schema,
                         "numVirtualCpu": integer1_schema,
-                        },
-                    }
+                    },
                 },
+            },
             "required": ["vnfInstanceId", "additionalParams"],
             "additionalProperties": False,
-            }
         },
+    },
     "required": ["lcmOperationType", "verticalScale", "nsInstanceId"],
     "additionalProperties": False,
 }
@@ -1436,32 +1441,46 @@ vnflcmsub_schema = {
                 "enum": [
                     "VnfIdentifierCreationNotification",
                     "VnfLcmOperationOccurrenceNotification",
-                    "VnfIdentifierDeletionNotification"
-                    ]
-            }
+                    "VnfIdentifierDeletionNotification",
+                ]
+            },
         },
         "operationTypes": {
             "type": "array",
             "items": {
                 "enum": [
-                    "INSTANTIATE", "SCALE", "SCALE_TO_LEVEL", "CHANGE_FLAVOUR", "TERMINATE",
-                    "HEAL", "OPERATE", "CHANGE_EXT_CONN", "MODIFY_INFO", "CREATE_SNAPSHOT",
-                    "REVERT_TO_SNAPSHOT", "CHANGE_VNFPKG"
-                    ]
-            }
+                    "INSTANTIATE",
+                    "SCALE",
+                    "SCALE_TO_LEVEL",
+                    "CHANGE_FLAVOUR",
+                    "TERMINATE",
+                    "HEAL",
+                    "OPERATE",
+                    "CHANGE_EXT_CONN",
+                    "MODIFY_INFO",
+                    "CREATE_SNAPSHOT",
+                    "REVERT_TO_SNAPSHOT",
+                    "CHANGE_VNFPKG",
+                ]
+            },
         },
         "operationStates": {
             "type": "array",
             "items": {
                 "enum": [
-                    "STARTING", "PROCESSING", "COMPLETED", "FAILED_TEMP", "FAILED",
-                    "ROLLING_BACK", "ROLLED_BACK"
-                    ]
-            }
-        }
+                    "STARTING",
+                    "PROCESSING",
+                    "COMPLETED",
+                    "FAILED_TEMP",
+                    "FAILED",
+                    "ROLLING_BACK",
+                    "ROLLED_BACK",
+                ]
+            },
+        },
     },
-    "required": ["VnfInstanceSubscriptionFilter", "notificationTypes"]
- }
+    "required": ["VnfInstanceSubscriptionFilter", "notificationTypes"],
+}
 
 vnf_subscription = {
     "title": "vnf subscription input schema",
@@ -1470,9 +1489,9 @@ vnf_subscription = {
     "properties": {
         "filter": vnflcmsub_schema,
         "CallbackUri": description_schema,
-        "authentication": authentication_schema
+        "authentication": authentication_schema,
     },
-    "required": ["filter", "CallbackUri"]
+    "required": ["filter", "CallbackUri"],
 }