Search in sources :

Example 16 with ComponentConfigAdapter

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

the class LinkCollectionIntentCompilerDomainP2PTest 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;
    // defining the domain assignments
    domainService = createMock(DomainService.class);
    expect(domainService.getDomain(d1Id)).andReturn(LOCAL).anyTimes();
    expect(domainService.getDomain(d2Id)).andReturn(domain).anyTimes();
    expect(domainService.getDomain(d4Id)).andReturn(domain).anyTimes();
    expect(domainService.getDomain(d3Id)).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();
    LinkCollectionCompiler.optimizeInstructions = false;
    LinkCollectionCompiler.copyTtl = false;
    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 17 with ComponentConfigAdapter

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

the class IntentManagerTest method testCorruptRetry.

/**
 * Test failure to install an intent, and verify retries.
 */
@Test
public void testCorruptRetry() {
    IntentCleanup cleanup = new IntentCleanup();
    cleanup.service = manager;
    cleanup.store = manager.store;
    cleanup.cfgService = new ComponentConfigAdapter();
    cleanup.period = 1_000_000;
    cleanup.retryThreshold = 3;
    try {
        cleanup.activate();
        final TestIntentCompilerMultipleFlows errorCompiler = new TestIntentCompilerMultipleFlows();
        extensionService.registerCompiler(MockIntent.class, errorCompiler);
        List<Intent> intents;
        flowRuleService.setFuture(false);
        intents = Lists.newArrayList(service.getIntents());
        assertThat(intents, hasSize(0));
        final MockIntent intent1 = new MockIntent(MockIntent.nextId());
        listener.setLatch(1, Type.INSTALL_REQ);
        listener.setLatch(cleanup.retryThreshold, Type.CORRUPT);
        listener.setLatch(1, Type.INSTALLED);
        service.submit(intent1);
        listener.await(Type.INSTALL_REQ);
        listener.await(Type.CORRUPT);
        assertEquals(CORRUPT, manager.getIntentState(intent1.key()));
        assertThat(listener.getCounts(Type.CORRUPT), is(cleanup.retryThreshold));
    } finally {
        cleanup.deactivate();
    }
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) FlowRuleIntent(org.onosproject.net.intent.FlowRuleIntent) Intent(org.onosproject.net.intent.Intent) PathIntent(org.onosproject.net.intent.PathIntent) MockIntent(org.onosproject.net.intent.IntentTestsMocks.MockIntent) MockIntent(org.onosproject.net.intent.IntentTestsMocks.MockIntent) Test(org.junit.Test)

Example 18 with ComponentConfigAdapter

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

the class HostLocationProviderTest method setUp.

@Before
public void setUp() {
    coreService = createMock(CoreService.class);
    expect(coreService.registerApplication(appId.name())).andReturn(appId).anyTimes();
    replay(coreService);
    provider.cfgService = new ComponentConfigAdapter();
    provider.coreService = coreService;
    provider.providerRegistry = hostRegistry;
    provider.topologyService = topoService;
    provider.packetService = packetService;
    provider.deviceService = deviceService;
    provider.hostService = hostService;
    provider.interfaceService = interfaceService;
    provider.registry = registryAdapter;
    provider.netcfgService = netcfgService;
    provider.activate(CTX_FOR_NO_REMOVE);
    provider.deviceEventHandler = MoreExecutors.newDirectExecutorService();
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) CoreService(org.onosproject.core.CoreService) Before(org.junit.Before)

Example 19 with ComponentConfigAdapter

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

the class LinkDiscoveryProviderTest method setUp.

@Before
public void setUp() {
    coreService = createMock(CoreService.class);
    expect(coreService.registerApplication(appId.name())).andReturn(appId).anyTimes();
    replay(coreService);
    provider.coreService = coreService;
    provider.providerRegistry = linkRegistry;
    provider.deviceService = deviceService;
    provider.mastershipService = mastershipService;
    provider.linkService = linkService;
    provider.cfgService = new ComponentConfigAdapter();
    AbstractProjectableModel.setDriverService(null, new DriverServiceAdapter());
    provider.activate(null);
    providerService = linkRegistry.registeredProvider();
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) DriverServiceAdapter(org.onosproject.net.driver.DriverServiceAdapter) CoreService(org.onosproject.core.CoreService) Before(org.junit.Before)

Example 20 with ComponentConfigAdapter

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

the class LinkCollectionIntentCompilerP2PTest 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();
    LinkCollectionCompiler.optimizeInstructions = false;
    LinkCollectionCompiler.copyTtl = false;
    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)

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