Search in sources :

Example 1 with IntIntentCodec

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");
}
Also used : IntIntentId(org.onosproject.inbandtelemetry.api.IntIntentId) IntIntent(org.onosproject.inbandtelemetry.api.IntIntent) IntDeviceConfig(org.onosproject.net.behaviour.inbandtelemetry.IntDeviceConfig) DeviceId(org.onosproject.net.DeviceId) IntIntentCodec(org.onosproject.inbandtelemetry.rest.IntIntentCodec) IntReportConfig(org.onosproject.net.behaviour.inbandtelemetry.IntReportConfig) KryoNamespace(org.onlab.util.KryoNamespace) ApplicationId(org.onosproject.core.ApplicationId) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

KryoNamespace (org.onlab.util.KryoNamespace)1 ApplicationId (org.onosproject.core.ApplicationId)1 IntIntent (org.onosproject.inbandtelemetry.api.IntIntent)1 IntIntentId (org.onosproject.inbandtelemetry.api.IntIntentId)1 IntIntentCodec (org.onosproject.inbandtelemetry.rest.IntIntentCodec)1 DeviceId (org.onosproject.net.DeviceId)1 IntDeviceConfig (org.onosproject.net.behaviour.inbandtelemetry.IntDeviceConfig)1 IntReportConfig (org.onosproject.net.behaviour.inbandtelemetry.IntReportConfig)1 Activate (org.osgi.service.component.annotations.Activate)1