Skip to content
Snippets Groups Projects
Commit 688051a7 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Compute:

- updated MockOSM constants and helper methods
parent e871a09e
No related branches found
No related tags found
2 merge requests!54Release 2.0.0,!27New Descriptor Loader Framework and OFC'22 code migrations
# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
WIM_USERNAME = 'admin'
WIM_PASSWORD = 'admin'
# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
def compose_service_endpoint_id(endpoint_id):
device_uuid = endpoint_id['device_id']['device_uuid']['uuid']
endpoint_uuid = endpoint_id['endpoint_uuid']['uuid']
return ':'.join([device_uuid, endpoint_uuid])
def wim_mapping(site_id, ce_endpoint_id, pe_device_id, priority=None, redundant=[]):
ce_endpoint_id = ce_endpoint_id['endpoint_id']
ce_device_uuid = ce_endpoint_id['device_id']['device_uuid']['uuid']
ce_endpoint_uuid = ce_endpoint_id['endpoint_uuid']['uuid']
pe_device_uuid = pe_device_id['device_uuid']['uuid']
service_endpoint_id = '{:s}:{:s}:{:s}'.format(site_id, ce_device_uuid, ce_endpoint_uuid)
bearer = '{:s}:{:s}'.format(ce_device_uuid, pe_device_uuid)
_mapping = {
'service_endpoint_id': service_endpoint_id,
'datacenter_id': site_id, 'device_id': ce_device_uuid, 'device_interface_id': ce_endpoint_uuid,
'service_mapping_info': {
'site-id': site_id,
'bearer': {'bearer-reference': bearer},
}
}
if priority is not None: _mapping['service_mapping_info']['priority'] = priority
if len(redundant) > 0: _mapping['service_mapping_info']['redundant'] = redundant
return service_endpoint_id, _mapping
def connection_point(service_endpoint_id : str, encapsulation_type : str, vlan_id : int):
return {
'service_endpoint_id': service_endpoint_id,
'service_endpoint_encapsulation_type': encapsulation_type,
'service_endpoint_encapsulation_info': {'vlan': vlan_id}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment