Пример #1
0
    def runTest(self):
        INFO = " 1.1.20 - Table Identifier Violation"
        in_port, out_port1 = testutils.openflow_ports(2)
        testutils.delete_all_flows(self.controller)

        match = ofp.match([
            ofp.oxm.in_port(in_port),
        ])
        priority = 10
        logging.info("Inserting flow with bad table ID")
        inst = ofp.instruction.apply_actions([ofp.action.output(out_port1)])
        request = ofp.message.flow_add(table_id=255,
                                       match=match,
                                       instructions=[inst],
                                       buffer_id=ofp.OFP_NO_BUFFER,
                                       priority=priority,
                                       flags=ofp.OFPFF_SEND_FLOW_REM)
        reply, pkt = self.controller.transact(request)
        try:
            self.assertTrue(reply is not None,
                            "No response to malformed table ID")
            self.assertTrue(reply.type == ofp.OFPT_ERROR,
                            "Reply not an error message")
            self.assertTrue(reply.err_type == ofp.OFPET_FLOW_MOD_FAILED,
                            "Reply error type is not flow mod failed")
            self.assertTrue(reply.code == ofp.OFPFMFC_BAD_TABLE_ID,
                            "Reply error code is not bad table ID")
            log.info(PASS + INFO)
        except AssertionError, Err:
            log.info(FAIL + INFO)
            log.info(REASON + " -> "+ str(Err))
Пример #2
0
    def runTest(self):
        INFO = " 1.1.50 - Table Loop Violation"
        in_port, out_port1 = testutils.openflow_ports(2)

        testutils.delete_all_flows(self.controller)

        match = ofp.match([
            ofp.oxm.in_port(in_port),
        ])
        priority = 1000
        logging.info("Inserting flow with bad goto table instruction")
        inst1 = ofp.instruction.apply_actions([ofp.action.output(out_port1)])
        inst2 = ofp.instruction.goto_table(5)
        request = ofp.message.flow_add(table_id=10,
                                       match=match,
                                       instructions=[inst1, inst2],
                                       buffer_id=ofp.OFP_NO_BUFFER,
                                       priority=priority,
                                       flags=ofp.OFPFF_SEND_FLOW_REM)
        reply, pkt = self.controller.transact(request)
        try:
            self.assertTrue(reply is not None,
                            "No response to table loop error")
            self.assertTrue(reply.type == ofp.OFPT_ERROR,
                            "Reply not an error message")
            self.assertTrue(reply.err_type == ofp.OFPET_BAD_INSTRUCTION,
                            "Reply error type is not bad instruction request")
            self.assertTrue(reply.code == ofp.OFPBIC_BAD_TABLE_ID,
                           "Reply error code is not bad table id")
            log.info(PASS + INFO)
        except AssertionError, Err:
            log.info(FAIL + INFO)
            log.info(REASON + " -> "+ str(Err))
Пример #3
0
    def runTest(self):
        INFO = " 1.1.110 - Invalid OXM - Value"
        in_port, out_port1 = testutils.openflow_ports(2)

        testutils.delete_all_flows(self.controller)

        match = ofp.match([ofp.oxm.in_port(in_port),
                          ofp.oxm.eth_type(0x800),
                          ofp.oxm.ip_dscp(100), ])
        action = ofp.action.output(out_port1)
        inst = ofp.instruction.apply_actions(actions=[action])
        logging.info("Inserting flow with bad match value")
        # Wrong match value in flow mod
        request = ofp.message.flow_add(table_id=10,
                                       match=match,
                                       instructions=[inst],
                                       hard_timeout=1000,)
        reply, pkt = self.controller.transact(request)
        try:
            self.assertTrue(reply is not None,
                            "No response to invalid OXM value")
            self.assertTrue(reply.type == ofp.OFPT_ERROR,
                            "Reply not an error message")
            self.assertTrue(reply.err_type == ofp.OFPET_BAD_MATCH,
                            "Reply error type is not bad match request")
            self.assertTrue(reply.code == ofp.OFPBMC_BAD_VALUE,
                           "Reply error code is not bad match value")
            log.info(PASS + INFO)
        except AssertionError, Err:
            log.info(FAIL + INFO)
            log.info(REASON + " -> "+ str(Err))
Пример #4
0
    def runTest(self):
        INFO = " 1.1.90 - Invalid OXM - Type"
        in_port, out_port1 = testutils.openflow_ports(2)

        testutils.delete_all_flows(self.controller)

        match = ofp.match([
            ofp.oxm.in_port(in_port),
        ])
        inst = ofp.instruction.apply_actions([ofp.action.output(out_port1)])
        logging.info("Inserting flow with malformed control message type")
        # Wrong type in flow mod
        request = ofp.message.flow_add(table_id=10,
                                       type=16,
                                       match=match,
                                       instructions=[inst],
                                       hard_timeout=1000)
        reply, pkt = self.controller.transact(request)
        try:
            self.assertTrue(reply is not None,
                            "No response to invalid OXM type")
            self.assertTrue(reply.type == ofp.OFPT_ERROR,
                            "Reply not an error message")
            self.assertTrue(reply.err_type == ofp.OFPET_BAD_REQUEST,
                            "Reply error type is not bad request")
            self.assertTrue(reply.code == ofp.OFPFMFC_BAD_COMMAND,
                           "Reply error code is not bad command")
            log.info(PASS + INFO)
        except AssertionError, Err:
            log.info(FAIL + INFO)
            log.info(REASON + " -> "+ str(Err))
Пример #5
0
    def runTest(self):
        in_port, out_port1 = testutils.openflow_ports(2)

        testutils.delete_all_flows(self.controller)

        match = ofp.match([
            ofp.oxm.in_port(in_port),
        ])
        action = ofp.action.output(out_port1)
        inst = ofp.instruction.apply_actions(actions=[action])
        logging.info("Inserting flow with bad match length")
        # Wrong length in flow mod
        request = ofp.message.flow_add(table_id=10,
                                       match=match,
                                       instructions=[inst],
                                       hard_timeout=1000,
                                       length=10000)
        reply, pkt = self.controller.transact(request)

        self.assertTrue(reply is not None, "No response to bad match length")
        self.assertTrue(reply.type == ofp.OFPT_ERROR,
                        "reply not an error message")
        self.assertTrue(reply.err_type == ofp.OFPET_BAD_MATCH,
                        "reply error type is not bad match request")
        self.assertTrue(reply.code == ofp.OFPBMC_BAD_LEN,
                        "reply error code is not bad match length")
Пример #6
0
    def runTest(self):
        in_port, out_port1 = testutils.openflow_ports(2)

        testutils.delete_all_flows(self.controller)

        match = ofp.match([
            ofp.oxm.in_port(in_port),
        ])
        inst = ofp.instruction.apply_actions([ofp.action.output(out_port1)])
        logging.info("Inserting flow with malformed control message type")
        # Wrong type in flow mod
        request = ofp.message.flow_add(table_id=10,
                                       type=16,
                                       match=match,
                                       instructions=[inst],
                                       hard_timeout=1000)
        reply, pkt = self.controller.transact(request)

        self.assertTrue(reply is not None,
                        "No response to malformed control message type")
        self.assertTrue(reply.type == ofp.OFPT_ERROR,
                        "reply not an error message")
        self.assertTrue(reply.err_type == ofp.OFPET_BAD_REQUEST,
                        "reply error type is not bad request")
        self.assertTrue(reply.code == ofp.OFPFMFC_BAD_COMMAND,
                        "reply error code is not bad timeout")
Пример #7
0
    def runTest(self):
        INFO = " 1.1.110 - Invalid OXM - Value"
        in_port, out_port1 = testutils.openflow_ports(2)

        testutils.delete_all_flows(self.controller)

        match = ofp.match([
            ofp.oxm.in_port(in_port),
            ofp.oxm.eth_type(0x800),
            ofp.oxm.ip_dscp(100),
        ])
        action = ofp.action.output(out_port1)
        inst = ofp.instruction.apply_actions(actions=[action])
        logging.info("Inserting flow with bad match value")
        # Wrong match value in flow mod
        request = ofp.message.flow_add(
            table_id=10,
            match=match,
            instructions=[inst],
            hard_timeout=1000,
        )
        reply, pkt = self.controller.transact(request)
        try:
            self.assertTrue(reply is not None,
                            "No response to invalid OXM value")
            self.assertTrue(reply.type == ofp.OFPT_ERROR,
                            "Reply not an error message")
            self.assertTrue(reply.err_type == ofp.OFPET_BAD_MATCH,
                            "Reply error type is not bad match request")
            self.assertTrue(reply.code == ofp.OFPBMC_BAD_VALUE,
                            "Reply error code is not bad match value")
            log.info(PASS + INFO)
        except AssertionError, Err:
            log.info(FAIL + INFO)
            log.info(REASON + " -> " + str(Err))
Пример #8
0
    def runTest(self):
        INFO = " 1.1.20 - Table Identifier Violation"
        in_port, out_port1 = testutils.openflow_ports(2)
        testutils.delete_all_flows(self.controller)

        match = ofp.match([
            ofp.oxm.in_port(in_port),
        ])
        priority = 10
        logging.info("Inserting flow with bad table ID")
        inst = ofp.instruction.apply_actions([ofp.action.output(out_port1)])
        request = ofp.message.flow_add(table_id=255,
                                       match=match,
                                       instructions=[inst],
                                       buffer_id=ofp.OFP_NO_BUFFER,
                                       priority=priority,
                                       flags=ofp.OFPFF_SEND_FLOW_REM)
        reply, pkt = self.controller.transact(request)
        try:
            self.assertTrue(reply is not None,
                            "No response to malformed table ID")
            self.assertTrue(reply.type == ofp.OFPT_ERROR,
                            "Reply not an error message")
            self.assertTrue(reply.err_type == ofp.OFPET_FLOW_MOD_FAILED,
                            "Reply error type is not flow mod failed")
            self.assertTrue(reply.code == ofp.OFPFMFC_BAD_TABLE_ID,
                            "Reply error code is not bad table ID")
            log.info(PASS + INFO)
        except AssertionError, Err:
            log.info(FAIL + INFO)
            log.info(REASON + " -> " + str(Err))
Пример #9
0
    def runTest(self):
        INFO = " 1.1.90 - Invalid OXM - Type"
        in_port, out_port1 = testutils.openflow_ports(2)

        testutils.delete_all_flows(self.controller)

        match = ofp.match([
            ofp.oxm.in_port(in_port),
        ])
        inst = ofp.instruction.apply_actions([ofp.action.output(out_port1)])
        logging.info("Inserting flow with malformed control message type")
        # Wrong type in flow mod
        request = ofp.message.flow_add(table_id=10,
                                       type=16,
                                       match=match,
                                       instructions=[inst],
                                       hard_timeout=1000)
        reply, pkt = self.controller.transact(request)
        try:
            self.assertTrue(reply is not None,
                            "No response to invalid OXM type")
            self.assertTrue(reply.type == ofp.OFPT_ERROR,
                            "Reply not an error message")
            self.assertTrue(reply.err_type == ofp.OFPET_BAD_REQUEST,
                            "Reply error type is not bad request")
            self.assertTrue(reply.code == ofp.OFPFMFC_BAD_COMMAND,
                            "Reply error code is not bad command")
            log.info(PASS + INFO)
        except AssertionError, Err:
            log.info(FAIL + INFO)
            log.info(REASON + " -> " + str(Err))
