Esempio n. 1
0
    def runTest(self):
        count = 0
        basic_logger.info("Running " + str(self))
        #clear the environment
        msg = message.meter_mod()
        msg.meter_id = ofp.OFPM_ALL
        msg.command = ofp.OFPMC_DELETE
        self.controller.message_send(msg)
        metermoddrop = message.meter_mod_drop()
        metermoddrop.command = ofp.OFPMC_ADD
        metermoddrop.flags = ofp.OFPMF_KBPS+14
        rv = self.controller.message_send(metermoddrop)
        self.assertTrue(rv == 0, "Error sending meter mod")

        #print(metermoddrop.show())

        (response, raw) = self.controller.poll(ofp.OFPT_ERROR, 2)
        #print(response.show())
        self.assertTrue(response is not None, 'No error message received')
        self.assertEqual(ofp.OFPET_METER_MOD_FAILED, response.type,
                       'Error message type mismatch: ' +
                       str(ofp.OFPET_METER_MOD_FAILED,) + " != " +
                       str(response.type))
        self.assertEqual(ofp.OFPMMFC_BAD_FLAGS, response.code,
                       'Error message code mismatch: ' +
                       str(ofp.OFPMMFC_BAD_FLAGS) + " != " +
                       str(response.code))
Esempio n. 2
0
    def runTest(self):
        count = 0
        basic_logger.info("Running " + str(self))
        metermoddrop = message.meter_mod_drop()
        metermoddrop.command = ofp.OFPMC_ADD
        metermoddrop.flags = ofp.OFPMF_KBPS
        #response, _ = self.controller.transact(metermoddrop)
        rv = self.controller.message_send(metermoddrop)
        self.assertTrue(rv == 0, "Error sending meter mod add")

        #send meter mod del message
        metermoddrop.command = ofp.OFPMC_DELETE
        rv = self.controller.message_send(metermoddrop)
        self.assertTrue(rv == 0, "Error sending meter mod del")

        #send multipart request message to get meter info
        basic_logger.info("Sending meter config request")
        request = message.meter_config_request()
        (response, _) = self.controller.transact(request, timeout=2)
        #print(response.show())

        #no meter mod entry,it will return a reply message
        self.assertEqual(response.header.type, ofp.OFPT_ERROR,
                         'response is not ERROR')
        self.assertEqual(request.header.xid, response.header.xid,
                         'response xid != request xid')
        self.assertEqual(response.type, ofp.OFPET_METER_MOD_FAILED,
                         'response.type != expect type')        
        self.assertEqual(response.code, ofp.OFPMMFC_UNKNOWN_METER,
                         'response code != expect code')   
Esempio n. 3
0
    def runTest(self):
        count = 0
        basic_logger.info("Running " + str(self))
        #clear the environment
        msg = message.meter_mod()
        msg.meter_id = ofp.OFPM_ALL
        msg.command = ofp.OFPMC_DELETE
        self.controller.message_send(msg)
        metermoddrop = message.meter_mod_drop()
        metermoddrop.command = ofp.OFPMC_ADD
        metermoddrop.flags = ofp.OFPMF_KBPS + 14
        rv = self.controller.message_send(metermoddrop)
        self.assertTrue(rv == 0, "Error sending meter mod")

        #print(metermoddrop.show())

        (response, raw) = self.controller.poll(ofp.OFPT_ERROR, 2)
        #print(response.show())
        self.assertTrue(response is not None, 'No error message received')
        self.assertEqual(
            ofp.OFPET_METER_MOD_FAILED, response.type,
            'Error message type mismatch: ' +
            str(ofp.OFPET_METER_MOD_FAILED, ) + " != " + str(response.type))
        self.assertEqual(
            ofp.OFPMMFC_BAD_FLAGS, response.code,
            'Error message code mismatch: ' + str(ofp.OFPMMFC_BAD_FLAGS) +
            " != " + str(response.code))
Esempio n. 4
0
    def runTest(self):
        count = 0
        basic_logger.info("Running " + str(self))
        metermoddrop = message.meter_mod_drop()
        metermoddrop.command = ofp.OFPMC_ADD
        metermoddrop.flags = ofp.OFPMF_KBPS
        #response, _ = self.controller.transact(metermoddrop)
        rv = self.controller.message_send(metermoddrop)
        self.assertTrue(rv == 0, "Error sending meter mod add")

        #send meter mod del message
        metermoddrop.command = ofp.OFPMC_DELETE
        rv = self.controller.message_send(metermoddrop)
        self.assertTrue(rv == 0, "Error sending meter mod del")

        #send multipart request message to get meter info
        basic_logger.info("Sending meter config request")
        request = message.meter_config_request()
        (response, _) = self.controller.transact(request, timeout=2)
        #print(response.show())

        #no meter mod entry,it will return a reply message
        self.assertEqual(response.header.type, ofp.OFPT_ERROR,
                         'response is not ERROR')
        self.assertEqual(request.header.xid, response.header.xid,
                         'response xid != request xid')
        self.assertEqual(response.type, ofp.OFPET_METER_MOD_FAILED,
                         'response.type != expect type')
        self.assertEqual(response.code, ofp.OFPMMFC_UNKNOWN_METER,
                         'response code != expect code')
Esempio n. 5
0
    def runTest(self):
        count = 0
        basic_logger.info("Running " + str(self))
        metermoddrop = message.meter_mod_drop()
        metermoddrop.command = ofp.OFPMC_ADD
        metermoddrop.flags = ofp.OFPMF_KBPS
        #response, _ = self.controller.transact(metermoddrop)
        rv = self.controller.message_send(metermoddrop)
        self.assertTrue(rv == 0, "Error sending meter mod")

        #send multipart request message to get meter info
        basic_logger.info("Sending meter config request")
        request = message.meter_config_request()
        (response, _) = self.controller.transact(request, timeout=2)
        #print(response.show())

        #meter mod entry,it will return a reply message
        self.assertEqual(response.header.type, ofp.OFPT_MULTIPART_REPLY,
                         'response is not MULTIPART_REPLY')
        self.assertEqual(request.header.xid, response.header.xid,
                         'response xid != request xid')    
Esempio n. 6
0
    def runTest(self):
        count = 0
        basic_logger.info("Running " + str(self))
        metermoddrop = message.meter_mod_drop()
        metermoddrop.command = ofp.OFPMC_ADD
        metermoddrop.flags = ofp.OFPMF_KBPS
        #response, _ = self.controller.transact(metermoddrop)
        rv = self.controller.message_send(metermoddrop)
        self.assertTrue(rv == 0, "Error sending meter mod")

        #send multipart request message to get meter info
        basic_logger.info("Sending meter config request")
        request = message.meter_config_request()
        (response, _) = self.controller.transact(request, timeout=2)
        #print(response.show())

        #meter mod entry,it will return a reply message
        self.assertEqual(response.header.type, ofp.OFPT_MULTIPART_REPLY,
                         'response is not MULTIPART_REPLY')
        self.assertEqual(request.header.xid, response.header.xid,
                         'response xid != request xid')