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

PathComp component:

- Fix pure optical path to be returned as a single basic connection
parent a378b44a
Loading
Loading
Loading
Loading
+27 −5
Original line number Diff line number Diff line
@@ -336,8 +336,17 @@ class _Algorithm:
                ]

                self.logger.debug('path_hops = {:s}'.format(str(path_hops)))
                device_types = {v[0]['device_type'] for k,v in self.device_dict.items()}
                DEVICES_BASIC_CONNECTION = {
                #device_types = {
                #    v[0]['device_type']
                #    for k,v in self.device_dict.items()
                #}
                device_types = {
                    self.device_dict[path_hop['device']][0]['device_type']
                    for path_hop in path_hops
                }
                self.logger.debug('device_types = {:s}'.format(str(device_types)))

                DEVICES_BASIC_PACKET_CONNECTION = {
                    DeviceTypeEnum.EMULATED_CLIENT.value,
                    DeviceTypeEnum.EMULATED_COMPUTER.value,
                    DeviceTypeEnum.EMULATED_DATACENTER.value,
@@ -346,10 +355,23 @@ class _Algorithm:
                    DeviceTypeEnum.PACKET_POP.value,
                    DeviceTypeEnum.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('DEVICES_BASIC_PACKET_CONNECTION = {:s}'.format(str(DEVICES_BASIC_PACKET_CONNECTION)))
                is_basic_packet_connection = device_types.issubset(DEVICES_BASIC_PACKET_CONNECTION)
                self.logger.debug('is_basic_packet_connection = {:s}'.format(str(is_basic_packet_connection)))

                DEVICES_BASIC_OPTICAL_CONNECTION = {
                    DeviceTypeEnum.EMULATED_OPTICAL_ROADM.value,
                    DeviceTypeEnum.OPTICAL_ROADM.value,
                    DeviceTypeEnum.EMULATED_OPTICAL_TRANSPONDER.value,
                    DeviceTypeEnum.OPTICAL_TRANSPONDER.value,
                }
                self.logger.debug('DEVICES_BASIC_OPTICAL_CONNECTION = {:s}'.format(str(DEVICES_BASIC_OPTICAL_CONNECTION)))
                is_basic_optical_connection = device_types.issubset(DEVICES_BASIC_OPTICAL_CONNECTION)
                self.logger.debug('is_basic_optical_connection = {:s}'.format(str(is_basic_optical_connection)))

                is_basic_connection = is_basic_packet_connection or is_basic_optical_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(