コード例 #1
0
    def runTest(self):
        logging.info("Running Forward_Table test")

        # delete all entries
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)
        # add flow
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port)])
            ])
        # Create a packet out message
        pkt = str(simple_tcp_packet())
        pkt_out = ofp.message.packet_out()
        pkt_out.data = pkt
        pkt_out.in_port = in_port
        pkt_out.buffer_id = ofp.OFP_NO_BUFFER
        act = ofp.action.output()
        act.port = ofp.OFPP_TABLE
        pkt_out.actions.append(act)
        self.controller.message_send(pkt_out)

        # Verifying packet out message recieved on the expected dataplane port.
        verify_packets(self, pkt, [out_port])
コード例 #2
0
ファイル: flow_mod.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port1, out_port2 = openflow_ports(3)

        # flow add
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port1)])],
                                     prio = 10
                                     )
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port2)])],
                                     prio = 11
                                     )
        # send packet to in_port and verify
        flow_stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(flow_stats), 2)

        pkt = str(simple_tcp_packet())
        self.dataplane.send(in_port, pkt)
        verify_packets(self, pkt, [out_port2])
        verify_no_packet(self, pkt, out_port1)
コード例 #3
0
ファイル: error_messages.py プロジェクト: jackyangNJ/oftest
    def runTest(self):
        delete_all_flows(self.controller)

        logging.info(
            "Inserting flow: flow-mod cmd=add,table=0,prio=15 in_port=1 apply:output=2"
        )
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(2)]),
                                     instructions=[
                                         ofp.instruction.apply_actions(
                                             [ofp.action.output(1)]),
                                     ])

        logging.info(
            "Inserting flow:  flow-mod cmd=add,table=0,prio=15,flags=0x2 apply:output=1"
        )
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(2)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(1)]),
            ],
            flags=ofp.OFPFF_CHECK_OVERLAP,
        )

        # Verify the correct error message is returned
        response, _ = self.controller.poll(
            exp_msg=ofp.message.flow_mod_failed_error_msg)
        self.assertTrue(response is not None,
                        "No Flow Mod Failed Error message was received")
        self.assertEqual(response.code, ofp.OFPFMFC_OVERLAP,
                         "Error message error code is not OFPFMFC_OVERLAP")
コード例 #4
0
ファイル: counters.py プロジェクト: lparkes/oftest
    def runTest(self):
        logging.info("")
        flow_stats = get_flow_stats(self, ofp.match())
        in_port, out_port = openflow_ports(2)
        # Clear Switch State
        delete_all_flows(self.controller)

        flow_entry_num = 10
        table_num = 5
        for i in range(table_num):
            for j in range(flow_entry_num):
                FuncUtils.flow_entry_install(
                    self.controller,
                    "flow_add",
                    table_id=i,
                    match=ofp.match([ofp.oxm.in_port(in_port)]),
                    instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port)])],
                    prio=j,
                )
        # test
        request = ofp.message.table_stats_request()
        (reply, pkt) = self.controller.transact(request)

        active_entry = 0
        for obj in reply.entries:
            active_entry += obj.active_count
        self.assertEqual(flow_entry_num * table_num, active_entry, "Active entry error")
コード例 #5
0
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)
        request1 = FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port)])
            ])

        request2 = FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port)])
            ])

        # Verify the correct error message is returned
        response, _ = self.controller.poll(
            exp_msg=ofp.message.flow_mod_failed_error_msg)
        self.assertTrue(response is None,
                        "Flow Mod Failed Error message was received")

        # read flow entries to ensure the new entry is inserted
        flow_stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(flow_stats), 2)
        self.assertTrue(request1.instructions, flow_stats[0].instructions)
        self.assertTrue(request2.instructions, flow_stats[1].instructions)
コード例 #6
0
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port1, out_port2 = openflow_ports(3)

        # flow add
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port1)])
            ],
            hard_timeout=1,
        )
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port2)])
            ],
            hard_timeout=100)
        # tests
        time.sleep(5)
        stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(stats), 1, "Expected empty flow stats reply")
