Commit 18d2709e authored by Georgios P. Katsikas's avatar Georgios P. Katsikas
Browse files

fix: P4 service handlers support multi-device config

parent df5542d3
Loading
Loading
Loading
Loading
+76 −74
Original line number Diff line number Diff line
@@ -346,9 +346,10 @@ class P4FabricACLServiceHandler(_ServiceHandler):
        except Exception as ex:
            LOGGER.error("Failed to parse service settings: {}".format(ex))
            raise Exception(ex)
        assert isinstance(self.__switch_info, dict), "Switch info object must be a map with switch names as keys"
        assert isinstance(self.__switch_info, list), "Switch info object must be a list"

        for switch_name, switch_info in self.__switch_info.items():
        for switch in self.__switch_info:
            for switch_name, switch_info in switch.items():
                assert switch_name, "Invalid P4 switch name"
                assert isinstance(switch_info, dict), "Switch {} info must be a map with arch, dpid, and fwd_list items)"
                assert switch_info[ARCH] in SUPPORTED_TARGET_ARCH_LIST, \
@@ -418,7 +419,8 @@ class P4FabricACLServiceHandler(_ServiceHandler):
    def _print_settings(self):
        LOGGER.info("--------------- {} settings ---------------".format(self.__service.name))
        LOGGER.info("--- Topology info")
        for switch_name, switch_info in self.__switch_info.items():
        for switch in self.__switch_info:
            for switch_name, switch_info in switch.items():
                LOGGER.info("\t Device {}".format(switch_name))
                LOGGER.info("\t\t| Target P4 architecture: {}".format(switch_info[ARCH]))
                LOGGER.info("\t\t|          Data plane ID: {}".format(switch_info[DPID]))
+34 −31
Original line number Diff line number Diff line
@@ -316,9 +316,11 @@ class P4FabricINTServiceHandler(_ServiceHandler):
        except Exception as ex:
            LOGGER.error("Failed to parse service settings: {}".format(ex))
            raise Exception(ex)
        assert isinstance(self.__switch_info, dict), "Switch info object must be a map with switch names as keys"
        assert isinstance(self.__switch_info, list), "Switch info object must be a list"

        for switch_name, switch_info in self.__switch_info.items():
        # for switch_name, switch_info in self.__switch_info.items():
        for switch in self.__switch_info:
            for switch_name, switch_info in switch.items():
                assert switch_name, "Invalid P4 switch name"
                assert isinstance(switch_info, dict), "Switch {} info must be a map with arch, dpid, mac, ip, and int_port items)"
                assert switch_info[ARCH] in SUPPORTED_TARGET_ARCH_LIST, \
@@ -356,7 +358,8 @@ class P4FabricINTServiceHandler(_ServiceHandler):
    def _print_settings(self):
        LOGGER.info("-------------------- {} settings --------------------".format(self.__service.name))
        LOGGER.info("--- Topology info")
        for switch_name, switch_info in self.__switch_info.items():
        for switch in self.__switch_info:
            for switch_name, switch_info in switch.items():
                LOGGER.info("\t Device {}".format(switch_name))
                LOGGER.info("\t\t|  Target P4 architecture: {}".format(switch_info[ARCH]))
                LOGGER.info("\t\t|           Data plane ID: {}".format(switch_info[DPID]))
+55 −53
Original line number Diff line number Diff line
@@ -329,9 +329,10 @@ class P4FabricL2SimpleServiceHandler(_ServiceHandler):
        except Exception as ex:
            LOGGER.error("Failed to parse service settings: {}".format(ex))
            raise Exception(ex)
        assert isinstance(self.__switch_info, dict), "Switch info object must be a map with switch names as keys"
        assert isinstance(self.__switch_info, list), "Switch info object must be a list"

        for switch_name, switch_info in self.__switch_info.items():
        for switch in self.__switch_info:
            for switch_name, switch_info in switch.items():
                assert switch_name, "Invalid P4 switch name"
                assert isinstance(switch_info, dict), "Switch {} info must be a map with arch, dpid, and fwd_list items)"
                assert switch_info[ARCH] in SUPPORTED_TARGET_ARCH_LIST, \
@@ -380,7 +381,8 @@ class P4FabricL2SimpleServiceHandler(_ServiceHandler):
    def _print_settings(self):
        LOGGER.info("--------------- {} settings ---------------".format(self.__service.name))
        LOGGER.info("--- Topology info")
        for switch_name, switch_info in self.__switch_info.items():
        for switch in self.__switch_info:
            for switch_name, switch_info in switch.items():
                LOGGER.info("\t Device {}".format(switch_name))
                LOGGER.info("\t\t| Target P4 architecture: {}".format(switch_info[ARCH]))
                LOGGER.info("\t\t|          Data plane ID: {}".format(switch_info[DPID]))
+64 −62
Original line number Diff line number Diff line
@@ -327,9 +327,10 @@ class P4FabricL3ServiceHandler(_ServiceHandler):
        except Exception as ex:
            LOGGER.error("Failed to parse service settings: {}".format(ex))
            raise Exception(ex)
        assert isinstance(self.__switch_info, dict), "Switch info object must be a map with switch names as keys"
        assert isinstance(self.__switch_info, list), "Switch info object must be a list"

        for switch_name, switch_info in self.__switch_info.items():
        for switch in self.__switch_info:
            for switch_name, switch_info in switch.items():
                assert switch_name, "Invalid P4 switch name"
                assert isinstance(switch_info, dict), "Switch {} info must be a map with arch, dpid, and fwd_list items)"
                assert switch_info[ARCH] in SUPPORTED_TARGET_ARCH_LIST, \
@@ -388,7 +389,8 @@ class P4FabricL3ServiceHandler(_ServiceHandler):
    def _print_settings(self):
        LOGGER.info("--------------- {} settings ---------------".format(self.__service.name))
        LOGGER.info("--- Topology info")
        for switch_name, switch_info in self.__switch_info.items():
        for switch in self.__switch_info:
            for switch_name, switch_info in switch.items():
                LOGGER.info("\t Device {}".format(switch_name))
                LOGGER.info("\t\t| Target P4 architecture: {}".format(switch_info[ARCH]))
                LOGGER.info("\t\t|          Data plane ID: {}".format(switch_info[DPID]))