2 * Copyright (c) 2015 Huawei Technologies and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.groupbasedpolicy.renderer.faas;
11 import java.util.concurrent.Executors;
12 import java.util.concurrent.ScheduledExecutorService;
14 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
15 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
16 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
21 * Renderer that converts GBP services to FAAS logical networks, which then maps
22 * to the physical networks..
24 public class FaasRenderer implements AutoCloseable {
26 private static final Logger LOG = LoggerFactory.getLogger(FaasRenderer.class);
28 private final DataBroker dataBroker;
29 private final ScheduledExecutorService executor;
31 private final FaasEndpointManagerListener endpointListner;
33 public FaasRenderer(final DataBroker dataProvider, RpcProviderRegistry rpcRegistry,
34 NotificationService notificationService) {
36 this.dataBroker = dataProvider;
38 int numCPU = Runtime.getRuntime().availableProcessors();
39 executor = Executors.newScheduledThreadPool(numCPU * 2);
41 endpointListner = new FaasEndpointManagerListener(dataProvider);
43 LOG.info("FAAS Renderer has Started");
47 public void close() throws Exception {
48 executor.shutdownNow();
49 endpointListner.close();