Dear sir, I'm using ryu to generate LLDP packets and send them out of all switch ports using this code:
> def send_lldp(self, datapath): > ports = self.dpset.get_ports(datapath.id) > for port in ports: > pkt = packet.Packet() > pkt.add_protocol(ethernet.ethernet( > ethertype=ethernet.ether.ETH_TYPE_LLDP, > dst="01:80:C2:00:00:02", > src=port.hw_addr > )) > pkt.add_protocol(lldp.lldp( > [ > > lldp.ChassisID(chassis_id=dpid_to_str(datapath.id).encode(), subtype=lldp.ChassisID.SUB_CHASSIS_COMPONENT), > lldp.PortID(port_id=port.name, subtype=lldp.PortID.SUB_INTERFACE_NAME), > ] > )) > try: > self._send_packet(datapath, port.port_no, pkt) > except Exception as e: > print(str(e)) I've added a rule to forward packets to the controller in case of LLDP match: > parser.OFPMatch( > eth_type=ethernet.ether.ETH_TYPE_LLDP > ) but when the packets are received by the controller as PacketIn messages I'm unable to get LLDP headers. this is the code I'm using for PacketIn: > @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER) > def _packet_in_handler(self, ev): > msg = ev.msg > datapath = msg.datapath > port = msg.match['in_port'] > pkt = packet.Packet(msg.data) > self.logger.info("packet-in %s" % (pkt,)) > pkt_ethernet = pkt.get_protocol(ethernet.ethernet) > if not pkt_ethernet: > return > pkt_lldp = pkt.get_protocol(lldp.lldp) > if pkt_lldp: > self._handle_lldp(datapath, port, pkt_ethernet, pkt_lldp) pkt_lldp is None and the value of pkt.protocols is: > [ethernet(dst='01:80:c2:00:00:02',ethertype=35020,src='d2:7d:8f:dd:c8:bd'), b'\x02\x11\x010000ba8f9ab84c4c\x04\x07\x05p1-sw2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'] Best Regards, Maged
_______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel