Search in sources :

Example 51 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.start.input.Config in project bgpcep by opendaylight.

the class TunnelProviderDeployer method createTunnelTopologyProvider.

private synchronized void createTunnelTopologyProvider(final Topology topology) {
    if (!filterPcepTopologies(topology.getTopologyTypes())) {
        return;
    }
    final TopologyId topologyId = topology.getTopologyId();
    if (this.pcepTunnelServices.containsKey(topology.getTopologyId())) {
        LOG.warn("Tunnel Topology {} already exist. New instance won't be created", topologyId);
        return;
    }
    LOG.debug("Create Tunnel Topology {}", topologyId);
    final PcepTunnelTopologyConfig config = topology.getAugmentation(PcepTunnelTopologyConfig.class);
    final String pcepTopoID = StringUtils.substringBetween(config.getPcepTopologyReference().getValue(), "=\"", "\"");
    final InstanceIdentifier<Topology> pcepTopoRef = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, new TopologyKey(new TopologyId(pcepTopoID))).build();
    final PCEPTunnelClusterSingletonService tunnelTopoCss = new PCEPTunnelClusterSingletonService(this.dependencies, pcepTopoRef, topologyId);
    this.pcepTunnelServices.put(topology.getTopologyId(), tunnelTopoCss);
}
Also used : TopologyKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey) NetworkTopology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) PcepTunnelTopologyConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.config.rev171127.PcepTunnelTopologyConfig) TopologyId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId)

Example 52 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.start.input.Config in project bgpcep by opendaylight.

the class PCEPTopologyDeployerImpl method createTopologyProvider.

private synchronized void createTopologyProvider(final Topology topology) {
    if (!filterPcepTopologies(topology.getTopologyTypes())) {
        return;
    }
    final TopologyId topologyId = topology.getTopologyId();
    if (this.pcepTopologyServices.containsKey(topology.getTopologyId())) {
        LOG.warn("Topology Provider {} already exist. New instance won't be created", topologyId);
        return;
    }
    LOG.info("Creating Topology {}", topologyId);
    LOG.trace("Topology {}.", topology);
    final SessionConfig config = topology.getAugmentation(PcepTopologyTypeConfig.class).getSessionConfig();
    final InstructionScheduler instructionScheduler = this.instructionSchedulerFactory.createInstructionScheduler(topologyId.getValue());
    final PCEPTopologyConfiguration dependencies = new PCEPTopologyConfiguration(config, topology);
    final PCEPTopologyProviderBean pcepTopologyProviderBean = (PCEPTopologyProviderBean) this.container.getComponentInstance(PCEPTopologyProviderBean.class.getSimpleName());
    this.pcepTopologyServices.put(topologyId, pcepTopologyProviderBean);
    pcepTopologyProviderBean.start(dependencies, instructionScheduler);
}
Also used : PcepTopologyTypeConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.config.rev171025.PcepTopologyTypeConfig) SessionConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.config.rev171025.pcep.config.SessionConfig) InstructionScheduler(org.opendaylight.bgpcep.programming.spi.InstructionScheduler) TopologyId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId)

Example 53 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.start.input.Config in project bgpcep by opendaylight.

the class PCEPTopologyProviderUtil method contructSpeakersId.

static SpeakerIdMapping contructSpeakersId(final Topology topology) {
    final SpeakerIdMapping ret = SpeakerIdMapping.getSpeakerIdMap();
    topology.getNode().stream().filter(Objects::nonNull).filter(node -> node.getAugmentation(PcepNodeConfig.class) != null).filter(node -> node.getAugmentation(PcepNodeConfig.class).getSessionConfig() != null).filter(node -> node.getAugmentation(PcepNodeConfig.class).getSessionConfig().getAugmentation(PcepNodeSyncConfig.class) != null).forEach(node -> {
        final PcepNodeConfig config = node.getAugmentation(PcepNodeConfig.class);
        final PcepNodeSyncConfig nodeSyncConfig = config.getSessionConfig().getAugmentation(PcepNodeSyncConfig.class);
        final InetAddress address = InetAddresses.forString(node.getNodeId().getValue());
        ret.put(address, nodeSyncConfig.getSpeakerEntityIdValue());
    });
    return ret;
}
Also used : PcepNodeSyncConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.sync.optimizations.config.rev171025.PcepNodeSyncConfig) PcepNodeConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.config.rev171025.PcepNodeConfig) Logger(org.slf4j.Logger) KeyMapping(org.opendaylight.protocol.concepts.KeyMapping) TopologyTypes1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TopologyTypes1) LoggerFactory(org.slf4j.LoggerFactory) Rfc2385Key(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.rfc2385.cfg.rev160324.Rfc2385Key) InetSocketAddress(java.net.InetSocketAddress) StandardCharsets(java.nio.charset.StandardCharsets) InetAddress(java.net.InetAddress) Objects(java.util.Objects) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) TopologyTypes(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.TopologyTypes) IetfInetUtil(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) SpeakerIdMapping(org.opendaylight.protocol.pcep.SpeakerIdMapping) InetAddresses(com.google.common.net.InetAddresses) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) PcepNodeSyncConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.sync.optimizations.config.rev171025.PcepNodeSyncConfig) SpeakerIdMapping(org.opendaylight.protocol.pcep.SpeakerIdMapping) Objects(java.util.Objects) PcepNodeConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.config.rev171025.PcepNodeConfig) InetAddress(java.net.InetAddress)

