blob: fb65fdd3a420c950f9cd1906d87aad9a042b4551 [file] [log] [blame]
Anderson Bravalheri0446cd52018-08-17 15:26:19 +01001# -*- 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
35from ..openmano_schemas import (
36 description_schema,
37 name_schema,
38 nameshort_schema
39)
40
41# WIM -------------------------------------------------------------------------
David García00e29dd2018-12-10 09:43:50 +010042wim_types = ["tapi", "onos", "odl", "dynpac"]
Anderson Bravalheri0446cd52018-08-17 15:26:19 +010043
Anderson Bravalherifed47b02018-12-16 20:44:08 +000044dpid_type = {
45 "type": "string",
46 "pattern":
47 "^[0-9a-zA-Z]+(:[0-9a-zA-Z]+)*$"
48}
49
50port_type = {
51 "oneOf": [
52 {"type": "string",
53 "minLength": 1,
54 "maxLength": 5},
55 {"type": "integer",
56 "minimum": 1,
57 "maximum": 65534}
58 ]
59}
60
61wim_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 },
86 "oneOf": [
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 Bravalheri0446cd52018-08-17 15:26:19 +0100109wim_schema_properties = {
110 "name": name_schema,
111 "description": description_schema,
112 "type": {
113 "type": "string",
David García00e29dd2018-12-10 09:43:50 +0100114 "enum": ["tapi", "onos", "odl", "dynpac"]
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100115 },
116 "wim_url": description_schema,
Anderson Bravalherifed47b02018-12-16 20:44:08 +0000117 "config": {
118 "type": "object",
119 "properties": {
120 "wim_port_mapping": wim_port_mapping_desc
121 }
122 }
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100123}
124
125wim_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"],
134 "additionalProperties": True
135 }
136 },
137 "required": ["wim"],
138 "additionalProperties": False
139}
140
141wim_edit_schema = {
142 "title": "wim edit information schema",
143 "$schema": "http://json-schema.org/draft-04/schema#",
144 "type": "object",
145 "properties": {
146 "wim": {
147 "type": "object",
148 "properties": wim_schema_properties,
149 "additionalProperties": False
150 }
151 },
152 "required": ["wim"],
153 "additionalProperties": False
154}
155
156wim_account_schema = {
157 "title": "wim account information schema",
158 "$schema": "http://json-schema.org/draft-04/schema#",
159 "type": "object",
160 "properties": {
161 "wim_account": {
162 "type": "object",
163 "properties": {
164 "name": name_schema,
165 "user": nameshort_schema,
166 "password": nameshort_schema,
167 "config": {"type": "object"}
168 },
169 "additionalProperties": True
170 }
171 },
172 "required": ["wim_account"],
173 "additionalProperties": False
174}
175
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100176wim_port_mapping_schema = {
177 "$schema": "http://json-schema.org/draft-04/schema#",
178 "title": "wim mapping information schema",
179 "type": "object",
180 "properties": {
Anderson Bravalherifed47b02018-12-16 20:44:08 +0000181 "wim_port_mapping": wim_port_mapping_desc
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100182 },
183 "required": ["wim_port_mapping"]
184}