コード例 #7
0
ファイル: flow_mod.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        # flow add
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port)])],
                                     hard_timeout=1,
                                     flags=ofp.OFPFF_SEND_FLOW_REM
                                     )
        # send packet to in_port and verify
        start_time = time.time()
        dura_time = 6
        while True:
            if time.time() - start_time > dura_time:
                break
            pkt = str(simple_tcp_packet())
            self.dataplane.send(in_port, pkt)
        time.sleep(5)

        msg, _ = self.controller.poll(ofp.message.flow_removed)
        self.assertTrue(msg is not None, "Error message was not received")
        self.assertEqual(msg.duration_sec, 1, "Time is not correct")
コード例 #8
0
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port1, out_port2 = openflow_ports(3)

        # flow add
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port1)])
            ],
            prio=10)
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port2)])
            ],
            prio=11)
        # send packet to in_port and verify
        flow_stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(flow_stats), 2)

        pkt = str(simple_tcp_packet())
        self.dataplane.send(in_port, pkt)
        verify_packets(self, pkt, [out_port2])
        verify_no_packet(self, pkt, out_port1)
コード例 #9
0
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port1, out_port2 = openflow_ports(3)

        request = FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port1)])
            ])

        pkg_num = 10
        FuncUtils.send_packets(self, simple_icmp_packet(), in_port, pkg_num)

        FuncUtils.flow_entry_install(
            self.controller,
            "flow_mods",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port2)])
            ])

        # verify flow entry pkg num
        flow_stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(flow_stats), 1)
        verify_flow_stats(self, request.match, pkts=pkg_num)
コード例 #10
0
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        # flow add
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port)])
            ],
            hard_timeout=1,
            flags=ofp.OFPFF_SEND_FLOW_REM)
        # send packet to in_port and verify
        start_time = time.time()
        dura_time = 6
        while True:
            if time.time() - start_time > dura_time:
                break
            pkt = str(simple_tcp_packet())
            self.dataplane.send(in_port, pkt)
        time.sleep(5)

        msg, _ = self.controller.poll(ofp.message.flow_removed)
        self.assertTrue(msg is not None, "Error message was not received")
        self.assertEqual(msg.duration_sec, 1, "Time is not correct")
コード例 #11
0
ファイル: flow_mod.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[
                                         ofp.instruction.apply_actions([ofp.action.output(out_port)])
                                     ])
        # test
        delete_all_flows(self.controller)
        error_msg, _ = self.controller.poll(ofp.message.flow_removed)
        self.assertTrue(error_msg is None, "Error message was received")

        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[
                                         ofp.instruction.apply_actions([ofp.action.output(out_port)])
                                     ],
                                     flags=ofp.OFPFF_SEND_FLOW_REM)
        # test
        delete_all_flows(self.controller)
        error_msg, _ = self.controller.poll(ofp.message.flow_removed)
        self.assertTrue(error_msg is not None, "Error message was not received")
コード例 #12
0
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        # flow add
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port)])
            ],
        )
        pkt = str(simple_tcp_packet())
        self.dataplane.send(in_port, pkt)
        verify_packets(self, pkt, [out_port])
        # flow del
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_del",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
        )
        # verify the num of flow entry is 0
        flow_stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(flow_stats), 0)
        self.dataplane.send(in_port, pkt)
        verify_packets(self, pkt, [])
コード例 #13
0
ファイル: error_messages.py プロジェクト: jackyangNJ/oftest
    def runTest(self):
        delete_all_flows(self.controller)

        logging.info("Inserting flow: flow-mod cmd=add,table=0,prio=15 in_port=1 apply:output=2")
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(2)]),
                                     instructions=[
                                         ofp.instruction.apply_actions([ofp.action.output(1)]),
                                     ])

        logging.info("Inserting flow:  flow-mod cmd=add,table=0,prio=15,flags=0x2 apply:output=1")
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(2)]),
                                     instructions=[
                                         ofp.instruction.apply_actions([ofp.action.output(1)]),
                                     ],
                                     flags=ofp.OFPFF_CHECK_OVERLAP, )

        # Verify the correct error message is returned
        response, _ = self.controller.poll(exp_msg=ofp.message.flow_mod_failed_error_msg)
        self.assertTrue(response is not None,
                        "No Flow Mod Failed Error message was received")
        self.assertEqual(response.code, ofp.OFPFMFC_OVERLAP,
                         "Error message error code is not OFPFMFC_OVERLAP")
