Search in sources :

Example 1 with DomainService

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

the class DomainIdCompleter method complete.

@Override
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
    // Delegate string completer
    StringsCompleter delegate = new StringsCompleter();
    // Fetch our service and feed it's offerings to the string completer
    DomainService service = AbstractShellCommand.get(DomainService.class);
    Iterator<DomainId> it = service.getDomainIds().iterator();
    SortedSet<String> strings = delegate.getStrings();
    while (it.hasNext()) {
        strings.add(it.next().id());
    }
    // Now let the completer do the work for figuring out what to offer.
    return delegate.complete(session, commandLine, candidates);
}
Also used : DomainId(org.onosproject.net.domain.DomainId) StringsCompleter(org.apache.karaf.shell.support.completers.StringsCompleter) DomainService(org.onosproject.net.domain.DomainService)

Example 2 with DomainService

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

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

Example 5 with DomainService

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

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