use of org.onosproject.inbandtelemetry.rest.IntIntentCodec 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");
}
Aggregations