Loading src/pathcomp/frontend/service/algorithms/tools/ComposeConfigRules.py +14 −14 Original line number Diff line number Diff line Loading @@ -79,10 +79,10 @@ def compose_device_config_rules( config_rules : List, subservice_config_rules : List, path_hops : List, device_name_mapping : Dict[str, str], endpoint_name_mapping : Dict[Tuple[str, str], str] ) -> None: LOGGER.warning('[compose_device_config_rules] begin') LOGGER.debug('[compose_device_config_rules] begin') LOGGER.warning('[compose_device_config_rules] device_name_mapping={:s}'.format(str(device_name_mapping))) LOGGER.warning('[compose_device_config_rules] endpoint_name_mapping={:s}'.format(str(endpoint_name_mapping))) LOGGER.debug('[compose_device_config_rules] device_name_mapping={:s}'.format(str(device_name_mapping))) LOGGER.debug('[compose_device_config_rules] endpoint_name_mapping={:s}'.format(str(endpoint_name_mapping))) devices_traversed = set() endpoints_traversed = set() Loading @@ -92,28 +92,28 @@ def compose_device_config_rules( endpoints_traversed.add((device_uuid_or_name, path_hop['ingress_ep'])) endpoints_traversed.add((device_uuid_or_name, path_hop['egress_ep'])) LOGGER.warning('[compose_device_config_rules] devices_traversed={:s}'.format(str(devices_traversed))) LOGGER.warning('[compose_device_config_rules] endpoints_traversed={:s}'.format(str(endpoints_traversed))) LOGGER.debug('[compose_device_config_rules] devices_traversed={:s}'.format(str(devices_traversed))) LOGGER.debug('[compose_device_config_rules] endpoints_traversed={:s}'.format(str(endpoints_traversed))) for config_rule in config_rules: LOGGER.warning('[compose_device_config_rules] processing config_rule: {:s}'.format( LOGGER.debug('[compose_device_config_rules] processing config_rule: {:s}'.format( grpc_message_to_json_string(config_rule))) if config_rule.WhichOneof('config_rule') == 'acl': LOGGER.warning('[compose_device_config_rules] is acl') LOGGER.debug('[compose_device_config_rules] is acl') endpoint_id = config_rule.acl.endpoint_id device_uuid_or_name = endpoint_id.device_id.device_uuid.uuid LOGGER.warning('[compose_device_config_rules] device_uuid_or_name={:s}'.format(str(device_uuid_or_name))) LOGGER.debug('[compose_device_config_rules] device_uuid_or_name={:s}'.format(str(device_uuid_or_name))) device_name_or_uuid = device_name_mapping.get(device_uuid_or_name, device_uuid_or_name) LOGGER.warning('[compose_device_config_rules] device_name_or_uuid={:s}'.format(str(device_name_or_uuid))) LOGGER.debug('[compose_device_config_rules] device_name_or_uuid={:s}'.format(str(device_name_or_uuid))) device_keys = {device_uuid_or_name, device_name_or_uuid} if len(device_keys.intersection(devices_traversed)) == 0: continue endpoint_uuid = endpoint_id.endpoint_uuid.uuid LOGGER.warning('[compose_device_config_rules] endpoint_uuid={:s}'.format(str(endpoint_uuid))) LOGGER.debug('[compose_device_config_rules] endpoint_uuid={:s}'.format(str(endpoint_uuid))) # given endpoint uuids link 'eth-1/0/20.533', remove last part after the '.' endpoint_uuid_or_name = (endpoint_uuid[::-1].split('.', maxsplit=1)[-1])[::-1] LOGGER.warning('[compose_device_config_rules] endpoint_uuid_or_name={:s}'.format(str(endpoint_uuid_or_name))) LOGGER.debug('[compose_device_config_rules] endpoint_uuid_or_name={:s}'.format(str(endpoint_uuid_or_name))) endpoint_name_or_uuid_1 = endpoint_name_mapping[(device_uuid_or_name, endpoint_uuid_or_name)] endpoint_name_or_uuid_2 = endpoint_name_mapping[(device_name_or_uuid, endpoint_uuid_or_name)] endpoint_keys = {endpoint_uuid_or_name, endpoint_name_or_uuid_1, endpoint_name_or_uuid_2} Loading @@ -121,11 +121,11 @@ def compose_device_config_rules( device_endpoint_keys = set(itertools.product(device_keys, endpoint_keys)) if len(device_endpoint_keys.intersection(endpoints_traversed)) == 0: continue LOGGER.warning('[compose_device_config_rules] adding acl config rule') LOGGER.debug('[compose_device_config_rules] adding acl config rule') subservice_config_rules.append(config_rule) elif config_rule.WhichOneof('config_rule') == 'custom': LOGGER.warning('[compose_device_config_rules] is custom') LOGGER.debug('[compose_device_config_rules] is custom') match = DEVICE_SETTINGS.match(config_rule.custom.resource_key) if match is not None: Loading Loading @@ -153,4 +153,4 @@ def compose_device_config_rules( else: continue LOGGER.warning('[compose_device_config_rules] end') LOGGER.debug('[compose_device_config_rules] end') Loading
src/pathcomp/frontend/service/algorithms/tools/ComposeConfigRules.py +14 −14 Original line number Diff line number Diff line Loading @@ -79,10 +79,10 @@ def compose_device_config_rules( config_rules : List, subservice_config_rules : List, path_hops : List, device_name_mapping : Dict[str, str], endpoint_name_mapping : Dict[Tuple[str, str], str] ) -> None: LOGGER.warning('[compose_device_config_rules] begin') LOGGER.debug('[compose_device_config_rules] begin') LOGGER.warning('[compose_device_config_rules] device_name_mapping={:s}'.format(str(device_name_mapping))) LOGGER.warning('[compose_device_config_rules] endpoint_name_mapping={:s}'.format(str(endpoint_name_mapping))) LOGGER.debug('[compose_device_config_rules] device_name_mapping={:s}'.format(str(device_name_mapping))) LOGGER.debug('[compose_device_config_rules] endpoint_name_mapping={:s}'.format(str(endpoint_name_mapping))) devices_traversed = set() endpoints_traversed = set() Loading @@ -92,28 +92,28 @@ def compose_device_config_rules( endpoints_traversed.add((device_uuid_or_name, path_hop['ingress_ep'])) endpoints_traversed.add((device_uuid_or_name, path_hop['egress_ep'])) LOGGER.warning('[compose_device_config_rules] devices_traversed={:s}'.format(str(devices_traversed))) LOGGER.warning('[compose_device_config_rules] endpoints_traversed={:s}'.format(str(endpoints_traversed))) LOGGER.debug('[compose_device_config_rules] devices_traversed={:s}'.format(str(devices_traversed))) LOGGER.debug('[compose_device_config_rules] endpoints_traversed={:s}'.format(str(endpoints_traversed))) for config_rule in config_rules: LOGGER.warning('[compose_device_config_rules] processing config_rule: {:s}'.format( LOGGER.debug('[compose_device_config_rules] processing config_rule: {:s}'.format( grpc_message_to_json_string(config_rule))) if config_rule.WhichOneof('config_rule') == 'acl': LOGGER.warning('[compose_device_config_rules] is acl') LOGGER.debug('[compose_device_config_rules] is acl') endpoint_id = config_rule.acl.endpoint_id device_uuid_or_name = endpoint_id.device_id.device_uuid.uuid LOGGER.warning('[compose_device_config_rules] device_uuid_or_name={:s}'.format(str(device_uuid_or_name))) LOGGER.debug('[compose_device_config_rules] device_uuid_or_name={:s}'.format(str(device_uuid_or_name))) device_name_or_uuid = device_name_mapping.get(device_uuid_or_name, device_uuid_or_name) LOGGER.warning('[compose_device_config_rules] device_name_or_uuid={:s}'.format(str(device_name_or_uuid))) LOGGER.debug('[compose_device_config_rules] device_name_or_uuid={:s}'.format(str(device_name_or_uuid))) device_keys = {device_uuid_or_name, device_name_or_uuid} if len(device_keys.intersection(devices_traversed)) == 0: continue endpoint_uuid = endpoint_id.endpoint_uuid.uuid LOGGER.warning('[compose_device_config_rules] endpoint_uuid={:s}'.format(str(endpoint_uuid))) LOGGER.debug('[compose_device_config_rules] endpoint_uuid={:s}'.format(str(endpoint_uuid))) # given endpoint uuids link 'eth-1/0/20.533', remove last part after the '.' endpoint_uuid_or_name = (endpoint_uuid[::-1].split('.', maxsplit=1)[-1])[::-1] LOGGER.warning('[compose_device_config_rules] endpoint_uuid_or_name={:s}'.format(str(endpoint_uuid_or_name))) LOGGER.debug('[compose_device_config_rules] endpoint_uuid_or_name={:s}'.format(str(endpoint_uuid_or_name))) endpoint_name_or_uuid_1 = endpoint_name_mapping[(device_uuid_or_name, endpoint_uuid_or_name)] endpoint_name_or_uuid_2 = endpoint_name_mapping[(device_name_or_uuid, endpoint_uuid_or_name)] endpoint_keys = {endpoint_uuid_or_name, endpoint_name_or_uuid_1, endpoint_name_or_uuid_2} Loading @@ -121,11 +121,11 @@ def compose_device_config_rules( device_endpoint_keys = set(itertools.product(device_keys, endpoint_keys)) if len(device_endpoint_keys.intersection(endpoints_traversed)) == 0: continue LOGGER.warning('[compose_device_config_rules] adding acl config rule') LOGGER.debug('[compose_device_config_rules] adding acl config rule') subservice_config_rules.append(config_rule) elif config_rule.WhichOneof('config_rule') == 'custom': LOGGER.warning('[compose_device_config_rules] is custom') LOGGER.debug('[compose_device_config_rules] is custom') match = DEVICE_SETTINGS.match(config_rule.custom.resource_key) if match is not None: Loading Loading @@ -153,4 +153,4 @@ def compose_device_config_rules( else: continue LOGGER.warning('[compose_device_config_rules] end') LOGGER.debug('[compose_device_config_rules] end')