Search in sources :

Example 1 with MockResourceService

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);
}
Also used : MockResourceService(org.onosproject.net.resource.MockResourceService) IntentExtensionService(org.onosproject.net.intent.IntentExtensionService) CoreService(org.onosproject.core.CoreService) Before(org.junit.Before)

Example 2 with MockResourceService

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);
}
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 3 with MockResourceService

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();
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) MockResourceService(org.onosproject.net.resource.MockResourceService) IntentExtensionService(org.onosproject.net.intent.IntentExtensionService) DomainService(org.onosproject.net.domain.DomainService) FlowObjectiveServiceAdapter(org.onosproject.net.flowobjective.FlowObjectiveServiceAdapter) CoreService(org.onosproject.core.CoreService) Before(org.junit.Before)

Example 4 with MockResourceService

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;
}
Also used : MockResourceService(org.onosproject.net.resource.MockResourceService) IntentTestsMocks(org.onosproject.net.intent.IntentTestsMocks)

Example 5 with MockResourceService

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;
}
Also used : MockResourceService(org.onosproject.net.resource.MockResourceService) IntentTestsMocks(org.onosproject.net.intent.IntentTestsMocks)

Aggregations

MockResourceService (org.onosproject.net.resource.MockResourceService)15 Before (org.junit.Before)10 CoreService (org.onosproject.core.CoreService)9 IntentExtensionService (org.onosproject.net.intent.IntentExtensionService)9 ComponentConfigAdapter (org.onosproject.cfg.ComponentConfigAdapter)7 DomainService (org.onosproject.net.domain.DomainService)6 IntentTestsMocks (org.onosproject.net.intent.IntentTestsMocks)5 ComponentConfigService (org.onosproject.cfg.ComponentConfigService)1 DefaultPath (org.onosproject.net.DefaultPath)1 FilteredConnectPoint (org.onosproject.net.FilteredConnectPoint)1 FlowObjectiveServiceAdapter (org.onosproject.net.flowobjective.FlowObjectiveServiceAdapter)1 EncapsulationConstraint (org.onosproject.net.intent.constraint.EncapsulationConstraint)1