Search in sources :

Example 11 with MockResourceService

use of org.onosproject.net.resource.MockResourceService 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);
}
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 12 with MockResourceService

use of org.onosproject.net.resource.MockResourceService 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);
}
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) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint) Before(org.junit.Before)

Example 13 with MockResourceService

use of org.onosproject.net.resource.MockResourceService 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);
}
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 14 with MockResourceService

use of org.onosproject.net.resource.MockResourceService in project onos by opennetworkinglab.

the class LabelAllocatorTest method setUp.

@Before
public void setUp() {
    this.resourceService = new MockResourceService();
    this.allocator = new LabelAllocator(this.resourceService);
}
Also used : MockResourceService(org.onosproject.net.resource.MockResourceService) Before(org.junit.Before)

Example 15 with MockResourceService

use of org.onosproject.net.resource.MockResourceService in project onos by opennetworkinglab.

the class OpticalCircuitIntentCompilerTest method setUp.

@Before
public void setUp() {
    sut = new OpticalCircuitIntentCompiler();
    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.intentService = new TestIntentService();
    sut.intentSetMultimap = new MockIntentSetMultimap();
    super.setUp();
    intentExtensionService = createMock(IntentExtensionService.class);
    intentExtensionService.registerCompiler(OpticalCircuitIntent.class, sut);
    intentExtensionService.unregisterCompiler(OpticalCircuitIntent.class);
    sut.intentManager = intentExtensionService;
    replay(coreService, intentExtensionService);
    // mocking ComponentConfigService
    ComponentConfigService mockConfigService = EasyMock.createMock(ComponentConfigService.class);
    expect(mockConfigService.getProperties(anyObject())).andReturn(ImmutableSet.of());
    mockConfigService.registerProperties(sut.getClass());
    expectLastCall();
    mockConfigService.unregisterProperties(sut.getClass(), false);
    expectLastCall();
    expect(mockConfigService.getProperties(anyObject())).andReturn(ImmutableSet.of());
    sut.cfgService = mockConfigService;
    replay(mockConfigService);
}
Also used : ComponentConfigService(org.onosproject.cfg.ComponentConfigService) MockResourceService(org.onosproject.net.resource.MockResourceService) IntentExtensionService(org.onosproject.net.intent.IntentExtensionService) CoreService(org.onosproject.core.CoreService) Before(org.junit.Before)

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