def send_lldp(self, sw, port): """Send LLDP to switch and port @param sw datapath id of switch @param port phy port """ self.__po.xid = ofutil.get_xid() self.__po.actions[0].port = port.port_no switch = self.conn.get_conn(sw) if (switch != None): switch.send(self.__po.pack()+\ self.form_eth_lldp(sw, port)) output.vdbg("Sending LLDP to %x:" % sw +str(port.port_no), self.__class__.__name__)
def get_flow_stats_request(self, out_port=pyof.OFPP_NONE, table_id=0xFF): """Function to return flow_stats_request for a matching flow @return (ofp_stats_request, ofp_flow_stats_request) """ sr = pyof.ofp_stats_request() sr.header.xid = ofutil.get_xid() sr.type = pyof.OFPST_FLOW fsr = pyof.ofp_flow_stats_request() fsr.match = self.match fsr.table_id = table_id fsr.out_port = out_port return (sr, fsr)
def get_flow_mod(self, command=pyof.OFPFC_ADD, cookie=0): """Function to return flow_entry in terms of flow mod. @return ofp_flow_mod """ fm = pyof.ofp_flow_mod() fm.match = self.match fm.cookie = cookie fm.command = command fm.idle_timeout = self.idle_timeout fm.hard_timeout = self.hard_timeout fm.priority = self.priority fm.buffer_id = self.buffer_id fm.out_port = self.out_port fm.flags = self.flags fm.actions = self.actions[:] fm.header.xid = ofutil.get_xid() return fm