Search in sources :

Example 6 with IntIntent

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");
}
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)

Example 7 with IntIntent

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);
}
Also used : IntIntent(org.onosproject.inbandtelemetry.api.IntIntent)

Aggregations

IntIntent (org.onosproject.inbandtelemetry.api.IntIntent)7 IntIntentId (org.onosproject.inbandtelemetry.api.IntIntentId)5 IntService (org.onosproject.inbandtelemetry.api.IntService)4 Produces (javax.ws.rs.Produces)3 IntDeviceConfig (org.onosproject.net.behaviour.inbandtelemetry.IntDeviceConfig)3 IntReportConfig (org.onosproject.net.behaviour.inbandtelemetry.IntReportConfig)3 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)2 GET (javax.ws.rs.GET)2 KryoNamespace (org.onlab.util.KryoNamespace)2 ApplicationId (org.onosproject.core.ApplicationId)2 IntIntentCodec (org.onosproject.inbandtelemetry.rest.IntIntentCodec)2 DeviceId (org.onosproject.net.DeviceId)2 NetworkConfigEvent (org.onosproject.net.config.NetworkConfigEvent)2 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)2 TrafficSelector (org.onosproject.net.flow.TrafficSelector)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 Maps (com.google.common.collect.Maps)1 Striped (com.google.common.util.concurrent.Striped)1 IOException (java.io.IOException)1