Disable the check of the release notes
[osm/RO.git] / RO-SDN-tapi / osm_rosdn_tapi / tests / tools.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 a helper methods for the Mock OSM RO component that can be used
29 for rapid unit testing.
30
31 This code is based on code taken with permission from ETSI TeraFlowSDN project at:
32 https://labs.etsi.org/rep/tfs/controller
33 """
34
35 from typing import Dict, Optional
36
37
38 # Ref: https://osm.etsi.org/wikipub/index.php/WIM
39 # Fields defined according to from osm_ro_plugin.sdnconn import SdnConnectorBase
40 def wim_port_mapping(
41 datacenter_id: str,
42 device_id: str,
43 device_interface_id: str,
44 service_endpoint_id: str,
45 switch_dpid: Optional[str] = None,
46 switch_port: Optional[str] = None,
47 service_mapping_info: Dict = {},
48 ):
49 mapping = {
50 "datacenter_id": datacenter_id,
51 "device_id": device_id,
52 "device_interface_id": device_interface_id,
53 "service_endpoint_id": service_endpoint_id,
54 "service_mapping_info": service_mapping_info,
55 }
56 if switch_dpid is not None:
57 mapping["switch_dpid"] = switch_dpid
58 if switch_port is not None:
59 mapping["switch_port"] = switch_port
60 return mapping