Search in sources :

Example 1 with TransmitPacketInput

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");
}
Also used : TransmitPacketInput(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput)

Example 2 with TransmitPacketInput

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");
}
Also used : NodeConnectorRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef) TransmitPacketInput(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput) ActionSetFieldTunnelId(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId) ActionOutput(org.opendaylight.genius.mdsalutil.actions.ActionOutput) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)

Example 3 with TransmitPacketInput

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;
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) NodeConnectorRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef) TransmitPacketInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInputBuilder) TransmitPacketInput(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)

Example 4 with TransmitPacketInput

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");
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) TransmitPacketInput(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput)

Example 5 with TransmitPacketInput

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();
}
Also used : OutputActionCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder) NodeConnectorRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action) OutputActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) ArrayList(java.util.ArrayList) ActionConvertorData(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData) PacketOutInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInputBuilder) OutputActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder) ArrayList(java.util.ArrayList) List(java.util.List) PathArgument(org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)

Aggregations

TransmitPacketInput (org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput)13 NodeConnectorRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef)8 NodeRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef)7 TransmitPacketInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInputBuilder)7 Test (org.junit.Test)4 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)4 PacketOutInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput)4 PacketOutConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.PacketOutConvertorData)3 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 PacketException (org.opendaylight.openflowplugin.libraries.liblldp.PacketException)2 ActionConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData)2 Uri (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)2 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)2 NodeConnectorKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)2 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)2 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)2 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)2 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)2