Commit fbfb96f2 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Test - Tools - Mock OSM:

- Fixed wim_mapping() method to accept a bearer_prefix
parent f00b014f
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -12,14 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Dict, Optional
from typing import Dict, Optional, Tuple

def compose_service_endpoint_id(site_id : str, endpoint_id : Dict):
    device_uuid = endpoint_id['device_id']['device_uuid']['uuid']
    endpoint_uuid = endpoint_id['endpoint_uuid']['uuid']
    return ':'.join([site_id, device_uuid, endpoint_uuid])

def wim_mapping(site_id, ce_endpoint_id, pe_device_id : Optional[Dict] = None, priority=None, redundant=[]):
def wim_mapping(
    site_id, ce_endpoint_id, pe_device_id : Optional[Dict] = None,
    bearer_prefix : Optional[str] = None, priority=None, redundant=[]
) -> Tuple[str, Dict]:
    ce_device_uuid = ce_endpoint_id['device_id']['device_uuid']['uuid']
    ce_endpoint_uuid = ce_endpoint_id['endpoint_uuid']['uuid']
    service_endpoint_id = compose_service_endpoint_id(site_id, ce_endpoint_id)
@@ -28,6 +31,8 @@ def wim_mapping(site_id, ce_endpoint_id, pe_device_id : Optional[Dict] = None, p
    else:
        pe_device_uuid = pe_device_id['device_uuid']['uuid']
        bearer = '{:s}:{:s}'.format(ce_device_uuid, pe_device_uuid)
    if bearer_prefix is not None:
        bearer = '{:s}:{:s}'.format(bearer_prefix, bearer)
    mapping = {
        'service_endpoint_id': service_endpoint_id,
        'datacenter_id': site_id, 'device_id': ce_device_uuid, 'device_interface_id': ce_endpoint_uuid,