Search in sources :

Example 26 with ComponentConfigAdapter

use of org.onosproject.cfg.ComponentConfigAdapter in project onos by opennetworkinglab.

the class NetconfDeviceProviderTest method setUp.

@Before
public void setUp() throws IOException {
    coreService = createMock(CoreService.class);
    expect(coreService.registerApplication(APP_NAME)).andReturn(appId).anyTimes();
    replay(coreService);
    provider.coreService = coreService;
    provider.providerRegistry = deviceRegistry;
    provider.mastershipService = mastershipService;
    provider.deviceService = deviceService;
    provider.providerService = providerService;
    provider.cfgService = cfgService;
    provider.controller = controller;
    provider.deviceKeyAdminService = deviceKeyAdminService;
    provider.componentConfigService = new ComponentConfigAdapter();
    AbstractProjectableModel.setDriverService(null, new DriverServiceAdapter());
    provider.activate(null);
    devices.clear();
    available = false;
    firstRequest = true;
    DeviceId subject = DeviceId.deviceId(NETCONF_DEVICE_ID_STRING);
    DeviceId subjectIpv6 = DeviceId.deviceId(NETCONF_DEVICE_ID_STRING_IPV6);
    String key = "netconf";
    ObjectMapper mapper = new ObjectMapper();
    JsonNode jsonNode = mapper.readTree(jsonStream);
    ConfigApplyDelegate delegate = new MockDelegate();
    netconfDeviceConfig.init(subject, key, jsonNode, mapper, delegate);
    JsonNode jsonNodesshKey = mapper.readTree(jsonStreamSshKey);
    netconfDeviceConfigSshKey.init(subject, key, jsonNodesshKey, mapper, delegate);
    JsonNode jsonNodeEmpty = mapper.createObjectNode();
    netconfDeviceConfigEmptyIpv4.init(subject, key, jsonNodeEmpty, mapper, delegate);
    netconfDeviceConfigEmptyIpv6.init(subjectIpv6, key, jsonNodeEmpty, mapper, delegate);
    deviceAdded = new CountDownLatch(0);
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) DriverServiceAdapter(org.onosproject.net.driver.DriverServiceAdapter) DeviceId(org.onosproject.net.DeviceId) CoreService(org.onosproject.core.CoreService) JsonNode(com.fasterxml.jackson.databind.JsonNode) CountDownLatch(java.util.concurrent.CountDownLatch) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ConfigApplyDelegate(org.onosproject.net.config.ConfigApplyDelegate) Before(org.junit.Before)

Example 27 with ComponentConfigAdapter

use of org.onosproject.cfg.ComponentConfigAdapter in project onos by opennetworkinglab.

the class InfluxDbMetricsReporterTest method setUp.

/**
 * Sets up the services required by influxDB metrics reporter.
 */
@Before
public void setUp() {
    influxReporter = new DefaultInfluxDbMetricsReporter();
    influxReporter.coreService = new CoreServiceAdapter();
    influxReporter.cfgService = new ComponentConfigAdapter();
    influxReporter.clusterService = new ClusterServiceAdapter();
    influxReporter.metricsService = new TestMetricsService();
    influxReporter.activate();
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) CoreServiceAdapter(org.onosproject.core.CoreServiceAdapter) ClusterServiceAdapter(org.onosproject.cluster.ClusterServiceAdapter) Before(org.junit.Before)

Example 28 with ComponentConfigAdapter

use of org.onosproject.cfg.ComponentConfigAdapter in project onos by opennetworkinglab.

the class LinkCollectionOptimizationTest method setUp.

@Before
public void setUp() {
    sut = new LinkCollectionIntentCompiler();
    coreService = createMock(CoreService.class);
    expect(coreService.registerApplication("org.onosproject.net.intent")).andReturn(appId);
    sut.coreService = coreService;
    domainService = createMock(DomainService.class);
    expect(domainService.getDomain(anyObject(DeviceId.class))).andReturn(LOCAL).anyTimes();
    sut.domainService = domainService;
    super.setUp();
    intentExtensionService = createMock(IntentExtensionService.class);
    intentExtensionService.registerCompiler(LinkCollectionIntent.class, sut);
    intentExtensionService.unregisterCompiler(LinkCollectionIntent.class);
    registrator = new IntentConfigurableRegistrator();
    registrator.extensionService = intentExtensionService;
    registrator.cfgService = new ComponentConfigAdapter();
    registrator.activate();
    sut.registrator = registrator;
    sut.resourceService = new MockResourceService();
    /*
         * We activate the optimizations.
         */
    LinkCollectionCompiler.optimizeInstructions = true;
    LinkCollectionCompiler.copyTtl = true;
    replay(coreService, domainService, intentExtensionService);
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) IntentExtensionService(org.onosproject.net.intent.IntentExtensionService) MockResourceService(org.onosproject.net.resource.MockResourceService) DomainService(org.onosproject.net.domain.DomainService) CoreService(org.onosproject.core.CoreService) Before(org.junit.Before)

Example 29 with ComponentConfigAdapter

