Search in sources :

Example 46 with DefaultOutboundPacket

use of org.onosproject.net.packet.DefaultOutboundPacket in project onos by opennetworkinglab.

the class Dhcp4HandlerImpl method forwardPacket.

// forward the packet to ConnectPoint where the DHCP server is attached.
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()));
        if (log.isTraceEnabled()) {
            log.trace("Relaying packet to destination {}", packet.getDestLocation());
        }
        log.debug("packetService.emit(o) to port {}", packet.getDestLocation());
        packetService.emit(o);
    }
}
Also used : DefaultOutboundPacket(org.onosproject.net.packet.DefaultOutboundPacket) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) DefaultOutboundPacket(org.onosproject.net.packet.DefaultOutboundPacket) OutboundPacket(org.onosproject.net.packet.OutboundPacket)

Example 47 with DefaultOutboundPacket

use of org.onosproject.net.packet.DefaultOutboundPacket in project onos by opennetworkinglab.

the class Dhcp6HandlerImpl method forwardPacket.

// forward the packet to ConnectPoint where the DHCP server is attached.
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);
        }
    }
}
Also used : UDP(org.onlab.packet.UDP) IPv6(org.onlab.packet.IPv6) DefaultOutboundPacket(org.onosproject.net.packet.DefaultOutboundPacket) DHCP6(org.onlab.packet.DHCP6) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) DefaultOutboundPacket(org.onosproject.net.packet.DefaultOutboundPacket) OutboundPacket(org.onosproject.net.packet.OutboundPacket)

Example 48 with DefaultOutboundPacket

use of org.onosproject.net.packet.DefaultOutboundPacket in project onos by opennetworkinglab.

the class DhcpRelayManager method sendHostRelearnProbeToConnectPoint.

// Send Host Relearn Probe packets to ConnectPoint
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);
    }
}
Also used : DefaultOutboundPacket(org.onosproject.net.packet.DefaultOutboundPacket) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) DefaultOutboundPacket(org.onosproject.net.packet.DefaultOutboundPacket) OutboundPacket(org.onosproject.net.packet.OutboundPacket) ConnectPoint(org.onosproject.net.ConnectPoint)

Example 49 with DefaultOutboundPacket

use of org.onosproject.net.packet.DefaultOutboundPacket in project onos by opennetworkinglab.

the class K8sRoutingArpHandler method sendArpRequest.

private void sendArpRequest(K8sNode k8sNode) {
    MacAddress bridgeMac = k8sNode.extBridgeMac();
    IpAddress bridgeIp = k8sNode.extBridgeIp();
    IpAddress extGatewayIp = k8sNode.extGatewayIp();
    Ethernet ethRequest = ARP.buildArpRequest(bridgeMac.toBytes(), bridgeIp.toOctets(), extGatewayIp.toOctets(), VlanId.NO_VID);
    TrafficTreatment treatment = DefaultTrafficTreatment.builder().setOutput(k8sNode.extBridgePortNum()).build();
    packetService.emit(new DefaultOutboundPacket(k8sNode.extBridge(), treatment, ByteBuffer.wrap(ethRequest.serialize())));
}
Also used : Ethernet(org.onlab.packet.Ethernet) IpAddress(org.onlab.packet.IpAddress) DefaultOutboundPacket(org.onosproject.net.packet.DefaultOutboundPacket) MacAddress(org.onlab.packet.MacAddress) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment)

Example 50 with DefaultOutboundPacket

use of org.onosproject.net.packet.DefaultOutboundPacket in project onos by opennetworkinglab.

the class K8sSwitchingArpHandler method setArpRequest.

private void setArpRequest(byte[] senderMac, byte[] senderIp, byte[] targetIp, K8sNode k8sNode) {
    Ethernet ethRequest = ARP.buildArpRequest(senderMac, senderIp, targetIp, VlanId.NO_VID);
    // TODO: we need to find a way of sending out ARP request to learn
    // MAC addresses in NORMAL mode
    PortNumber k8sExtToOsPatchPort = k8sNode.portNumByName(k8sNode.extBridge(), k8sNode.k8sExtToOsPatchPortName());
    if (k8sExtToOsPatchPort == null) {
        log.warn("Kubernetes external to OpenStack patch port is null");
        return;
    }
    TrafficTreatment treatment = DefaultTrafficTreatment.builder().setOutput(k8sExtToOsPatchPort).build();
    packetService.emit(new DefaultOutboundPacket(k8sNode.extBridge(), treatment, ByteBuffer.wrap(ethRequest.serialize())));
}
Also used : Ethernet(org.onlab.packet.Ethernet) DefaultOutboundPacket(org.onosproject.net.packet.DefaultOutboundPacket) PortNumber(org.onosproject.net.PortNumber) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment)

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