コード例 #14
0
ファイル: flow_mod.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port1, out_port2 = openflow_ports(3)

        request = FuncUtils.flow_entry_install(self.controller,
                                               "flow_add",
                                               match=ofp.match([ofp.oxm.in_port(in_port)]),
                                               instructions=[
                                                   ofp.instruction.apply_actions([ofp.action.output(out_port1)])
                                               ])

        pkg_num = 10
        FuncUtils.send_packets(self, simple_icmp_packet(), in_port, pkg_num)

        FuncUtils.flow_entry_install(self.controller,
                                     "flow_mods",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[
                                         ofp.instruction.apply_actions([ofp.action.output(out_port2)])
                                     ])

        # verify flow entry pkg num
        flow_stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(flow_stats), 1)
        verify_flow_stats(self, request.match, pkts=pkg_num)
コード例 #15
0
ファイル: error_messages.py プロジェクト: jackyangNJ/oftest
    def runTest(self):
        in_port = openflow_ports(1)[0]
        pkt = str(simple_tcp_packet())

        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     instructions=[
                                         ofp.instruction.apply_actions([
                                             ofp.action.output(
                                                 port=ofp.OFPP_CONTROLLER,
                                                 max_len=2000)
                                         ])
                                     ])

        pkt = str(simple_tcp_packet())
        self.dataplane.send(in_port, pkt)
        response, _ = self.controller.poll(ofp.message.packet_in)

        msg = ofp.message.packet_out(in_port=ofp.OFPP_CONTROLLER,
                                     actions=[ofp.action.output(port=in_port)],
                                     buffer_id=response.buffer_id,
                                     data=pkt)
        self.controller.message_send(msg)

        response, _ = self.controller.poll(ofp.message.bad_request_error_msg)
        self.assertEqual(
            response.code, ofp.OFPBRC_BUFFER_EMPTY,
            "Error message error code is not OFPBRC_BUFFER_EMPTY")
コード例 #16
0
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port)])
            ])

        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     instructions=[
                                         ofp.instruction.apply_actions(
                                             [ofp.action.output(out_port)])
                                     ],
                                     flags=ofp.OFPFF_CHECK_OVERLAP)

        # Verify the correct error message is returned
        response, _ = self.controller.poll(
            exp_msg=ofp.message.flow_mod_failed_error_msg)
        self.assertTrue(response is not None,
                        "No Flow Mod Failed Error message was received")
コード例 #17
0
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port)])
            ])
        # test
        delete_all_flows(self.controller)
        error_msg, _ = self.controller.poll(ofp.message.flow_removed)
        self.assertTrue(error_msg is None, "Error message was received")

        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port)])
            ],
            flags=ofp.OFPFF_SEND_FLOW_REM)
        # test
        delete_all_flows(self.controller)
        error_msg, _ = self.controller.poll(ofp.message.flow_removed)
        self.assertTrue(error_msg is not None,
                        "Error message was not received")
コード例 #18
0
    def runTest(self):
        delete_all_flows(self.controller)

        # config
        in_port, out_port = openflow_ports(2)
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     instructions=[ofp.instruction.apply_actions(
                                         [ofp.action.output(
                                             port=ofp.OFPP_CONTROLLER,
                                             max_len=1000
                                         )])])
        # test
        request = ofp.message.get_config_request()
        response, _ = self.controller.transact(request)
        print(response.show() + "num=" + str(response.miss_send_len))

        pkt = str(simple_tcp_packet(pktlen=80, ip_ttl=1))
        self.dataplane.send(in_port, pkt)
        response, _ = self.controller.poll(ofp.message.packet_in)
        self.assertTrue(response is not None, "No packetin received")
        logging.info(response.show())
        logging.info(len(response.data))

        self.assertEqual(response.reason, ofp.OFPR_NO_MATCH,
                         "Packetin reason field is not NO_MATCH")