use of org.onosproject.cfg.ComponentConfigAdapter in project onos by opennetworkinglab.

the class VirtualNetworkPacketManagerWithDistStoreTest method setUpDistPacketStore.

private void setUpDistPacketStore() throws TestUtils.TestUtilsException {
    distStore = new DistributedVirtualPacketStore();
    TestUtils.setField(distStore, "cfgService", new ComponentConfigAdapter());
    TestUtils.setField(distStore, "storageService", storageService);
    TestUtils.setField(distStore, "clusterService", clusterService);
    TestUtils.setField(distStore, "communicationService", new TestClusterCommunicationService());
    TestUtils.setField(distStore, "mastershipService", new TestMastershipService());
    distStore.activate(new ComponentContextAdapter());
    // super.setUp() will cause Distributed store to be used.
    packetStore = distStore;
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) ComponentContextAdapter(org.onlab.osgi.ComponentContextAdapter) DistributedVirtualPacketStore(org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualPacketStore)

Example 30 with ComponentConfigAdapter

use of org.onosproject.cfg.ComponentConfigAdapter in project onos by opennetworkinglab.

the class ECFlowRuleStoreTest method setUp.

@Before
public void setUp() throws Exception {
    flowStoreImpl = new ECFlowRuleStore();
    flowStoreImpl.storageService = new TestStorageService() {

        @Override
        public <K, V> ConsistentMapBuilder<K, V> consistentMapBuilder() {
            return new ConsistentMapBuilder<K, V>() {

                @Override
                public AsyncConsistentMap<K, V> buildAsyncMap() {
                    return new AsyncConsistentMapAdapter<K, V>();
                }

                @Override
                public ConsistentMap<K, V> build() {
                    return null;
                }
            };
        }
    };
    ReplicaInfoManager replicaInfoManager = new ReplicaInfoManager();
    replicaInfoManager.mastershipService = new MasterOfAll();
    flowStoreImpl.replicaInfoManager = replicaInfoManager;
    mockClusterService = createMock(ClusterService.class);
    flowStoreImpl.clusterService = mockClusterService;
    nodeId = new NodeId("1");
    mockControllerNode = new MockControllerNode(nodeId);
    expect(mockClusterService.getLocalNode()).andReturn(mockControllerNode).anyTimes();
    replay(mockClusterService);
    flowStoreImpl.clusterCommunicator = new ClusterCommunicationServiceAdapter();
    flowStoreImpl.mastershipService = new MasterOfAll();
    flowStoreImpl.deviceService = new DeviceServiceAdapter();
    flowStoreImpl.coreService = new CoreServiceAdapter();
    flowStoreImpl.configService = new ComponentConfigAdapter();
    flowStoreImpl.persistenceService = new PersistenceServiceAdapter();
    flowStoreImpl.activate(context);
}
Also used : PersistenceServiceAdapter(org.onosproject.store.persistence.PersistenceServiceAdapter) TestStorageService(org.onosproject.store.service.TestStorageService) ClusterCommunicationServiceAdapter(org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter) ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) ClusterService(org.onosproject.cluster.ClusterService) CoreServiceAdapter(org.onosproject.core.CoreServiceAdapter) ConsistentMap(org.onosproject.store.service.ConsistentMap) AsyncConsistentMap(org.onosproject.store.service.AsyncConsistentMap) NodeId(org.onosproject.cluster.NodeId) AsyncConsistentMap(org.onosproject.store.service.AsyncConsistentMap) ConsistentMapBuilder(org.onosproject.store.service.ConsistentMapBuilder) DeviceServiceAdapter(org.onosproject.net.device.DeviceServiceAdapter) Before(org.junit.Before)

Aggregations

ComponentConfigAdapter (org.onosproject.cfg.ComponentConfigAdapter)30 Before (org.junit.Before)27 CoreService (org.onosproject.core.CoreService)12 IntentExtensionService (org.onosproject.net.intent.IntentExtensionService)7 MockResourceService (org.onosproject.net.resource.MockResourceService)7 TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)6 DomainService (org.onosproject.net.domain.DomainService)6 ClusterService (org.onosproject.cluster.ClusterService)4 NodeId (org.onosproject.cluster.NodeId)4 DeviceServiceAdapter (org.onosproject.net.device.DeviceServiceAdapter)4 DriverServiceAdapter (org.onosproject.net.driver.DriverServiceAdapter)4 CoreServiceAdapter (org.onosproject.core.CoreServiceAdapter)3 DefaultDriver (org.onosproject.net.driver.DefaultDriver)3 DriverRegistryManager (org.onosproject.net.driver.impl.DriverRegistryManager)3 ClusterCommunicationServiceAdapter (org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter)3 TestStorageService (org.onosproject.store.service.TestStorageService)3 Test (org.junit.Test)2 ComponentContextAdapter (org.onlab.osgi.ComponentContextAdapter)2 FlowRuleIntent (org.onosproject.net.intent.FlowRuleIntent)2 Intent (org.onosproject.net.intent.Intent)2