又遇到一个问题,使用OFPMatch匹配的某个数据包,但是怎么Drop掉?又不会了,翻到了下面的代码
参考网址:http://stackoverflow.com/questions/41023354/ryu-controller-drop-packet
def dropEthType(self, match_eth_type = 0x0800): parser = self.parser proto = self.proto match = parser.OFPMatch(eth_type = match_eth_type) instruction = [ parser.OFPInstructionActions(proto.OFPIT_CLEAR_ACTIONS, []) ] msg = parser.OFPFlowMod(self.datapath, table_id = OFDPA_FLOW_TABLE_ID_ACL_POLICY, priority = 1, command = proto.OFPFC_ADD, match = match, instructions = instruction ) self._log("dropEthType : %s" % str(msg)) reply = api.send_msg(self.ryuapp, msg) if reply: raise Exception
时间: 2024-10-11 10:19:29