コード例 #19
0
ファイル: error_messages.py プロジェクト: jackyangNJ/oftest
    def runTest(self):
        in_port = openflow_ports(1)[0]
        pkt = str(simple_tcp_packet())

        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     instructions=[ofp.instruction.apply_actions(
                                         [ofp.action.output(
                                             port=ofp.OFPP_CONTROLLER,
                                             max_len=2000
                                         )])])

        pkt = str(simple_tcp_packet())
        self.dataplane.send(in_port, pkt)
        response, _ = self.controller.poll(ofp.message.packet_in)

        msg = ofp.message.packet_out(
            in_port=ofp.OFPP_CONTROLLER,
            actions=[ofp.action.output(port=in_port)],
            buffer_id=response.buffer_id,
            data=pkt)
        self.controller.message_send(msg)

        response, _ = self.controller.poll(ofp.message.bad_request_error_msg)
        self.assertEqual(response.code, ofp.OFPBRC_BUFFER_EMPTY,
                         "Error message error code is not OFPBRC_BUFFER_EMPTY")
コード例 #20
0
ファイル: error_messages.py プロジェクト: jackyangNJ/oftest
 def runTest(self):
     FuncUtils.flow_entry_install(self.controller,
                                  "flow_add",
                                  instructions=[ofp.instruction.apply_actions(
                                      [ofp.action.push_vlan(ethertype=0x0081)])])
     response, _ = self.controller.poll(ofp.message.bad_action_error_msg)
     self.assertTrue(response is not None,
                     "No Error message was received")
     self.assertEqual(response.code, ofp.OFPBAC_BAD_ARGUMENT,
                      "Error message error code is not OFPBAC_BAD_ARGUMENT")
コード例 #21
0
ファイル: FlowTableError.py プロジェクト: xuchen1992/oftest
 def runTest(self):
     action = ofp.action.output(port=ofp.OFPP_CONTROLLER,
                                max_len=ofp.OFPCML_NO_BUFFER)
     action.type = 100
     FuncUtils.flow_entry_install(
         self.controller,
         "flow_add",
         instructions=[ofp.instruction.apply_actions([action])])
     response, _ = self.controller.poll(ofp.message.bad_action_error_msg)
     self.assertTrue(response is not None, "No Error message was received")
     self.assertEqual(response.code, ofp.OFPBAC_BAD_TYPE,
                      "Error message error code is not OFPBRC_BAD_TYPE")
コード例 #22
0
ファイル: flow_mod.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        FuncUtils.flow_entry_install(self.controller,
                                     "flow_del",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[
                                         ofp.instruction.apply_actions([ofp.action.output(out_port)])
                                     ])
        # test
        error_msg, _ = self.controller.poll(ofp.OFPT_ERROR)
        self.assertTrue(error_msg is None, "Error message was received")
コード例 #23
0
ファイル: actions.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[
                                         ofp.instruction.apply_actions([ofp.action.output(ofp.OFPP_IN_PORT)])])
        # send packets
        pkt = str(simple_tcp_packet())
        self.dataplane.send(in_port, pkt)
        verify_packets(self, pkt, [in_port])
コード例 #24
0
ファイル: counters.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        # add flow
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port)])],
        )
        stat = get_port_stats(self, in_port)[0]
        self.assertTrue(stat.rx_dropped is not None, "No rx_dropped field")
コード例 #25
0
ファイル: error_messages.py プロジェクト: jackyangNJ/oftest
 def runTest(self):
     FuncUtils.flow_entry_install(
         self.controller,
         "flow_add",
         instructions=[
             ofp.instruction.apply_actions(
                 [ofp.action.push_vlan(ethertype=0x0081)])
         ])
     response, _ = self.controller.poll(ofp.message.bad_action_error_msg)
     self.assertTrue(response is not None, "No Error message was received")
     self.assertEqual(
         response.code, ofp.OFPBAC_BAD_ARGUMENT,
         "Error message error code is not OFPBAC_BAD_ARGUMENT")
コード例 #26
0
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        FuncUtils.flow_entry_install(
            self.controller,
            "flow_del",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port)])
            ])
        # test
        error_msg, _ = self.controller.poll(ofp.OFPT_ERROR)
        self.assertTrue(error_msg is None, "Error message was received")
コード例 #27
0
ファイル: flow_mod.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        # flow add and delete
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port)])],
                                     prio=15)
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_del",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     )
        # flow add and delete strict
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port)])],
                                     prio=125)
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_dels",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     prio=125)

        # verify the num of flow entry is 0
        flow_stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(flow_stats), 0)
