Search in sources :

Example 86 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.Config in project openflowplugin by opendaylight.

the class SimplifiedOperationalListener method reconciliation.

/**
 * If node is present in config DS diff between wanted configuration (in config DS) and actual device
 * configuration (coming from operational) should be calculated and sent to device.
 * @param modification from DS
 * @return optional syncup future
 */
private Optional<ListenableFuture<Boolean>> reconciliation(final DataTreeModification<Node> modification) {
    final NodeId nodeId = ModificationUtil.nodeId(modification);
    final Optional<FlowCapableNode> nodeConfiguration = configDao.loadByNodeId(nodeId);
    if (nodeConfiguration.isPresent()) {
        LOG.debug("Reconciliation {}: {}", dsType(), nodeId.getValue());
        final InstanceIdentifier<FlowCapableNode> nodePath = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(ModificationUtil.nodeId(modification))).augmentation(FlowCapableNode.class);
        final FlowCapableNode fcOperationalNode = ModificationUtil.flowCapableNodeAfter(modification);
        final SyncupEntry syncupEntry = new SyncupEntry(nodeConfiguration.get(), LogicalDatastoreType.CONFIGURATION, fcOperationalNode, dsType());
        return Optional.of(reactor.syncup(nodePath, syncupEntry));
    } else {
        LOG.debug("Config not present for reconciliation: {}", nodeId.getValue());
        reconciliationRegistry.unregisterIfRegistered(nodeId);
        return skipModification(modification);
    }
}
Also used : FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) SyncupEntry(org.opendaylight.openflowplugin.applications.frsync.util.SyncupEntry) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)

Example 87 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.Config in project openflowplugin by opendaylight.

the class FRMTest method getConfigurationService.

public ConfigurationService getConfigurationService() {
    final ConfigurationService configurationService = Mockito.mock(ConfigurationService.class);
    final ForwardingRulesManagerConfig config = getConfig();
    Mockito.when(configurationService.registerListener(Mockito.any())).thenReturn(() -> {
    });
    Mockito.when(configurationService.getProperty(Mockito.eq("disable-reconciliation"), Mockito.any())).thenReturn(config.isDisableReconciliation());
    Mockito.when(configurationService.getProperty(Mockito.eq("stale-marking-enabled"), Mockito.any())).thenReturn(config.isStaleMarkingEnabled());
    Mockito.when(configurationService.getProperty(Mockito.eq("reconciliation-retry-count"), Mockito.any())).thenReturn(config.getReconciliationRetryCount());
    Mockito.when(configurationService.getProperty(Mockito.eq("bundle-based-reconciliation-enabled"), Mockito.any())).thenReturn(config.isBundleBasedReconciliationEnabled());
    return configurationService;
}
Also used : ConfigurationService(org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService) ForwardingRulesManagerConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.forwardingrules.manager.config.rev160511.ForwardingRulesManagerConfig)

Example 88 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.Config in project openflowplugin by opendaylight.

the class PortMessageSerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
    serializer.serialize(MESSAGE, out);
    // Header
    assertEquals(out.readByte(), VERSION);
    assertEquals(out.readByte(), serializer.getMessageType());
    assertEquals(out.readShort(), LENGTH);
    assertEquals(out.readInt(), XID.intValue());
    // Body
    assertEquals(out.readInt(), PORT_NUMBER_VAL.intValue());
    out.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_01);
    byte[] address = new byte[6];
    out.readBytes(address);
    assertEquals(new MacAddress(ByteBufUtils.macAddressToString(address)).getValue(), new MacAddress(MAC_ADDRESS).getValue());
    out.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_02);
    // Port config
    final int config = ByteBufUtils.fillBitMaskFromMap(ImmutableMap.<Integer, Boolean>builder().put(0, IS_PORTDOWN).put(2, IS_NORECV).put(5, IS_NOFWD).put(6, IS_NOPACKETIN).build());
    final int mask = ByteBufUtils.fillBitMaskFromMap(ImmutableMap.<Integer, Boolean>builder().put(0, true).put(2, true).put(5, true).put(6, true).build());
    assertEquals(out.readInt(), config);
    assertEquals(out.readInt(), mask);
    // Port features
    assertEquals(out.readInt(), ByteBufUtils.fillBitMask(0, IS_10MBHD, IS_10MBFD, IS_100MBHD, IS_100MBFD, IS_1GBHD, IS_1GBFD, IS_10GBFD, IS_40GBFD, IS_100GBFD, IS_1TBFD, IS_OTHER, IS_COPPER, IS_FIBER, IS_AUTOENG, IS_PAUSE, IS_PAUSE_ASYM));
    out.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_03);
    assertEquals(out.readableBytes(), 0);
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Test(org.junit.Test) AbstractSerializerTest(org.opendaylight.openflowplugin.impl.protocol.serialization.AbstractSerializerTest)

