Search in sources :

Example 51 with DefaultOutboundPacket

use of org.onosproject.net.packet.DefaultOutboundPacket in project aaa by opencord.

the class PortBasedRadiusCommunicator method sendFromRadiusServerPort.

/**
 * Sends packet to the RADIUS server using one of the switch ports.
 *
 * @param packet Ethernet packet to be sent
 */
private void sendFromRadiusServerPort(Ethernet packet) {
    if (radiusServerConnectPoint != null) {
        log.trace("AAA Manager sending Ethernet packet = {}", packet);
        TrafficTreatment t = DefaultTrafficTreatment.builder().setOutput(radiusServerConnectPoint.port()).build();
        OutboundPacket o = new DefaultOutboundPacket(radiusServerConnectPoint.deviceId(), t, ByteBuffer.wrap(packet.serialize()));
        packetService.emit(o);
    } else {
        log.error("Unable to send RADIUS packet, connectPoint is null");
    }
}
Also used : DefaultOutboundPacket(org.onosproject.net.packet.DefaultOutboundPacket) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) OutboundPacket(org.onosproject.net.packet.OutboundPacket) DefaultOutboundPacket(org.onosproject.net.packet.DefaultOutboundPacket)

Example 52 with DefaultOutboundPacket

use of org.onosproject.net.packet.DefaultOutboundPacket in project fabric-tna by stratum.

the class FabricInterpreterTest method testMapOutboundPacketWithForwarding.

@Test
public void testMapOutboundPacketWithForwarding() throws PiPipelineInterpreter.PiInterpreterException, ImmutableByteSequence.ByteSequenceTrimException {
    PortNumber outputPort = PortNumber.TABLE;
    TrafficTreatment outputTreatment = DefaultTrafficTreatment.builder().setOutput(outputPort).build();
    ByteBuffer data = ByteBuffer.allocate(64);
    OutboundPacket outPkt = new DefaultOutboundPacket(DEVICE_ID, outputTreatment, data);
    Collection<PiPacketOperation> result = interpreter.mapOutboundPacket(outPkt);
    assertEquals(result.size(), 1);
    ImmutableList.Builder<PiPacketMetadata> builder = ImmutableList.builder();
    builder.add(PiPacketMetadata.builder().withId(P4InfoConstants.PAD0).withValue(ImmutableByteSequence.copyFrom(0).fit(P4InfoConstants.PAD0_BITWIDTH)).build());
    builder.add(PiPacketMetadata.builder().withId(P4InfoConstants.EGRESS_PORT).withValue(ImmutableByteSequence.copyFrom(0).fit(P4InfoConstants.EGRESS_PORT_BITWIDTH)).build());
    builder.add(PiPacketMetadata.builder().withId(P4InfoConstants.PAD1).withValue(ImmutableByteSequence.copyFrom(0).fit(P4InfoConstants.PAD1_BITWIDTH)).build());
    builder.add(PiPacketMetadata.builder().withId(P4InfoConstants.QUEUE_ID).withValue(ImmutableByteSequence.copyFrom(SYSTEM_QUEUE_ID).fit(P4InfoConstants.QUEUE_ID_BITWIDTH)).build());
    builder.add(PiPacketMetadata.builder().withId(P4InfoConstants.PAD2).withValue(ImmutableByteSequence.copyFrom(0).fit(P4InfoConstants.PAD2_BITWIDTH)).build());
    builder.add(PiPacketMetadata.builder().withId(P4InfoConstants.CPU_LOOPBACK_MODE).withValue(ImmutableByteSequence.copyFrom(0).fit(P4InfoConstants.CPU_LOOPBACK_MODE_BITWIDTH)).build());
    builder.add(PiPacketMetadata.builder().withId(P4InfoConstants.DO_FORWARDING).withValue(ImmutableByteSequence.copyFrom(1).fit(P4InfoConstants.DO_FORWARDING_BITWIDTH)).build());
    builder.add(PiPacketMetadata.builder().withId(P4InfoConstants.PAD3).withValue(ImmutableByteSequence.copyFrom(0).fit(P4InfoConstants.PAD3_BITWIDTH)).build());
    builder.add(PiPacketMetadata.builder().withId(P4InfoConstants.PAD4).withValue(ImmutableByteSequence.copyFrom(0).fit(P4InfoConstants.PAD4_BITWIDTH)).build());
    builder.add(PiPacketMetadata.builder().withId(P4InfoConstants.ETHER_TYPE).withValue(ImmutableByteSequence.copyFrom(0xBF01).fit(P4InfoConstants.ETHER_TYPE_BITWIDTH)).build());
    PiPacketOperation expectedPktOp = PiPacketOperation.builder().withType(PiPacketOperationType.PACKET_OUT).withData(ImmutableByteSequence.copyFrom(data)).withMetadatas(builder.build()).build();
    assertEquals(expectedPktOp, result.iterator().next());
}
Also used : PiPacketMetadata(org.onosproject.net.pi.runtime.PiPacketMetadata) ImmutableList(com.google.common.collect.ImmutableList) PiPacketOperation(org.onosproject.net.pi.runtime.PiPacketOperation) DefaultOutboundPacket(org.onosproject.net.packet.DefaultOutboundPacket) PortNumber(org.onosproject.net.PortNumber) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) ByteBuffer(java.nio.ByteBuffer) OutboundPacket(org.onosproject.net.packet.OutboundPacket) DefaultOutboundPacket(org.onosproject.net.packet.DefaultOutboundPacket) Test(org.junit.Test)

Example 53 with DefaultOutboundPacket

use of org.onosproject.net.packet.DefaultOutboundPacket in project fabric-tna by stratum.

the class FabricUpfProgrammable method sendPacketOut.

@Override
public void sendPacketOut(ByteBuffer data) {
    if (!setupBehaviour("sendPacketOut()")) {
        return;
    }
    final OutboundPacket pkt = new DefaultOutboundPacket(deviceId, // Use TABLE logical port to have pkt routed via pipeline tables.
    DefaultTrafficTreatment.builder().setOutput(PortNumber.TABLE).build(), data);
    packetService.emit(pkt);
}
Also used : DefaultOutboundPacket(org.onosproject.net.packet.DefaultOutboundPacket) OutboundPacket(org.onosproject.net.packet.OutboundPacket) DefaultOutboundPacket(org.onosproject.net.packet.DefaultOutboundPacket)

Aggregations

DefaultOutboundPacket (org.onosproject.net.packet.DefaultOutboundPacket)53 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)42 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)41 OutboundPacket (org.onosproject.net.packet.OutboundPacket)32 Ethernet (org.onlab.packet.Ethernet)23 ByteBuffer (java.nio.ByteBuffer)12 ConnectPoint (org.onosproject.net.ConnectPoint)12 PortNumber (org.onosproject.net.PortNumber)11 IpAddress (org.onlab.packet.IpAddress)9 Test (org.junit.Test)8 DeviceId (org.onosproject.net.DeviceId)8 InboundPacket (org.onosproject.net.packet.InboundPacket)7 PacketContext (org.onosproject.net.packet.PacketContext)7 Set (java.util.Set)6 MacAddress (org.onlab.packet.MacAddress)6 ApplicationId (org.onosproject.core.ApplicationId)6 PacketProcessor (org.onosproject.net.packet.PacketProcessor)6 DefaultInboundPacket (org.onosproject.net.packet.DefaultInboundPacket)5 PacketService (org.onosproject.net.packet.PacketService)5 PiPacketOperation (org.onosproject.net.pi.runtime.PiPacketOperation)5