Search in sources :

Example 21 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.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 22 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.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 23 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.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 24 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.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)

Example 25 with Config

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project openflowplugin by opendaylight.

the class LLDPLinkAgerTest method getConfigurationService.

private ConfigurationService getConfigurationService() {
    final ConfigurationService configurationService = Mockito.mock(ConfigurationService.class);
    final TopologyLldpDiscoveryConfig config = getConfig();
    Mockito.when(configurationService.registerListener(Mockito.any())).thenReturn(() -> {
    });
    Mockito.when(configurationService.getProperty(Mockito.eq("topology-lldp-interval"), Mockito.any())).thenReturn(config.getTopologyLldpInterval());
    Mockito.when(configurationService.getProperty(Mockito.eq("topology-lldp-expiration-interval"), Mockito.any())).thenReturn(config.getTopologyLldpExpirationInterval());
    return configurationService;
}
Also used : TopologyLldpDiscoveryConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.lldp.discovery.config.rev160511.TopologyLldpDiscoveryConfig) ConfigurationService(org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService)

Aggregations

ArrayList (java.util.ArrayList)61 ExecutionException (java.util.concurrent.ExecutionException)47 Test (org.junit.Test)46 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)34 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)29 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)26 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)26 BigInteger (java.math.BigInteger)25 Logger (org.slf4j.Logger)25 LoggerFactory (org.slf4j.LoggerFactory)25 List (java.util.List)24 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)24 ByteBuf (io.netty.buffer.ByteBuf)21 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)21 Collections (java.util.Collections)20 Map (java.util.Map)18 Singleton (javax.inject.Singleton)18 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)18 Inject (javax.inject.Inject)17 DataBroker (org.opendaylight.mdsal.binding.api.DataBroker)17