blob: 101bcb1d6596e988827d64401719a1750d5c27d4 [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 -------------------------------------------------------------------------
tierno250e3292019-05-23 08:07:12 +000042wim_types = ["tapi", "onos", "odl", "dynpac", "fake"]
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 },
Anderson Bravalheridfed5112019-02-08 01:44:14 +000086 "anyOf": [
Anderson Bravalherifed47b02018-12-16 20:44:08 +000087 {
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",
tierno250e3292019-05-23 08:07:12 +0000114 "enum": ["tapi", "onos", "odl", "dynpac", "fake"]
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"],
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100134 }
135 },
136 "required": ["wim"],
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100137}
138
139wim_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 Bravalheri0446cd52018-08-17 15:26:19 +0100147 }
148 },
149 "required": ["wim"],
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100150}
151
152wim_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 Bravalheri0446cd52018-08-17 15:26:19 +0100165 }
166 },
167 "required": ["wim_account"],
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100168}
169
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100170wim_port_mapping_schema = {
171 "$schema": "http://json-schema.org/draft-04/schema#",
172 "title": "wim mapping information schema",
173 "type": "object",
174 "properties": {
Anderson Bravalherifed47b02018-12-16 20:44:08 +0000175 "wim_port_mapping": wim_port_mapping_desc
Anderson Bravalheri0446cd52018-08-17 15:26:19 +0100176 },
177 "required": ["wim_port_mapping"]
178}