Search in sources :

Example 11 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project netvirt by opendaylight.

the class OpenflowRenderer method renderPath.

@Override
// FindBugs reports "Useless object stored in variable flows" however it doesn't recognize the usage of forEach.
@SuppressFBWarnings("UC_USELESS_OBJECT")
public void renderPath(NodeId nodeId, Long nsp, short nsi, short nsl, String firstHopIp) {
    List<Flow> flows = new ArrayList<>();
    if (firstHopIp != null) {
        Long port = geniusProvider.getEgressVxlanPortForNode(OpenFlow13Provider.getDpnIdFromNodeId(nodeId)).orElse(null);
        if (port == null) {
            LOG.error("OpenflowRenderer: cant get egressPort for nodeId [{}]", nodeId.getValue());
            return;
        }
        Flow flow;
        flow = openFlow13Provider.createEgressClassifierTransportEgressRemoteFlow(nodeId, nsp, port, firstHopIp);
        flows.add(flow);
    } else {
        Flow flow;
        flow = openFlow13Provider.createEgressClassifierTransportEgressLocalFlow(nodeId, nsp);
        flows.add(flow);
    }
    short egressNsi = (short) (nsi - nsl);
    flows.add(openFlow13Provider.createIngressClassifierFilterChainEgressFlow(nodeId, nsp, egressNsi));
    ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> flows.forEach(flow -> this.openFlow13Provider.appendFlowForCreate(nodeId, flow, tx))), LOG, "Error rendering a path");
}
Also used : Logger(org.slf4j.Logger) ManagedNewTransactionRunner(org.opendaylight.genius.infra.ManagedNewTransactionRunner) LoggerFactory(org.slf4j.LoggerFactory) ClassifierEntryRenderer(org.opendaylight.netvirt.sfc.classifier.service.domain.api.ClassifierEntryRenderer) Matches(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.Matches) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) OpenFlow13Provider(org.opendaylight.netvirt.sfc.classifier.providers.OpenFlow13Provider) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) ArrayList(java.util.ArrayList) ListenableFutures(org.opendaylight.infrautils.utils.concurrent.ListenableFutures) List(java.util.List) GeniusProvider(org.opendaylight.netvirt.sfc.classifier.providers.GeniusProvider) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) ManagedNewTransactionRunnerImpl(org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) ArrayList(java.util.ArrayList) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 12 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project openflowplugin by opendaylight.

the class AbstractNotificationSupplierBase method getNodeII.

/**
 * Method returns a keyed {@link InstanceIdentifier} for {@link Node} from inventory
 * because this path is a base for every OF paths.
 *
 * @param ii - key for keyed {@link Node} {@link InstanceIdentifier}
 * @return Keyed InstanceIdentifier for Node
 */
protected static KeyedInstanceIdentifier<Node, NodeKey> getNodeII(final InstanceIdentifier<?> ii) {
    final NodeKey key = ii.firstKeyOf(Node.class, NodeKey.class);
    Preconditions.checkArgument(key != null);
    return InstanceIdentifier.create(Nodes.class).child(Node.class, key);
}
Also used : NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)

Example 13 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project openflowplugin by opendaylight.

the class NodeConnectorNotificationSupplierImpl method createNotification.

@Override
public NodeConnectorUpdated createNotification(final FlowCapableNodeConnector flowCapableNodeConnector, final InstanceIdentifier<FlowCapableNodeConnector> path) {
    Preconditions.checkArgument(flowCapableNodeConnector != null);
    Preconditions.checkArgument(path != null);
    final NodeConnectorUpdatedBuilder notifBuilder = new NodeConnectorUpdatedBuilder();
    final FlowCapableNodeConnectorUpdatedBuilder connNotifBuilder = new FlowCapableNodeConnectorUpdatedBuilder(flowCapableNodeConnector);
    notifBuilder.setId(path.firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId());
    notifBuilder.setNodeConnectorRef(new NodeConnectorRef(path));
    notifBuilder.addAugmentation(FlowCapableNodeConnectorUpdated.class, connNotifBuilder.build());
    return notifBuilder.build();
}
Also used : NodeConnectorRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef) FlowCapableNodeConnectorUpdatedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorUpdatedBuilder) NodeConnectorUpdatedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdatedBuilder) FlowCapableNodeConnectorUpdatedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorUpdatedBuilder)

Example 14 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project openflowplugin by opendaylight.

the class NodeConnectorNotificationSupplierImpl method deleteNotification.

@Override
public NodeConnectorRemoved deleteNotification(final InstanceIdentifier<FlowCapableNodeConnector> path) {
    Preconditions.checkArgument(path != null);
    final NodeConnectorRemovedBuilder notifBuilder = new NodeConnectorRemovedBuilder();
    notifBuilder.setNodeConnectorRef(new NodeConnectorRef(path));
    return notifBuilder.build();
}
Also used : NodeConnectorRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef) NodeConnectorRemovedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemovedBuilder)

Example 15 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project openflowplugin by opendaylight.

the class MeterStatNotificationSupplierImpl method createNotification.

@Override
public MeterStatisticsUpdated createNotification(final MeterStatistics meterStatistics, final InstanceIdentifier<MeterStatistics> path) {
    Preconditions.checkArgument(meterStatistics != null);
    Preconditions.checkArgument(path != null);
    final MeterStatisticsUpdatedBuilder builder = new MeterStatisticsUpdatedBuilder();
    builder.setId(getNodeId(path));
    builder.setMoreReplies(Boolean.FALSE);
    // TODO : fix if it needs, but we have to ask DataStore for the NodeConnector list
    builder.setNodeConnector(Collections.<NodeConnector>emptyList());
    builder.setMeterStats(Collections.singletonList(new MeterStatsBuilder(meterStatistics).build()));
    return builder.build();
}
Also used : MeterStatisticsUpdatedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterStatisticsUpdatedBuilder) MeterStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStatsBuilder)

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