use of org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput in project netvirt by opendaylight.
the class SubnetRoutePacketInHandler method transmitArpPacket.
private void transmitArpPacket(BigInteger dpnId, String sourceIpAddress, String sourceMac, byte[] dstIp, long elanTag) throws UnknownHostException {
LOG.debug("Sending arp with elan tag {}", elanTag);
VpnManagerCounters.subnet_route_packet_arp_sent.inc();
long groupid = VpnUtil.getRemoteBCGroup(elanTag);
TransmitPacketInput arpRequestInput = ArpUtils.createArpRequestInput(dpnId, groupid, HexEncode.bytesFromHexString(sourceMac), InetAddress.getByName(sourceIpAddress).getAddress(), dstIp);
JdkFutures.addErrorLogging(packetService.transmitPacket(arpRequestInput), LOG, "Transmit packet");
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput in project netvirt by opendaylight.
the class NaptEventHandler method sendNaptPacketOut.
private void sendNaptPacketOut(byte[] pktOut, InterfaceInfo infInfo, List<ActionInfo> actionInfos, Long tunId) {
LOG.trace("sendNaptPacketOut: Sending packet out DpId {}, interfaceInfo {}", infInfo.getDpId(), infInfo);
// set inPort, and action as OFPP_TABLE so that it starts from table 0 (lowest table as per spec)
actionInfos.add(new ActionSetFieldTunnelId(2, BigInteger.valueOf(tunId)));
actionInfos.add(new ActionOutput(3, new Uri("0xfffffff9")));
NodeConnectorRef inPort = MDSALUtil.getNodeConnRef(infInfo.getDpId(), String.valueOf(infInfo.getPortNo()));
LOG.debug("sendNaptPacketOut : inPort for packetout is being set to {}", String.valueOf(infInfo.getPortNo()));
TransmitPacketInput output = MDSALUtil.getPacketOut(actionInfos, pktOut, infInfo.getDpId().longValue(), inPort);
LOG.debug("sendNaptPacketOut : Transmitting packet: {}, inPort {}", output, inPort);
JdkFutures.addErrorLogging(pktService.transmitPacket(output), LOG, "Transmit packet");
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput in project netvirt by opendaylight.
the class Ipv6NeighborSolicitation method transmitNeighborSolicitation.
public boolean transmitNeighborSolicitation(BigInteger dpnId, NodeConnectorRef nodeRef, MacAddress srcMacAddress, Ipv6Address srcIpv6Address, Ipv6Address targetIpv6Address) {
byte[] txPayload = frameNeighborSolicitationRequest(srcMacAddress, srcIpv6Address, targetIpv6Address);
NodeConnectorRef nodeConnectorRef = MDSALUtil.getNodeConnRef(dpnId, "0xfffffffd");
TransmitPacketInput input = new TransmitPacketInputBuilder().setPayload(txPayload).setNode(new NodeRef(InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(new NodeId("openflow:" + dpnId))).toInstance())).setEgress(nodeRef).setIngress(nodeConnectorRef).build();
// Tx the packet out of the controller.
LOG.debug("Transmitting the Neighbor Solicitation packet out on {}", dpnId);
JdkFutures.addErrorLogging(packetService.transmitPacket(input), LOG, "transmitPacket");
return true;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput in project netvirt by opendaylight.
the class DhcpPktHandler method sendPacketOut.
private void sendPacketOut(byte[] pktOut, BigInteger dpnId, String interfaceName, BigInteger tunnelId) {
List<Action> action = getEgressAction(interfaceName, tunnelId);
TransmitPacketInput output = MDSALUtil.getPacketOut(action, pktOut, dpnId);
LOG.trace("Transmitting packet: {}", output);
JdkFutures.addErrorLogging(pktService.transmitPacket(output), LOG, "Transmit packet");
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput in project openflowplugin by opendaylight.
the class PacketOutConvertor method convert.
@Override
public PacketOutInput convert(TransmitPacketInput source, PacketOutConvertorData data) {
LOG.trace("toPacketOutInput for datapathId:{}, xid:{}", data.getDatapathId(), data.getXid());
// Build Port ID from TransmitPacketInput.Ingress
PortNumber inPortNr;
Long bufferId = OFConstants.OFP_NO_BUFFER;
Iterable<PathArgument> inArgs = null;
if (source.getIngress() != null) {
inArgs = source.getIngress().getValue().getPathArguments();
}
if (inArgs != null && Iterables.size(inArgs) >= 3) {
inPortNr = getPortNumber(Iterables.get(inArgs, 2), data.getVersion());
} else {
// The packetOut originated from the controller
inPortNr = new PortNumber(0xfffffffdL);
}
// Build Buffer ID to be NO_OFP_NO_BUFFER
if (source.getBufferId() != null) {
bufferId = source.getBufferId();
}
PortNumber outPort = null;
NodeConnectorRef outRef = source.getEgress();
Iterable<PathArgument> outArgs = outRef.getValue().getPathArguments();
if (Iterables.size(outArgs) >= 3) {
outPort = getPortNumber(Iterables.get(outArgs, 2), data.getVersion());
} else {
// TODO : P4 search for some normal exception
// new Exception("PORT NR not exist in Egress");
LOG.error("PORT NR not exist in Egress");
}
List<Action> actions = new ArrayList<>();
List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> inputActions = source.getAction();
if (inputActions != null) {
final ActionConvertorData actionConvertorData = new ActionConvertorData(data.getVersion());
actionConvertorData.setDatapathId(data.getDatapathId());
final Optional<List<Action>> convertedActions = getConvertorExecutor().convert(inputActions, actionConvertorData);
actions = convertedActions.orElse(Collections.emptyList());
} else {
// TODO VD P! wait for way to move Actions (e.g. augmentation)
OutputActionCaseBuilder outputActionCaseBuilder = new OutputActionCaseBuilder();
OutputActionBuilder outputActionBuilder = new OutputActionBuilder();
outputActionBuilder.setPort(outPort);
outputActionBuilder.setMaxLength(OFConstants.OFPCML_NO_BUFFER);
outputActionCaseBuilder.setOutputAction(outputActionBuilder.build());
ActionBuilder actionBuild = new ActionBuilder();
actionBuild.setActionChoice(outputActionCaseBuilder.build());
actions.add(actionBuild.build());
}
PacketOutInputBuilder builder = new PacketOutInputBuilder();
builder.setAction(actions);
builder.setData(source.getPayload());
builder.setVersion(data.getVersion());
builder.setXid(data.getXid());
builder.setInPort(inPortNr);
builder.setBufferId(bufferId);
return builder.build();
}
Aggregations