use of org.onosproject.net.resource.MockResourceService in project onos by opennetworkinglab.
the class PointToPointIntentCompilerTest method makeCompiler.
/**
* Creates a point to point intent compiler for a three switch linear
* topology.
*
* @param resourceService service to use for resource allocation requests
* @return point to point compiler
*/
private PointToPointIntentCompiler makeCompiler(String[] hops, ResourceService resourceService) {
final PointToPointIntentCompiler compiler = new PointToPointIntentCompiler();
compiler.pathService = new IntentTestsMocks.MockPathService(hops);
if (resourceService == null) {
compiler.resourceService = new MockResourceService();
} else {
compiler.resourceService = resourceService;
}
return compiler;
}
use of org.onosproject.net.resource.MockResourceService in project onos by opennetworkinglab.
the class SinglePointToMultiPointIntentCompilerTest method makeCompiler.
/**
* Creates a compiler for SinglePointToMultiPoint intents.
*
* @param hops hops to use while computing paths for this intent
* @param pathService the path service
* @param resourceService the resource service
* @return a single point to multi point intent compiler
*/
private SinglePointToMultiPointIntentCompiler makeCompiler(String[] hops, PathService pathService, ResourceService resourceService) {
SinglePointToMultiPointIntentCompiler compiler = new SinglePointToMultiPointIntentCompiler();
compiler.deviceService = new IntentTestsMocks.MockDeviceService();
if (pathService == null) {
compiler.pathService = new IntentTestsMocks.Mp2MpMockPathService(hops);
} else {
compiler.pathService = pathService;
}
if (resourceService == null) {
compiler.resourceService = new MockResourceService();
} else {
compiler.resourceService = resourceService;
}
return compiler;
}
use of org.onosproject.net.resource.MockResourceService in project onos by opennetworkinglab.
the class LinkCollectionEncapIntentCompilerTest 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.net.resource.MockResourceService in project onos by opennetworkinglab.
the class HostToHostIntentCompilerTest method makeCompiler.
/**
* Creates a compiler for HostToHost intents.
*
* @param hops string array describing the path hops to use when compiling
* @param resourceService the resource service
* @return HostToHost intent compiler
*/
private HostToHostIntentCompiler makeCompiler(String[] hops, ResourceService resourceService) {
HostToHostIntentCompiler compiler = new HostToHostIntentCompiler();
compiler.pathService = new IntentTestsMocks.MockPathService(hops);
compiler.hostService = mockHostService;
if (resourceService == null) {
compiler.resourceService = new MockResourceService();
} else {
compiler.resourceService = resourceService;
}
return compiler;
}
use of org.onosproject.net.resource.MockResourceService 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);
}
Aggregations