Disable the check of the release notes
[osm/RO.git] / RO-SDN-tapi / osm_rosdn_tapi / conn_info.py
1 # -*- coding: utf-8 -*-
2
3 #######################################################################################
4 # This file is part of OSM RO module
5 #
6 # Copyright ETSI Contributors and Others.
7 #
8 # Licensed under the Apache License, Version 2.0 (the "License"); you may
9 # not use this file except in compliance with the License. You may obtain
10 # a copy of the License at
11 #
12 # http://www.apache.org/licenses/LICENSE-2.0
13 #
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17 # License for the specific language governing permissions and limitations
18 # under the License.
19 #######################################################################################
20 # This work has been performed in the context of the TeraFlow Project -
21 # funded by the European Commission under Grant number 101015857 through the
22 # Horizon 2020 program.
23 # Contributors:
24 # - Lluis Gifre <lluis.gifre@cttc.es>
25 # - Ricard Vilalta <ricard.vilalta@cttc.es>
26 #######################################################################################
27
28 """This file contains the methods to compose the conn_info data structures for the
29 Transport API (TAPI) WIM connector."""
30
31
32 def conn_info_compose_unidirectional(
33 service_az_uuid,
34 service_az_endpoints,
35 service_za_uuid,
36 service_za_endpoints,
37 requested_capacity=None,
38 vlan_constraint=None,
39 ):
40 conn_info_az = {
41 "uuid": service_az_uuid,
42 "endpoints": service_az_endpoints,
43 }
44 conn_info_za = {
45 "uuid": service_za_uuid,
46 "endpoints": service_za_endpoints,
47 }
48 if requested_capacity is not None:
49 conn_info_az["requested_capacity"] = requested_capacity
50 conn_info_za["requested_capacity"] = requested_capacity
51 if vlan_constraint is not None:
52 conn_info_az["vlan_constraint"] = vlan_constraint
53 conn_info_za["vlan_constraint"] = vlan_constraint
54 conn_info = {
55 "az": conn_info_az,
56 "za": conn_info_za,
57 "bidirectional": False,
58 }
59 return conn_info
60
61
62 def conn_info_compose_bidirectional(
63 service_uuid,
64 service_endpoints,
65 requested_capacity=None,
66 vlan_constraint=None,
67 ):
68 conn_info = {
69 "uuid": service_uuid,
70 "endpoints": service_endpoints,
71 "bidirectional": True,
72 }
73 if requested_capacity is not None:
74 conn_info["requested_capacity"] = requested_capacity
75 if vlan_constraint is not None:
76 conn_info["vlan_constraint"] = vlan_constraint
77 return conn_info