Пример #1
0
    def runTest(self):
        """
        Add four flow entries:
        First Table; Match IP Src A; goto Second Table
        Second Table; Match IP Src A; send to 1, goto Third Table
        Third Table; Match IP Src A; clear action, goto Fourth Table
        Fourth Table; Match IP Src A; send to 2

        Then send in 2 packets:
        IP A, TCP C; expect out port 1
        IP A, TCP B; expect out port 1

        @param self object instance
        @param EX_ACL_TABLE first table
        @param WC_ACL_TABLE second table
        @param WC_SERV_TABLE third table
        @param EX_L2_TABLE fourth table
        """
        of_ports = testutils.clear_switch(self, pa_port_map.keys(), pa_logger)

        # Set up first match
        #write_goto(self, testutils.EX_ACL_TABLE, testutils.WC_ACL_TABLE)
        act = action.action_set_field()
        field = match.eth_src(parse.parse_mac("aa:aa:aa:aa:aa:aa"))
        act.field.add(field)
        testutils.write_goto_action(self,
                                    testutils.WC_ACL_TABLE,
                                    testutils.WC_SERV_TABLE,
                                    act=act)
        # Set up second match
        testutils.write_goto_output(self, testutils.WC_SERV_TABLE,
                                    testutils.EX_L3_TABLE, of_ports[0],
                                    of_ports[2])
        # Set up third match, "Clear Action"
        inst = instruction.instruction_clear_actions()
        testutils.write_goto(self,
                             testutils.EX_L3_TABLE,
                             testutils.WC_L3_TABLE,
                             of_ports[2],
                             add_inst=inst)
        # Set up fourth match
        testutils.write_output(self, testutils.WC_L3_TABLE, of_ports[1])
        #write_output(self, testutils.EX_L2_TABLE, 4)

        # Generate a packet matching flow 1, 2, and 3; rcv on port[1]
        testutils.reply_check_dp(self,
                                 tcp_sport=1234,
                                 ing_port=of_ports[2],
                                 egr_port=of_ports[1])
Пример #2
0
    def scenario4(self,
                  first_table=0,
                  second_table=1,
                  third_table=2,
                  fourth_table=3):
        """
        Add four flow entries:
        First Table; Match IP Src A; goto Second Table
        Second Table; Match IP Src A; send to 1, goto Third Table
        Third Table; Match IP Src A; clear action, goto Fourth Table
        Fourth Table; Match IP Src A; send to 2

        Then send in 2 packets:
        IP A, TCP C; expect out port 1
        IP A, TCP B; expect out port 1

        @param self object instance
        @param first_table first table
        @param second_table second table
        @param third_table third table
        @param fourth_table fourth table
        """
        of_ports = testutils.clear_switch(self, pa_port_map.keys(), pa_logger)

        # Set up first match
        write_goto(self, first_table, second_table)
        # Set up second match
        write_goto_output(self, second_table, third_table, of_ports[0])
        # Set up third match, "Clear Action"
        inst = instruction.instruction_clear_actions()
        write_goto(self, third_table, fourth_table, add_inst=inst)
        # Set up fourth match
        write_output(self, fourth_table, of_ports[1])

        # Generate a packet matching flow 1, 2, and 3; rcv on port[1]
        reply_check_dp(self,
                       tcp_sport=10,
                       ing_port=of_ports[2],
                       egr_port=of_ports[1])
        # Generate a packet matching flow 1, 2, and 3; rcv on port[1]
        reply_check_dp(self,
                       tcp_sport=80,
                       ing_port=of_ports[2],
                       egr_port=of_ports[1])
Пример #3
0
    def runTest(self):
        """
        Add four flow entries:
        First Table; Match IP Src A; goto Second Table
        Second Table; Match IP Src A; send to 1, goto Third Table
        Third Table; Match IP Src A; clear action, goto Fourth Table
        Fourth Table; Match IP Src A; send to 2

        Then send in 2 packets:
        IP A, TCP C; expect out port 1
        IP A, TCP B; expect out port 1

        @param self object instance
        @param EX_ACL_TABLE first table
        @param WC_ACL_TABLE second table
        @param WC_SERV_TABLE third table
        @param EX_L2_TABLE fourth table
        """
        of_ports = testutils.clear_switch(self, pa_port_map.keys(), pa_logger)

        # Set up first match
        #write_goto(self, testutils.EX_ACL_TABLE, testutils.WC_ACL_TABLE)
        act = action.action_set_field()
        field = match.eth_src(parse.parse_mac("aa:aa:aa:aa:aa:aa"))
        act.field.add(field)
        testutils.write_goto_action(self, testutils.WC_ACL_TABLE, testutils.WC_SERV_TABLE ,act = act)
        # Set up second match
        testutils.write_goto_output(self, testutils.WC_SERV_TABLE, testutils.EX_L3_TABLE, of_ports[0], of_ports[2])
        # Set up third match, "Clear Action"
        inst = instruction.instruction_clear_actions()
        testutils.write_goto(self, testutils.EX_L3_TABLE, testutils.WC_L3_TABLE, of_ports[2], add_inst=inst)
        # Set up fourth match
        testutils.write_output(self, testutils.WC_L3_TABLE, of_ports[1])
        #write_output(self, testutils.EX_L2_TABLE, 4)

        # Generate a packet matching flow 1, 2, and 3; rcv on port[1]
        testutils.reply_check_dp(self, tcp_sport=1234,
                       ing_port = of_ports[2], egr_port = of_ports[1])
Пример #4
0
    def scenario4(self, first_table = 0, second_table = 1, third_table = 2, fourth_table = 3):
        """
        Add four flow entries:
        First Table; Match IP Src A; goto Second Table
        Second Table; Match IP Src A; send to 1, goto Third Table
        Third Table; Match IP Src A; clear action, goto Fourth Table
        Fourth Table; Match IP Src A; send to 2

        Then send in 2 packets:
        IP A, TCP C; expect out port 1
        IP A, TCP B; expect out port 1

        @param self object instance
        @param first_table first table
        @param second_table second table
        @param third_table third table
        @param fourth_table fourth table
        """
        of_ports = testutils.clear_switch(self, pa_port_map.keys(), pa_logger)

        # Set up first match
        write_goto(self, first_table, second_table)
        # Set up second match
        write_goto_output(self, second_table, third_table, of_ports[0])
        # Set up third match, "Clear Action"
        inst = instruction.instruction_clear_actions()
        write_goto(self, third_table, fourth_table, add_inst=inst)
        # Set up fourth match
        write_output(self, fourth_table, of_ports[1])

        # Generate a packet matching flow 1, 2, and 3; rcv on port[1]
        reply_check_dp(self, tcp_sport=10,
                       ing_port = of_ports[2], egr_port = of_ports[1])
        # Generate a packet matching flow 1, 2, and 3; rcv on port[1]
        reply_check_dp(self, tcp_sport=80,
                       ing_port = of_ports[2], egr_port = of_ports[1])