2 * Copyright (c) 2015 Brocade Communications Systems, 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
8 package org.opendaylight.ovsdb.compatibility.plugin.impl;
10 import java.util.List;
11 import java.util.concurrent.ConcurrentMap;
12 import java.util.concurrent.ExecutionException;
14 import org.opendaylight.controller.sal.core.Node;
15 import org.opendaylight.controller.sal.utils.Status;
16 import org.opendaylight.ovsdb.compatibility.plugin.api.NodeUtils;
17 import org.opendaylight.ovsdb.compatibility.plugin.api.OvsdbConfigurationService;
18 import org.opendaylight.ovsdb.compatibility.plugin.api.StatusWithUuid;
19 import org.opendaylight.ovsdb.compatibility.plugin.error.OvsdbPluginException;
20 import org.opendaylight.ovsdb.lib.notation.Row;
21 import org.opendaylight.ovsdb.lib.notation.UUID;
22 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
23 import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
26 * This is a proxy class for ovsdb plugin's OvsdbConfigurationService class
27 * It just forward the call to OvsdbConfigurationService instance and pass
28 * back the response to the caller.
30 * @author Anil Vishnoi (vishnoianil@gmail.com)
33 public class ConfigurationServiceImpl implements OvsdbConfigurationService
35 private volatile org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService pluginOvsdbConfigurationService;
41 * Function called by the dependency manager when at least one dependency
42 * become unsatisfied or when the component is shutting down because for
43 * example bundle is being stopped.
50 * Function called by dependency manager after "init ()" is called and after
51 * the services provided by the class are registered in the service registry
58 * Function called by the dependency manager before the services exported by
59 * the component are unregistered, this will be followed by a "destroy ()"
66 public void setOvsdbConfigurationService(org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService pluginOvsdbConfigurationService){
67 this.pluginOvsdbConfigurationService = pluginOvsdbConfigurationService;
70 public void unsetOvsdbConfigurationService(org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService pluginOvsdbConfigurationService){
71 this.pluginOvsdbConfigurationService = null;
76 public StatusWithUuid insertRow(Node node, String tableName, String parentUuid, Row<GenericTableSchema> row) {
77 return StatusConvertorUtil.convertOvsdbStatusWithUuidToCompLayerStatusWithUuid(pluginOvsdbConfigurationService.insertRow(NodeUtils.getMdsalNode(node), tableName, parentUuid, row));
81 public Status updateRow (Node node, String tableName, String parentUUID, String rowUUID, Row row) {
82 return StatusConvertorUtil
83 .convertOvsdbStatusToSalStatus(pluginOvsdbConfigurationService
84 .updateRow(NodeUtils.getMdsalNode(node), tableName, parentUUID, rowUUID, row));
88 public Status deleteRow(Node node, String tableName, String uuid) {
89 return StatusConvertorUtil
90 .convertOvsdbStatusToSalStatus(pluginOvsdbConfigurationService.
91 deleteRow(NodeUtils.getMdsalNode(node), tableName, uuid));
95 public ConcurrentMap<String, Row> getRows(Node node, String tableName) {
96 return pluginOvsdbConfigurationService.getRows(NodeUtils.getMdsalNode(node), tableName);
100 public Row getRow(Node node, String tableName, String uuid) {
101 return pluginOvsdbConfigurationService.getRow(NodeUtils.getMdsalNode(node), tableName, uuid);
105 public List<String> getTables(Node node) {
106 return pluginOvsdbConfigurationService.getTables(NodeUtils.getMdsalNode(node));
110 public Boolean setOFController(Node node, String bridgeUUID) throws InterruptedException, ExecutionException {
111 return pluginOvsdbConfigurationService.setOFController(NodeUtils.getMdsalNode(node), bridgeUUID);
115 public <T extends TypedBaseTable<?>> String getTableName(Node node, Class<T> typedClass) {
116 return pluginOvsdbConfigurationService.getTableName(NodeUtils.getMdsalNode(node), typedClass);
120 public <T extends TypedBaseTable<?>> T getTypedRow(Node node, Class<T> typedClass, Row row) {
121 return pluginOvsdbConfigurationService.getTypedRow(NodeUtils.getMdsalNode(node), typedClass, row);
125 public <T extends TypedBaseTable<?>> T createTypedRow(Node node, Class<T> typedClass) {
126 return pluginOvsdbConfigurationService.createTypedRow(NodeUtils.getMdsalNode(node), typedClass);
130 public UUID insertRow(Node node, String databaseName, String tableName, String parentTable, UUID parentUuid,
131 String parentColumn, Row<GenericTableSchema> row) throws OvsdbPluginException {
132 return pluginOvsdbConfigurationService
133 .insertRow(NodeUtils.getMdsalNode(node), databaseName, tableName, parentTable, parentUuid,
138 public UUID insertRow(Node node, String databaseName, String tableName,
139 UUID parentRowUuid, Row<GenericTableSchema> row)
140 throws OvsdbPluginException {
141 return this.insertRow(node, databaseName, tableName, null, parentRowUuid, null, row);
145 public Row<GenericTableSchema> insertTree(Node node, String databaseName, String tableName, String parentTable, UUID parentUuid,
146 String parentColumn, Row<GenericTableSchema> row) throws OvsdbPluginException {
147 return pluginOvsdbConfigurationService
148 .insertTree(NodeUtils.getMdsalNode(node), databaseName, tableName, parentTable,
149 parentUuid, parentColumn, row);
153 public Row<GenericTableSchema> insertTree(Node node, String databaseName,
154 String tableName, UUID parentRowUuid, Row<GenericTableSchema> row)
155 throws OvsdbPluginException {
156 return this.insertTree(node, databaseName, tableName, null, parentRowUuid, null, row);
160 public Row<GenericTableSchema> updateRow(Node node, String databaseName,
161 String tableName, UUID rowUuid, Row<GenericTableSchema> row,
162 boolean overwrite) throws OvsdbPluginException {
163 return pluginOvsdbConfigurationService
164 .updateRow(NodeUtils.getMdsalNode(node), databaseName, tableName, rowUuid, row, overwrite);
168 public void deleteRow(Node node, String databaseName, String tableName, String parentTable, UUID parentRowUuid,
169 String parentColumn, UUID rowUuid) throws OvsdbPluginException {
170 pluginOvsdbConfigurationService
171 .deleteRow(NodeUtils.getMdsalNode(node), databaseName, tableName, parentTable,
172 parentRowUuid, parentColumn, rowUuid);
176 public void deleteRow(Node node, String databaseName, String tableName, UUID rowUuid) throws OvsdbPluginException {
177 this.deleteRow(node, databaseName, tableName, null, null, null, rowUuid);
181 public Row<GenericTableSchema> getRow(Node node, String databaseName,
182 String tableName, UUID uuid) throws OvsdbPluginException {
183 return pluginOvsdbConfigurationService
184 .getRow(NodeUtils.getMdsalNode(node), databaseName, tableName, uuid);
188 public ConcurrentMap<UUID, Row<GenericTableSchema>> getRows(Node node,
189 String databaseName, String tableName) throws OvsdbPluginException {
190 return pluginOvsdbConfigurationService
191 .getRows(NodeUtils.getMdsalNode(node), databaseName, tableName);
195 public ConcurrentMap<UUID, Row<GenericTableSchema>> getRows(Node node,
196 String databaseName, String tableName, String fiqlQuery)
197 throws OvsdbPluginException {
198 return this.getRows(node, databaseName, tableName);
202 public List<String> getTables(Node node, String databaseName) throws OvsdbPluginException {
203 return pluginOvsdbConfigurationService.getTables(NodeUtils.getMdsalNode(node), databaseName);