Search in sources :

Example 36 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.Path in project openflowplugin by opendaylight.

the class CtStateConvertor method convert.

@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
    CtStateCaseValue ctStateCaseValue = (CtStateCaseValue) input.getMatchEntryValue();
    NxmNxCtStateBuilder ctStateBuilder = new NxmNxCtStateBuilder();
    ctStateBuilder.setCtState(ctStateCaseValue.getCtStateValues().getCtState());
    ctStateBuilder.setMask(ctStateCaseValue.getCtStateValues().getMask());
    return resolveAugmentation(ctStateBuilder.build(), path, NxmNxCtStateKey.class);
}
Also used : NxmNxCtStateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.ct.state.grouping.NxmNxCtStateBuilder) CtStateCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtStateCaseValue)

Example 37 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.Path in project openflowplugin by opendaylight.

the class UdpSrcConvertor method convert.

@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
    UdpSrcCaseValue udpSrcCaseValue = (UdpSrcCaseValue) input.getMatchEntryValue();
    NxmOfUdpSrcBuilder udpSrcBuilder = new NxmOfUdpSrcBuilder();
    udpSrcBuilder.setPort(udpSrcCaseValue.getUdpSrcValues().getPort());
    udpSrcBuilder.setMask(udpSrcCaseValue.getUdpSrcValues().getMask());
    return resolveAugmentation(udpSrcBuilder.build(), path, NxmOfUdpSrcKey.class);
}
Also used : NxmOfUdpSrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.udp.src.grouping.NxmOfUdpSrcBuilder) UdpSrcCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpSrcCaseValue)

Example 38 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.Path in project openflowplugin by opendaylight.

the class RegConvertor method convert.

@SuppressWarnings("unchecked")
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
    NxmNxRegBuilder nxRegBuilder = new NxmNxRegBuilder();
    if (!org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg.class.isAssignableFrom(input.getOxmMatchField())) {
        String msg = input.getOxmMatchField() + " does not implement " + org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg.class;
        LOG.warn(msg);
        throw new IllegalStateException(msg);
    }
    nxRegBuilder.setReg((Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg>) input.getOxmMatchField());
    RegCaseValue regCaseValue = (RegCaseValue) input.getMatchEntryValue();
    nxRegBuilder.setValue(regCaseValue.getRegValues().getValue());
    if (input.isHasMask()) {
        nxRegBuilder.setMask(regCaseValue.getRegValues().getMask());
    }
    return resolveAugmentation(nxRegBuilder.build(), path, resolveRegKey(input.getOxmMatchField()));
}
Also used : NxmNxReg(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.reg.grouping.NxmNxReg) RegCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValue) NxmNxRegBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.nx.reg.grouping.NxmNxRegBuilder)

Example 39 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.Path in project openflowplugin by opendaylight.

the class TcpSrcConvertor method convert.

@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
    TcpSrcCaseValue tcpSrcCaseValue = (TcpSrcCaseValue) input.getMatchEntryValue();
    NxmOfTcpSrcBuilder tcpSrcBuilder = new NxmOfTcpSrcBuilder();
    tcpSrcBuilder.setPort(tcpSrcCaseValue.getTcpSrcValues().getPort());
    tcpSrcBuilder.setMask(tcpSrcCaseValue.getTcpSrcValues().getMask());
    return resolveAugmentation(tcpSrcBuilder.build(), path, NxmOfTcpSrcKey.class);
}
Also used : NxmOfTcpSrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.tcp.src.grouping.NxmOfTcpSrcBuilder) TcpSrcCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpSrcCaseValue)

Example 40 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.Path in project openflowplugin by opendaylight.

the class DeviceFlowRegistryImpl method fillFromDatastore.

private CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> fillFromDatastore(final LogicalDatastoreType logicalDatastoreType, final InstanceIdentifier<FlowCapableNode> path) {
    // Create new read-only transaction
    final ReadOnlyTransaction transaction = dataBroker.newReadOnlyTransaction();
    // Bail out early if transaction is null
    if (transaction == null) {
        return Futures.immediateFailedCheckedFuture(new ReadFailedException("Read transaction is null"));
    }
    // Prepare read operation from datastore for path
    final CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> future = transaction.read(logicalDatastoreType, path);
    // Bail out early if future is null
    if (future == null) {
        return Futures.immediateFailedCheckedFuture(new ReadFailedException("Future from read transaction is null"));
    }
    Futures.addCallback(future, new FutureCallback<Optional<FlowCapableNode>>() {

        @Override
        public void onSuccess(@Nonnull Optional<FlowCapableNode> result) {
            result.asSet().stream().filter(Objects::nonNull).filter(flowCapableNode -> Objects.nonNull(flowCapableNode.getTable())).flatMap(flowCapableNode -> flowCapableNode.getTable().stream()).filter(Objects::nonNull).filter(table -> Objects.nonNull(table.getFlow())).flatMap(table -> table.getFlow().stream()).filter(Objects::nonNull).filter(flow -> Objects.nonNull(flow.getId())).forEach(flowConsumer);
            // After we are done with reading from datastore, close the transaction
            transaction.close();
        }

        @Override
        public void onFailure(Throwable throwable) {
            // Even when read operation failed, close the transaction
            transaction.close();
        }
    }, MoreExecutors.directExecutor());
    return future;
}
Also used : MoreExecutors(com.google.common.util.concurrent.MoreExecutors) Arrays(java.util.Arrays) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) DeviceFlowRegistry(org.opendaylight.openflowplugin.api.openflow.registry.flow.DeviceFlowRegistry) LoggerFactory(org.slf4j.LoggerFactory) CheckedFuture(com.google.common.util.concurrent.CheckedFuture) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) ArrayList(java.util.ArrayList) ReadOnlyTransaction(org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Optional(com.google.common.base.Optional) Map(java.util.Map) FlowDescriptor(org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowDescriptor) Nonnull(javax.annotation.Nonnull) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) FlowRegistryKey(org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowRegistryKey) BiMap(com.google.common.collect.BiMap) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) LogicalDatastoreType(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType) ThreadSafe(javax.annotation.concurrent.ThreadSafe) Maps(com.google.common.collect.Maps) FutureCallback(com.google.common.util.concurrent.FutureCallback) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) Objects(java.util.Objects) Consumer(java.util.function.Consumer) GeneralAugMatchNodesNodeTableFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.GeneralAugMatchNodesNodeTableFlow) HashBiMap(com.google.common.collect.HashBiMap) Futures(com.google.common.util.concurrent.Futures) List(java.util.List) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) VisibleForTesting(com.google.common.annotations.VisibleForTesting) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) Optional(com.google.common.base.Optional) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) ReadOnlyTransaction(org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction) Objects(java.util.Objects)

Aggregations

ArrayList (java.util.ArrayList)53 Test (org.junit.Test)48 ExecutionException (java.util.concurrent.ExecutionException)26 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)21 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)20 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)19 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)19 Collections (java.util.Collections)18 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)18 ByteBuf (io.netty.buffer.ByteBuf)16 List (java.util.List)16 TransportZones (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones)16 Logger (org.slf4j.Logger)16 LoggerFactory (org.slf4j.LoggerFactory)16 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)15 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder)15 AsPathBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.AsPathBuilder)15 TransportZoneKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)14 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update)12 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)11