def handle_packet(self, incoming_intf, packet): """Forwards to the user responsible for handling packets for this virtual node""" if self.conn is not None: logging.debug('%s got packet on %s - forwarding to VNS client: %s' % (self.di(), incoming_intf.name, pktstr(packet))) self.topo.stats.note_pkt_to_client(len(packet)) self.conn.send(VNSPacket(incoming_intf.name, packet))
def _handle_SRPacketIn(self, event): #log.debug("SRServerListener catch SRPacketIn event, port=%d, pkt=%r" % (event.port, event.pkt)) try: intfname = self.port_to_intfname[event.port] except KeyError: #log.debug("Couldn't find interface for portnumber %s" % event.port) return self.broadcast(VNSPacket(intfname, event.pkt))
def _handle_SRPacketIn(self, event): log.debug("SRServerListener catch SRPacketIn event, port=%d, pkt=%r, vhost=%s" % (event.port, event.pkt, event.vhost)) try: intfname = self.port_to_intfname[event.vhost][event.port] except KeyError: log.debug("Couldn't find interface for portnumber %s" % event.port) return #print "srpacketin, packet=%s" % ethernet(event.pkt) self.send_to_vhost(VNSPacket(intfname, event.pkt), event.vhost)
def _handle_SRPacketIn(self, event): #log.debug("SRServerListener catch SRPacketIn(port=%d, pkt=%r)" % (event.port, event.pkt)) if (self.swid != event.swid): return try: intfname = self.port_to_intfname[event.port] except KeyError: log.debug("Couldn't find interface for portnumber %s" % event.port) return print "srpacketin, packet=%s" % ethernet(event.pkt) self.broadcast(VNSPacket(intfname, event.pkt))
def handle_VNetPacketIn(self, event): try: intfname = self.port_to_intfname[event.port] except KeyError: log.debug("Couldn't find interface for portnumber %s" % event.port) return log.debug("Packet in %s.%s: %s" % (self.swid, intfname, ethernet(event.pkt))) if (self.conn is None): log.debug("VNet device %s is not connected" % (self.swid)) return self.conn.send(VNSPacket(intfname, event.pkt))
def _handle_SRPacketIn(self, event): log.debug("SRServerListener catch SRPacketIn event, port=%d, pkt=%r" % (event.port, event.pkt)) try: intfname = self.port_to_intfname[event.port] except KeyError: log.debug("Couldn't find interface for portnumber %s" % event.port) return pkt = ethernet(event.pkt) log.info("srpacketin, packet=%s" % pkt) if pkt.type == pkt.IP_TYPE: log.info('Caught SR In IP Packet: %s => %s' % (pkt.next.srcip, pkt.next.dstip)) if pkt.next.srcip == '192.168.30.2' and pkt.next.dstip == '192.168.30.254': pkt.next.dstip = IPAddr('192.168.10.1') log.info('Rewritten In packet : %s => %s' % (pkt.next.srcip, pkt.next.dstip)) event.pkt = pkt.pack() self.broadcast(VNSPacket(intfname, event.pkt))