Loading src/realizer/restconf/service_types/builders/configure_match_criteria.py +20 −16 Original line number Diff line number Diff line Loading @@ -21,13 +21,13 @@ from src.utils.safe_get import safe_get def configure_match_criteria(network_access, site, sdp, layer_type): """Configura los criterios de coincidencia en el acceso a la red.""" MATCH_TYPE_MAPPING = { "dscp": "dscp" "dscp": "dscp", "vlan": "dot1q", "any": "any" } if layer_type == "l3": MATCH_TYPE_MAPPING["source-ip-prefix"] = "ipv4-src-prefix" MATCH_TYPE_MAPPING["destination-ip-prefix"] = "ipv4-dst-prefix" MATCH_TYPE_MAPPING["vlan"] = "vlan" # Need to check if applies with l2 too MATCH_TYPE_MAPPING["any"] = "any" # Need to check if applies with l2 too match_criteria = sdp.get("match_criteria") if not match_criteria: Loading @@ -47,18 +47,8 @@ def configure_match_criteria(network_access, site, sdp, layer_type): prefix_length = safe_get(sdp, ["sdp", "attachment-circuits", "attachment-circuit", 0, "ac-ipv4-prefix-length"]) lan = f"{provider_address}/{prefix_length}" if provider_address and prefix_length else None if match_type != "vlan" and match_type != "any": rule = { "id": f"match-{match_type}-{index}", "match-flow": { MATCH_TYPE_MAPPING[match_type]: value } } network_access["service"]["qos"]["qos-classification-policy"]["rule"].append(rule) elif match_type == "vlan": if layer_type == "l3" and match_type == "vlan": site["routing-protocols"] = {"routing-protocol": []} # Handle VLAN match criteria routing_protocol = { "type": "static", "static": { Loading @@ -75,3 +65,17 @@ def configure_match_criteria(network_access, site, sdp, layer_type): } site["routing-protocols"]["routing-protocol"].append(routing_protocol) return # Do not add rule when match type is any if match_type == "any": return rule = { "id": f"match-{match_type}-{index}", "match-flow": { MATCH_TYPE_MAPPING[match_type]: value } } network_access["service"]["qos"]["qos-classification-policy"]["rule"].append(rule) Loading
src/realizer/restconf/service_types/builders/configure_match_criteria.py +20 −16 Original line number Diff line number Diff line Loading @@ -21,13 +21,13 @@ from src.utils.safe_get import safe_get def configure_match_criteria(network_access, site, sdp, layer_type): """Configura los criterios de coincidencia en el acceso a la red.""" MATCH_TYPE_MAPPING = { "dscp": "dscp" "dscp": "dscp", "vlan": "dot1q", "any": "any" } if layer_type == "l3": MATCH_TYPE_MAPPING["source-ip-prefix"] = "ipv4-src-prefix" MATCH_TYPE_MAPPING["destination-ip-prefix"] = "ipv4-dst-prefix" MATCH_TYPE_MAPPING["vlan"] = "vlan" # Need to check if applies with l2 too MATCH_TYPE_MAPPING["any"] = "any" # Need to check if applies with l2 too match_criteria = sdp.get("match_criteria") if not match_criteria: Loading @@ -47,18 +47,8 @@ def configure_match_criteria(network_access, site, sdp, layer_type): prefix_length = safe_get(sdp, ["sdp", "attachment-circuits", "attachment-circuit", 0, "ac-ipv4-prefix-length"]) lan = f"{provider_address}/{prefix_length}" if provider_address and prefix_length else None if match_type != "vlan" and match_type != "any": rule = { "id": f"match-{match_type}-{index}", "match-flow": { MATCH_TYPE_MAPPING[match_type]: value } } network_access["service"]["qos"]["qos-classification-policy"]["rule"].append(rule) elif match_type == "vlan": if layer_type == "l3" and match_type == "vlan": site["routing-protocols"] = {"routing-protocol": []} # Handle VLAN match criteria routing_protocol = { "type": "static", "static": { Loading @@ -75,3 +65,17 @@ def configure_match_criteria(network_access, site, sdp, layer_type): } site["routing-protocols"]["routing-protocol"].append(routing_protocol) return # Do not add rule when match type is any if match_type == "any": return rule = { "id": f"match-{match_type}-{index}", "match-flow": { MATCH_TYPE_MAPPING[match_type]: value } } network_access["service"]["qos"]["qos-classification-policy"]["rule"].append(rule)