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

PathComp component - Frontend:

- Added special logic to manage pure-packet connectivity services without sub-services
parent d0172421
No related branches found
No related tags found
2 merge requests!294Release TeraFlowSDN 4.0,!172Resolve "(CTTC) Extend gNMI-OpenConfig SBI driver"
......@@ -14,6 +14,7 @@
import json, logging, requests, uuid
from typing import Dict, List, Optional, Tuple, Union
from common.DeviceTypes import DeviceTypeEnum
from common.proto.context_pb2 import (
ConfigRule, Connection, Device, DeviceList, EndPointId, Link, LinkList, Service, ServiceStatusEnum, ServiceTypeEnum
)
......@@ -251,21 +252,37 @@ class _Algorithm:
]
self.logger.debug('path_hops = {:s}'.format(str(path_hops)))
try:
_device_dict = {k:v[0] for k,v in self.device_dict.items()}
self.logger.debug('self.device_dict = {:s}'.format(str(_device_dict)))
connections = convert_explicit_path_hops_to_connections(
path_hops, self.device_dict, main_service_uuid, main_service_type)
self.logger.debug('EXTRAPOLATED connections = {:s}'.format(str(connections)))
except: # pylint: disable=bare-except
MSG = ' '.join([
'Unable to Extrapolate sub-services and sub-connections.',
'Assuming single-service and single-connection.',
])
self.logger.exception(MSG)
device_types = {v[0]['device_type'] for k,v in self.device_dict.items()}
DEVICES_BASIC_CONNECTION = {
DeviceTypeEnum.DATACENTER.value, DeviceTypeEnum.EMULATED_DATACENTER.value,
DeviceTypeEnum.CLIENT.value, DeviceTypeEnum.EMULATED_CLIENT.value,
DeviceTypeEnum.PACKET_ROUTER.value, DeviceTypeEnum.EMULATED_PACKET_ROUTER.value,
}
self.logger.debug('device_types = {:s}'.format(str(device_types)))
self.logger.debug('DEVICES_BASIC_CONNECTION = {:s}'.format(str(DEVICES_BASIC_CONNECTION)))
is_basic_connection = device_types.issubset(DEVICES_BASIC_CONNECTION)
self.logger.debug('is_basic_connection = {:s}'.format(str(is_basic_connection)))
if is_basic_connection:
self.logger.info('Assuming basic connections...')
connections = convert_explicit_path_hops_to_plain_connection(
path_hops, main_service_uuid, main_service_type)
self.logger.debug('BASIC connections = {:s}'.format(str(connections)))
else:
try:
_device_dict = {k:v[0] for k,v in self.device_dict.items()}
self.logger.debug('self.device_dict = {:s}'.format(str(_device_dict)))
connections = convert_explicit_path_hops_to_connections(
path_hops, self.device_dict, main_service_uuid, main_service_type)
self.logger.debug('EXTRAPOLATED connections = {:s}'.format(str(connections)))
except: # pylint: disable=bare-except
MSG = ' '.join([
'Unable to Extrapolate sub-services and sub-connections.',
'Assuming single-service and single-connection.',
])
self.logger.exception(MSG)
connections = convert_explicit_path_hops_to_plain_connection(
path_hops, main_service_uuid, main_service_type)
self.logger.debug('BASIC connections = {:s}'.format(str(connections)))
for connection in connections:
service_uuid,service_type,path_hops,_ = connection
......
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