Exemple #1
0
    def runTest(self):
        role, gen = role_setup.request(self, ofp.OFPCR_ROLE_NOCHANGE)
        role_setup.error(self, ofp.OFPCR_ROLE_MASTER, gen - 1,
                         ofp.OFPRRFC_STALE)

        role1, gen1 = role_setup.request(self, ofp.OFPCR_ROLE_NOCHANGE)
        role_setup.error(self, ofp.OFPCR_ROLE_SLAVE, gen1 - 1,
                         ofp.OFPRRFC_STALE)
Exemple #2
0
    def runTest(self):
        INFO = " 1.2.10 - Slave Controller Violation"
        role, gen = role_setup.request(self, ofp.OFPCR_ROLE_NOCHANGE)
        role_setup.request(self, ofp.OFPCR_ROLE_SLAVE, gen)

        # Generate requests not allowed in Slave Controller Role
        # Packet Out
        self.controller.message_send(
            ofp.message.packet_out(buffer_id=ofp.OFP_NO_BUFFER))

        # Flow Modification
        self.controller.message_send(
            ofp.message.flow_delete(
                buffer_id=ofp.OFP_NO_BUFFER,
                out_port=ofp.OFPP_ANY,
                out_group=ofp.OFPG_ANY))

        # Group Modification
        self.controller.message_send(
            ofp.message.group_mod(
                command=ofp.OFPGC_DELETE,
                group_id=ofp.OFPG_ALL))

        # Port Modification
        self.controller.message_send(
            ofp.message.port_mod(
                port_no=ofp.OFPP_MAX))

        # Table Modification
        self.controller.message_send(
            ofp.message.table_mod(
                table_id=1))

        # Since Table Features is unsupported in OF1.3, we skip it
        testutils.do_barrier(self.controller)
        try:
            err_count = 0
            while self.controller.packets:
                msg = self.controller.packets.pop(0)[0]
                if msg.type == ofp.OFPT_ERROR:
                    self.assertEquals(msg.err_type, ofp.OFPET_BAD_REQUEST)
                    self.assertEquals(msg.code, ofp.OFPBRC_EPERM)
                    err_count += 1
                self.assertEquals(err_count, 5,
                                  "Expected errors for each message")
                log.info(PASS + INFO)
        except AssertionError, Err:
            log.info(FAIL + INFO)
            log.info(REASON + " -> "+ str(Err))
Exemple #3
0
    def runTest(self):
        INFO = " 1.2.20 - Corrupted Generation ID"
        role, gen = role_setup.request(self, ofp.OFPCR_ROLE_NOCHANGE)
        try:
            role_setup.error(self, ofp.OFPCR_ROLE_MASTER, gen - 1,
                             ofp.OFPRRFC_STALE)
        except AssertionError:
            log.info(FAIL + INFO)
            log.info(REASON + " -> Master: Corrupted Generation ID processed")

        role1, gen1 = role_setup.request(self, ofp.OFPCR_ROLE_NOCHANGE)
        try:
            role_setup.error(self, ofp.OFPCR_ROLE_SLAVE, gen1 - 1,
                             ofp.OFPRRFC_STALE)
            log.info(PASS + INFO)
        except AssertionError:
            log.info(FAIL + INFO)
            log.info(REASON + " -> Slave: Corrupted Generation ID processed")
Exemple #4
0
    def runTest(self):
        INFO = " 1.2.10 - Slave Controller Violation"
        role, gen = role_setup.request(self, ofp.OFPCR_ROLE_NOCHANGE)
        role_setup.request(self, ofp.OFPCR_ROLE_SLAVE, gen)

        # Generate requests not allowed in Slave Controller Role
        # Packet Out
        self.controller.message_send(
            ofp.message.packet_out(buffer_id=ofp.OFP_NO_BUFFER))

        # Flow Modification
        self.controller.message_send(
            ofp.message.flow_delete(buffer_id=ofp.OFP_NO_BUFFER,
                                    out_port=ofp.OFPP_ANY,
                                    out_group=ofp.OFPG_ANY))

        # Group Modification
        self.controller.message_send(
            ofp.message.group_mod(command=ofp.OFPGC_DELETE,
                                  group_id=ofp.OFPG_ALL))

        # Port Modification
        self.controller.message_send(
            ofp.message.port_mod(port_no=ofp.OFPP_MAX))

        # Table Modification
        self.controller.message_send(ofp.message.table_mod(table_id=1))

        # Since Table Features is unsupported in OF1.3, we skip it
        testutils.do_barrier(self.controller)
        try:
            err_count = 0
            while self.controller.packets:
                msg = self.controller.packets.pop(0)[0]
                if msg.type == ofp.OFPT_ERROR:
                    self.assertEquals(msg.err_type, ofp.OFPET_BAD_REQUEST)
                    self.assertEquals(msg.code, ofp.OFPBRC_EPERM)
                    err_count += 1
                self.assertEquals(err_count, 5,
                                  "Expected errors for each message")
                log.info(PASS + INFO)
        except AssertionError, Err:
            log.info(FAIL + INFO)
            log.info(REASON + " -> " + str(Err))
Exemple #5
0
    def runTest(self):
        INFO = " 1.2.20 - Corrupted Generation ID"
        role, gen = role_setup.request(self, ofp.OFPCR_ROLE_NOCHANGE)
        try:
            role_setup.error(self,
                             ofp.OFPCR_ROLE_MASTER,
                             gen-1,
                             ofp.OFPRRFC_STALE)
        except AssertionError:
            log.info(FAIL + INFO)
            log.info(REASON + " -> Master: Corrupted Generation ID processed")

        role1, gen1 = role_setup.request(self, ofp.OFPCR_ROLE_NOCHANGE)
        try:
            role_setup.error(self,
                             ofp.OFPCR_ROLE_SLAVE,
                             gen1-1,
                             ofp.OFPRRFC_STALE)
            log.info(PASS + INFO)
        except AssertionError:
            log.info(FAIL + INFO)
            log.info(REASON + " -> Slave: Corrupted Generation ID processed")
Exemple #6
0
    def runTest(self):
        role, gen = role_setup.request(self, ofp.OFPCR_ROLE_NOCHANGE)
        role_setup.error(self, ofp.OFPCR_ROLE_MASTER, gen-1, ofp.OFPRRFC_STALE)

        role1, gen1 = role_setup.request(self, ofp.OFPCR_ROLE_NOCHANGE)
        role_setup.error(self, ofp.OFPCR_ROLE_SLAVE, gen1-1, ofp.OFPRRFC_STALE)