use of org.onosproject.net.intent.IntentExtensionService 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);
}
use of org.onosproject.net.intent.IntentExtensionService in project onos by opennetworkinglab.
the class OpticalPathIntentCompilerTest method setUp.
@Before
public void setUp() {
sut = new OpticalPathIntentCompiler();
coreService = createMock(CoreService.class);
expect(coreService.registerApplication("org.onosproject.net.intent")).andReturn(appId);
sut.coreService = coreService;
super.setUp();
intent = OpticalPathIntent.builder().appId(appId).src(d1p1).dst(d3p1).path(new DefaultPath(PID, links, ScalarWeight.toWeight(hops))).lambda(createLambda()).signalType(OchSignalType.FIXED_GRID).build();
intentExtensionService = createMock(IntentExtensionService.class);
intentExtensionService.registerCompiler(OpticalPathIntent.class, sut);
intentExtensionService.unregisterCompiler(OpticalPathIntent.class);
sut.intentManager = intentExtensionService;
replay(coreService, 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.");
}
}
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.");
}
}
use of org.onosproject.net.intent.IntentExtensionService 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);
}
Aggregations