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);
}
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();
}
}
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();
}
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();
}
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);
}
Aggregations