diff --git a/src/service/service/service_handlers/p4_fabric_tna_commons/p4_fabric_tna_commons.py b/src/service/service/service_handlers/p4_fabric_tna_commons/p4_fabric_tna_commons.py index eb8077ff37b5eda29308517d1fb3aa485b80027c..4b60f91185aa739fbf182bdf070516389c409e5b 100644 --- a/src/service/service/service_handlers/p4_fabric_tna_commons/p4_fabric_tna_commons.py +++ b/src/service/service/service_handlers/p4_fabric_tna_commons/p4_fabric_tna_commons.py @@ -129,7 +129,7 @@ RULE_CONF_INTERVAL_SEC = 0.1 def arch_tna(arch : str) -> bool: return arch == TARGET_ARCH_TNA - + def arch_v1model(arch : str) -> bool: return not arch_tna(arch) @@ -143,13 +143,13 @@ def generate_random_mac() -> str: def prefix_to_hex_mask(prefix_len): # Calculate the binary mask binary_mask = (1 << 32) - (1 << (32 - prefix_len)) - + # Convert the binary mask to the 4 octets (32 bits) mask = struct.pack('!I', binary_mask) - + # Convert to a string of hex values hex_mask = ''.join(f'{byte:02x}' for byte in mask) - + return "0x"+hex_mask.upper() def sleep_for(time_sec : int) -> None: @@ -172,7 +172,7 @@ def rules_set_up_port_ingress( assert ingress_port >= 0, "Invalid ingress port to configure ingress port" assert port_type.lower() in PORT_TYPES_STR_VALID, "Invalid port type to configure ingress port" assert chk_vlan_id(vlan_id), "Invalid VLAN ID to configure ingress port" - + rule_no = cache_rule(TABLE_INGRESS_VLAN, action) port_type_int = PORT_TYPE_MAP[port_type.lower()]