use of org.onosproject.net.resource.MockResourceService in project onos by opennetworkinglab.
the class OpticalOduIntentCompilerTest method setUp.
@Before
public void setUp() {
AbstractProjectableModel.setDriverService(null, new MockDriverService());
sut = new OpticalOduIntentCompiler();
coreService = createMock(CoreService.class);
expect(coreService.registerApplication("org.onosproject.net.intent")).andReturn(appId);
sut.coreService = coreService;
sut.deviceService = new MockDeviceService();
sut.resourceService = new MockResourceService();
sut.topologyService = new MockTopologyService();
super.setUp();
intentExtensionService = createMock(IntentExtensionService.class);
intentExtensionService.registerCompiler(OpticalOduIntent.class, sut);
intentExtensionService.unregisterCompiler(OpticalOduIntent.class);
sut.intentManager = intentExtensionService;
replay(coreService, intentExtensionService);
}
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 LinkCollectionIntentFlowObjectiveCompilerTest method setUp.
@Before
public void setUp() {
compiler = new LinkCollectionIntentFlowObjectiveCompiler();
coreService = createMock(CoreService.class);
expect(coreService.registerApplication("org.onosproject.net.intent")).andReturn(appId);
flowObjectiveService = new FlowObjectiveServiceAdapter();
resourceService = new MockResourceService();
compiler.coreService = coreService;
compiler.flowObjectiveService = flowObjectiveService;
domainService = createMock(DomainService.class);
expect(domainService.getDomain(anyObject(DeviceId.class))).andReturn(LOCAL).anyTimes();
compiler.domainService = domainService;
super.setUp();
intentExtensionService = createMock(IntentExtensionService.class);
intentExtensionService.registerCompiler(LinkCollectionIntent.class, compiler);
intentExtensionService.unregisterCompiler(LinkCollectionIntent.class);
registrator = new IntentConfigurableRegistrator();
registrator.extensionService = intentExtensionService;
registrator.cfgService = new ComponentConfigAdapter();
registrator.activate();
compiler.registrator = registrator;
compiler.resourceService = resourceService;
LinkCollectionCompiler.optimizeInstructions = false;
LinkCollectionCompiler.copyTtl = false;
replay(coreService, domainService, intentExtensionService);
compiler.activate();
}
use of org.onosproject.net.resource.MockResourceService in project onos by opennetworkinglab.
the class MultiPointToSinglePointIntentCompilerTest method makeCompiler.
/**
* Creates a compiler for MultiPointToSinglePoint intents.
*
* @param hops hops to use while computing paths for this intent
* @param pathService the path service
* @param resourceService the resource service
* @return MultiPointToSinglePoint intent
*/
private MultiPointToSinglePointIntentCompiler makeCompiler(String[] hops, PathService pathService, ResourceService resourceService) {
MultiPointToSinglePointIntentCompiler compiler = new MultiPointToSinglePointIntentCompiler();
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 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;
}
Aggregations