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);
}
}
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);
}
}
}
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);
}
}
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())));
}
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())));
}
Aggregations