| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | ## |
| 3 | # Copyright 2018 University of Bristol - High Performance Networks Research |
| 4 | # Group |
| 5 | # All Rights Reserved. |
| 6 | # |
| 7 | # Contributors: Anderson Bravalheri, Dimitrios Gkounis, Abubakar Siddique |
| 8 | # Muqaddas, Navdeep Uniyal, Reza Nejabati and Dimitra Simeonidou |
| 9 | # |
| 10 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 11 | # not use this file except in compliance with the License. You may obtain |
| 12 | # a copy of the License at |
| 13 | # |
| 14 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 15 | # |
| 16 | # Unless required by applicable law or agreed to in writing, software |
| 17 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 18 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 19 | # License for the specific language governing permissions and limitations |
| 20 | # under the License. |
| 21 | # |
| 22 | # For those usages not covered by the Apache License, Version 2.0 please |
| 23 | # contact with: <highperformance-networks@bristol.ac.uk> |
| 24 | # |
| 25 | # Neither the name of the University of Bristol nor the names of its |
| 26 | # contributors may be used to endorse or promote products derived from |
| 27 | # this software without specific prior written permission. |
| 28 | # |
| 29 | # This work has been performed in the context of DCMS UK 5G Testbeds |
| 30 | # & Trials Programme and in the framework of the Metro-Haul project - |
| 31 | # funded by the European Commission under Grant number 761727 through the |
| 32 | # Horizon 2020 and 5G-PPP programmes. |
| 33 | ## |
| 34 | |
| 35 | from ..openmano_schemas import ( |
| 36 | description_schema, |
| 37 | name_schema, |
| 38 | nameshort_schema |
| 39 | ) |
| 40 | |
| 41 | # WIM ------------------------------------------------------------------------- |
| tierno | 250e329 | 2019-05-23 08:07:12 +0000 | [diff] [blame] | 42 | wim_types = ["tapi", "onos", "odl", "dynpac", "fake"] |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 43 | |
| Anderson Bravalheri | fed47b0 | 2018-12-16 20:44:08 +0000 | [diff] [blame] | 44 | dpid_type = { |
| 45 | "type": "string", |
| 46 | "pattern": |
| 47 | "^[0-9a-zA-Z]+(:[0-9a-zA-Z]+)*$" |
| 48 | } |
| 49 | |
| 50 | port_type = { |
| 51 | "oneOf": [ |
| 52 | {"type": "string", |
| 53 | "minLength": 1, |
| 54 | "maxLength": 5}, |
| 55 | {"type": "integer", |
| 56 | "minimum": 1, |
| 57 | "maximum": 65534} |
| 58 | ] |
| 59 | } |
| 60 | |
| 61 | wim_port_mapping_desc = { |
| 62 | "type": "array", |
| 63 | "items": { |
| 64 | "type": "object", |
| 65 | "properties": { |
| 66 | "datacenter_name": nameshort_schema, |
| 67 | "pop_wan_mappings": { |
| 68 | "type": "array", |
| 69 | "items": { |
| 70 | "type": "object", |
| 71 | "properties": { |
| 72 | "pop_switch_dpid": dpid_type, |
| 73 | "pop_switch_port": port_type, |
| 74 | "wan_service_endpoint_id": name_schema, |
| 75 | "wan_service_mapping_info": { |
| 76 | "type": "object", |
| 77 | "properties": { |
| 78 | "mapping_type": name_schema, |
| 79 | "wan_switch_dpid": dpid_type, |
| 80 | "wan_switch_port": port_type |
| 81 | }, |
| 82 | "additionalProperties": True, |
| 83 | "required": ["mapping_type"] |
| 84 | } |
| 85 | }, |
| Anderson Bravalheri | dfed511 | 2019-02-08 01:44:14 +0000 | [diff] [blame] | 86 | "anyOf": [ |
| Anderson Bravalheri | fed47b0 | 2018-12-16 20:44:08 +0000 | [diff] [blame] | 87 | { |
| 88 | "required": [ |
| 89 | "pop_switch_dpid", |
| 90 | "pop_switch_port", |
| 91 | "wan_service_endpoint_id" |
| 92 | ] |
| 93 | }, |
| 94 | { |
| 95 | "required": [ |
| 96 | "pop_switch_dpid", |
| 97 | "pop_switch_port", |
| 98 | "wan_service_mapping_info" |
| 99 | ] |
| 100 | } |
| 101 | ] |
| 102 | } |
| 103 | } |
| 104 | }, |
| 105 | "required": ["datacenter_name", "pop_wan_mappings"] |
| 106 | } |
| 107 | } |
| 108 | |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 109 | wim_schema_properties = { |
| 110 | "name": name_schema, |
| 111 | "description": description_schema, |
| 112 | "type": { |
| 113 | "type": "string", |
| tierno | 250e329 | 2019-05-23 08:07:12 +0000 | [diff] [blame] | 114 | "enum": ["tapi", "onos", "odl", "dynpac", "fake"] |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 115 | }, |
| 116 | "wim_url": description_schema, |
| Anderson Bravalheri | fed47b0 | 2018-12-16 20:44:08 +0000 | [diff] [blame] | 117 | "config": { |
| 118 | "type": "object", |
| 119 | "properties": { |
| 120 | "wim_port_mapping": wim_port_mapping_desc |
| 121 | } |
| 122 | } |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | wim_schema = { |
| 126 | "title": "wim information schema", |
| 127 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 128 | "type": "object", |
| 129 | "properties": { |
| 130 | "wim": { |
| 131 | "type": "object", |
| 132 | "properties": wim_schema_properties, |
| 133 | "required": ["name", "type", "wim_url"], |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 134 | } |
| 135 | }, |
| 136 | "required": ["wim"], |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | wim_edit_schema = { |
| 140 | "title": "wim edit information schema", |
| 141 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 142 | "type": "object", |
| 143 | "properties": { |
| 144 | "wim": { |
| 145 | "type": "object", |
| 146 | "properties": wim_schema_properties, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 147 | } |
| 148 | }, |
| 149 | "required": ["wim"], |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | wim_account_schema = { |
| 153 | "title": "wim account information schema", |
| 154 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 155 | "type": "object", |
| 156 | "properties": { |
| 157 | "wim_account": { |
| 158 | "type": "object", |
| 159 | "properties": { |
| 160 | "name": name_schema, |
| 161 | "user": nameshort_schema, |
| 162 | "password": nameshort_schema, |
| 163 | "config": {"type": "object"} |
| 164 | }, |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 165 | } |
| 166 | }, |
| 167 | "required": ["wim_account"], |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 168 | } |
| 169 | |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 170 | wim_port_mapping_schema = { |
| 171 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 172 | "title": "wim mapping information schema", |
| 173 | "type": "object", |
| 174 | "properties": { |
| Anderson Bravalheri | fed47b0 | 2018-12-16 20:44:08 +0000 | [diff] [blame] | 175 | "wim_port_mapping": wim_port_mapping_desc |
| Anderson Bravalheri | 0446cd5 | 2018-08-17 15:26:19 +0100 | [diff] [blame] | 176 | }, |
| 177 | "required": ["wim_port_mapping"] |
| 178 | } |