Пример #10
0
    def runTest(self):
        INFO = " 1.1.50 - Table Loop Violation"
        in_port, out_port1 = testutils.openflow_ports(2)

        testutils.delete_all_flows(self.controller)

        match = ofp.match([
            ofp.oxm.in_port(in_port),
        ])
        priority = 1000
        logging.info("Inserting flow with bad goto table instruction")
        inst1 = ofp.instruction.apply_actions([ofp.action.output(out_port1)])
        inst2 = ofp.instruction.goto_table(5)
        request = ofp.message.flow_add(table_id=10,
                                       match=match,
                                       instructions=[inst1, inst2],
                                       buffer_id=ofp.OFP_NO_BUFFER,
                                       priority=priority,
                                       flags=ofp.OFPFF_SEND_FLOW_REM)
        reply, pkt = self.controller.transact(request)
        try:
            self.assertTrue(reply is not None,
                            "No response to table loop error")
            self.assertTrue(reply.type == ofp.OFPT_ERROR,
                            "Reply not an error message")
            self.assertTrue(reply.err_type == ofp.OFPET_BAD_INSTRUCTION,
                            "Reply error type is not bad instruction request")
            self.assertTrue(reply.code == ofp.OFPBIC_BAD_TABLE_ID,
                            "Reply error code is not bad table id")
            log.info(PASS + INFO)
        except AssertionError, Err:
            log.info(FAIL + INFO)
            log.info(REASON + " -> " + str(Err))
Пример #11
0
    def runTest(self):
        in_port, out_port1 = testutils.openflow_ports(2)

        testutils.delete_all_flows(self.controller)

        match = ofp.match([
            ofp.oxm.in_port(in_port),
        ])
        inst = ofp.instruction.apply_actions([ofp.action.output(out_port1)])
        logging.info("Inserting flow with malformed control message type")
        # Wrong type in flow mod
        request = ofp.message.flow_add(table_id=10,
                                       type=16,
                                       match=match,
                                       instructions=[inst],
                                       hard_timeout=1000)
        reply, pkt = self.controller.transact(request)

        self.assertTrue(reply is not None,
                        "No response to malformed control message type")
        self.assertTrue(reply.type == ofp.OFPT_ERROR,
                        "reply not an error message")
        self.assertTrue(reply.err_type == ofp.OFPET_BAD_REQUEST,
                        "reply error type is not bad request")
        self.assertTrue(reply.code == ofp.OFPFMFC_BAD_COMMAND,
                        "reply error code is not bad timeout")
Пример #12
0
    def runTest(self):
        in_port, out_port1 = testutils.openflow_ports(2)

        testutils.delete_all_flows(self.controller)

        match = ofp.match([
            ofp.oxm.in_port(in_port),
        ])
        action = ofp.action.output(out_port1)
        inst = ofp.instruction.apply_actions(actions=[action])
        logging.info("Inserting flow with bad match length")
        # Wrong length in flow mod
        request = ofp.message.flow_add(table_id=10,
                                       match=match,
                                       instructions=[inst],
                                       hard_timeout=1000,
                                       length=10000)
        reply, pkt = self.controller.transact(request)

        self.assertTrue(reply is not None, "No response to bad match length")
        self.assertTrue(reply.type == ofp.OFPT_ERROR,
                        "reply not an error message")
        self.assertTrue(reply.err_type == ofp.OFPET_BAD_MATCH,
                        "reply error type is not bad match request")
        self.assertTrue(reply.code == ofp.OFPBMC_BAD_LEN,
                        "reply error code is not bad match length")
Пример #13
0
 def setUp(self):
     base_tests.SimpleDataPlane.setUp(self)
     testutils.delete_all_flows(self.controller)
     testutils.delete_all_groups(self.controller)
Пример #14
0
 def setUp(self):
     base_tests.SimpleDataPlane.setUp(self)
     testutils.delete_all_flows(self.controller)
     testutils.delete_all_groups(self.controller)