org.onosproject.net.packet.OutboundPacket Java Examples
The following examples show how to use
org.onosproject.net.packet.OutboundPacket.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DhcpRelayManagerTest.java From onos with Apache License 2.0 | 6 votes |
@Test public void testWithRelayAgentConfig() throws DeserializationException { manager.v4Handler .setDefaultDhcpServerConfigs(ImmutableList.of(new MockDhcpServerConfig(RELAY_AGENT_IP))); manager.v4Handler .setIndirectDhcpServerConfigs(ImmutableList.of(new MockDhcpServerConfig(RELAY_AGENT_IP))); packetService.processPacket(new TestDhcpRequestPacketContext(CLIENT2_MAC, CLIENT2_VLAN, CLIENT2_CP, INTERFACE_IP.ipAddress().getIp4Address(), true)); assertAfter(PKT_PROCESSING_MS, () -> assertNotNull(packetService.emittedPacket)); OutboundPacket outPacket = packetService.emittedPacket; byte[] outData = outPacket.data().array(); Ethernet eth = Ethernet.deserializer().deserialize(outData, 0, outData.length); IPv4 ip = (IPv4) eth.getPayload(); UDP udp = (UDP) ip.getPayload(); DHCP dhcp = (DHCP) udp.getPayload(); assertAfter(PKT_PROCESSING_MS, () -> assertEquals(RELAY_AGENT_IP.toInt(), dhcp.getGatewayIPAddress())); }
Example #2
Source File: LinkDiscovery.java From onos with Apache License 2.0 | 6 votes |
/** * Creates packet_out BDDP for specified output port. * * @param portNumber the port * @param portDesc the port description * @return Packet_out message with LLDP data */ private OutboundPacket createOutBoundBddp(Long portNumber, String portDesc) { if (portNumber == null) { return null; } ONOSLLDP lldp = getLinkProbe(portNumber, portDesc); if (lldp == null) { log.warn("Cannot get link probe with portNumber {} and portDesc {} for {} at BDDP packet creation.", portNumber, portDesc, deviceId); return null; } bddpEth.setSourceMACAddress(context.fingerprint()).setPayload(lldp); return new DefaultOutboundPacket(deviceId, builder().setOutput(portNumber(portNumber)).build(), ByteBuffer.wrap(bddpEth.serialize())); }
Example #3
Source File: LinkDiscovery.java From onos with Apache License 2.0 | 6 votes |
/** * Creates packet_out LLDP for specified output port. * * @param portNumber the port * @param portDesc the port description * @return Packet_out message with LLDP data */ private OutboundPacket createOutBoundLldp(Long portNumber, String portDesc) { if (portNumber == null) { return null; } ONOSLLDP lldp = getLinkProbe(portNumber, portDesc); if (lldp == null) { log.warn("Cannot get link probe with portNumber {} and portDesc {} for {} at LLDP packet creation.", portNumber, portDesc, deviceId); return null; } ethPacket.setSourceMACAddress(context.fingerprint()).setPayload(lldp); return new DefaultOutboundPacket(deviceId, builder().setOutput(portNumber(portNumber)).build(), ByteBuffer.wrap(ethPacket.serialize())); }
Example #4
Source File: HostLocationProvider.java From onos with Apache License 2.0 | 6 votes |
private void sendProbe(Host host, IpAddress targetIp) { Ethernet probePacket = null; if (targetIp.isIp4()) { // IPv4: Use ARP probePacket = buildArpRequest(targetIp, host); } else { // IPv6: Use Neighbor Discovery //TODO need to implement ndp probe log.info("Triggering probe on device {} ", host); return; } TrafficTreatment treatment = DefaultTrafficTreatment.builder().setOutput(host.location().port()).build(); OutboundPacket outboundPacket = new DefaultOutboundPacket(host.location().deviceId(), treatment, ByteBuffer.wrap(probePacket.serialize())); packetService.emit(outboundPacket); }
Example #5
Source File: LinkDiscovery.java From onos with Apache License 2.0 | 6 votes |
private void sendProbes(Long portNumber, String portDesc) { if (context.packetService() == null) { return; } log.trace("Sending probes out of {}@{}", portNumber, deviceId); OutboundPacket pkt = createOutBoundLldp(portNumber, portDesc); if (pkt != null) { context.packetService().emit(pkt); } else { log.warn("Cannot send lldp packet due to packet is null {}", deviceId); } if (context.useBddp()) { OutboundPacket bpkt = createOutBoundBddp(portNumber, portDesc); if (bpkt != null) { context.packetService().emit(bpkt); } else { log.warn("Cannot send bddp packet due to packet is null {}", deviceId); } } }
Example #6
Source File: McastForwarding.java From onos with Apache License 2.0 | 6 votes |
/** * Forward the packet to it's multicast destinations. * * @param context The packet context * @param egressList The list of egress ports which the multicast packet is intended for. */ private void forwardPacketToDst(PacketContext context, ArrayList<ConnectPoint> egressList) { // Send the pack out each of the respective egress ports for (ConnectPoint egress : egressList) { TrafficTreatment treatment = DefaultTrafficTreatment.builder() .setOutput(egress.port()).build(); OutboundPacket packet = new DefaultOutboundPacket( egress.deviceId(), treatment, context.inPacket().unparsed()); packetService.emit(packet); } }
Example #7
Source File: DistributedPacketStore.java From onos with Apache License 2.0 | 6 votes |
@Override public void emit(OutboundPacket packet) { NodeId myId = clusterService.getLocalNode().id(); NodeId master = mastershipService.getMasterFor(packet.sendThrough()); if (master == null) { return; } if (myId.equals(master)) { notifyDelegate(new PacketEvent(Type.EMIT, packet)); return; } communicationService.unicast(packet, PACKET_OUT_SUBJECT, SERIALIZER::encode, master) .whenComplete((r, error) -> { if (error != null) { log.warn("Failed to send packet-out to {}", master, error); } }); }
Example #8
Source File: Dhcp6HandlerImpl.java From onos with Apache License 2.0 | 6 votes |
private void forwardPacket(InternalPacket packet) { //send Packetout to dhcp server connectpoint. if (packet.getDestLocation() != null) { TrafficTreatment t = DefaultTrafficTreatment.builder() .setOutput(packet.getDestLocation().port()).build(); OutboundPacket o = new DefaultOutboundPacket( packet.getDestLocation().deviceId(), t, ByteBuffer.wrap(packet.getPacket().serialize())); packetService.emit(o); if (log.isTraceEnabled()) { IPv6 ip6 = (IPv6) packet.getPacket().getPayload(); UDP udp = (UDP) ip6.getPayload(); DHCP6 dhcp6 = (DHCP6) udp.getPayload(); log.trace("Relaying packet to destination {} eth: {} dhcp: {}", packet.getDestLocation(), packet.getPacket(), dhcp6); } } }
Example #9
Source File: Dhcp4HandlerImpl.java From onos with Apache License 2.0 | 6 votes |
/** * Send the response DHCP to the requester host. * * @param thePacket the packet * @param dhcpPayload the DHCP data */ private void sendResponseToClient(InternalPacket thePacket, DHCP dhcpPayload) { checkNotNull(thePacket, "Nothing to send"); checkNotNull(thePacket.getPacket(), "Packet to send must not be empty"); checkNotNull(thePacket.getDestLocation(), "Packet destination not be empty"); Ethernet ethPacket = thePacket.getPacket(); if (directlyConnected(dhcpPayload)) { ethPacket = removeRelayAgentOption(ethPacket); } TrafficTreatment treatment = DefaultTrafficTreatment.builder() .setOutput(thePacket.getDestLocation().port()) .build(); OutboundPacket o = new DefaultOutboundPacket( thePacket.getDestLocation().deviceId(), treatment, ByteBuffer.wrap(ethPacket.serialize())); if (log.isTraceEnabled()) { log.trace("Relaying packet to DHCP client {} via {}", ethPacket, thePacket.getDestLocation()); } packetService.emit(o); }
Example #10
Source File: P4RuntimePacketProvider.java From onos with Apache License 2.0 | 6 votes |
@Override public void send() { if (this.block()) { log.info("Unable to send, packet context is blocked"); return; } DeviceId deviceId = outPacket().sendThrough(); ByteBuffer rawData = outPacket().data(); TrafficTreatment treatment; if (outPacket().treatment() == null) { treatment = (treatmentBuilder() == null) ? emptyTreatment() : treatmentBuilder().build(); } else { treatment = outPacket().treatment(); } OutboundPacket outboundPacket = new DefaultOutboundPacket(deviceId, treatment, rawData); emit(outboundPacket); }
Example #11
Source File: P4RuntimePacketProgrammable.java From onos with Apache License 2.0 | 6 votes |
@Override public void emit(OutboundPacket packet) { if (!this.setupBehaviour("emit()")) { return; } final PiPipelineInterpreter interpreter = getInterpreter(handler()); if (interpreter == null) { // Error logged by getInterpreter(). return; } if (log.isTraceEnabled()) { logPacketOut(packet); } try { interpreter.mapOutboundPacket(packet).forEach( op -> client.packetOut(p4DeviceId, op, pipeconf)); } catch (PiPipelineInterpreter.PiInterpreterException e) { log.error("Unable to translate outbound packet for {} with pipeconf {}: {}", deviceId, pipeconf.id(), e.getMessage()); } }
Example #12
Source File: DistributedVirtualPacketStore.java From onos with Apache License 2.0 | 6 votes |
@Override public void emit(NetworkId networkId, OutboundPacket packet) { NodeId myId = clusterService.getLocalNode().id(); // TODO revive this when there is MastershipService support for virtual devices // NodeId master = mastershipService.getMasterFor(packet.sendThrough()); // // if (master == null) { // log.warn("No master found for {}", packet.sendThrough()); // return; // } // // log.debug("master {} found for {}", myId, packet.sendThrough()); // if (myId.equals(master)) { // notifyDelegate(networkId, new PacketEvent(EMIT, packet)); // return; // } // // communicationService.unicast(packet, PACKET_OUT_SUBJECT, SERIALIZER::encode, master) // .whenComplete((r, error) -> { // if (error != null) { // log.warn("Failed to send packet-out to {}", master, error); // } // }); }
Example #13
Source File: DhcpRelayManager.java From onos with Apache License 2.0 | 5 votes |
/** * Processes the ARP Payload and initiates a reply to the client. * * @param context the packet context * @param packet the ethernet payload * @param replyMac mac address to be replied */ private void processArpPacket(PacketContext context, Ethernet packet, MacAddress replyMac) { ARP arpPacket = (ARP) packet.getPayload(); ARP arpReply = arpPacket.duplicate(); arpReply.setOpCode(ARP.OP_REPLY); arpReply.setTargetProtocolAddress(arpPacket.getSenderProtocolAddress()); arpReply.setTargetHardwareAddress(arpPacket.getSenderHardwareAddress()); arpReply.setSenderProtocolAddress(arpPacket.getTargetProtocolAddress()); arpReply.setSenderHardwareAddress(replyMac.toBytes()); // Ethernet Frame. Ethernet ethReply = new Ethernet(); ethReply.setSourceMACAddress(replyMac.toBytes()); ethReply.setDestinationMACAddress(packet.getSourceMAC()); ethReply.setEtherType(Ethernet.TYPE_ARP); ethReply.setVlanID(packet.getVlanID()); ethReply.setPayload(arpReply); ConnectPoint targetPort = context.inPacket().receivedFrom(); TrafficTreatment t = DefaultTrafficTreatment.builder() .setOutput(targetPort.port()).build(); OutboundPacket o = new DefaultOutboundPacket( targetPort.deviceId(), t, ByteBuffer.wrap(ethReply.serialize())); if (log.isTraceEnabled()) { log.trace("Relaying ARP packet {} to {}", packet, targetPort); } packetService.emit(o); }
Example #14
Source File: DhcpRelayManager.java From onos with Apache License 2.0 | 5 votes |
private void sendHostRelearnProbeToConnectPoint(Ethernet nsPacket, ConnectPoint connectPoint) { TrafficTreatment treatment = DefaultTrafficTreatment.builder().setOutput(connectPoint.port()).build(); OutboundPacket outboundPacket = new DefaultOutboundPacket(connectPoint.deviceId(), treatment, ByteBuffer.wrap(nsPacket.serialize())); int counter = 0; try { while (counter < dhcpHostRelearnProbeCount) { packetService.emit(outboundPacket); counter++; Thread.sleep(dhcpHostRelearnProbeInterval); } } catch (Exception e) { log.error("Exception while emmiting packet {}", e.getMessage(), e); } }
Example #15
Source File: SimpleFabricRouting.java From onos with Apache License 2.0 | 5 votes |
/** * Emits the specified packet onto the network. */ private void forwardPacketToDstIp(PacketContext context, IpAddress nextHopIp, MacAddress srcMac, boolean updateMac) { Set<Host> hosts = hostService.getHostsByIp(nextHopIp); Host dstHost; if (!hosts.isEmpty()) { dstHost = hosts.iterator().next(); } else { // NOTE: hostService.requestMac(nextHopIp); NOT IMPLEMENTED in ONOS HostManager.java; do it myself log.warn("forward packet nextHopIp host_mac unknown: nextHopIp={}", nextHopIp); hostService.startMonitoringIp(nextHopIp); simpleFabric.requestMac(nextHopIp); // CONSIDER: make flood on all port of the dstHost's DefaultFabricNetwork return; } TrafficTreatment treatment = DefaultTrafficTreatment.builder() .setOutput(dstHost.location().port()).build(); OutboundPacket outPacket; if (updateMac) { // NOTE: eth address update by treatment is NOT applied, so update mac myself outPacket = new DefaultOutboundPacket(dstHost.location().deviceId(), treatment, ByteBuffer.wrap(context.inPacket().parsed() .setSourceMACAddress(srcMac) .setDestinationMACAddress(dstHost.mac()).serialize())); } else { outPacket = new DefaultOutboundPacket(dstHost.location().deviceId(), treatment, context.inPacket().unparsed()); } // be quiet on normal situation log.info("forward packet: nextHopIP={} srcCP={} dstCP={}", nextHopIp, context.inPacket().receivedFrom(), dstHost.location()); packetService.emit(outPacket); }
Example #16
Source File: DhcpRelayManagerTest.java From onos with Apache License 2.0 | 5 votes |
@Test public void testArpRequest() throws Exception { packetService.processPacket(new TestArpRequestPacketContext(CLIENT_INTERFACE)); assertAfter(PKT_PROCESSING_MS, () -> assertNotNull(packetService.emittedPacket)); OutboundPacket outboundPacket = packetService.emittedPacket; byte[] outPacketData = outboundPacket.data().array(); Ethernet eth = Ethernet.deserializer().deserialize(outPacketData, 0, outPacketData.length); assertAfter(PKT_PROCESSING_MS, () -> assertEquals(eth.getEtherType(), Ethernet.TYPE_ARP)); ARP arp = (ARP) eth.getPayload(); assertAfter(PKT_PROCESSING_MS, () -> assertArrayEquals(arp.getSenderHardwareAddress(), CLIENT_INTERFACE.mac().toBytes())); }
Example #17
Source File: OpenstackRoutingSnatIcmpHandler.java From onos with Apache License 2.0 | 5 votes |
private void sendRequestForExternal(IPv4 ipPacket, DeviceId srcDevice, IpAddress srcNatIp, ExternalPeerRouter externalPeerRouter) { ICMP icmpReq = (ICMP) ipPacket.getPayload(); icmpReq.resetChecksum(); ipPacket.setSourceAddress(srcNatIp.getIp4Address().toInt()).resetChecksum(); ipPacket.setPayload(icmpReq); Ethernet icmpRequestEth = new Ethernet(); icmpRequestEth.setEtherType(Ethernet.TYPE_IPV4) .setSourceMACAddress(DEFAULT_GATEWAY_MAC) .setDestinationMACAddress(externalPeerRouter.macAddress()); if (!externalPeerRouter.vlanId().equals(VlanId.NONE)) { icmpRequestEth.setVlanID(externalPeerRouter.vlanId().toShort()); } icmpRequestEth.setPayload(ipPacket); OpenstackNode osNode = osNodeService.node(srcDevice); if (osNode == null) { final String error = String.format("Cannot find openstack node for %s", srcDevice); throw new IllegalStateException(error); } TrafficTreatment treatment = DefaultTrafficTreatment.builder() .setOutput(osNode.uplinkPortNum()) .build(); OutboundPacket packet = new DefaultOutboundPacket( srcDevice, treatment, ByteBuffer.wrap(icmpRequestEth.serialize())); packetService.emit(packet); }
Example #18
Source File: OpenstackRoutingSnatIcmpHandler.java From onos with Apache License 2.0 | 5 votes |
private void sendReply(Ethernet icmpReply, InstancePort instPort) { TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder() .setOutput(instPort.portNumber()); String netId = instPort.networkId(); String segId = osNetworkService.segmentId(netId); switch (osNetworkService.networkType(netId)) { case VXLAN: case GRE: case GENEVE: tBuilder.setTunnelId(Long.valueOf(segId)); break; case VLAN: tBuilder.setVlanId(VlanId.vlanId(segId)); break; default: break; } OutboundPacket packet = new DefaultOutboundPacket( instPort.deviceId(), tBuilder.build(), ByteBuffer.wrap(icmpReply.serialize())); packetService.emit(packet); }
Example #19
Source File: PipelineInterpreterImpl.java From onos with Apache License 2.0 | 5 votes |
@Override public Collection<PiPacketOperation> mapOutboundPacket(OutboundPacket packet) throws PiInterpreterException { TrafficTreatment treatment = packet.treatment(); // We support only packet-out with OUTPUT instructions. if (treatment.allInstructions().size() != 1 && treatment.allInstructions().get(0).type() != OUTPUT) { throw new PiInterpreterException( "Treatment not supported: " + treatment.toString()); } Instruction instruction = treatment.allInstructions().get(0); PortNumber port = ((OutputInstruction) instruction).port(); List<PiPacketOperation> piPacketOps = Lists.newArrayList(); if (!port.isLogical()) { piPacketOps.add(createPiPacketOp(packet.data(), port.toLong())); } else if (port.equals(FLOOD)) { // Since mytunnel.p4 does not support flooding, we create a packet // operation for each switch port. DeviceService deviceService = handler().get(DeviceService.class); DeviceId deviceId = packet.sendThrough(); for (Port p : deviceService.getPorts(deviceId)) { piPacketOps.add(createPiPacketOp(packet.data(), p.number().toLong())); } } else { throw new PiInterpreterException(format( "Output on logical port '%s' not supported", port)); } return piPacketOps; }
Example #20
Source File: SfcManager.java From onos with Apache License 2.0 | 5 votes |
/** * Send packet back to classifier. * * @param context packet context */ private void sendPacket(PacketContext context) { ConnectPoint sourcePoint = context.inPacket().receivedFrom(); TrafficTreatment treatment = DefaultTrafficTreatment.builder().setOutput(PortNumber.TABLE).build(); OutboundPacket packet = new DefaultOutboundPacket(sourcePoint.deviceId(), treatment, context.inPacket() .unparsed()); packetService.emit(packet); log.trace("Sending packet: {}", packet); }
Example #21
Source File: OpenstackSwitchingArpHandlerTest.java From onos with Apache License 2.0 | 5 votes |
@Override public void emit(OutboundPacket packet) { try { Ethernet eth = Ethernet.deserializer().deserialize(packet.data().array(), 0, packet.data().array().length); validatePacket(eth); } catch (Exception e) { fail(e.getMessage()); } }
Example #22
Source File: SimpleFabricManager.java From onos with Apache License 2.0 | 5 votes |
@Override public boolean requestMac(IpAddress ip) { FabricSubnet fabricSubnet = fabricSubnet(ip); if (fabricSubnet == null) { log.warn("simple fabric request mac failed for unknown fabricSubnet: {}", ip); return false; } FabricNetwork fabricNetwork = fabricNetwork(fabricSubnet.networkName()); if (fabricNetwork == null) { log.warn("simple fabric request mac failed for unknown fabricNetwork name {}: {}", fabricSubnet.networkName(), ip); return false; } log.debug("simple fabric send request mac fabricNetwork {}: {}", fabricNetwork.name(), ip); for (Interface iface : fabricNetwork.interfaces()) { Ethernet neighbourReq; if (ip.isIp4()) { neighbourReq = ARP.buildArpRequest(fabricSubnet.gatewayMac().toBytes(), fabricSubnet.gatewayIp().toOctets(), ip.toOctets(), iface.vlan().toShort()); } else { byte[] soliciteIp = IPv6.getSolicitNodeAddress(ip.toOctets()); neighbourReq = NeighborSolicitation.buildNdpSolicit( ip.getIp6Address(), fabricSubnet.gatewayIp().getIp6Address(), Ip6Address.valueOf(soliciteIp), MacAddress.valueOf(fabricSubnet.gatewayMac().toBytes()), MacAddress.valueOf(IPv6.getMCastMacAddress(soliciteIp)), iface.vlan()); } TrafficTreatment treatment = DefaultTrafficTreatment.builder() .setOutput(iface.connectPoint().port()).build(); OutboundPacket packet = new DefaultOutboundPacket(iface.connectPoint().deviceId(), treatment, ByteBuffer.wrap(neighbourReq.serialize())); packetService.emit(packet); } return true; }
Example #23
Source File: OpenstackSwitchingDhcpHandlerTest.java From onos with Apache License 2.0 | 5 votes |
@Override public void emit(OutboundPacket packet) { try { Ethernet eth = Ethernet.deserializer().deserialize(packet.data().array(), 0, packet.data().array().length); validatePacket(eth); } catch (Exception e) { fail(e.getMessage()); } }
Example #24
Source File: OpenstackRoutingSnatIcmpHandlerTest.java From onos with Apache License 2.0 | 5 votes |
@Override public void emit(OutboundPacket packet) { try { Ethernet eth = Ethernet.deserializer().deserialize(packet.data().array(), 0, packet.data().array().length); validatePacket(eth); } catch (Exception e) { fail(e.getMessage()); } }
Example #25
Source File: SdnIpReactiveRouting.java From onos with Apache License 2.0 | 5 votes |
/** * Emits the specified packet onto the network. * * @param context the packet context * @param connectPoint the connect point where the packet should be * sent out */ private void forwardPacketToDst(PacketContext context, ConnectPoint connectPoint) { TrafficTreatment treatment = DefaultTrafficTreatment.builder() .setOutput(connectPoint.port()).build(); OutboundPacket packet = new DefaultOutboundPacket(connectPoint.deviceId(), treatment, context.inPacket().unparsed()); packetService.emit(packet); log.trace("sending packet: {}", packet); }
Example #26
Source File: PacketManagerTest.java From onos with Apache License 2.0 | 5 votes |
/** * Tests the correct usage of fallback driver provider for packets. */ @Test public void packetProviderfallbackBasics() { OutboundPacket packet = new DefaultOutboundPacket(FOO_DID, DefaultTrafficTreatment.emptyTreatment(), ByteBuffer.allocate(5)); mgr.emit(packet); assertEquals("Packet not emitted correctly", packet, emittedPacket); }
Example #27
Source File: VirtualNetworkPacketManager.java From onos with Apache License 2.0 | 5 votes |
private void localEmit(NetworkId networkId, OutboundPacket packet) { Device device = deviceService.getDevice(packet.sendThrough()); if (device == null) { return; } VirtualPacketProvider packetProvider = providerService.provider(); if (packetProvider != null) { packetProvider.emit(networkId, packet); } }
Example #28
Source File: DefaultVirtualPacketProviderTest.java From onos with Apache License 2.0 | 5 votes |
/** Test the virtual outbound packet is delivered to a proper (physical) * device. */ @Test public void devirtualizePacket() { TrafficTreatment tr = DefaultTrafficTreatment.builder() .setOutput(VPORT_NUM1).build(); ByteBuffer data = ByteBuffer.wrap("abc".getBytes()); OutboundPacket vOutPacket = new DefaultOutboundPacket(VDID, tr, data); virtualProvider.emit(VNET_ID, vOutPacket); assertEquals("The count should be 1", 1, testPacketService.getRequestedPacketCount()); OutboundPacket pOutPacket = testPacketService.getRequestedPacket(0); assertEquals("The packet should be requested on DEV1", DID1, pOutPacket.sendThrough()); PortNumber outPort = pOutPacket.treatment() .allInstructions() .stream() .filter(i -> i.type() == Instruction.Type.OUTPUT) .map(i -> (Instructions.OutputInstruction) i) .map(i -> i.port()) .findFirst().get(); assertEquals("The packet should be out at PORT1 of DEV1", PORT_NUM1, outPort); }
Example #29
Source File: DefaultVirtualPacketContext.java From onos with Apache License 2.0 | 5 votes |
/** * Creates a new packet context. * * @param time creation time * @param inPkt inbound packet * @param outPkt outbound packet * @param block whether the context is blocked or not * @param networkId virtual network ID where this context is handled * @param dvpp pointer to default virtual packet provider */ protected DefaultVirtualPacketContext(long time, InboundPacket inPkt, OutboundPacket outPkt, boolean block, NetworkId networkId, DefaultVirtualPacketProvider dvpp) { super(time, inPkt, outPkt, block); this.networkId = networkId; this.dvpp = dvpp; }
Example #30
Source File: VirtualNetworkPacketManagerTest.java From onos with Apache License 2.0 | 5 votes |
/** * Tests the correct usage of emit() for a outbound packet. */ @Test public void emitTest() { OutboundPacket packet = new DefaultOutboundPacket(VDID1, DefaultTrafficTreatment.emptyTreatment(), ByteBuffer.allocate(5)); packetManager1.emit(packet); assertEquals("Packet not emitted correctly", packet, emittedPacket); }