コード例 #28
0
ファイル: FlowTableError.py プロジェクト: lparkes/oftest
 def runTest(self):
     action = ofp.action.output(
         port=ofp.OFPP_CONTROLLER,
         max_len=ofp.OFPCML_NO_BUFFER
     )
     action.type = 100
     FuncUtils.flow_entry_install(self.controller,
                                  "flow_add",
                                  instructions=[ofp.instruction.apply_actions(
                                      [action])])
     response, _ = self.controller.poll(ofp.message.bad_action_error_msg)
     self.assertTrue(response is not None,
                     "No Error message was received")
     self.assertEqual(response.code, ofp.OFPBAC_BAD_TYPE,
                      "Error message error code is not OFPBRC_BAD_TYPE")
コード例 #29
0
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        request = FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port)])
            ])
        # send matching packets
        pkt = str(simple_icmp_packet())
        times = 10
        for i in range(times):
            self.dataplane.send(in_port, pkt)

        # send same flow into the table to reset counters
        self.controller.message_send(request)

        # check result
        flow_stats = get_flow_stats(self, ofp.match())
        for entry in flow_stats:
            logging.debug(entry.show())

        self.assertEqual(len(flow_stats), 1)
        self.assertEqual(flow_stats[0].packet_count, 0)
コード例 #30
0
    def runTest(self):
        delete_all_flows(self.controller)

        # config
        in_port, out_port = openflow_ports(2)
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     instructions=[ofp.instruction.apply_actions(
                                         [ofp.action.output(
                                             port=ofp.OFPP_CONTROLLER,
                                             max_len=ofp.OFPCML_NO_BUFFER
                                         )])])
        # test
        pkt = str(simple_tcp_packet(pktlen=70))
        self.dataplane.send(in_port, pkt)
        verify_packet_in(self, pkt, in_port, ofp.OFPR_NO_MATCH)
コード例 #31
0
ファイル: flow_mod.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        request = FuncUtils.flow_entry_install(self.controller,
                                               "flow_add",
                                               match=ofp.match([ofp.oxm.in_port(in_port)]),
                                               instructions=[
                                                   ofp.instruction.apply_actions([ofp.action.output(out_port)])])
        # send matching packets
        pkt = str(simple_icmp_packet())
        times = 10
        for i in range(times):
            self.dataplane.send(in_port, pkt)

        # send same flow into the table to reset counters
        self.controller.message_send(request)

        # check result
        flow_stats = get_flow_stats(self, ofp.match())
        for entry in flow_stats:
            logging.debug(entry.show())

        self.assertEqual(len(flow_stats), 1)
        self.assertEqual(flow_stats[0].packet_count, 0)
コード例 #32
0
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions(
                    [ofp.action.output(ofp.OFPP_IN_PORT)])
            ])
        # send packets
        pkt = str(simple_tcp_packet())
        self.dataplane.send(in_port, pkt)
        verify_packets(self, pkt, [in_port])
コード例 #33
0
ファイル: FlowTableError.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        for i in range(65539):
            FuncUtils.flow_entry_install(self.controller,
                                         "flow_add",
                                         match=ofp.match([ofp.oxm.in_port(in_port)]),
                                         instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port)])],
                                         prio=i)
            # read error message
            response, _ = self.controller.poll(ofp.message.flow_mod_failed_error_msg, 0.00001)

            if response is not None and (response.code == ofp.OFPFMFC_TABLE_FULL):
                return
        self.assertTrue(False, "No error message was received")
コード例 #34
0
ファイル: counters.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)
        # add flow
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port)])],
        )
        # test
        pkt_num = 10
        pkt = str(simple_tcp_packet())
        for i in range(pkt_num):
            self.dataplane.send(in_port, pkt)

        verify_port_stats(self, out_port, tx_bytes=pkt_num * len(pkt))
コード例 #35
0
ファイル: flow_mod.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port)])])

        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port)])],
                                     flags=ofp.OFPFF_CHECK_OVERLAP)

        # Verify the correct error message is returned
        response, _ = self.controller.poll(exp_msg=ofp.message.flow_mod_failed_error_msg)
        self.assertTrue(response is not None,
                        "No Flow Mod Failed Error message was received")
コード例 #36
0
ファイル: actions.py プロジェクト: lparkes/oftest
    def runTest(self):
        logging.info("TestCase 70.30: Forward: Controller")
        # delete all entries
        delete_all_flows(self.controller)

        in_port, out_port = openflow_ports(2)
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions(
                                         [ofp.action.output(
                                             port=ofp.OFPP_CONTROLLER,
                                             max_len=ofp.OFPCML_NO_BUFFER
                                         )])])

        pkt = str(simple_tcp_packet())
        self.dataplane.send(in_port, pkt)
        verify_packet_in(self, pkt, in_port, ofp.OFPR_ACTION)
コード例 #37
0
ファイル: actions.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)

        # config
        in_port, out_port1, out_port2, out_port3 = openflow_ports(4)
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions(
                                         [ofp.action.output(ofp.OFPP_ALL)])]
                                     )

        # tests
        pkt = str(simple_tcp_packet())
        self.dataplane.send(in_port, pkt)

        verify_no_packet(self, pkt, in_port)
        verify_packets(self, pkt, [out_port1, out_port2, out_port3])
コード例 #38
0
ファイル: actions.py プロジェクト: lparkes/oftest
    def verify_modify(self, actions, pkt, exp_pkt):
        in_port, out_port = openflow_ports(2)

        actions = actions + [ofp.action.output(out_port)]

        logging.info("Running actions test for %s", pp(actions))

        delete_all_flows(self.controller)

        logging.info("Inserting flow")
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=packet_to_flow_match(self, pkt),
                                     instructions=[ofp.instruction.apply_actions(actions)]
                                     )

        logging.info("Sending packet, expecting output to port %d", out_port)
        self.dataplane.send(in_port, str(pkt))
        verify_packets(self, str(exp_pkt), [out_port])
コード例 #39
0
    def verify_modify(self, actions, pkt, exp_pkt):
        in_port, out_port = openflow_ports(2)

        actions = actions + [ofp.action.output(out_port)]

        logging.info("Running actions test for %s", pp(actions))

        delete_all_flows(self.controller)

        logging.info("Inserting flow")
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=packet_to_flow_match(self, pkt),
            instructions=[ofp.instruction.apply_actions(actions)])

        logging.info("Sending packet, expecting output to port %d", out_port)
        self.dataplane.send(in_port, str(pkt))
        verify_packets(self, str(exp_pkt), [out_port])
コード例 #40
0
    def runTest(self):
        delete_all_flows(self.controller)

        # config
        in_port, out_port = openflow_ports(2)
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     instructions=[ofp.instruction.apply_actions(
                                         [ofp.action.output(
                                             port=ofp.OFPP_CONTROLLER,
                                             max_len=ofp.OFPCML_NO_BUFFER
                                         )])])
        # test
        pkt = str(simple_tcp_packet())
        self.dataplane.send(in_port, pkt)
        response, _ = self.controller.poll(ofp.message.packet_in)
        self.assertTrue(response is not None, "No packetin received")
        self.assertEqual(response.reason, ofp.OFPR_NO_MATCH,
                         "Packetin reason field is not NO_MATCH")
コード例 #41
0
ファイル: FlowTableError.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)

        # search unavalible port
        for port_nonvalid in range(1000):
            FuncUtils.flow_entry_install(self.controller,
                                         "flow_add",
                                         instructions=[
                                             ofp.instruction.apply_actions([ofp.action.output(port_nonvalid)])
                                         ])
            _, port_config, _ = port_config_get(self.controller, port_nonvalid)
            if port_config is None:
                break

        # read error message
        response, _ = self.controller.poll(ofp.message.bad_action_error_msg)
        self.assertTrue(response is not None,
                        "No error message was received")
        self.assertEqual(response.code, ofp.OFPBAC_BAD_OUT_PORT)
コード例 #42
0
    def runTest(self):
        delete_all_flows(self.controller)

        # config
        in_port, out_port1, out_port2, out_port3 = openflow_ports(4)
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match(
                                         [ofp.oxm.in_port(in_port)]),
                                     instructions=[
                                         ofp.instruction.apply_actions(
                                             [ofp.action.output(ofp.OFPP_ALL)])
                                     ])

        # tests
        pkt = str(simple_tcp_packet())
        self.dataplane.send(in_port, pkt)

        verify_no_packet(self, pkt, in_port)
        verify_packets(self, pkt, [out_port1, out_port2, out_port3])
コード例 #43
0
    def runTest(self):
        logging.info("TestCase 70.30: Forward: Controller")
        # delete all entries
        delete_all_flows(self.controller)

        in_port, out_port = openflow_ports(2)
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([
                    ofp.action.output(port=ofp.OFPP_CONTROLLER,
                                      max_len=ofp.OFPCML_NO_BUFFER)
                ])
            ])

        pkt = str(simple_tcp_packet())
        self.dataplane.send(in_port, pkt)
        verify_packet_in(self, pkt, in_port, ofp.OFPR_ACTION)
コード例 #44
0
ファイル: FlowTableError.py プロジェクト: xuchen1992/oftest
    def runTest(self):
        delete_all_flows(self.controller)

        # search unavalible port
        for port_nonvalid in range(1000):
            FuncUtils.flow_entry_install(
                self.controller,
                "flow_add",
                instructions=[
                    ofp.instruction.apply_actions(
                        [ofp.action.output(port_nonvalid)])
                ])
            _, port_config, _ = port_config_get(self.controller, port_nonvalid)
            if port_config is None:
                break

        # read error message
        response, _ = self.controller.poll(ofp.message.bad_action_error_msg)
        self.assertTrue(response is not None, "No error message was received")
        self.assertEqual(response.code, ofp.OFPBAC_BAD_OUT_PORT)
コード例 #45
0
    def runTest(self):
        delete_all_flows(self.controller)

        # config
        in_port, out_port = openflow_ports(2)
        max_len = 100
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions(
                                         [ofp.action.output(
                                             port=ofp.OFPP_CONTROLLER,
                                             max_len=ofp.OFPCML_NO_BUFFER
                                         )])])
        # test
        pkt = str(simple_tcp_packet(pktlen=0))
        self.dataplane.send(in_port, pkt)

        response, _ = self.controller.poll(ofp.message.packet_in)
        logging.info(response.show())
        self.assertTrue(response is not None, "No packetin received")
コード例 #46
0
ファイル: ControlChannel.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port1, out_port2 = openflow_ports(3)

        # flow add
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port1)])],
                                     hard_timeout=1,
                                     )
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port2)])],
                                     hard_timeout=100
                                     )
        # tests
        time.sleep(5)
        stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(stats), 1, "Expected empty flow stats reply")
コード例 #47
0
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        # flow T0 add
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port)])
            ])

        # flow T1 add
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([
                ofp.oxm.in_port(in_port),
                ofp.oxm.eth_dst([0x00, 0x13, 0x3b, 0x0f, 0x42, 0x1c])
            ]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port)])
            ])
        # flow del
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_dels",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
        )

        # verify the num of flow entry is 1
        flow_stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(flow_stats), 1)
コード例 #48
0
ファイル: flow_mod.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port1, out_port2 = openflow_ports(3)

        # flow add
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port1)])],
                                     prio=15
                                     )
        # flow add
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port2)])],
                                     prio=14
                                     )
        # check
        flow_stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(flow_stats), 2, "Flow was not inserted correctly")
        # flow del
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_del",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     prio=15,
                                     out_port=out_port1
                                     )
        # verify the num of flow entry is 1 and matching entry is removed
        flow_stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(flow_stats), 1, len(flow_stats))
コード例 #49
0
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port1, out_port2 = openflow_ports(3)

        # flow add
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port1)])
            ],
            prio=15)
        # flow add
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port2)])
            ],
            prio=14)
        # check
        flow_stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(flow_stats), 2, "Flow was not inserted correctly")
        # flow del
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_del",
                                     match=ofp.match(
                                         [ofp.oxm.in_port(in_port)]),
                                     prio=15,
                                     out_port=out_port1)
        # verify the num of flow entry is 1 and matching entry is removed
        flow_stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(flow_stats), 1, len(flow_stats))
コード例 #50
0
ファイル: flow_mod.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        # flow add
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port)])],
                                     prio=15
                                     )
        # flow add
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port)])],
                                     prio=14
                                     )
        # flow del
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_dels",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     prio=15
                                     )
        # verify the num of flow entry is 1
        flow_stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(flow_stats), 1)
        self.assertEqual(flow_stats[0].priority, 14, "Not matching entry is removed")
