Guest User

Untitled

a guest
Jan 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
  2. def _packet_in_handler(self, ev):
  3. msg = ev.msg
  4. data = msg.data
  5. datapath = msg.datapath
  6. dpid = datapath.id
  7.  
  8. pkt = packet.Packet(data=data)
  9. if pkt.get_protocol(lldp.lldp):
  10. switch = get_switch(self.switches, dpid)[0]
  11.  
  12. ports = switch.ports
  13. self.northbound.define_ports(dpid, ports)
  14.  
  15. links = get_link(self.switches, dpid)
  16. self.northbound.define_links(dpid, links)
Add Comment
Please, Sign In to add comment