2 * Copyright (c) 2015 Huawei, Inc. 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.nemo.renderer.openflow;
11 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
12 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
13 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
18 import com.google.common.util.concurrent.FutureCallback;
19 import com.google.common.util.concurrent.Futures;
21 public class OpenflowRenderer implements AutoCloseable {
23 private static final Logger LOG = LoggerFactory.getLogger(OpenflowRenderer.class);
25 private DataBroker dataBroker;
26 private final ResourceManager resourceManager;
27 private final FlowTableManager flowTableMng;
29 public OpenflowRenderer(DataBroker dataBroker) {
31 this.dataBroker = dataBroker;
33 System.out.println("Waiting for loading config file about 30s...");
35 LOG.info("New ResourceManager.");
36 resourceManager = new ResourceManager(dataBroker);
38 LOG.info("New FlowTableManager.");
39 flowTableMng = new FlowTableManager(dataBroker, resourceManager);
41 LOG.info("Initialized openflow renderer.");
49 public void close() throws Exception {
50 if (flowTableMng != null) flowTableMng.close();
51 if (resourceManager != null) resourceManager.close();