Search in sources :

Example 6 with DomainService

use of org.onosproject.net.domain.DomainService 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 7 with DomainService

use of org.onosproject.net.domain.DomainService 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 8 with DomainService

use of org.onosproject.net.domain.DomainService in project onos by opennetworkinglab.

the class GetDomainsCommand method doExecute.

@Override
public void doExecute() {
    DomainService domainService = AbstractShellCommand.get(DomainService.class);
    Set<DomainId> domainIds = domainService.getDomainIds();
    domainIds.forEach(domainId -> print("%s", domainId.id()));
}
Also used : DomainId(org.onosproject.net.domain.DomainId) DomainService(org.onosproject.net.domain.DomainService)

Aggregations

DomainService (org.onosproject.net.domain.DomainService)8 Before (org.junit.Before)6 ComponentConfigAdapter (org.onosproject.cfg.ComponentConfigAdapter)6 CoreService (org.onosproject.core.CoreService)6 IntentExtensionService (org.onosproject.net.intent.IntentExtensionService)6 MockResourceService (org.onosproject.net.resource.MockResourceService)6 DomainId (org.onosproject.net.domain.DomainId)2 StringsCompleter (org.apache.karaf.shell.support.completers.StringsCompleter)1 FilteredConnectPoint (org.onosproject.net.FilteredConnectPoint)1 FlowObjectiveServiceAdapter (org.onosproject.net.flowobjective.FlowObjectiveServiceAdapter)1