Search in sources :

Example 41 with Ports

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.multipart.reply.port.desc.Ports in project genius by opendaylight.

the class SouthboundUtils method addAllPortsToBridge.

/*
     * Add all tunnels ports corresponding to the bridge to the topology config DS.
     */
public void addAllPortsToBridge(BridgeEntry bridgeEntry, InterfaceManagerCommonUtils interfaceManagerCommonUtils, InstanceIdentifier<OvsdbBridgeAugmentation> bridgeIid, OvsdbBridgeAugmentation bridgeNew) {
    String bridgeName = bridgeNew.getBridgeName().getValue();
    LOG.debug("adding all ports to bridge: {}", bridgeName);
    List<BridgeInterfaceEntry> bridgeInterfaceEntries = bridgeEntry.getBridgeInterfaceEntry();
    if (bridgeInterfaceEntries != null) {
        for (BridgeInterfaceEntry bridgeInterfaceEntry : bridgeInterfaceEntries) {
            String portName = bridgeInterfaceEntry.getInterfaceName();
            InterfaceKey interfaceKey = new InterfaceKey(portName);
            Interface iface = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
            if (iface != null) {
                IfTunnel ifTunnel = iface.getAugmentation(IfTunnel.class);
                if (ifTunnel != null) {
                    if (!(interfacemgrProvider.isItmDirectTunnelsEnabled() && ifTunnel.isInternal())) {
                        addTunnelPortToBridge(ifTunnel, bridgeIid, iface, portName);
                    }
                    if (isOfTunnel(ifTunnel)) {
                        LOG.debug("Using OFTunnel. Only one tunnel port will be added");
                        return;
                    }
                }
            } else {
                LOG.debug("Interface {} not found in config DS", portName);
            }
        }
    }
}
Also used : IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) BridgeInterfaceEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.bridge.entry.BridgeInterfaceEntry) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)

Example 42 with Ports

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.multipart.reply.port.desc.Ports in project bgpcep by opendaylight.

the class AbstractFlowspecNlriParser method createPorts.

private static List<Ports> createPorts(final UnkeyedListNode portsData) {
    final List<Ports> ports = new ArrayList<>();
    for (final UnkeyedListEntryNode node : portsData.getValue()) {
        final PortsBuilder portsBuilder = new PortsBuilder();
        final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(OP_NID);
        if (opValue.isPresent()) {
            portsBuilder.setOp(NumericTwoByteOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
        }
        final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(VALUE_NID);
        if (valueNode.isPresent()) {
            portsBuilder.setValue((Integer) valueNode.get().getValue());
        }
        ports.add(portsBuilder.build());
    }
    return ports;
}
Also used : Set(java.util.Set) DataContainerChild(org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild) ArrayList(java.util.ArrayList) DestinationPorts(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.destination.port._case.DestinationPorts) SourcePorts(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.source.port._case.SourcePorts) Ports(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.port._case.Ports) UnkeyedListEntryNode(org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode) PathArgument(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument) PortsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.port._case.PortsBuilder) SourcePortsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.source.port._case.SourcePortsBuilder) DestinationPortsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.destination.port._case.DestinationPortsBuilder)

Example 43 with Ports

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.multipart.reply.port.desc.Ports in project bgpcep by opendaylight.

the class FSDestinationPortHandler method parseDestinationPort.

private static List<DestinationPorts> parseDestinationPort(final ByteBuf nlri) {
    final List<DestinationPorts> ports = new ArrayList<>();
    boolean end = false;
    // we can do this as all fields will be rewritten in the cycle
    final DestinationPortsBuilder builder = new DestinationPortsBuilder();
    while (!end) {
        final byte b = nlri.readByte();
        final NumericOperand op = NumericOneByteOperandParser.INSTANCE.parse(b);
        builder.setOp(op);
        final short length = AbstractOperandParser.parseLength(b);
        builder.setValue(ByteArray.bytesToInt(ByteArray.readBytes(nlri, length)));
        end = op.isEndOfList();
        ports.add(builder.build());
    }
    return ports;
}
Also used : NumericOperand(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.NumericOperand) DestinationPorts(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.destination.port._case.DestinationPorts) ArrayList(java.util.ArrayList) DestinationPortsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.destination.port._case.DestinationPortsBuilder)

Example 44 with Ports

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.multipart.reply.port.desc.Ports in project bgpcep by opendaylight.

the class FSSourcePortHandler method parseSourcePort.

private static List<SourcePorts> parseSourcePort(final ByteBuf nlri) {
    final List<SourcePorts> ports = new ArrayList<>();
    boolean end = false;
    // we can do this as all fields will be rewritten in the cycle
    final SourcePortsBuilder builder = new SourcePortsBuilder();
    while (!end) {
        final byte b = nlri.readByte();
        final NumericOperand op = NumericOneByteOperandParser.INSTANCE.parse(b);
        builder.setOp(op);
        final short length = AbstractOperandParser.parseLength(b);
        builder.setValue(ByteArray.bytesToInt(ByteArray.readBytes(nlri, length)));
        end = op.isEndOfList();
        ports.add(builder.build());
    }
    return ports;
}
Also used : NumericOperand(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.NumericOperand) SourcePortsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.source.port._case.SourcePortsBuilder) ArrayList(java.util.ArrayList) SourcePorts(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.source.port._case.SourcePorts)

Example 45 with Ports

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.multipart.reply.port.desc.Ports in project bgpcep by opendaylight.

the class NumericOperandParserTest method testSerializeTwoByte.

@Test
public void testSerializeTwoByte() {
    final ByteBuf nlriByteBuf = Unpooled.buffer();
    final List<Ports> ports = new ArrayList<>();
    // create 3 ports without end-of-list bit set
    for (int i = 0; i < 3; i++) {
        ports.add(new PortsBuilder().setOp(new NumericOperand(false, false, true, false, false)).setValue(100 + i).build());
    }
    NumericTwoByteOperandParser.INSTANCE.serialize(ports, nlriByteBuf);
    assertArrayEquals(ONE_BYTE_CODE_LIST, ByteArray.readAllBytes(nlriByteBuf));
}
Also used : NumericOperand(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.NumericOperand) ArrayList(java.util.ArrayList) Ports(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.port._case.Ports) ByteBuf(io.netty.buffer.ByteBuf) PortsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.flowspec.flowspec.type.port._case.PortsBuilder) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)29 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)21 BigInteger (java.math.BigInteger)16 Ports (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.Ports)13 RouterPorts (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.RouterPorts)12 Test (org.junit.Test)11 InternalToExternalPortMap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.ports.InternalToExternalPortMap)11 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)9 Subnetmap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)8 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)8 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)7 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)7 Port (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port)7 ExecutionException (java.util.concurrent.ExecutionException)6 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)5 ByteBuf (io.netty.buffer.ByteBuf)5 HashSet (java.util.HashSet)4 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)4 RouterPortsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.RouterPortsKey)4 Ports (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.multipart.reply.port.desc.Ports)4