Example 89 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.Config in project openflowplugin by opendaylight.

the class OF10PortModInputMessageFactoryTest method test.

@Test
public void test() {
    ByteBuf bb = BufferHelper.buildBuffer("19 e9 08 00 27 00 b0 eb " + "00 00 00 15 00 00 00 62 00 00 02 8c 00 00 00 00 ");
    PortModInput deserializedMessage = BufferHelper.deserialize(factory, bb);
    BufferHelper.checkHeaderV10(deserializedMessage);
    Assert.assertEquals("Wrong port", new PortNumber(6633L), deserializedMessage.getPortNo());
    Assert.assertEquals("Wrong hwAddr", new MacAddress("08:00:27:00:b0:eb"), deserializedMessage.getHwAddress());
    Assert.assertEquals("Wrong config", new PortConfigV10(true, false, false, true, false, false, true), deserializedMessage.getConfigV10());
    Assert.assertEquals("Wrong mask", new PortConfigV10(false, true, true, false, false, true, false), deserializedMessage.getMaskV10());
    Assert.assertEquals("Wrong advertise", new PortFeaturesV10(true, true, false, false, false, false, false, true, true, false, false, false), deserializedMessage.getAdvertiseV10());
}
Also used : PortConfigV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10) PortFeaturesV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10) PortModInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput) ByteBuf(io.netty.buffer.ByteBuf) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Test(org.junit.Test)

Example 90 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.Config in project openflowplugin by opendaylight.

the class ConfigurationServiceFactoryImplTest method setUp.

@Before
public void setUp() throws Exception {
    when(config.isIsStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
    when(config.isIsFlowStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
    when(config.isIsTableStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
    when(config.isIsFlowStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
    when(config.isIsGroupStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
    when(config.isIsMeterStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
    when(config.isIsQueueStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
    when(config.isIsPortStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
    when(config.getBarrierCountLimit()).thenReturn(new NonZeroUint16Type(BARRIER_COUNT_LIMIT));
    when(config.getBarrierIntervalTimeoutLimit()).thenReturn(new NonZeroUint32Type(BARRIER_INTERVAL_TIMEOUT_LIMIT));
    when(config.getEchoReplyTimeout()).thenReturn(new NonZeroUint32Type(ECHO_REPLY_TIMEOUT));
    when(config.isEnableFlowRemovedNotification()).thenReturn(ENABLE_FLOW_REMOVED_NOTIFICATION);
    when(config.isSkipTableFeatures()).thenReturn(SKIP_TABLE_FEATURES);
    when(config.getBasicTimerDelay()).thenReturn(new NonZeroUint32Type(BASIC_TIMER_DELAY));
    when(config.getMaximumTimerDelay()).thenReturn(new NonZeroUint32Type(MAXIMUM_TIMER_DELAY));
    when(config.isSwitchFeaturesMandatory()).thenReturn(SWITCH_FEATURES_MANDATORY);
    when(config.isIsStatisticsRpcEnabled()).thenReturn(IS_STATISTICS_RPC_ENABLED);
    when(config.isUseSingleLayerSerialization()).thenReturn(USE_SINGLE_LAYER_SERIALIZATION);
    when(config.getRpcRequestsQuota()).thenReturn(new NonZeroUint16Type(RPC_REQUESTS_QUOTA));
    when(config.getGlobalNotificationQuota()).thenReturn(GLOBAL_NOTIFICATION_QUOTA);
    when(config.getThreadPoolMinThreads()).thenReturn(THREAD_POOL_MIN_THREADS);
    when(config.getThreadPoolMaxThreads()).thenReturn(new NonZeroUint16Type(THREAD_POOL_MAX_THREADS));
    when(config.getThreadPoolTimeout()).thenReturn(THREAD_POOL_TIMEOUT);
    final Dictionary<String, Object> properties = new Hashtable<>();
    properties.put(ConfigurationProperty.IS_STATISTICS_POLLING_ON.toString(), IS_STATISTICS_POLLING_ON);
    when(configuration.getProperties()).thenReturn(properties);
    when(configurationAdmin.getConfiguration(OFConstants.CONFIG_FILE_ID)).thenReturn(configuration);
    when(bundleContext.getService(serviceReference)).thenReturn(configurationAdmin);
    when(bundleContext.getServiceReference(ConfigurationAdmin.class)).thenReturn(serviceReference);
    configurationService = new ConfigurationServiceFactoryImpl().newInstance(config, bundleContext);
}
Also used : NonZeroUint16Type(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint16Type) Hashtable(java.util.Hashtable) NonZeroUint32Type(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint32Type) Before(org.junit.Before)

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