Example 54 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.start.input.Config in project openflowplugin by opendaylight.

the class SyncReactorFutureZipDecoratorTest method testSyncupConfigEmptyQueue.

@Test
public void testSyncupConfigEmptyQueue() throws Exception {
    final FlowCapableNode dataBefore = Mockito.mock(FlowCapableNode.class);
    final FlowCapableNode dataAfter = Mockito.mock(FlowCapableNode.class);
    final CountDownLatch latchForNext = new CountDownLatch(1);
    final SyncupEntry first = new SyncupEntry(dataBefore, configDS, null, configDS);
    final SyncupEntry second = new SyncupEntry(dataAfter, configDS, dataBefore, configDS);
    Mockito.when(delegate.syncup(Matchers.<InstanceIdentifier<FlowCapableNode>>any(), Mockito.eq(first))).thenAnswer(invocationOnMock -> {
        LOG.info("unlocking next config");
        latchForNext.countDown();
        return Futures.immediateFuture(Boolean.TRUE);
    });
    reactor.syncup(fcNodePath, first);
    latchForNext.await();
    mockSyncupWithEntry(second);
    reactor.syncup(fcNodePath, second);
    boolean terminated = syncThreadPool.awaitTermination(1, TimeUnit.SECONDS);
    if (!terminated) {
        LOG.info("thread pool not terminated.");
        syncThreadPool.shutdownNow();
    }
    final InOrder inOrder = Mockito.inOrder(delegate);
    inOrder.verify(delegate).syncup(fcNodePath, first);
    inOrder.verify(delegate).syncup(fcNodePath, second);
    inOrder.verifyNoMoreInteractions();
}
Also used : InOrder(org.mockito.InOrder) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) CountDownLatch(java.util.concurrent.CountDownLatch) SyncupEntry(org.opendaylight.openflowplugin.applications.frsync.util.SyncupEntry) Test(org.junit.Test)

Example 55 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.start.input.Config in project openflowplugin by opendaylight.

the class TableFeaturesResponseConvertorTest method testWithMPTableFeature.

/**
 * Test correct input - without table properties.
 */
@Test
public void testWithMPTableFeature() {
    TableFeaturesBuilder featuresBuilder = new TableFeaturesBuilder();
    featuresBuilder.setTableId((short) 5);
    featuresBuilder.setName("Aloha");
    byte[] metaMatch = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 };
    featuresBuilder.setMetadataMatch(metaMatch);
    byte[] metaWrite = new byte[] { 8, 9, 10, 11, 12, 13, 14, 15 };
    featuresBuilder.setMetadataWrite(metaWrite);
    featuresBuilder.setConfig(new TableConfig(false));
    featuresBuilder.setMaxEntries(42L);
    List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.multipart.reply.table.features.TableFeatures> features = new ArrayList<>();
    features.add(featuresBuilder.build());
    MultipartReplyTableFeaturesBuilder builder = new MultipartReplyTableFeaturesBuilder();
    builder.setTableFeatures(features);
    List<TableFeatures> list = convert(builder.build());
    Assert.assertEquals("Returned empty list", 1, list.size());
    TableFeatures feature = list.get(0);
    Assert.assertEquals("Wrong table-id", 5, feature.getTableId().intValue());
    Assert.assertEquals("Wrong name", "Aloha", feature.getName());
    Assert.assertEquals("Wrong metadata match", new BigInteger(1, metaMatch), feature.getMetadataMatch());
    Assert.assertEquals("Wrong metadata write", new BigInteger(1, metaWrite), feature.getMetadataWrite());
    Assert.assertEquals("Wrong config", false, feature.getConfig().isDEPRECATEDMASK());
    Assert.assertEquals("Wrong max-entries", 42, feature.getMaxEntries().intValue());
    Assert.assertEquals("Wrong properties", 0, feature.getTableProperties().getTableFeatureProperties().size());
}
Also used : ArrayList(java.util.ArrayList) MultipartReplyTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeaturesBuilder) TableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.multipart.reply.table.features.TableFeaturesBuilder) MultipartReplyTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeaturesBuilder) TableFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures) MultipartReplyTableFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeatures) TableConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig) BigInteger(java.math.BigInteger) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)47 Test (org.junit.Test)45 BigInteger (java.math.BigInteger)29 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)23 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)23 ByteBuf (io.netty.buffer.ByteBuf)21 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)21 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)20 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)19 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)19 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)19 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)16 ExecutionException (java.util.concurrent.ExecutionException)16 Optional (com.google.common.base.Optional)15 List (java.util.List)15 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)14 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)14 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)14 InterfaceKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey)12 Vteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps)12