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')
def runTest(self): count = 0 basic_logger.info("Running " + str(self)) #send multipart request message to get meter info basic_logger.info("Sending meter config request") request = message.meter_config_request() request.meter_id = 0 (response, _) = self.controller.transact(request, timeout=2) #print(response.show()) #No meter mod entry,it will return a errer message self.assertEqual(response.header.type, ofp.OFPT_ERROR, 'response is not OFPT_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')
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')