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