use of org.onosproject.core.CoreService 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.core.CoreService 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);
}
use of org.onosproject.core.CoreService in project onos by opennetworkinglab.
the class LinkCollectionIntentCompilerTest 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();
intent = LinkCollectionIntent.builder().appId(APP_ID).selector(selector).treatment(treatment).links(links).filteredIngressPoints(ImmutableSet.of(new FilteredConnectPoint(d1p1))).filteredEgressPoints(ImmutableSet.of(new FilteredConnectPoint(d3p1))).build();
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.core.CoreService 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);
}
use of org.onosproject.core.CoreService in project onos by opennetworkinglab.
the class LldpLinkProviderTest method setUp.
@Before
public void setUp() {
deviceBlacklist = new HashSet<>();
portBlacklist = new HashSet<>();
cfg = new TestSuppressionConfig();
coreService = createMock(CoreService.class);
expect(coreService.registerApplication(appId.name())).andReturn(appId).anyTimes();
replay(coreService);
provider.cfgService = new ComponentConfigAdapter();
provider.enabled = false;
provider.coreService = coreService;
provider.cfgRegistry = configRegistry;
provider.deviceService = deviceService;
provider.linkService = linkService;
provider.packetService = packetService;
provider.providerRegistry = linkRegistry;
provider.masterService = masterService;
provider.clusterMetadataService = new ClusterMetadataServiceAdapter();
provider.activate(null);
provider.eventExecutor = MoreExecutors.newDirectExecutorService();
providerService = linkRegistry.registeredProvider();
}
Aggregations