X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FRO.git;a=blobdiff_plain;f=osm_ro%2Fwim%2Fschemas.py;h=101bcb1d6596e988827d64401719a1750d5c27d4;hp=a040405b574a960cabd8ef78ff0e3a10d3dd6bda;hb=06abc096e277e5b0b3321dcd81e7782459960a97;hpb=0446cd5df24c38f95cea13b995c553e9b2403f21 diff --git a/osm_ro/wim/schemas.py b/osm_ro/wim/schemas.py index a040405b..101bcb1d 100644 --- a/osm_ro/wim/schemas.py +++ b/osm_ro/wim/schemas.py @@ -39,17 +39,87 @@ from ..openmano_schemas import ( ) # WIM ------------------------------------------------------------------------- -wim_types = ["tapi", "onos", "odl"] +wim_types = ["tapi", "onos", "odl", "dynpac", "fake"] + +dpid_type = { + "type": "string", + "pattern": + "^[0-9a-zA-Z]+(:[0-9a-zA-Z]+)*$" +} + +port_type = { + "oneOf": [ + {"type": "string", + "minLength": 1, + "maxLength": 5}, + {"type": "integer", + "minimum": 1, + "maximum": 65534} + ] +} + +wim_port_mapping_desc = { + "type": "array", + "items": { + "type": "object", + "properties": { + "datacenter_name": nameshort_schema, + "pop_wan_mappings": { + "type": "array", + "items": { + "type": "object", + "properties": { + "pop_switch_dpid": dpid_type, + "pop_switch_port": port_type, + "wan_service_endpoint_id": name_schema, + "wan_service_mapping_info": { + "type": "object", + "properties": { + "mapping_type": name_schema, + "wan_switch_dpid": dpid_type, + "wan_switch_port": port_type + }, + "additionalProperties": True, + "required": ["mapping_type"] + } + }, + "anyOf": [ + { + "required": [ + "pop_switch_dpid", + "pop_switch_port", + "wan_service_endpoint_id" + ] + }, + { + "required": [ + "pop_switch_dpid", + "pop_switch_port", + "wan_service_mapping_info" + ] + } + ] + } + } + }, + "required": ["datacenter_name", "pop_wan_mappings"] + } +} wim_schema_properties = { "name": name_schema, "description": description_schema, "type": { "type": "string", - "enum": ["tapi", "onos", "odl"] + "enum": ["tapi", "onos", "odl", "dynpac", "fake"] }, "wim_url": description_schema, - "config": {"type": "object"} + "config": { + "type": "object", + "properties": { + "wim_port_mapping": wim_port_mapping_desc + } + } } wim_schema = { @@ -61,11 +131,9 @@ wim_schema = { "type": "object", "properties": wim_schema_properties, "required": ["name", "type", "wim_url"], - "additionalProperties": True } }, "required": ["wim"], - "additionalProperties": False } wim_edit_schema = { @@ -76,11 +144,9 @@ wim_edit_schema = { "wim": { "type": "object", "properties": wim_schema_properties, - "additionalProperties": False } }, "required": ["wim"], - "additionalProperties": False } wim_account_schema = { @@ -96,28 +162,9 @@ wim_account_schema = { "password": nameshort_schema, "config": {"type": "object"} }, - "additionalProperties": True } }, "required": ["wim_account"], - "additionalProperties": False -} - -dpid_type = { - "type": "string", - "pattern": - "^[0-9a-zA-Z]+(:[0-9a-zA-Z]+)*$" -} - -port_type = { - "oneOf": [ - {"type": "string", - "minLength": 1, - "maxLength": 5}, - {"type": "integer", - "minimum": 1, - "maximum": 65534} - ] } wim_port_mapping_schema = { @@ -125,53 +172,7 @@ wim_port_mapping_schema = { "title": "wim mapping information schema", "type": "object", "properties": { - "wim_port_mapping": { - "type": "array", - "items": { - "type": "object", - "properties": { - "datacenter_name": nameshort_schema, - "pop_wan_mappings": { - "type": "array", - "items": { - "type": "object", - "properties": { - "pop_switch_dpid": dpid_type, - "pop_switch_port": port_type, - "wan_service_endpoint_id": name_schema, - "wan_service_mapping_info": { - "type": "object", - "properties": { - "mapping_type": name_schema, - "wan_switch_dpid": dpid_type, - "wan_switch_port": port_type - }, - "additionalProperties": True, - "required": ["mapping_type"] - } - }, - "oneOf": [ - { - "required": [ - "pop_switch_dpid", - "pop_switch_port", - "wan_service_endpoint_id" - ] - }, - { - "required": [ - "pop_switch_dpid", - "pop_switch_port", - "wan_service_mapping_info" - ] - } - ] - } - } - }, - "required": ["datacenter_name", "pop_wan_mappings"] - } - } + "wim_port_mapping": wim_port_mapping_desc }, "required": ["wim_port_mapping"] }