use of org.onosproject.inbandtelemetry.api.IntIntent in project onos by opennetworkinglab.
the class SimpleIntManager method activate.
@Activate
public void activate() {
final ApplicationId appId = coreService.registerApplication(APP_NAME);
KryoNamespace.Builder serializer = KryoNamespace.newBuilder().register(KryoNamespaces.API).register(IntIntent.class).register(IntIntentId.class).register(IntDeviceRole.class).register(IntIntent.IntHeaderType.class).register(IntMetadataType.class).register(IntIntent.IntReportType.class).register(IntIntent.TelemetryMode.class).register(IntDeviceConfig.class).register(IntDeviceConfig.TelemetrySpec.class);
codecService.registerCodec(IntIntent.class, new IntIntentCodec());
devicesToConfigure = storageService.<DeviceId, Long>consistentMapBuilder().withSerializer(Serializer.using(serializer.build())).withName("onos-int-devices-to-configure").withApplicationId(appId).withPurgeOnUninstall().build();
devicesToConfigure.addListener(devicesToConfigureListener);
intentMap = storageService.<IntIntentId, IntIntent>consistentMapBuilder().withSerializer(Serializer.using(serializer.build())).withName("onos-int-intents").withApplicationId(appId).withPurgeOnUninstall().build();
intentMap.addListener(intentMapListener);
intStarted = storageService.<Boolean>atomicValueBuilder().withSerializer(Serializer.using(serializer.build())).withName("onos-int-started").withApplicationId(appId).build().asAtomicValue();
intStarted.addListener(intStartedListener);
intConfig = storageService.<IntDeviceConfig>atomicValueBuilder().withSerializer(Serializer.using(serializer.build())).withName("onos-int-config").withApplicationId(appId).build().asAtomicValue();
intConfig.addListener(intConfigListener);
intentIds = storageService.getAtomicIdGenerator("int-intent-id-generator");
// Bootstrap config for already existing devices.
triggerAllDeviceConfigure();
// Bootstrap core event executor before adding listener
eventExecutor = newSingleThreadScheduledExecutor(groupedThreads("onos/int", "events-%d", log));
hostService.addListener(hostListener);
deviceService.addListener(deviceListener);
netcfgRegistry.registerConfigFactory(intAppConfigFactory);
netcfgService.addListener(appConfigListener);
// Initialize the INT report
IntReportConfig reportConfig = netcfgService.getConfig(appId, IntReportConfig.class);
if (reportConfig != null) {
IntDeviceConfig intDeviceConfig = IntDeviceConfig.builder().withMinFlowHopLatencyChangeNs(reportConfig.minFlowHopLatencyChangeNs()).withCollectorPort(reportConfig.collectorPort()).withCollectorIp(reportConfig.collectorIp()).enabled(true).build();
setConfig(intDeviceConfig);
}
startInt();
log.info("Started");
}
use of org.onosproject.inbandtelemetry.api.IntIntent in project onos by opennetworkinglab.
the class TestCodecService method installTestIntents.
/*
* Utilities
*/
private void installTestIntents() {
// Pre-install an INT intent to the manager.
IntIntent.Builder intentBuilder = IntIntent.builder().withHeaderType(IntIntent.IntHeaderType.HOP_BY_HOP).withReportType(IntIntent.IntReportType.TRACKED_FLOW);
IntIntent postcardIntent = intentBuilder.withTelemetryMode(IntIntent.TelemetryMode.POSTCARD).withSelector(FLOW_SELECTOR1).build();
IntIntent nonPoscardIntent = intentBuilder.withTelemetryMode(IntIntent.TelemetryMode.INBAND_TELEMETRY).withSelector(FLOW_SELECTOR2).build();
manager.installIntIntent(nonPoscardIntent);
manager.installIntIntent(postcardIntent);
}
Aggregations