Search in sources :

Example 1 with XconnectCodec

use of org.onosproject.segmentrouting.xconnect.api.XconnectCodec in project trellis-control by opennetworkinglab.

the class XconnectManager method activate.

@Activate
void activate() {
    appId = coreService.registerApplication(APP_NAME);
    codecService.registerCodec(XconnectDesc.class, new XconnectCodec());
    KryoNamespace.Builder serializer = KryoNamespace.newBuilder().register(KryoNamespaces.API).register(XconnectManager.class).register(XconnectKey.class).register(XconnectEndpoint.class).register(XconnectPortEndpoint.class).register(XconnectLoadBalancerEndpoint.class).register(VlanNextObjectiveStoreKey.class);
    xconnectStore = storageService.<XconnectKey, Set<XconnectEndpoint>>consistentMapBuilder().withName("onos-sr-xconnect").withRelaxedReadConsistency().withSerializer(Serializer.using(serializer.build())).build();
    xConnectExecutor = Executors.newSingleThreadScheduledExecutor(groupedThreads("sr-xconnect-event", "%d", log));
    xconnectStore.addListener(xconnectListener, xConnectExecutor);
    xconnectNextObjStore = storageService.<XconnectKey, Integer>consistentMapBuilder().withName("onos-sr-xconnect-next").withRelaxedReadConsistency().withSerializer(Serializer.using(serializer.build())).build();
    xconnectMulticastNextStore = storageService.<VlanNextObjectiveStoreKey, Integer>consistentMapBuilder().withName("onos-sr-xconnect-l2multicast-next").withSerializer(Serializer.using(serializer.build())).build();
    xconnectMulticastPortsStore = storageService.<VlanNextObjectiveStoreKey, List<PortNumber>>consistentMapBuilder().withName("onos-sr-xconnect-l2multicast-ports").withSerializer(Serializer.using(serializer.build())).build();
    deviceEventExecutor = Executors.newSingleThreadScheduledExecutor(groupedThreads("sr-xconnect-device-event", "%d", log));
    deviceService.addListener(deviceListener);
    hostEventExecutor = Executors.newSingleThreadExecutor(groupedThreads("sr-xconnect-host-event", "%d", log));
    hostService.addListener(hostListener);
    portLoadBalancerCache = CacheBuilder.newBuilder().expireAfterWrite(WAIT_TIME_MS, TimeUnit.MILLISECONDS).removalListener((RemovalNotification<PortLoadBalancerId, XconnectKey> notification) -> log.debug("PortLoadBalancer cache removal event. portLoadBalancerId={}, xConnectKey={}", notification.getKey(), notification.getValue())).build();
    portLoadBalancerExecutor = newScheduledThreadPool(1, groupedThreads("portLoadBalancerCacheWorker", "-%d", log));
    // Let's schedule the cleanup of the cache
    portLoadBalancerExecutor.scheduleAtFixedRate(portLoadBalancerCache::cleanUp, 0, WAIT_TIME_MS, TimeUnit.MILLISECONDS);
    portLoadBalancerService.addListener(portLoadBalancerListener);
    log.info("Started");
}
Also used : XconnectLoadBalancerEndpoint(org.onosproject.segmentrouting.xconnect.api.XconnectLoadBalancerEndpoint) VlanNextObjectiveStoreKey(org.onosproject.segmentrouting.storekey.VlanNextObjectiveStoreKey) XconnectCodec(org.onosproject.segmentrouting.xconnect.api.XconnectCodec) XconnectEndpoint(org.onosproject.segmentrouting.xconnect.api.XconnectEndpoint) KryoNamespace(org.onlab.util.KryoNamespace) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) RemovalNotification(com.google.common.cache.RemovalNotification) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

RemovalNotification (com.google.common.cache.RemovalNotification)1 ImmutableList (com.google.common.collect.ImmutableList)1 List (java.util.List)1 KryoNamespace (org.onlab.util.KryoNamespace)1 VlanNextObjectiveStoreKey (org.onosproject.segmentrouting.storekey.VlanNextObjectiveStoreKey)1 XconnectCodec (org.onosproject.segmentrouting.xconnect.api.XconnectCodec)1 XconnectEndpoint (org.onosproject.segmentrouting.xconnect.api.XconnectEndpoint)1 XconnectLoadBalancerEndpoint (org.onosproject.segmentrouting.xconnect.api.XconnectLoadBalancerEndpoint)1 Activate (org.osgi.service.component.annotations.Activate)1