Search in sources :

Example 6 with IntentExtensionService

use of org.onosproject.net.intent.IntentExtensionService in project onos by opennetworkinglab.

the class IntentListCompilers method doExecute.

@Override
protected void doExecute() {
    IntentExtensionService service = get(IntentExtensionService.class);
    OptionalInt length = service.getCompilers().keySet().stream().mapToInt(s -> s.getName().length()).max();
    if (length.isPresent()) {
        service.getCompilers().entrySet().forEach(e -> {
            print("%-" + length.getAsInt() + "s\t%s", e.getKey().getName(), e.getValue().getClass().getName());
        });
    } else {
        print("There are no compilers registered.");
    }
}
Also used : AbstractShellCommand(org.onosproject.cli.AbstractShellCommand) IntentExtensionService(org.onosproject.net.intent.IntentExtensionService) Service(org.apache.karaf.shell.api.action.lifecycle.Service) OptionalInt(java.util.OptionalInt) Command(org.apache.karaf.shell.api.action.Command) IntentExtensionService(org.onosproject.net.intent.IntentExtensionService) OptionalInt(java.util.OptionalInt)

Example 7 with IntentExtensionService

use of org.onosproject.net.intent.IntentExtensionService in project onos by opennetworkinglab.

the class IntentListInstallers method doExecute.

@Override
protected void doExecute() {
    IntentExtensionService service = get(IntentExtensionService.class);
    OptionalInt length = service.getInstallers().keySet().stream().mapToInt(s -> s.getName().length()).max();
    if (length.isPresent()) {
        service.getInstallers().entrySet().forEach(e -> {
            print("%-" + length.getAsInt() + "s\t%s", e.getKey().getName(), e.getValue().getClass().getName());
        });
    } else {
        print("There are no installers registered.");
    }
}
Also used : AbstractShellCommand(org.onosproject.cli.AbstractShellCommand) IntentExtensionService(org.onosproject.net.intent.IntentExtensionService) Service(org.apache.karaf.shell.api.action.lifecycle.Service) OptionalInt(java.util.OptionalInt) Command(org.apache.karaf.shell.api.action.Command) IntentExtensionService(org.onosproject.net.intent.IntentExtensionService) OptionalInt(java.util.OptionalInt)

Example 8 with IntentExtensionService

use of org.onosproject.net.intent.IntentExtensionService in project onos by opennetworkinglab.

the class LinkCollectionIntentCompilerDomainP2PTest 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;
    // defining the domain assignments
    domainService = createMock(DomainService.class);
    expect(domainService.getDomain(d1Id)).andReturn(LOCAL).anyTimes();
    expect(domainService.getDomain(d2Id)).andReturn(domain).anyTimes();
    expect(domainService.getDomain(d4Id)).andReturn(domain).anyTimes();
    expect(domainService.getDomain(d3Id)).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 9 with IntentExtensionService

use of org.onosproject.net.intent.IntentExtensionService 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 10 with IntentExtensionService

use of org.onosproject.net.intent.IntentExtensionService 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)

Aggregations

IntentExtensionService (org.onosproject.net.intent.IntentExtensionService)12 Before (org.junit.Before)10 CoreService (org.onosproject.core.CoreService)10 MockResourceService (org.onosproject.net.resource.MockResourceService)9 ComponentConfigAdapter (org.onosproject.cfg.ComponentConfigAdapter)7 DomainService (org.onosproject.net.domain.DomainService)6 OptionalInt (java.util.OptionalInt)2 Command (org.apache.karaf.shell.api.action.Command)2 Service (org.apache.karaf.shell.api.action.lifecycle.Service)2 AbstractShellCommand (org.onosproject.cli.AbstractShellCommand)2 DefaultPath (org.onosproject.net.DefaultPath)2 ComponentConfigService (org.onosproject.cfg.ComponentConfigService)1 FilteredConnectPoint (org.onosproject.net.FilteredConnectPoint)1 FlowObjectiveServiceAdapter (org.onosproject.net.flowobjective.FlowObjectiveServiceAdapter)1 EncapsulationConstraint (org.onosproject.net.intent.constraint.EncapsulationConstraint)1