Commit 9f1b13b1 authored by Shayan Hajipour's avatar Shayan Hajipour
Browse files

debug: main service uuid added to the prefix of the hash function of the...

debug: main service uuid added to the prefix of the hash function of the subservices, __post_init__ changed to a method tha is called in the code
parent 6161b92a
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -63,11 +63,11 @@ class ConnectionEntry:
    path_hops    : List[Dict] = field(default_factory=list)
    dependencies : List[str] = field(default_factory=list)

    def __post_init__(self) -> None:
        if self.uuid != '':
            return
        composed_string = '-'.join(f'{path_hop["device"]}/{path_hop["ingress_ep"]}/{path_hop["egress_ep"]}' for path_hop in self.path_hops)
        self.sub_service_uuid = get_uuid_from_string(composed_string)
    def calculate_subservice_uuid(self, main_service_uuid: str) -> None:
        composed_string = main_service_uuid + '-'.join(
            f'{path_hop["device"]}/{path_hop["ingress_ep"]}/{path_hop["egress_ep"]}' for path_hop in self.path_hops
        )
        self.uuid = get_uuid_from_string(composed_string)

def convert_explicit_path_hops_to_connections(
    path_hops : List[Dict], device_dict : Dict[str, Tuple[Dict, Device]],
@@ -103,6 +103,7 @@ def convert_explicit_path_hops_to_connections(
            prv_service_type = connection_stack.queue[-1].service_type
            service_type = get_service_type(res_class[1], prv_service_type)
            connection_entry = ConnectionEntry(service_type=service_type, path_hops=[path_hop])
            connection_entry.calculate_subservice_uuid(main_service_uuid)
            connection_stack.put(connection_entry)

            # underlying connection ended
@@ -116,6 +117,7 @@ def convert_explicit_path_hops_to_connections(
            prv_service_type = connection_stack.queue[-1].service_type
            service_type = get_service_type(res_class[1], prv_service_type)
            connection_entry = ConnectionEntry(service_type=service_type, path_hops=[path_hop])
            connection_entry.calculate_subservice_uuid(main_service_uuid)
            connection_stack.put(connection_entry)
        elif prv_res_class[2] is not None and res_class[2] is None:
            # leaving domain of a device controller, terminate underlying connection
@@ -139,6 +141,7 @@ def convert_explicit_path_hops_to_connections(
                prv_service_type = connection_stack.queue[-1].service_type
                service_type = get_service_type(res_class[1], prv_service_type)
                connection_entry = ConnectionEntry(service_type=service_type, path_hops=[path_hop])
                connection_entry.calculate_subservice_uuid (main_service_uuid)
                connection_stack.put(connection_entry)
        elif prv_res_class[0] is None:
            # path ingress
@@ -151,6 +154,7 @@ def convert_explicit_path_hops_to_connections(
            prv_service_type = connection_stack.queue[-1].service_type
            service_type = get_service_type(res_class[1], prv_service_type)
            connection_entry = ConnectionEntry(service_type=service_type, path_hops=[path_hop])
            connection_entry.calculate_subservice_uuid(main_service_uuid)
            connection_stack.put(connection_entry)
        elif prv_res_class[0] == res_class[0]:
            # same resource group kind
@@ -169,6 +173,7 @@ def convert_explicit_path_hops_to_connections(
                prv_service_type = connection_stack.queue[-1].service_type
                service_type = get_service_type(res_class[1], prv_service_type)
                connection_entry = ConnectionEntry(service_type=service_type, path_hops=[path_hop])
                connection_entry.calculate_subservice_uuid(main_service_uuid)
                connection_stack.put(connection_entry)
        elif prv_res_class[0] < res_class[0]:
            # underlying connection ended