コード例 #51
0
ファイル: flow_mod.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        # flow T0 add
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port)])]
                                     )

        # flow T1 add
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port),
                                                      ofp.oxm.eth_dst([0x00, 0x13, 0x3b, 0x0f, 0x42, 0x1c])
                                                      ]),
                                     instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port)])]
                                     )
        # flow del
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_dels",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     )

        # verify the num of flow entry is 1
        flow_stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(flow_stats), 1)
コード例 #52
0
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        # flow add
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port)])
            ],
            prio=15)
        # flow add
        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=ofp.match([ofp.oxm.in_port(in_port)]),
            instructions=[
                ofp.instruction.apply_actions([ofp.action.output(out_port)])
            ],
            prio=14)
        # flow del
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_dels",
                                     match=ofp.match(
                                         [ofp.oxm.in_port(in_port)]),
                                     prio=15)
        # verify the num of flow entry is 1
        flow_stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(flow_stats), 1)
        self.assertEqual(flow_stats[0].priority, 14,
                         "Not matching entry is removed")
コード例 #53
0
    def runTest(self):
        delete_all_flows(self.controller)

        # config
        in_port, out_port = openflow_ports(2)
        max_len = 100
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions(
                                         [ofp.action.output(
                                             port=ofp.OFPP_CONTROLLER,
                                             max_len=max_len
                                         )])])
        # test
        pkt = str(simple_tcp_packet(pktlen=700))
        self.dataplane.send(in_port, pkt)

        response, _ = self.controller.poll(ofp.message.packet_in)
        self.assertTrue(response is not None, "No packetin received")
        self.assertEqual(response.reason, ofp.OFPR_ACTION, "Reason of packetin is incorrect")
        self.assertEqual(len(response.data), max_len, "Length of packetin is incorrect")
コード例 #54
0
ファイル: flow_mod.py プロジェクト: lparkes/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        # flow add
        FuncUtils.flow_entry_install(self.controller,
                                     "flow_add",
                                     match=ofp.match([ofp.oxm.in_port(in_port)]),
                                     instructions=[ofp.instruction.apply_actions([ofp.action.output(out_port)])],
                                     hard_timeout=0,
                                     idle_timeout=0
                                     )
        # send packet to in_port and verify
        pkt = str(simple_tcp_packet())
        self.dataplane.send(in_port, pkt)
        verify_packets(self, pkt, [out_port])
        time.sleep(3)
        self.dataplane.send(in_port, pkt)
        verify_packets(self, pkt, [out_port])

        flow_stats = get_flow_stats(self, ofp.match())
        self.assertEqual(len(flow_stats), 1)
コード例 #55
0
ファイル: FlowTableError.py プロジェクト: xuchen1992/oftest
    def runTest(self):
        delete_all_flows(self.controller)
        in_port, out_port = openflow_ports(2)

        for i in range(65539):
            FuncUtils.flow_entry_install(self.controller,
                                         "flow_add",
                                         match=ofp.match(
                                             [ofp.oxm.in_port(in_port)]),
                                         instructions=[
                                             ofp.instruction.apply_actions(
                                                 [ofp.action.output(out_port)])
                                         ],
                                         prio=i)
            # read error message
            response, _ = self.controller.poll(
                ofp.message.flow_mod_failed_error_msg, 0.00001)

            if response is not None and (response.code
                                         == ofp.OFPFMFC_TABLE_FULL):
                return
        self.assertTrue(False, "No error message was received")
コード例 #56
0
    def runTest(self):
        in_port, out_port = openflow_ports(2)

        actions = [ofp.action.output(out_port)]

        pkt = simple_tcp_packet()

        logging.info("Running actions test for %s", pp(actions))

        delete_all_flows(self.controller)

        FuncUtils.flow_entry_install(
            self.controller,
            "flow_add",
            match=packet_to_flow_match(self, pkt),
            instructions=[ofp.instruction.write_actions(actions)])

        pktstr = str(pkt)

        logging.info("Sending packet, expecting output to port %d", out_port)
        self.dataplane.send(in_port, pktstr)
        verify_packets(self, pktstr, [out_port])