Refactor of the OVSDB Plugin
authorDave Tucker <djt@redhat.com>
Mon, 4 Aug 2014 11:44:55 +0000 (12:44 +0100)
committerDave Tucker <djt@redhat.com>
Mon, 4 Aug 2014 12:30:17 +0000 (13:30 +0100)
- Separate API and Implementation of services
- Deprecated existing interfaces
- Only export the OSGi services from the budle
- Remove ServiceHelper and use Dependency Injection
- Publish Ovsdb Connection events from the Library via OSGi

Change-Id: Ic9fac3747548a741998c40940f73244dae06626a
Signed-off-by: Dave Tucker <djt@redhat.com>
56 files changed:
integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/OvsdbIntegrationTestBase.java
integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/neutron/NeutronIT.java
integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/plugin/OvsdbPluginIT.java
northbound/pom.xml
northbound/src/main/java/org/opendaylight/ovsdb/northbound/OvsdbNorthboundV2.java
openstack/net-virt-providers/pom.xml
openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/Activator.java
openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/OF10Provider.java
openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/OF13Provider.java
openstack/net-virt/pom.xml
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/Activator.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/NetworkHandler.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/PortHandler.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/SouthboundHandler.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/BridgeConfigurationManagerImpl.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/ConfigurationServiceImpl.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/TenantNetworkManagerImpl.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/VlanConfigurationCacheImpl.java
plugin/pom.xml
plugin/src/main/java/org/opendaylight/ovsdb/plugin/ChannelConnectionHandler.java [deleted file]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/Connection.java
plugin/src/main/java/org/opendaylight/ovsdb/plugin/IConnectionServiceInternal.java
plugin/src/main/java/org/opendaylight/ovsdb/plugin/InsertRequest.java [deleted file]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/InventoryServiceInternal.java
plugin/src/main/java/org/opendaylight/ovsdb/plugin/MutateRequest.java [deleted file]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/NodeConnectorFactory.java [deleted file]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/NodeFactory.java [deleted file]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/OvsVswitchdSchemaConstants.java
plugin/src/main/java/org/opendaylight/ovsdb/plugin/OvsdbConfigService.java
plugin/src/main/java/org/opendaylight/ovsdb/plugin/OvsdbInventoryListener.java
plugin/src/main/java/org/opendaylight/ovsdb/plugin/OvsdbMessage.java [deleted file]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/ReadService.java [deleted file]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/StatusWithUuid.java
plugin/src/main/java/org/opendaylight/ovsdb/plugin/UpdateRequest.java [deleted file]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/Connection.java [new file with mode: 0644]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/OvsVswitchdSchemaConstants.java [new file with mode: 0644]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/OvsdbConfigurationService.java [new file with mode: 0644]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/OvsdbConnectionService.java [new file with mode: 0644]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/OvsdbInventoryListener.java [new file with mode: 0644]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/OvsdbInventoryService.java [new file with mode: 0644]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/StatusWithUuid.java [new file with mode: 0644]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/impl/ConfigurationServiceImpl.java [moved from plugin/src/main/java/org/opendaylight/ovsdb/plugin/ConfigurationService.java with 95% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/impl/ConnectionServiceImpl.java [moved from plugin/src/main/java/org/opendaylight/ovsdb/plugin/ConnectionService.java with 86% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/impl/InventoryServiceImpl.java [moved from plugin/src/main/java/org/opendaylight/ovsdb/plugin/InventoryService.java with 87% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/impl/NodeConnectorFactory.java [new file with mode: 0644]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/impl/NodeFactory.java [new file with mode: 0644]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/internal/Activator.java [moved from plugin/src/main/java/org/opendaylight/ovsdb/plugin/Activator.java with 70% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/internal/Encapsulation.java [moved from plugin/src/main/java/org/opendaylight/ovsdb/plugin/Encapsulation.java with 93% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/internal/IPAddressProperty.java [moved from plugin/src/main/java/org/opendaylight/ovsdb/plugin/IPAddressProperty.java with 96% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/internal/L4PortProperty.java [moved from plugin/src/main/java/org/opendaylight/ovsdb/plugin/L4PortProperty.java with 96% similarity]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/internal/NodeDatabase.java [moved from plugin/src/main/java/org/opendaylight/ovsdb/plugin/NodeDB.java with 98% similarity]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/BridgeDomainConfigBridgeTestCases.java
plugin/src/test/java/org/opendaylight/ovsdb/plugin/BridgeDomainConfigManagerTestCases.java
plugin/src/test/java/org/opendaylight/ovsdb/plugin/BridgeDomainConfigPortTestCases.java
plugin/src/test/java/org/opendaylight/ovsdb/plugin/PluginTestBase.java
plugin/src/test/java/org/opendaylight/ovsdb/plugin/TearDown.java

index e6b52fd85be8c0860c8776dca1ee4e43c65565fe..ff9abf1e639de67633f23d7ac57e7950650adc78 100644 (file)
@@ -34,7 +34,7 @@ import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.opendaylight.ovsdb.lib.OvsdbClient;
 import org.opendaylight.ovsdb.lib.OvsdbConnection;
 import org.opendaylight.ovsdb.lib.OvsdbConnectionListener;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
 
 public abstract class OvsdbIntegrationTestBase {
     protected final static String IDENTIFIER = "TEST";
@@ -64,7 +64,8 @@ public abstract class OvsdbIntegrationTestBase {
         String portStr = props.getProperty(SERVER_PORT, DEFAULT_SERVER_PORT);
         String connectionType = props.getProperty(CONNECTION_TYPE, "active");
 
-        IConnectionServiceInternal connection = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
+        OvsdbConnectionService
+                connection = (OvsdbConnectionService)ServiceHelper.getGlobalInstance(OvsdbConnectionService.class, this);
         // If the connection type is active, controller connects to the ovsdb-server
         if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_ACTIVE)) {
             if (addressStr == null) {
@@ -139,7 +140,7 @@ public abstract class OvsdbIntegrationTestBase {
         @Override
         public OvsdbClient call() throws Exception {
             OvsdbConnection connection = (OvsdbConnection)ServiceHelper.getGlobalInstance(OvsdbConnection.class, this);
-            connection.registerForPassiveConnection(this);
+            connection.registerConnectionListener(this);
             while (client == null) {
                 Thread.sleep(500);
             }
index 43f92324148f31cce67068ffe0e462219cc09d71..5661151ea749739d539b7cf37d37f25101c99e2c 100644 (file)
@@ -27,9 +27,8 @@ import org.opendaylight.ovsdb.lib.notation.Row;
 import org.opendaylight.ovsdb.lib.notation.Version;
 import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
 import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.schema.openvswitch.Interface;
 import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
@@ -71,7 +70,7 @@ public class NeutronIT extends OvsdbIntegrationTestBase {
     private BundleContext bc;
 
     @Inject
-    private OvsdbConfigService ovsdbConfigService;
+    private OvsdbConfigurationService ovsdbConfigurationService;
     private Node node = null;
 
     Component of10Provider;
@@ -80,7 +79,7 @@ public class NeutronIT extends OvsdbIntegrationTestBase {
     @Inject
     BridgeConfigurationManager bridgeConfigurationManager;
     @Inject
-    ConfigurationService configurationService;
+    org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService netVirtConfigurationService;
 
     Boolean tearDownBridge = false;
 
@@ -180,13 +179,13 @@ public class NeutronIT extends OvsdbIntegrationTestBase {
 
         Map<String, Row>
                 bridgeRows =
-                ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Bridge.class));
+                ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Bridge.class));
         Assert.assertEquals(1, bridgeRows.size());
 
-        Bridge bridgeRow = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeRows.values().iterator().next());
-        Assert.assertEquals(configurationService.getIntegrationBridgeName(), bridgeRow.getName());
+        Bridge bridgeRow = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeRows.values().iterator().next());
+        Assert.assertEquals(netVirtConfigurationService.getIntegrationBridgeName(), bridgeRow.getName());
 
-        String uuid = bridgeConfigurationManager.getBridgeUuid(node, configurationService.getIntegrationBridgeName());
+        String uuid = bridgeConfigurationManager.getBridgeUuid(node, netVirtConfigurationService.getIntegrationBridgeName());
         Assert.assertEquals(uuid, bridgeRow.getUuid().toString());
 
         tearDownBridge = true;
@@ -198,22 +197,22 @@ public class NeutronIT extends OvsdbIntegrationTestBase {
 
         final String endpointAddress = "10.10.10.10";
 
-        Map<String, Row> ovsRows = ovsdbConfigService.getRows(node,
-                                                              ovsdbConfigService.getTableName(node, OpenVSwitch.class));
-        OpenVSwitch ovsRow = ovsdbConfigService.getTypedRow(node,
+        Map<String, Row> ovsRows = ovsdbConfigurationService.getRows(node,
+                                                              ovsdbConfigurationService.getTableName(node, OpenVSwitch.class));
+        OpenVSwitch ovsRow = ovsdbConfigurationService.getTypedRow(node,
                                                             OpenVSwitch.class,
                                                             ovsRows.values().iterator().next());
 
-        Assert.assertEquals(null, configurationService.getTunnelEndPoint(node));
+        Assert.assertEquals(null, netVirtConfigurationService.getTunnelEndPoint(node));
 
-        ovsRow.setOtherConfig(ImmutableMap.of(configurationService.getTunnelEndpointKey(), endpointAddress));
-        ovsdbConfigService.updateRow(node,
-                                     ovsdbConfigService.getTableName(node, OpenVSwitch.class),
-                                     null,
-                                     ovsRow.getUuid().toString(),
-                                     ovsRow.getRow());
+        ovsRow.setOtherConfig(ImmutableMap.of(netVirtConfigurationService.getTunnelEndpointKey(), endpointAddress));
+        ovsdbConfigurationService.updateRow(node,
+                                            ovsdbConfigurationService.getTableName(node, OpenVSwitch.class),
+                                            null,
+                                            ovsRow.getUuid().toString(),
+                                            ovsRow.getRow());
 
-        Assert.assertEquals(InetAddress.getByName(endpointAddress), configurationService.getTunnelEndPoint(node));
+        Assert.assertEquals(InetAddress.getByName(endpointAddress), netVirtConfigurationService.getTunnelEndPoint(node));
     }
 
     @Test
@@ -223,9 +222,9 @@ public class NeutronIT extends OvsdbIntegrationTestBase {
         Version ovsVersion = this.getOvsVersion();
 
         if (ovsVersion.compareTo(Constants.OPENFLOW13_SUPPORTED) < 0) {
-            Assert.assertEquals(Constants.OPENFLOW10, configurationService.getOpenflowVersion(node));
+            Assert.assertEquals(Constants.OPENFLOW10, netVirtConfigurationService.getOpenflowVersion(node));
         } else {
-            Assert.assertEquals(Constants.OPENFLOW13, configurationService.getOpenflowVersion(node));
+            Assert.assertEquals(Constants.OPENFLOW13, netVirtConfigurationService.getOpenflowVersion(node));
         }
     }
 
@@ -235,8 +234,8 @@ public class NeutronIT extends OvsdbIntegrationTestBase {
 
         if (tearDownBridge) {
             String uuid = bridgeConfigurationManager.getBridgeUuid(node,
-                                                                   configurationService.getIntegrationBridgeName());
-            ovsdbConfigService.deleteRow(node, ovsdbConfigService.getTableName(node, Bridge.class), uuid);
+                                                                   netVirtConfigurationService.getIntegrationBridgeName());
+            ovsdbConfigurationService.deleteRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), uuid);
             tearDownBridge = false;
         }
 
@@ -246,9 +245,9 @@ public class NeutronIT extends OvsdbIntegrationTestBase {
     }
 
     private Version getOvsVersion(){
-        Map<String, Row> ovsRows = ovsdbConfigService.getRows(node,
-                                                              ovsdbConfigService.getTableName(node, OpenVSwitch.class));
-        OpenVSwitch ovsRow = ovsdbConfigService.getTypedRow(node,
+        Map<String, Row> ovsRows = ovsdbConfigurationService.getRows(node,
+                                                              ovsdbConfigurationService.getTableName(node, OpenVSwitch.class));
+        OpenVSwitch ovsRow = ovsdbConfigurationService.getTypedRow(node,
                                                             OpenVSwitch.class,
                                                             ovsRows.values().iterator().next());
         return Version.fromString(ovsRow.getOvsVersionColumn().getData().iterator().next());
index df77a37d0041011cbb346dfdbbc1f1c3a6fd3ddb..904d46d527ff58447adc79410062a5c7965eebc1 100644 (file)
@@ -38,12 +38,12 @@ import org.opendaylight.ovsdb.integrationtest.OvsdbIntegrationTestBase;
 import org.opendaylight.ovsdb.lib.OvsdbClient;
 import org.opendaylight.ovsdb.lib.OvsdbConnectionInfo;
 import org.opendaylight.ovsdb.lib.notation.Row;
-import org.opendaylight.ovsdb.plugin.Connection;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.InventoryServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.OvsdbInventoryListener;
-import org.opendaylight.ovsdb.plugin.StatusWithUuid;
+import org.opendaylight.ovsdb.plugin.api.Connection;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService;
+import org.opendaylight.ovsdb.plugin.api.StatusWithUuid;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
 
@@ -65,10 +65,10 @@ public class OvsdbPluginIT extends OvsdbIntegrationTestBase {
     private Logger log = LoggerFactory.getLogger(OvsdbPluginIT.class);
     @Inject
     private BundleContext bc;
-    private OvsdbConfigService ovsdbConfigService = null;
+    private OvsdbConfigurationService ovsdbConfigurationService = null;
 
     @Inject
-    private InventoryServiceInternal inventoryService;
+    private OvsdbInventoryService ovsdbInventoryService;
 
     private Node node = null;
     private OvsdbClient client = null;
@@ -134,13 +134,14 @@ public class OvsdbPluginIT extends OvsdbIntegrationTestBase {
         } catch (Exception e) {
             fail("Exception : "+e.getMessage());
         }
-        this.ovsdbConfigService = (OvsdbConfigService)ServiceHelper.getGlobalInstance(OvsdbConfigService.class, this);
+        this.ovsdbConfigurationService = (OvsdbConfigurationService)ServiceHelper.getGlobalInstance(OvsdbConfigurationService.class, this);
     }
 
     @Test
     public void apiTests() throws Exception {
         Thread.sleep(5000);
-        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
+        OvsdbConnectionService
+                connectionService = (OvsdbConnectionService)ServiceHelper.getGlobalInstance(OvsdbConnectionService.class, this);
 
         // Check for the ovsdb Connection as seen by the Plugin layer
         assertNotNull(connectionService.getNodes());
@@ -152,7 +153,7 @@ public class OvsdbPluginIT extends OvsdbIntegrationTestBase {
         if (connectionInfo.getType().equals(OvsdbConnectionInfo.ConnectionType.PASSIVE)) {
             identifier = connectionInfo.getRemoteAddress().getHostAddress()+":"+connectionInfo.getRemotePort();
         }
-        assertEquals(Node.fromString("OVS|"+identifier), connectionService.getNodes().get(0));
+        assertEquals(Node.fromString("OVS|" + identifier), connectionService.getNodes().get(0));
         System.out.println("Nodes = "+ connectionService.getNodes());
         /*
          * Test sequence :
@@ -192,7 +193,7 @@ public class OvsdbPluginIT extends OvsdbIntegrationTestBase {
         Node newNode = Node.fromString("OVS:10.10.10.10:65342");
 
         // Trigger event
-        inventoryService.notifyNodeAdded(newNode);
+        ovsdbInventoryService.notifyNodeAdded(newNode);
 
         Mockito.verify(listenerA, Mockito.times(1)).nodeAdded(newNode);
         Mockito.verify(listenerB, Mockito.times(1)).nodeAdded(newNode);
@@ -215,18 +216,18 @@ public class OvsdbPluginIT extends OvsdbIntegrationTestBase {
         // 3. Assert to make sure the bridge is created with a valid Uuid.
         printCache();
         Bridge bridge = connection.getClient().getTypedRowWrapper(Bridge.class, null);
-        Row bridgeRow = ovsdbConfigService.getRow(node, bridge.getSchema().getName(), status.getUuid().toString());
+        Row bridgeRow = ovsdbConfigurationService.getRow(node, bridge.getSchema().getName(), status.getUuid().toString());
         assertNotNull(bridgeRow);
         bridge = connection.getClient().getTypedRowWrapper(Bridge.class, bridgeRow);
         assertEquals(bridge.getUuid(), status.getUuid());
 
         // 4. Delete the bridge & Assert to make sure the return status is success.
-        Status delStatus = ovsdbConfigService.deleteRow(node, bridge.getSchema().getName(), status.getUuid().toString());
+        Status delStatus = ovsdbConfigurationService.deleteRow(node, bridge.getSchema().getName(), status.getUuid().toString());
         assertTrue(delStatus.isSuccess());
         Thread.sleep(2000); // TODO : Remove this Sleep once the Select operation is resolved.
 
         // 5. Assert to make sure the bridge is deleted
-        bridgeRow = ovsdbConfigService.getRow(node, bridge.getSchema().getName(), status.getUuid().toString());
+        bridgeRow = ovsdbConfigurationService.getRow(node, bridge.getSchema().getName(), status.getUuid().toString());
         assertNull(bridgeRow);
     }
 
@@ -235,28 +236,28 @@ public class OvsdbPluginIT extends OvsdbIntegrationTestBase {
         bridge.setName("br_test1");
         bridge.setStatus(ImmutableMap.of("key", "value"));
         bridge.setFloodVlans(Sets.newHashSet(34L));
-        return ovsdbConfigService.insertRow(node, bridge.getSchema().getName(), parentUuid, bridge.getRow());
+        return ovsdbConfigurationService.insertRow(node, bridge.getSchema().getName(), parentUuid, bridge.getRow());
     }
 
     public String getOpenVSwitchTableUUID(Connection connection) throws Exception {
         OpenVSwitch openVSwitch = connection.getClient().getTypedRowWrapper(OpenVSwitch.class, null);
-        ConcurrentMap<String, Row> row = ovsdbConfigService.getRows(node, openVSwitch.getSchema().getName());
+        ConcurrentMap<String, Row> row = ovsdbConfigurationService.getRows(node, openVSwitch.getSchema().getName());
         if (row == null || row.size() == 0) return null;
         return (String)row.keySet().toArray()[0];
     }
 
     public void printCache() throws Exception {
-        List<String> tables = ovsdbConfigService.getTables(node);
+        List<String> tables = ovsdbConfigurationService.getTables(node);
         System.out.println("Tables = "+tables);
         assertNotNull(tables);
         for (String table : tables) {
             System.out.println("Table "+table);
-            ConcurrentMap<String,Row> row = ovsdbConfigService.getRows(node, table);
+            ConcurrentMap<String,Row> row = ovsdbConfigurationService.getRows(node, table);
             System.out.println(row);
         }
     }
 
-    public class FakeListener implements OvsdbInventoryListener{
+    public class FakeListener implements OvsdbInventoryListener {
 
         @Override
         public void nodeAdded(Node node) {
index 52b4af9628d43adae00762430d356ba9610825c5..0b3c948ab7448bff5dacc3262efee02ec67049fe 100644 (file)
@@ -73,7 +73,7 @@
               com.sun.jersey.spi.container.servlet,
               org.opendaylight.controller.sal.core,
               org.opendaylight.controller.sal.authorization,
-              org.opendaylight.ovsdb.plugin,
+              org.opendaylight.ovsdb.plugin.api,
               org.opendaylight.ovsdb.lib,
               org.opendaylight.ovsdb.lib.jsonrpc,
               org.opendaylight.ovsdb.lib.notation,
index 2e2eca8276b6df79001308f55abc9b9b928e98a0..4005a151ce8d79f95255261d7cf4aa415c46e7c2 100644 (file)
@@ -43,11 +43,11 @@ import org.opendaylight.ovsdb.lib.OvsdbClient;
 import org.opendaylight.ovsdb.lib.notation.Row;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
-import org.opendaylight.ovsdb.plugin.Connection;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.OvsVswitchdSchemaConstants;
-import org.opendaylight.ovsdb.plugin.StatusWithUuid;
+import org.opendaylight.ovsdb.plugin.api.OvsVswitchdSchemaConstants;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.StatusWithUuid;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -325,16 +325,17 @@ public class OvsdbNorthboundV2 {
             throw new UnauthorizedException("User is not authorized to perform this operation");
         }
 
-        OvsdbConfigService ovsdbTable = (OvsdbConfigService)ServiceHelper.getGlobalInstance(OvsdbConfigService.class,
+        OvsdbConfigurationService
+                ovsdbTable = (OvsdbConfigurationService)ServiceHelper.getGlobalInstance(OvsdbConfigurationService.class,
                                                                                             this);
         if (ovsdbTable == null) {
             throw new ServiceUnavailableException("OVS Configuration Service " + RestMessages.SERVICEUNAVAILABLE.toString());
         }
 
         Node node = Node.fromString(nodeType, nodeId);
-        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
-        Connection connection = connectionService.getConnection(node);
-        OvsdbClient client = connection.getClient();
+        OvsdbConnectionService
+                connectionService = (OvsdbConnectionService)ServiceHelper.getGlobalInstance(OvsdbConnectionService.class, this);
+        OvsdbClient client = connectionService.getConnection(node).getClient();
         OvsdbRow localRow = OvsdbRow.fromJsonNode(client, OvsVswitchdSchemaConstants.DATABASE_NAME, rowJson);
         String bckCompatibleTableName = this.getBackwardCompatibleTableName(client, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
 
@@ -342,7 +343,8 @@ public class OvsdbNorthboundV2 {
             return Response.status(Response.Status.BAD_REQUEST).build();
         }
 
-        StatusWithUuid statusWithUuid = ovsdbTable.insertRow(node, bckCompatibleTableName, localRow.getParentUuid(), localRow.getRow());
+        StatusWithUuid
+                statusWithUuid = ovsdbTable.insertRow(node, bckCompatibleTableName, localRow.getParentUuid(), localRow.getRow());
 
         if (statusWithUuid.isSuccess()) {
             UUID uuid = statusWithUuid.getUuid();
@@ -415,16 +417,17 @@ public class OvsdbNorthboundV2 {
             throw new UnauthorizedException("User is not authorized to perform this operation");
         }
 
-        OvsdbConfigService ovsdbTable = (OvsdbConfigService)ServiceHelper.getGlobalInstance(OvsdbConfigService.class,
+        OvsdbConfigurationService
+                ovsdbTable = (OvsdbConfigurationService)ServiceHelper.getGlobalInstance(OvsdbConfigurationService.class,
                                                                                             this);
         if (ovsdbTable == null) {
             throw new ServiceUnavailableException("UserManager " + RestMessages.SERVICEUNAVAILABLE.toString());
         }
 
         Node node = Node.fromString(nodeType, nodeId);
-        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
-        Connection connection = connectionService.getConnection(node);
-        OvsdbClient client = connection.getClient();
+        OvsdbConnectionService
+                connectionService = (OvsdbConnectionService)ServiceHelper.getGlobalInstance(OvsdbConnectionService.class, this);
+        OvsdbClient client = connectionService.getConnection(node).getClient();
         String bckCompatibleTableName = this.getBackwardCompatibleTableName(client, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
 
         Row row = null;
@@ -497,16 +500,17 @@ public class OvsdbNorthboundV2 {
             throw new UnauthorizedException("User is not authorized to perform this operation");
         }
 
-        OvsdbConfigService ovsdbTable = (OvsdbConfigService)ServiceHelper.getGlobalInstance(OvsdbConfigService.class,
+        OvsdbConfigurationService
+                ovsdbTable = (OvsdbConfigurationService)ServiceHelper.getGlobalInstance(OvsdbConfigurationService.class,
                                                                                             this);
         if (ovsdbTable == null) {
             throw new ServiceUnavailableException("UserManager " + RestMessages.SERVICEUNAVAILABLE.toString());
         }
 
         Node node = Node.fromString(nodeType, nodeId);
-        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
-        Connection connection = connectionService.getConnection(node);
-        OvsdbClient client = connection.getClient();
+        OvsdbConnectionService
+                connectionService = (OvsdbConnectionService)ServiceHelper.getGlobalInstance(OvsdbConnectionService.class, this);
+        OvsdbClient client = connectionService.getConnection(node).getClient();
         String bckCompatibleTableName = this.getBackwardCompatibleTableName(client, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
         Map<String, Row> rows = null;
         try {
@@ -571,16 +575,17 @@ public class OvsdbNorthboundV2 {
             throw new UnauthorizedException("User is not authorized to perform this operation");
         }
 
-        OvsdbConfigService ovsdbTable = (OvsdbConfigService)ServiceHelper.getGlobalInstance(OvsdbConfigService.class,
+        OvsdbConfigurationService
+                ovsdbTable = (OvsdbConfigurationService)ServiceHelper.getGlobalInstance(OvsdbConfigurationService.class,
                                                                                             this);
         if (ovsdbTable == null) {
             throw new ServiceUnavailableException("OVS Configuration Service " + RestMessages.SERVICEUNAVAILABLE.toString());
         }
 
         Node node = Node.fromString(nodeType, nodeId);
-        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
-        Connection connection = connectionService.getConnection(node);
-        OvsdbClient client = connection.getClient();
+        OvsdbConnectionService
+                connectionService = (OvsdbConnectionService)ServiceHelper.getGlobalInstance(OvsdbConnectionService.class, this);
+        OvsdbClient client = connectionService.getConnection(node).getClient();
         String bckCompatibleTableName = this.getBackwardCompatibleTableName(client, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
         OvsdbRow localRow = OvsdbRow.fromJsonNode(client, OvsVswitchdSchemaConstants.DATABASE_NAME, rowJson);
 
@@ -651,16 +656,17 @@ public class OvsdbNorthboundV2 {
             throw new UnauthorizedException("User is not authorized to perform this operation");
         }
 
-        OvsdbConfigService ovsdbTable = (OvsdbConfigService)ServiceHelper.getGlobalInstance(OvsdbConfigService.class,
+        OvsdbConfigurationService
+                ovsdbTable = (OvsdbConfigurationService)ServiceHelper.getGlobalInstance(OvsdbConfigurationService.class,
                 this);
         if (ovsdbTable == null) {
             throw new ServiceUnavailableException("OVS Configuration Service " + RestMessages.SERVICEUNAVAILABLE.toString());
         }
 
         Node node = Node.fromString(nodeType, nodeId);
-        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
-        Connection connection = connectionService.getConnection(node);
-        OvsdbClient client = connection.getClient();
+        OvsdbConnectionService
+                connectionService = (OvsdbConnectionService)ServiceHelper.getGlobalInstance(OvsdbConnectionService.class, this);
+        OvsdbClient client = connectionService.getConnection(node).getClient();
         String bckCompatibleTableName = this.getBackwardCompatibleTableName(client, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
 
         Status status = ovsdbTable.deleteRow(node, bckCompatibleTableName, uuid);
index 7b40f7481d45515f5a7b49793fd82ab653e8a7bc..b91b6cef3d6c64477083d1d472f3b2c0a3c8f9b0 100644 (file)
@@ -81,7 +81,7 @@
                             org.opendaylight.controller.sal.core,
                             org.opendaylight.controller.sal.utils,
                             org.opendaylight.controller.sal.action,
-                            org.opendaylight.ovsdb.plugin,
+                            org.opendaylight.ovsdb.plugin.api,
                             org.opendaylight.ovsdb.lib.notation,
                             org.opendaylight.controller.sal.binding.api,
                             org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819,
index da654bf55f4bc9fed927daed45618eed425e307e..04bd3dcfada5604b3b8cdbff8a0ffed5e509dfe0 100644 (file)
@@ -15,12 +15,11 @@ import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
 import org.opendaylight.controller.switchmanager.ISwitchManager;
 import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
 import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;
 import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
 
 import org.apache.felix.dm.Component;
 
@@ -93,7 +92,7 @@ public class Activator extends ComponentActivatorAbstractBase {
 
             c.setInterface(NetworkingProvider.class.getName(), of10Properties);
             c.add(createServiceDependency()
-                          .setService(ConfigurationService.class)
+                          .setService(org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class)
                           .setRequired(true));
             c.add(createServiceDependency()
                           .setService(BridgeConfigurationManager.class)
@@ -101,8 +100,8 @@ public class Activator extends ComponentActivatorAbstractBase {
             c.add(createServiceDependency()
                           .setService(TenantNetworkManager.class)
                           .setRequired(true));
-            c.add(createServiceDependency().setService(OvsdbConfigService.class).setRequired(true));
-            c.add(createServiceDependency().setService(IConnectionServiceInternal.class).setRequired(true));
+            c.add(createServiceDependency().setService(OvsdbConfigurationService.class).setRequired(true));
+            c.add(createServiceDependency().setService(OvsdbConnectionService.class).setRequired(true));
             c.add(createServiceDependency().
                     setService(IForwardingRulesManager.class).
                     setRequired(true));
@@ -118,7 +117,7 @@ public class Activator extends ComponentActivatorAbstractBase {
 
             c.setInterface(NetworkingProvider.class.getName(), of13Properties);
             c.add(createServiceDependency()
-                          .setService(ConfigurationService.class)
+                          .setService(org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class)
                           .setRequired(true));
             c.add(createServiceDependency()
                           .setService(BridgeConfigurationManager.class)
@@ -126,8 +125,8 @@ public class Activator extends ComponentActivatorAbstractBase {
             c.add(createServiceDependency()
                           .setService(TenantNetworkManager.class)
                           .setRequired(true));
-            c.add(createServiceDependency().setService(OvsdbConfigService.class).setRequired(true));
-            c.add(createServiceDependency().setService(IConnectionServiceInternal.class).setRequired(true));
+            c.add(createServiceDependency().setService(OvsdbConfigurationService.class).setRequired(true));
+            c.add(createServiceDependency().setService(OvsdbConnectionService.class).setRequired(true));
             c.add(createServiceDependency().setService(MdsalConsumer.class).setRequired(true));
         }
     }
index 594ce2e061c9747909f90e0b6f6de3b1c59fe495..d31e8829f0574fad7dba945f9e0b8961149070eb 100644 (file)
@@ -25,12 +25,11 @@ import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
 import org.opendaylight.ovsdb.openstack.netvirt.NetworkHandler;
 import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;
 import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.StatusWithUuid;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.StatusWithUuid;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.schema.openvswitch.Interface;
 import org.opendaylight.ovsdb.schema.openvswitch.Port;
@@ -58,11 +57,11 @@ public class OF10Provider implements NetworkingProvider {
     public static final int LLDP_PRIORITY = 1000;
     public static final int NORMAL_PRIORITY = 0;
 
-    private volatile ConfigurationService configurationService;
+    private volatile org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService configurationService;
     private volatile BridgeConfigurationManager bridgeConfigurationManager;
     private volatile TenantNetworkManager tenantNetworkManager;
-    private volatile OvsdbConfigService ovsdbConfigService;
-    private volatile IConnectionServiceInternal connectionService;
+    private volatile OvsdbConfigurationService ovsdbConfigurationService;
+    private volatile OvsdbConnectionService connectionService;
     private volatile IForwardingRulesManager forwardingRulesManager;
     private volatile ISwitchManager switchManager;
 
@@ -118,8 +117,9 @@ public class OF10Provider implements NetworkingProvider {
             return;
         }
         try {
-            Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), brNetId);
-            Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+            Row row = ovsdbConfigurationService
+                    .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), brNetId);
+            Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
             Set<String> dpids = bridge.getDatapathIdColumn().getData();
             if (dpids == null || dpids.size() ==  0) return;
             Long dpidLong = HexEncode.stringToLong((String) dpids.toArray()[0]);
@@ -149,8 +149,9 @@ public class OF10Provider implements NetworkingProvider {
             return;
         }
         try {
-            Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), brNetId);
-            Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+            Row row = ovsdbConfigurationService
+                    .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), brNetId);
+            Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
             Set<String> dpids = bridge.getDatapathIdColumn().getData();
             if (dpids == null || dpids.size() ==  0) return;
             Long dpidLong = HexEncode.stringToLong((String) dpids.toArray()[0]);
@@ -179,8 +180,9 @@ public class OF10Provider implements NetworkingProvider {
             return;
         }
         try {
-            Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), brNetId);
-            Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+            Row row = ovsdbConfigurationService
+                    .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), brNetId);
+            Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
             Set<String> dpids = bridge.getDatapathIdColumn().getData();
             if (dpids == null || dpids.size() ==  0) return;
             Long dpidLong = HexEncode.stringToLong((String) dpids.toArray()[0]);
@@ -213,8 +215,9 @@ public class OF10Provider implements NetworkingProvider {
             return;
         }
         try {
-            Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), brNetId);
-            Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+            Row row = ovsdbConfigurationService
+                    .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), brNetId);
+            Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
             Set<String> dpids = bridge.getDatapathIdColumn().getData();
             if (dpids == null || dpids.size() ==  0) return;
             Long dpidLong = HexEncode.stringToLong((String) dpids.toArray()[0]);
@@ -241,8 +244,9 @@ public class OF10Provider implements NetworkingProvider {
             return;
         }
         try {
-            Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), brNetId);
-            Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+            Row row = ovsdbConfigurationService
+                    .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), brNetId);
+            Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
             Set<String> dpids = bridge.getDatapathIdColumn().getData();
             if (dpids == null || dpids.size() ==  0) return;
             Long dpidLong = HexEncode.stringToLong((String) dpids.toArray()[0]);
@@ -293,8 +297,9 @@ public class OF10Provider implements NetworkingProvider {
             return;
         }
         try {
-            Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), brNetId);
-            Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+            Row row = ovsdbConfigurationService
+                    .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), brNetId);
+            Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
             Set<String> dpids = bridge.getDatapathIdColumn().getData();
             if (dpids == null || dpids.size() ==  0) return;
             Long dpidLong = HexEncode.stringToLong((String) dpids.toArray()[0]);
@@ -345,10 +350,10 @@ public class OF10Provider implements NetworkingProvider {
 
         long patchOFPort = -1;
         try {
-            Map<String, Row> ifaces = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+            Map<String, Row> ifaces = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
             if (ifaces != null) {
                 for (Row row : ifaces.values()) {
-                    Interface patchiface = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+                    Interface patchiface = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
                     if (patchiface.getName().equalsIgnoreCase(patchInt)) {
                         Set<Long> of_ports = patchiface.getOpenFlowPortColumn().getData();
                         if (of_ports == null || of_ports.size() <= 0) {
@@ -364,7 +369,7 @@ public class OF10Provider implements NetworkingProvider {
                     logger.warn("Could not find port associated with patch interface {} on node {}. No flow rules to program", patchInt, node);
                 }
                 for (Row row : ifaces.values()) {
-                    Interface tuniface = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+                    Interface tuniface = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
                     if (tuniface.getName().equals(this.getTunnelName(tunnelType, segmentationId, dst))) {
                         Set<Long> of_ports = tuniface.getOpenFlowPortColumn().getData();
                         if (of_ports == null || of_ports.size() <= 0) {
@@ -426,10 +431,10 @@ public class OF10Provider implements NetworkingProvider {
 
         long patchOFPort = -1;
         try {
-            Map<String, Row> ifaces = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+            Map<String, Row> ifaces = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
             if (ifaces != null) {
                 for (Row row : ifaces.values()) {
-                    Interface patchiface = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+                    Interface patchiface = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
                     if (patchiface.getName().equalsIgnoreCase(patchInt)) {
                         Set<Long> of_ports = patchiface.getOpenFlowPortColumn().getData();
                         if (of_ports == null || of_ports.size() <= 0) {
@@ -446,7 +451,7 @@ public class OF10Provider implements NetworkingProvider {
                     // return;  // keep going; we assume that removal of rules does not really need patchOFPort
                 }
                 for (Row row : ifaces.values()) {
-                    Interface tuniface = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+                    Interface tuniface = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
                     if (tuniface.getName().equals(this.getTunnelName(tunnelType, segmentationId, dst))) {
                         Set<Long> of_ports = tuniface.getOpenFlowPortColumn().getData();
                         if (of_ports == null || of_ports.size() <= 0) {
@@ -585,10 +590,10 @@ public class OF10Provider implements NetworkingProvider {
     public long getOFPort (Node node, String portName) {
         long ofPort = -1;
         try {
-            Map<String, Row> ifaces = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+            Map<String, Row> ifaces = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
             if (ifaces != null) {
                 for (Row row : ifaces.values()) {
-                    Interface iface = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+                    Interface iface = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
                     if (iface.getName().equalsIgnoreCase(portName)) {
                         Set<Long> of_ports = iface.getOpenFlowPortColumn().getData();
                         if (of_ports == null || of_ports.size() <= 0) {
@@ -691,8 +696,9 @@ public class OF10Provider implements NetworkingProvider {
         }
 
         try {
-            Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), brUUID);
-            Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+            Row row = ovsdbConfigurationService
+                    .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), brUUID);
+            Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
             Set<String> dpids = bridge.getDatapathIdColumn().getData();
             if (dpids == null || dpids.size() ==  0) {
                 return null;
@@ -866,10 +872,10 @@ public class OF10Provider implements NetworkingProvider {
         try {
             String portName = getTunnelName(tunnelType, key, dst);
 
-            Map<String, Row> tunifaces = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+            Map<String, Row> tunifaces = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
             if (tunifaces != null) {
                 for (Row row : tunifaces.values()) {
-                    Interface tuniface = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+                    Interface tuniface = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
                     if (tuniface.getName().equals(portName)) return tuniface;
                 }
 
@@ -881,13 +887,15 @@ public class OF10Provider implements NetworkingProvider {
     }
 
     private boolean isTunnelPresent(Node node, String tunnelName, String bridgeUUID) throws Exception {
-        Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), bridgeUUID);
-        Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+        Row row = ovsdbConfigurationService
+                .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), bridgeUUID);
+        Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
         if (bridge != null) {
             Set<UUID> ports = bridge.getPortsColumn().getData();
             for (UUID portUUID : ports) {
-                Row portRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Port.class), portUUID.toString());
-                Port port = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+                Row portRow = ovsdbConfigurationService
+                        .getRow(node, ovsdbConfigurationService.getTableName(node, Port.class), portUUID.toString());
+                Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
                 if (port != null && port.getName().equalsIgnoreCase(tunnelName)) return true;
             }
         }
@@ -895,13 +903,15 @@ public class OF10Provider implements NetworkingProvider {
     }
 
     private String getPortUuid(Node node, String portName, String bridgeUUID) throws Exception {
-        Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), bridgeUUID);
-        Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+        Row row = ovsdbConfigurationService
+                .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), bridgeUUID);
+        Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
         if (bridge != null) {
             Set<UUID> ports = bridge.getPortsColumn().getData();
             for (UUID portUUID : ports) {
-                Row portRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Port.class), portUUID.toString());
-                Port port = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+                Row portRow = ovsdbConfigurationService
+                        .getRow(node, ovsdbConfigurationService.getTableName(node, Port.class), portUUID.toString());
+                Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
                 if (port != null && port.getName().equalsIgnoreCase(portName)) return portUUID.toString();
             }
         }
@@ -912,10 +922,10 @@ public class OF10Provider implements NetworkingProvider {
         try {
             String bridgeUUID = null;
             String tunnelBridgeName = configurationService.getNetworkBridgeName();
-            Map<String, Row> bridgeTable = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Bridge.class));
+            Map<String, Row> bridgeTable = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Bridge.class));
             if (bridgeTable != null) {
                 for (String uuid : bridgeTable.keySet()) {
-                    Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeTable.get(uuid));
+                    Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeTable.get(uuid));
                     if (bridge.getName().equals(tunnelBridgeName)) {
                         bridgeUUID = uuid;
                         break;
@@ -933,9 +943,11 @@ public class OF10Provider implements NetworkingProvider {
                 return new Status(StatusCode.SUCCESS);
             }
 
-            Port tunnelPort = ovsdbConfigService.createTypedRow(node, Port.class);
+            Port tunnelPort = ovsdbConfigurationService.createTypedRow(node, Port.class);
             tunnelPort.setName(portName);
-            StatusWithUuid statusWithUuid = ovsdbConfigService.insertRow(node, ovsdbConfigService.getTableName(node, Port.class), bridgeUUID, tunnelPort.getRow());
+            StatusWithUuid statusWithUuid = ovsdbConfigurationService
+                    .insertRow(node, ovsdbConfigurationService.getTableName(node, Port.class), bridgeUUID,
+                               tunnelPort.getRow());
             if (!statusWithUuid.isSuccess()) {
                 logger.error("Failed to insert Tunnel port {} in {}", portName, bridgeUUID);
                 return statusWithUuid;
@@ -945,8 +957,9 @@ public class OF10Provider implements NetworkingProvider {
             String interfaceUUID = null;
             int timeout = 6;
             while ((interfaceUUID == null) && (timeout > 0)) {
-                Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Port.class), tunnelPortUUID);
-                tunnelPort = ovsdbConfigService.getTypedRow(node, Port.class, row);
+                Row row = ovsdbConfigurationService
+                        .getRow(node, ovsdbConfigurationService.getTableName(node, Port.class), tunnelPortUUID);
+                tunnelPort = ovsdbConfigurationService.getTypedRow(node, Port.class, row);
                 Set<UUID> interfaces = tunnelPort.getInterfacesColumn().getData();
                 if (interfaces == null || interfaces.size() == 0) {
                     // Wait for the OVSDB update to sync up the Local cache.
@@ -955,8 +968,9 @@ public class OF10Provider implements NetworkingProvider {
                     continue;
                 }
                 interfaceUUID = interfaces.toArray()[0].toString();
-                Row ifaceRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Interface.class), interfaceUUID);
-                Interface iface = ovsdbConfigService.getTypedRow(node, Interface.class, ifaceRow);
+                Row ifaceRow = ovsdbConfigurationService
+                        .getRow(node, ovsdbConfigurationService.getTableName(node, Interface.class), interfaceUUID);
+                Interface iface = ovsdbConfigurationService.getTypedRow(node, Interface.class, ifaceRow);
                 if (iface == null) interfaceUUID = null;
             }
 
@@ -965,14 +979,16 @@ public class OF10Provider implements NetworkingProvider {
                 return new Status(StatusCode.INTERNALERROR);
             }
 
-            Interface tunInterface = ovsdbConfigService.createTypedRow(node, Interface.class);
+            Interface tunInterface = ovsdbConfigurationService.createTypedRow(node, Interface.class);
             tunInterface.setType(tunnelType);
             Map<String, String> options = Maps.newHashMap();
             options.put("key", key);
             options.put("local_ip", src.getHostAddress());
             options.put("remote_ip", dst.getHostAddress());
             tunInterface.setOptions(options);
-            Status status = ovsdbConfigService.updateRow(node, ovsdbConfigService.getTableName(node, Interface.class), tunnelPortUUID, interfaceUUID, tunInterface.getRow());
+            Status status = ovsdbConfigurationService
+                    .updateRow(node, ovsdbConfigurationService.getTableName(node, Interface.class), tunnelPortUUID,
+                               interfaceUUID, tunInterface.getRow());
             logger.debug("Tunnel {} add status : {}", tunInterface, status);
             return status;
         } catch (Exception e) {
@@ -984,10 +1000,10 @@ public class OF10Provider implements NetworkingProvider {
     private Status deletePort(Node node, String bridgeName, String portName) {
         try {
             String bridgeUUID = null;
-            Map<String, Row> bridgeTable = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Bridge.class));
+            Map<String, Row> bridgeTable = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Bridge.class));
             if (bridgeTable != null) {
                 for (String uuid : bridgeTable.keySet()) {
-                    Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeTable.get(uuid));
+                    Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeTable.get(uuid));
                     if (bridge.getName().equals(bridgeName)) {
                         bridgeUUID = uuid;
                         break;
@@ -1001,7 +1017,8 @@ public class OF10Provider implements NetworkingProvider {
             String portUUID = this.getPortUuid(node, portName, bridgeUUID);
             Status status = new Status(StatusCode.SUCCESS);
             if (portUUID != null) {
-                status = ovsdbConfigService.deleteRow(node, ovsdbConfigService.getTableName(node, Port.class), portUUID);
+                status = ovsdbConfigurationService
+                        .deleteRow(node, ovsdbConfigurationService.getTableName(node, Port.class), portUUID);
                 if (!status.isSuccess()) {
                     logger.error("Failed to delete port {} in {} status : {}", portName, bridgeUUID, status);
                     return status;
@@ -1054,8 +1071,9 @@ public class OF10Provider implements NetworkingProvider {
         }
 
         try {
-            Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), bridgeUuid);
-            Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+            Row row = ovsdbConfigurationService
+                    .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), bridgeUuid);
+            Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
             Set<String> dpids = bridge.getDatapathIdColumn().getData();
             if (dpids == null || dpids.size() ==  0) return;
             Long dpidLong = HexEncode.stringToLong((String) dpids.toArray()[0]);
index bee73f3e0d234bfb02b5afa8373fefd0b980929d..2464ae2e7f09522f66f57eb7f9d042f7b7c33851 100644 (file)
@@ -22,12 +22,11 @@ import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
 import org.opendaylight.ovsdb.openstack.netvirt.NetworkHandler;
 import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;
 import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.StatusWithUuid;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.StatusWithUuid;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.schema.openvswitch.Interface;
 import org.opendaylight.ovsdb.schema.openvswitch.Port;
@@ -144,11 +143,11 @@ public class OF13Provider implements NetworkingProvider {
     private static final short TABLE_2_LOCAL_FORWARD = 20;
     private static Long groupId = 1L;
 
-    private volatile ConfigurationService configurationService;
+    private volatile org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService configurationService;
     private volatile BridgeConfigurationManager bridgeConfigurationManager;
     private volatile TenantNetworkManager tenantNetworkManager;
-    private volatile OvsdbConfigService ovsdbConfigService;
-    private volatile IConnectionServiceInternal connectionService;
+    private volatile OvsdbConfigurationService ovsdbConfigurationService;
+    private volatile OvsdbConnectionService connectionService;
     private volatile MdsalConsumer mdsalConsumer;
 
     public OF13Provider(){
@@ -184,14 +183,16 @@ public class OF13Provider implements NetworkingProvider {
     }
 
     private boolean isTunnelPresent(Node node, String tunnelName, String bridgeUUID) throws Exception {
-        Preconditions.checkNotNull(ovsdbConfigService);
-        Row bridgeRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), bridgeUUID);
-        Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeRow);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
+        Row bridgeRow = ovsdbConfigurationService
+                .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), bridgeUUID);
+        Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeRow);
         if (bridge != null) {
             Set<UUID> ports = bridge.getPortsColumn().getData();
             for (UUID portUUID : ports) {
-                Row portRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Port.class), portUUID.toString());
-                Port port = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+                Row portRow = ovsdbConfigurationService
+                        .getRow(node, ovsdbConfigurationService.getTableName(node, Port.class), portUUID.toString());
+                Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
                 if (port != null && tunnelName.equalsIgnoreCase(port.getName())) return true;
             }
         }
@@ -199,14 +200,16 @@ public class OF13Provider implements NetworkingProvider {
     }
 
     private String getPortUuid(Node node, String name, String bridgeUUID) throws Exception {
-        Preconditions.checkNotNull(ovsdbConfigService);
-        Row bridgeRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), bridgeUUID);
-        Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeRow);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
+        Row bridgeRow = ovsdbConfigurationService
+                .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), bridgeUUID);
+        Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeRow);
         if (bridge != null) {
             Set<UUID> ports = bridge.getPortsColumn().getData();
             for (UUID portUUID : ports) {
-                Row portRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Port.class), portUUID.toString());
-                Port port = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+                Row portRow = ovsdbConfigurationService
+                        .getRow(node, ovsdbConfigurationService.getTableName(node, Port.class), portUUID.toString());
+                Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
                 if (port != null && name.equalsIgnoreCase(port.getName())) return portUUID.toString();
             }
         }
@@ -214,14 +217,14 @@ public class OF13Provider implements NetworkingProvider {
     }
 
     private Status addTunnelPort (Node node, String tunnelType, InetAddress src, InetAddress dst) {
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
         try {
             String bridgeUUID = null;
             String tunnelBridgeName = configurationService.getIntegrationBridgeName();
-            Map<String, Row> bridgeTable = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Bridge.class));
+            Map<String, Row> bridgeTable = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Bridge.class));
             if (bridgeTable != null) {
                 for (String uuid : bridgeTable.keySet()) {
-                    Bridge bridge = ovsdbConfigService.getTypedRow(node,Bridge.class, bridgeTable.get(uuid));
+                    Bridge bridge = ovsdbConfigurationService.getTypedRow(node,Bridge.class, bridgeTable.get(uuid));
                     if (bridge.getName().equals(tunnelBridgeName)) {
                         bridgeUUID = uuid;
                         break;
@@ -239,9 +242,10 @@ public class OF13Provider implements NetworkingProvider {
                 return new Status(StatusCode.SUCCESS);
             }
 
-            Port tunnelPort = ovsdbConfigService.createTypedRow(node, Port.class);
+            Port tunnelPort = ovsdbConfigurationService.createTypedRow(node, Port.class);
             tunnelPort.setName(portName);
-            StatusWithUuid statusWithUuid = ovsdbConfigService.insertRow(node, ovsdbConfigService.getTableName(node, Port.class), bridgeUUID, tunnelPort.getRow());
+            StatusWithUuid statusWithUuid = ovsdbConfigurationService
+                    .insertRow(node, ovsdbConfigurationService.getTableName(node, Port.class), bridgeUUID, tunnelPort.getRow());
             if (!statusWithUuid.isSuccess()) {
                 logger.error("Failed to insert Tunnel port {} in {}", portName, bridgeUUID);
                 return statusWithUuid;
@@ -251,8 +255,9 @@ public class OF13Provider implements NetworkingProvider {
             String interfaceUUID = null;
             int timeout = 6;
             while ((interfaceUUID == null) && (timeout > 0)) {
-                Row portRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Port.class), tunnelPortUUID);
-                tunnelPort = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+                Row portRow = ovsdbConfigurationService
+                        .getRow(node, ovsdbConfigurationService.getTableName(node, Port.class), tunnelPortUUID);
+                tunnelPort = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
                 Set<UUID> interfaces = tunnelPort.getInterfacesColumn().getData();
                 if (interfaces == null || interfaces.size() == 0) {
                     // Wait for the OVSDB update to sync up the Local cache.
@@ -261,8 +266,9 @@ public class OF13Provider implements NetworkingProvider {
                     continue;
                 }
                 interfaceUUID = interfaces.toArray()[0].toString();
-                Row intfRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Interface.class), interfaceUUID);
-                Interface intf = ovsdbConfigService.getTypedRow(node, Interface.class, intfRow);
+                Row intfRow = ovsdbConfigurationService
+                        .getRow(node, ovsdbConfigurationService.getTableName(node, Interface.class), interfaceUUID);
+                Interface intf = ovsdbConfigurationService.getTypedRow(node, Interface.class, intfRow);
                 if (intf == null) interfaceUUID = null;
             }
 
@@ -271,14 +277,15 @@ public class OF13Provider implements NetworkingProvider {
                 return new Status(StatusCode.INTERNALERROR);
             }
 
-            Interface tunInterface = ovsdbConfigService.createTypedRow(node, Interface.class);
+            Interface tunInterface = ovsdbConfigurationService.createTypedRow(node, Interface.class);
             tunInterface.setType(tunnelType);
             Map<String, String> options = Maps.newHashMap();
             options.put("key", "flow");
             options.put("local_ip", src.getHostAddress());
             options.put("remote_ip", dst.getHostAddress());
             tunInterface.setOptions(options);
-            Status status = ovsdbConfigService.updateRow(node, ovsdbConfigService.getTableName(node, Interface.class), tunnelPortUUID, interfaceUUID, tunInterface.getRow());
+            Status status = ovsdbConfigurationService
+                    .updateRow(node, ovsdbConfigurationService.getTableName(node, Interface.class), tunnelPortUUID, interfaceUUID, tunInterface.getRow());
             logger.debug("Tunnel {} add status : {}", tunInterface, status);
             return status;
         } catch (Exception e) {
@@ -289,13 +296,13 @@ public class OF13Provider implements NetworkingProvider {
 
     /* delete port from ovsdb port table */
     private Status deletePort(Node node, String bridgeName, String portName) {
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
         try {
             String bridgeUUID = null;
-            Map<String, Row> bridgeTable = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Bridge.class));
+            Map<String, Row> bridgeTable = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Bridge.class));
             if (bridgeTable != null) {
                 for (String uuid : bridgeTable.keySet()) {
-                    Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeTable.get(uuid));
+                    Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeTable.get(uuid));
                     if (bridge.getName().equals(bridgeName)) {
                         bridgeUUID = uuid;
                         break;
@@ -310,7 +317,8 @@ public class OF13Provider implements NetworkingProvider {
             String portUUID = this.getPortUuid(node, portName, bridgeUUID);
             Status status = new Status(StatusCode.SUCCESS);
             if (portUUID != null) {
-               status = ovsdbConfigService.deleteRow(node, ovsdbConfigService.getTableName(node, Port.class), portUUID);
+               status = ovsdbConfigurationService
+                       .deleteRow(node, ovsdbConfigurationService.getTableName(node, Port.class), portUUID);
                if (!status.isSuccess()) {
                    logger.error("Failed to delete port {} in {} status : {}", portName, bridgeUUID,
                                 status);
@@ -758,10 +766,11 @@ public class OF13Provider implements NetworkingProvider {
                         segmentationId, ethPort, false);
    }
     private Long getDpid (Node node, String bridgeUuid) {
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
         try {
-            Row bridgeRow =  ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), bridgeUuid);
-            Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeRow);
+            Row bridgeRow =  ovsdbConfigurationService
+                    .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), bridgeUuid);
+            Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeRow);
             Set<String> dpids = bridge.getDatapathIdColumn().getData();
             if (dpids == null || dpids.size() == 0) return 0L;
             return HexEncode.stringToLong((String) dpids.toArray()[0]);
@@ -888,7 +897,7 @@ public class OF13Provider implements NetworkingProvider {
     private void programTunnelRules (String tunnelType, String segmentationId, InetAddress dst, Node node,
             Interface intf, boolean local) {
 
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
 
         try {
 
@@ -917,10 +926,10 @@ public class OF13Provider implements NetworkingProvider {
                 return;
             }
 
-            Map<String, Row> intfs = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+            Map<String, Row> intfs = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
             if (intfs != null) {
                 for (Row row : intfs.values()) {
-                    Interface tunIntf = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+                    Interface tunIntf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
                     if (tunIntf.getName().equals(this.getTunnelName(tunnelType, dst))) {
                         of_ports = tunIntf.getOpenFlowPortColumn().getData();
                         if (of_ports == null || of_ports.size() <= 0) {
@@ -954,7 +963,7 @@ public class OF13Provider implements NetworkingProvider {
     private void removeTunnelRules (String tunnelType, String segmentationId, InetAddress dst, Node node,
             Interface intf, boolean local, boolean isLastInstanceOnNode) {
 
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
         try {
 
             Long dpid = this.getIntegrationBridgeOFDPID(node);
@@ -982,10 +991,10 @@ public class OF13Provider implements NetworkingProvider {
                 return;
             }
 
-            Map<String, Row> intfs = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+            Map<String, Row> intfs = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
             if (intfs != null) {
                 for (Row row : intfs.values()) {
-                    Interface tunIntf = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+                    Interface tunIntf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
                     if (tunIntf.getName().equals(this.getTunnelName(tunnelType, dst))) {
                         of_ports = tunIntf.getOpenFlowPortColumn().getData();
                         if (of_ports == null || of_ports.size() <= 0) {
@@ -1016,7 +1025,7 @@ public class OF13Provider implements NetworkingProvider {
     }
 
     private void programVlanRules (NeutronNetwork network, Node node, Interface intf) {
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
         logger.debug("Program vlan rules for interface {}", intf.getName());
         try {
 
@@ -1053,10 +1062,10 @@ public class OF13Provider implements NetworkingProvider {
                 return;
             }
 
-            Map<String, Row> intfs = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+            Map<String, Row> intfs = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
             if (intfs != null) {
                 for (Row row : intfs.values()) {
-                    Interface ethIntf = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+                    Interface ethIntf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
                     if (ethIntf.getName().equalsIgnoreCase(bridgeConfigurationManager.getPhysicalInterfaceName(node, network.getProviderPhysicalNetwork()))) {
                         of_ports = ethIntf.getOpenFlowPortColumn().getData();
                         timeout = 6;
@@ -1094,7 +1103,7 @@ public class OF13Provider implements NetworkingProvider {
 
     private void removeVlanRules (NeutronNetwork network, Node node,
                       Interface intf, boolean isLastInstanceOnNode) {
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
         logger.debug("Remove vlan rules for interface {}", intf.getName());
 
         try {
@@ -1123,10 +1132,10 @@ public class OF13Provider implements NetworkingProvider {
                 return;
             }
 
-            Map<String, Row> intfs = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+            Map<String, Row> intfs = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
             if (intfs != null) {
                 for (Row row : intfs.values()) {
-                    Interface ethIntf = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+                    Interface ethIntf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
                     if (ethIntf.getName().equalsIgnoreCase(bridgeConfigurationManager.getPhysicalInterfaceName(node,
                                                                    network.getProviderPhysicalNetwork()))) {
                         of_ports = ethIntf.getOpenFlowPortColumn().getData();
@@ -1184,12 +1193,12 @@ public class OF13Provider implements NetworkingProvider {
     }
 
     private Status triggerInterfaceUpdates(Node node) {
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
         try {
-            Map<String, Row> intfs = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+            Map<String, Row> intfs = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
             if (intfs != null) {
                 for (Row row : intfs.values()) {
-                    Interface intf = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+                    Interface intf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
                     NeutronNetwork network = tenantNetworkManager.getTenantNetwork(intf);
                     logger.debug("Trigger Interface update for {}", intf);
                     if (network != null) {
@@ -4031,12 +4040,12 @@ public class OF13Provider implements NetworkingProvider {
     }
 
     private String getInternalBridgeUUID (Node node, String bridgeName) {
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
         try {
-            Map<String, Row> bridgeTable = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Bridge.class));
+            Map<String, Row> bridgeTable = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Bridge.class));
             if (bridgeTable == null) return null;
             for (String key : bridgeTable.keySet()) {
-                Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeTable.get(key));
+                Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeTable.get(key));
                 if (bridge.getName().equals(bridgeName)) return key;
             }
         } catch (Exception e) {
index 47a3d179a19c28478dfc414213d22bfc14551964..43730ac601810b723eff709816ac59c0522aabb8 100644 (file)
@@ -58,7 +58,7 @@
               org.opendaylight.controller.switchmanager,
               org.opendaylight.controller.sal.core,
               org.opendaylight.controller.sal.utils,
-              org.opendaylight.ovsdb.plugin,
+              org.opendaylight.ovsdb.plugin.api,
               org.opendaylight.ovsdb.lib.notation,
               org.apache.felix.dm,
               org.slf4j,
index c0ebd86b4edf224b904ca24f86e5b2382fadeda1..75bf7693610134d8de808d1ba735d52f1c356802 100644 (file)
@@ -20,7 +20,6 @@ import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetAware;
 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
 import org.opendaylight.controller.switchmanager.IInventoryListener;
 import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;
 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
 import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
@@ -30,9 +29,9 @@ import org.opendaylight.ovsdb.openstack.netvirt.impl.ConfigurationServiceImpl;
 import org.opendaylight.ovsdb.openstack.netvirt.impl.ProviderNetworkManagerImpl;
 import org.opendaylight.ovsdb.openstack.netvirt.impl.TenantNetworkManagerImpl;
 import org.opendaylight.ovsdb.openstack.netvirt.impl.VlanConfigurationCacheImpl;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.OvsdbInventoryListener;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
 
 import org.apache.felix.dm.Component;
 
@@ -98,22 +97,23 @@ public class Activator extends ComponentActivatorAbstractBase {
     public void configureInstance(Component c, Object imp,
                                   String containerName) {
         if (imp.equals(ConfigurationServiceImpl.class)) {
-            c.setInterface(ConfigurationService.class.getName(), null);
-            c.add(createServiceDependency().setService(OvsdbConfigService.class));
+            c.setInterface(org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class.getName(), null);
+            c.add(createServiceDependency().setService(OvsdbConfigurationService.class));
         }
 
         if (imp.equals(BridgeConfigurationManagerImpl.class)) {
             c.setInterface(BridgeConfigurationManager.class.getName(), null);
-            c.add(createServiceDependency().setService(ConfigurationService.class).setRequired(true));
+            c.add(createServiceDependency().setService(
+                    org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class).setRequired(true));
             c.add(createServiceDependency().setService(NetworkingProviderManager.class));
-            c.add(createServiceDependency().setService(OvsdbConfigService.class));
+            c.add(createServiceDependency().setService(OvsdbConfigurationService.class));
         }
 
         if (imp.equals(TenantNetworkManagerImpl.class)) {
             c.setInterface(TenantNetworkManager.class.getName(), null);
             c.add(createServiceDependency().setService(NetworkingProviderManager.class));
-            c.add(createServiceDependency().setService(OvsdbConfigService.class));
-            c.add(createServiceDependency().setService(IConnectionServiceInternal.class));
+            c.add(createServiceDependency().setService(OvsdbConfigurationService.class));
+            c.add(createServiceDependency().setService(OvsdbConnectionService.class));
             c.add(createServiceDependency().
                     setService(INeutronNetworkCRUD.class).
                     setRequired(true));
@@ -125,7 +125,7 @@ public class Activator extends ComponentActivatorAbstractBase {
 
         if (imp.equals(VlanConfigurationCacheImpl.class)) {
             c.setInterface(VlanConfigurationCache.class.getName(), null);
-            c.add(createServiceDependency().setService(OvsdbConfigService.class));
+            c.add(createServiceDependency().setService(OvsdbConfigurationService.class));
             c.add(createServiceDependency().setService(TenantNetworkManager.class));
         }
 
@@ -133,9 +133,10 @@ public class Activator extends ComponentActivatorAbstractBase {
             c.setInterface(INeutronNetworkAware.class.getName(), null);
             c.add(createServiceDependency().setService(TenantNetworkManager.class).setRequired(true));
             c.add(createServiceDependency().setService(BridgeConfigurationManager.class).setRequired(true));
-            c.add(createServiceDependency().setService(ConfigurationService.class).setRequired(true));
-            c.add(createServiceDependency().setService(OvsdbConfigService.class).setRequired(true));
-            c.add(createServiceDependency().setService(IConnectionServiceInternal.class).setRequired(true));
+            c.add(createServiceDependency().setService(
+                    org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class).setRequired(true));
+            c.add(createServiceDependency().setService(OvsdbConfigurationService.class).setRequired(true));
+            c.add(createServiceDependency().setService(OvsdbConnectionService.class).setRequired(true));
             c.add(createServiceDependency().setService(INeutronNetworkCRUD.class).setRequired(true));
             c.add(createServiceDependency().setService(OvsdbInventoryListener.class).setRequired(true));
         }
@@ -146,20 +147,21 @@ public class Activator extends ComponentActivatorAbstractBase {
 
         if (imp.equals(PortHandler.class)) {
             c.setInterface(INeutronPortAware.class.getName(), null);
-            c.add(createServiceDependency().setService(OvsdbConfigService.class).setRequired(true));
-            c.add(createServiceDependency().setService(IConnectionServiceInternal.class).setRequired(true));
+            c.add(createServiceDependency().setService(OvsdbConfigurationService.class).setRequired(true));
+            c.add(createServiceDependency().setService(OvsdbConnectionService.class).setRequired(true));
             c.add(createServiceDependency().setService(OvsdbInventoryListener.class).setRequired(true));
         }
 
         if (imp.equals(SouthboundHandler.class)) {
             c.setInterface(new String[] {OvsdbInventoryListener.class.getName(),
                                          IInventoryListener.class.getName()}, null);
-            c.add(createServiceDependency().setService(ConfigurationService.class).setRequired(true));
+            c.add(createServiceDependency().setService(
+                    org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class).setRequired(true));
             c.add(createServiceDependency().setService(BridgeConfigurationManager.class).setRequired(true));
             c.add(createServiceDependency().setService(TenantNetworkManager.class).setRequired(true));
             c.add(createServiceDependency().setService(NetworkingProviderManager.class).setRequired(true));
-            c.add(createServiceDependency().setService(OvsdbConfigService.class).setRequired(true));
-            c.add(createServiceDependency().setService(IConnectionServiceInternal.class).setRequired(true));
+            c.add(createServiceDependency().setService(OvsdbConfigurationService.class).setRequired(true));
+            c.add(createServiceDependency().setService(OvsdbConnectionService.class).setRequired(true));
         }
 
         if (imp.equals(PortSecurityHandler.class)) {
@@ -170,7 +172,7 @@ public class Activator extends ComponentActivatorAbstractBase {
         if (imp.equals(ProviderNetworkManagerImpl.class)) {
             c.setInterface(NetworkingProviderManager.class.getName(), null);
             c.add(createServiceDependency()
-                    .setService(ConfigurationService.class)
+                    .setService(org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class)
                     .setRequired(true));
             c.add(createServiceDependency()
                     .setService(NetworkingProvider.class)
index 1aaa4c678ff5e3ff6fe9a4a4cd35327de0251d2f..d4b3d4d2c44bdc4f6cdcdbea4b76bc0649976023 100644 (file)
@@ -16,11 +16,10 @@ import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.ovsdb.lib.notation.Row;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
 import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.OvsdbInventoryListener;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
 import org.opendaylight.ovsdb.schema.openvswitch.Interface;
 import org.opendaylight.ovsdb.schema.openvswitch.Port;
 
@@ -49,11 +48,11 @@ public class NetworkHandler extends AbstractHandler
     // The implementation for each of these services is resolved by the OSGi Service Manager
     private volatile TenantNetworkManager tenantNetworkManager;
     private volatile BridgeConfigurationManager bridgeConfigurationManager;
-    private volatile ConfigurationService configurationService;
-    private volatile OvsdbConfigService ovsdbConfigService;
-    private volatile IConnectionServiceInternal connectionService;
+    private volatile org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService configurationService;
+    private volatile OvsdbConfigurationService ovsdbConfigurationService;
+    private volatile OvsdbConnectionService connectionService;
     private volatile INeutronNetworkCRUD neutronNetworkCache;
-    private volatile OvsdbInventoryListener inventoryListener;
+    private volatile OvsdbInventoryListener ovsdbInventoryListener;
 
     /**
      * Invoked when a network creation is requested
@@ -156,15 +155,15 @@ public class NetworkHandler extends AbstractHandler
                     List<String> phyIfName = bridgeConfigurationManager.getAllPhysicalInterfaceNames(node);
                     try {
                         ConcurrentMap<String, Row> ports =
-                                this.ovsdbConfigService.getRows(node,
-                                                                ovsdbConfigService.getTableName(node, Port.class));
+                                this.ovsdbConfigurationService.getRows(node,
+                                                                ovsdbConfigurationService.getTableName(node, Port.class));
                         if (ports != null) {
                             for (Row portRow : ports.values()) {
-                                Port port = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+                                Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
                                 for (UUID interfaceUuid : port.getInterfacesColumn().getData()) {
-                                    Interface interfaceRow = (Interface) ovsdbConfigService
+                                    Interface interfaceRow = (Interface) ovsdbConfigurationService
                                             .getRow(node,
-                                                    ovsdbConfigService.getTableName(node, Interface.class),
+                                                    ovsdbConfigurationService.getTableName(node, Interface.class),
                                                     interfaceUuid.toString());
 
                                     String interfaceType = interfaceRow.getTypeColumn().getData();
@@ -173,14 +172,14 @@ public class NetworkHandler extends AbstractHandler
                                             NetworkHandler.NETWORK_TYPE_GRE)) {
                                         /* delete tunnel ports on this node */
                                         logger.trace("Delete tunnel interface {}", interfaceRow);
-                                        ovsdbConfigService.deleteRow(node,
-                                                                     ovsdbConfigService.getTableName(node, Port.class),
+                                        ovsdbConfigurationService.deleteRow(node,
+                                                                     ovsdbConfigurationService.getTableName(node, Port.class),
                                                                      port.getUuid().toString());
                                         break;
                                     } else if (!phyIfName.isEmpty() && phyIfName.contains(interfaceRow.getName())) {
                                         logger.trace("Delete physical interface {}", interfaceRow);
-                                        ovsdbConfigService.deleteRow(node,
-                                                                     ovsdbConfigService.getTableName(node, Port.class),
+                                        ovsdbConfigurationService.deleteRow(node,
+                                                                     ovsdbConfigurationService.getTableName(node, Port.class),
                                                                      port.getUuid().toString());
                                         break;
                                     }
index c62fe26678bed0362016b6254bd1ed31c06844d3..fa93f1106ecb1521a2ea896197781bb79918875c 100644 (file)
@@ -15,9 +15,9 @@ import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.ovsdb.lib.notation.Row;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.OvsdbInventoryListener;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
 import org.opendaylight.ovsdb.schema.openvswitch.Interface;
 import org.opendaylight.ovsdb.schema.openvswitch.Port;
 
@@ -40,8 +40,8 @@ public class PortHandler extends AbstractHandler
      */
     static final Logger logger = LoggerFactory.getLogger(PortHandler.class);
 
-    private volatile OvsdbConfigService ovsdbConfigService;
-    private volatile IConnectionServiceInternal connectionService;
+    private volatile OvsdbConfigurationService ovsdbConfigurationService;
+    private volatile OvsdbConnectionService connectionService;
     private volatile OvsdbInventoryListener ovsdbInventoryListener;
 
     /**
@@ -139,15 +139,15 @@ public class PortHandler extends AbstractHandler
         for (Node node : nodes) {
             try {
                 ConcurrentMap<String, Row> portRows =
-                        this.ovsdbConfigService.getRows(node,
-                                                        ovsdbConfigService.getTableName(node, Port.class));
+                        this.ovsdbConfigurationService.getRows(node,
+                                                        ovsdbConfigurationService.getTableName(node, Port.class));
                 if (portRows != null) {
                     for (Row portRow : portRows.values()) {
-                        Port port = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+                        Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
                         for (UUID interfaceUuid : port.getInterfacesColumn().getData()) {
-                            Interface interfaceRow = (Interface) ovsdbConfigService
+                            Interface interfaceRow = (Interface) ovsdbConfigurationService
                                     .getRow(node,
-                                            ovsdbConfigService.getTableName(node, Interface.class),
+                                            ovsdbConfigurationService.getTableName(node, Interface.class),
                                             interfaceUuid.toString());
 
                             Map<String, String> externalIds = interfaceRow.getExternalIdsColumn().getData();
@@ -165,8 +165,8 @@ public class PortHandler extends AbstractHandler
 
                             if (neutronPortId.equalsIgnoreCase(neutronPort.getPortUUID())) {
                                 logger.trace("neutronPortDeleted: Delete interface {}", interfaceRow.getName());
-                                ovsdbConfigService.deleteRow(node,
-                                                             ovsdbConfigService.getTableName(node, Port.class),
+                                ovsdbConfigurationService.deleteRow(node,
+                                                             ovsdbConfigurationService.getTableName(node, Port.class),
                                                              port.getUuid().toString());
                                 break;
                             }
index ef19966e673234aacedf00e4e098ab658cff31d4..4177b7269293b25e8ad892c1c60858850f52c395 100644 (file)
@@ -18,12 +18,11 @@ import org.opendaylight.controller.switchmanager.IInventoryListener;
 import org.opendaylight.ovsdb.lib.notation.Row;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
 import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.OvsdbInventoryListener;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
 import org.opendaylight.ovsdb.schema.openvswitch.Interface;
 import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
 import org.opendaylight.ovsdb.schema.openvswitch.Port;
@@ -49,12 +48,12 @@ public class SouthboundHandler extends AbstractHandler implements OvsdbInventory
     List<Node> nodeCache;
 
     // The implementation for each of these services is resolved by the OSGi Service Manager
-    private volatile ConfigurationService configurationService;
+    private volatile org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService configurationService;
     private volatile BridgeConfigurationManager bridgeConfigurationManager;
     private volatile TenantNetworkManager tenantNetworkManager;
     private volatile NetworkingProviderManager networkingProviderManager;
-    private volatile OvsdbConfigService ovsdbConfigService;
-    private volatile IConnectionServiceInternal connectionService;
+    private volatile OvsdbConfigurationService ovsdbConfigurationService;
+    private volatile OvsdbConnectionService connectionService;
 
     void init() {
         eventHandler = Executors.newSingleThreadExecutor();
@@ -132,25 +131,25 @@ public class SouthboundHandler extends AbstractHandler implements OvsdbInventory
 
     private boolean isUpdateOfInterest(Node node, Row oldRow, Row newRow) {
         if (oldRow == null) return true;
-        if (newRow.getTableSchema().getName().equals(ovsdbConfigService.getTableName(node, Interface.class))) {
+        if (newRow.getTableSchema().getName().equals(ovsdbConfigurationService.getTableName(node, Interface.class))) {
             // We are NOT interested in Stats only updates
-            Interface oldIntf = ovsdbConfigService.getTypedRow(node, Interface.class, oldRow);
+            Interface oldIntf = ovsdbConfigurationService.getTypedRow(node, Interface.class, oldRow);
             if (oldIntf.getName() == null && oldIntf.getExternalIdsColumn() == null && oldIntf.getMacColumn() == null &&
                 oldIntf.getOpenFlowPortColumn() == null && oldIntf.getOptionsColumn() == null && oldIntf.getOtherConfigColumn() == null &&
                 oldIntf.getTypeColumn() == null) {
                 logger.trace("IGNORING Interface Update: node {}, row: {}", node, newRow);
                 return false;
             }
-        } else if (newRow.getTableSchema().getName().equals(ovsdbConfigService.getTableName(node, Port.class))) {
+        } else if (newRow.getTableSchema().getName().equals(ovsdbConfigurationService.getTableName(node, Port.class))) {
             // We are NOT interested in Stats only updates
-            Port oldPort = ovsdbConfigService.getTypedRow(node, Port.class, oldRow);
+            Port oldPort = ovsdbConfigurationService.getTypedRow(node, Port.class, oldRow);
             if (oldPort.getName() == null && oldPort.getExternalIdsColumn() == null && oldPort.getMacColumn() == null &&
                 oldPort.getInterfacesColumn() == null && oldPort.getTagColumn() == null && oldPort.getTrunksColumn() == null) {
                 logger.trace("IGNORING Port Update: node {}, row: {}", node, newRow);
                 return false;
             }
-        } else if (newRow.getTableSchema().getName().equals(ovsdbConfigService.getTableName(node, OpenVSwitch.class))) {
-            OpenVSwitch oldOpenvSwitch = ovsdbConfigService.getTypedRow(node, OpenVSwitch.class, oldRow);
+        } else if (newRow.getTableSchema().getName().equals(ovsdbConfigurationService.getTableName(node, OpenVSwitch.class))) {
+            OpenVSwitch oldOpenvSwitch = ovsdbConfigurationService.getTypedRow(node, OpenVSwitch.class, oldRow);
             if (oldOpenvSwitch.getOtherConfigColumn()== null) {
                 /* we are only interested in other_config field change */
                 return false;
@@ -181,9 +180,9 @@ public class SouthboundHandler extends AbstractHandler implements OvsdbInventory
     private void processRowUpdate(Node node, String tableName, String uuid, Row row,
                                   Object context, SouthboundEvent.Action action) {
         if (action == SouthboundEvent.Action.DELETE) {
-            if (tableName.equalsIgnoreCase(ovsdbConfigService.getTableName(node, Interface.class))) {
+            if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, Interface.class))) {
                 logger.debug("Processing update of {}. Deleted node: {}, uuid: {}, row: {}", tableName, node, uuid, row);
-                Interface deletedIntf = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+                Interface deletedIntf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
                 NeutronNetwork network = null;
                 if (context == null) {
                     network = tenantNetworkManager.getTenantNetwork(deletedIntf);
@@ -202,12 +201,13 @@ public class SouthboundHandler extends AbstractHandler implements OvsdbInventory
                     logger.debug("Processing update of {}:{} node {} intf {} network {}",
                             tableName, action, node, uuid, network.getNetworkUUID());
                     try {
-                        ConcurrentMap<String, Row> interfaces = this.ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+                        ConcurrentMap<String, Row> interfaces = this.ovsdbConfigurationService
+                                .getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
                         if (interfaces != null) {
                             boolean isLastInstanceOnNode = true;
                             for (String intfUUID : interfaces.keySet()) {
                                 if (intfUUID.equals(uuid)) continue;
-                                Interface intf = this.ovsdbConfigService.getTypedRow(node, Interface.class, interfaces.get(intfUUID));
+                                Interface intf = this.ovsdbConfigurationService.getTypedRow(node, Interface.class, interfaces.get(intfUUID));
                                 NeutronNetwork neutronNetwork = tenantNetworkManager.getTenantNetwork(intf);
                                 if (neutronNetwork != null && neutronNetwork.equals(network)) isLastInstanceOnNode = false;
                             }
@@ -219,10 +219,10 @@ public class SouthboundHandler extends AbstractHandler implements OvsdbInventory
                 }
             }
         }
-        else if (tableName.equalsIgnoreCase(ovsdbConfigService.getTableName(node, Interface.class))) {
+        else if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, Interface.class))) {
             logger.debug("Processing update of {}:{} node: {}, interface uuid: {}, row: {}",
                     tableName, action, node, uuid, row);
-            Interface intf = this.ovsdbConfigService.getTypedRow(node, Interface.class, row);
+            Interface intf = this.ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
             NeutronNetwork network = tenantNetworkManager.getTenantNetwork(intf);
             if (network != null && !network.getRouterExternal()) {
                 if (networkingProviderManager.getProvider(node).hasPerTenantTunneling()) {
@@ -239,15 +239,18 @@ public class SouthboundHandler extends AbstractHandler implements OvsdbInventory
                 }
                 this.handleInterfaceUpdate(node, uuid, intf);
             }
-        } else if (tableName.equalsIgnoreCase(ovsdbConfigService.getTableName(node, Port.class))) {
+
+        } else if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, Port.class))) {
             logger.debug("Processing update of {}:{} node: {}, port uuid: {}, row: {}", tableName, action, node, uuid, row);
-            Port port = this.ovsdbConfigService.getTypedRow(node, Port.class, row);
+            Port port = this.ovsdbConfigurationService.getTypedRow(node, Port.class, row);
             Set<UUID> interfaceUUIDs = port.getInterfacesColumn().getData();
             for (UUID intfUUID : interfaceUUIDs) {
                 logger.trace("Scanning interface "+intfUUID);
                 try {
-                    Row intfRow = this.ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Interface.class), intfUUID.toString());
-                    Interface intf = this.ovsdbConfigService.getTypedRow(node, Interface.class, intfRow);
+                    Row intfRow = this.ovsdbConfigurationService
+                            .getRow(node, ovsdbConfigurationService.getTableName(node, Interface.class),
+                                    intfUUID.toString());
+                    Interface intf = this.ovsdbConfigurationService.getTypedRow(node, Interface.class, intfRow);
                     NeutronNetwork network = tenantNetworkManager.getTenantNetwork(intf);
                     if (network != null && !network.getRouterExternal()) {
                          logger.debug("Processing update of {}:{} node {} intf {} network {}",
@@ -262,13 +265,14 @@ public class SouthboundHandler extends AbstractHandler implements OvsdbInventory
                     logger.error("Failed to process row update", e);
                 }
             }
-        } else if (tableName.equalsIgnoreCase(ovsdbConfigService.getTableName(node, OpenVSwitch.class))) {
+        } else if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, OpenVSwitch.class))) {
             logger.debug("Processing update of {}:{} node: {}, ovs uuid: {}, row: {}", tableName, action, node, uuid, row);
             try {
-                ConcurrentMap<String, Row> interfaces = this.ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+                ConcurrentMap<String, Row> interfaces = this.ovsdbConfigurationService
+                        .getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
                 if (interfaces != null) {
                     for (String intfUUID : interfaces.keySet()) {
-                        Interface intf = ovsdbConfigService.getTypedRow(node, Interface.class, interfaces.get(intfUUID));
+                        Interface intf = ovsdbConfigurationService.getTypedRow(node, Interface.class, interfaces.get(intfUUID));
                         this.handleInterfaceUpdate(node, intfUUID, intf);
                     }
                 }
@@ -316,10 +320,10 @@ public class SouthboundHandler extends AbstractHandler implements OvsdbInventory
 
     private String getPortIdForInterface (Node node, String uuid, Interface intf) {
         try {
-            Map<String, Row> ports = this.ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Port.class));
+            Map<String, Row> ports = this.ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Port.class));
             if (ports == null) return null;
             for (String portUUID : ports.keySet()) {
-                Port port = ovsdbConfigService.getTypedRow(node, Port.class, ports.get(portUUID));
+                Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, ports.get(portUUID));
                 Set<UUID> interfaceUUIDs = port.getInterfacesColumn().getData();
                 logger.trace("Scanning Port {} to identify interface : {} ",port, uuid);
                 for (UUID intfUUID : interfaceUUIDs) {
@@ -358,10 +362,10 @@ public class SouthboundHandler extends AbstractHandler implements OvsdbInventory
         if (nodes == null) return;
         for (Node node : nodes) {
             try {
-                List<String> tableNames = ovsdbConfigService.getTables(node);
+                List<String> tableNames = ovsdbConfigurationService.getTables(node);
                 if (tableNames == null) continue;
                 for (String tableName : tableNames) {
-                    Map<String, Row> rows = ovsdbConfigService.getRows(node, tableName);
+                    Map<String, Row> rows = ovsdbConfigurationService.getRows(node, tableName);
                     if (rows == null) continue;
                     for (String uuid : rows.keySet()) {
                         Row row = rows.get(uuid);
index 53fc1f190001190f05322117d79fa799dccb98b0..e0c9105a860f9e30541fd4e03a45028aca1b83fe 100644 (file)
@@ -18,11 +18,10 @@ import org.opendaylight.ovsdb.lib.notation.Row;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.openstack.netvirt.NetworkHandler;
 import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
 import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.StatusWithUuid;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.StatusWithUuid;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.schema.openvswitch.Interface;
 import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
@@ -44,22 +43,22 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
     static final Logger logger = LoggerFactory.getLogger(BridgeConfigurationManagerImpl.class);
 
     // The implementation for each of these services is resolved by the OSGi Service Manager
-    private volatile ConfigurationService configurationService;
+    private volatile org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService configurationService;
     private volatile NetworkingProviderManager networkingProviderManager;
-    private volatile OvsdbConfigService ovsdbConfigService;
+    private volatile OvsdbConfigurationService ovsdbConfigurationService;
 
     public BridgeConfigurationManagerImpl() {
     }
 
     @Override
     public String getBridgeUuid(Node node, String bridgeName) {
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
         try {
              Map<String, Row> bridgeTable =
-                     ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Bridge.class));
+                     ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Bridge.class));
             if (bridgeTable == null) return null;
             for (String key : bridgeTable.keySet()) {
-                Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeTable.get(key));
+                Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeTable.get(key));
                 if (bridge.getName().equals(bridgeName)) return key;
             }
         } catch (Exception e) {
@@ -76,21 +75,21 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
 
     @Override
     public boolean isNodeOverlayReady(Node node) {
-        Preconditions.checkNotNull(configurationService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
         return this.isNodeNeutronReady(node)
                && this.getBridgeUuid(node, configurationService.getNetworkBridgeName()) != null;
     }
 
     @Override
     public boolean isPortOnBridge (Node node, Bridge bridge, String portName) {
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
         for (UUID portsUUID : bridge.getPortsColumn().getData()) {
             try {
-                Row portRow = ovsdbConfigService.getRow(node,
-                                                        ovsdbConfigService.getTableName(node, Port.class),
+                Row portRow = ovsdbConfigurationService.getRow(node,
+                                                        ovsdbConfigurationService.getTableName(node, Port.class),
                                                         portsUUID.toString());
 
-                Port port = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+                Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
                 if ((port != null) && port.getName().equalsIgnoreCase(portName)) {
                     return true;
                 }
@@ -133,7 +132,7 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
 
     @Override
     public boolean isNodeVlanReady(Node node, NeutronNetwork network) {
-        Preconditions.checkNotNull(configurationService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
         Preconditions.checkNotNull(networkingProviderManager);
 
         /* is br-int created */
@@ -231,7 +230,7 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
         String phyIf = null;
         try {
             Map<String, Row> ovsTable =
-                    ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, OpenVSwitch.class));
+                    ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, OpenVSwitch.class));
 
             if (ovsTable == null) {
                 logger.error("OpenVSwitch table is null for Node {} ", node);
@@ -242,7 +241,7 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
             // The specification does not restrict the number of rows so we choose the first we find.
             for (Row row : ovsTable.values()) {
                 String providerMaps;
-                OpenVSwitch ovsRow = ovsdbConfigService.getTypedRow(node, OpenVSwitch.class, row);
+                OpenVSwitch ovsRow = ovsdbConfigurationService.getTypedRow(node, OpenVSwitch.class, row);
                 Map<String, String> configs = ovsRow.getOtherConfigColumn().getData();
 
                 if (configs == null) {
@@ -288,7 +287,7 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
 
         try {
             Map<String, Row> ovsTable =
-                    ovsdbConfigService.getRows(node,ovsdbConfigService.getTableName(node, OpenVSwitch.class));
+                    ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, OpenVSwitch.class));
 
             if (ovsTable == null) {
                 logger.error("OpenVSwitch table is null for Node {} ", node);
@@ -298,7 +297,7 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
             // While there is only one entry in the HashMap, we can't access it by index...
             for (Row row : ovsTable.values()) {
                 String bridgeMaps;
-                OpenVSwitch ovsRow = ovsdbConfigService.getTypedRow(node, OpenVSwitch.class, row);
+                OpenVSwitch ovsRow = ovsdbConfigurationService.getTypedRow(node, OpenVSwitch.class, row);
                 Map<String, String> configs = ovsRow.getOtherConfigColumn().getData();
 
                 if (configs == null) {
@@ -333,13 +332,13 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
      * Returns the Bridge for a given node and bridgeName
      */
     public Bridge getBridge (Node node, String bridgeName) {
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
         try {
             Map<String, Row> bridgeTable =
-                    ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Bridge.class));
+                    ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Bridge.class));
             if (bridgeTable != null) {
                 for (String key : bridgeTable.keySet()) {
-                    Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeTable.get(key));
+                    Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeTable.get(key));
                     if (bridge.getName().equals(bridgeName)) {
                         return bridge;
                     }
@@ -355,7 +354,7 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
      * Returns true if a patch port exists between the Integration Bridge and Network Bridge
      */
     private boolean isNetworkPatchCreated (Node node, Bridge intBridge, Bridge netBridge) {
-        Preconditions.checkNotNull(configurationService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
 
         boolean isPatchCreated = false;
 
@@ -374,7 +373,7 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
      * Creates the Integration Bridge
      */
     private void createIntegrationBridge (Node node) throws Exception {
-        Preconditions.checkNotNull(configurationService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
 
         String brInt = configurationService.getIntegrationBridgeName();
 
@@ -440,7 +439,7 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
                     type: internal
      */
     private boolean createBridges(Node node, NeutronNetwork network) throws Exception {
-        Preconditions.checkNotNull(configurationService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
         Preconditions.checkNotNull(networkingProviderManager);
         Status status;
 
@@ -503,7 +502,7 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
      * Add a Port to a Bridge
      */
     private Status addPortToBridge (Node node, String bridgeName, String portName) throws Exception {
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
 
         logger.debug("addPortToBridge: Adding port: {} to Bridge {}, Node {}", portName, bridgeName, node);
 
@@ -514,8 +513,9 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
         }
 
         /* Check if the port already exists. */
-        Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), bridgeUUID);
-        Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+        Row row = ovsdbConfigurationService
+                .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), bridgeUUID);
+        Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
         if (bridge != null) {
             if (isPortOnBridge(node, bridge, portName)) {
                 logger.debug("addPortToBridge: Port {} already in Bridge {}, Node {}", portName, bridgeName, node);
@@ -526,10 +526,10 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
             return new Status(StatusCode.NOTFOUND, "Could not find "+portName+" in "+bridgeName);
         }
 
-        Port port = ovsdbConfigService.createTypedRow(node, Port.class);
+        Port port = ovsdbConfigurationService.createTypedRow(node, Port.class);
         port.setName(portName);
         StatusWithUuid statusWithUuid =
-                ovsdbConfigService.insertRow(node, port.getSchema().getName(), bridgeUUID, port.getRow());
+                ovsdbConfigurationService.insertRow(node, port.getSchema().getName(), bridgeUUID, port.getRow());
         if (!statusWithUuid.isSuccess()) {
             logger.error("addPortToBridge: Failed to add Port {} in Bridge {}, Node {}", portName, bridgeName, node);
             return statusWithUuid;
@@ -539,8 +539,8 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
         String interfaceUUID = null;
         int timeout = 6;
         while ((interfaceUUID == null) && (timeout > 0)) {
-            Row portRow = ovsdbConfigService.getRow(node, port.getSchema().getName(), portUUID);
-            port = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+            Row portRow = ovsdbConfigurationService.getRow(node, port.getSchema().getName(), portUUID);
+            port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
             Set<UUID> interfaces = port.getInterfacesColumn().getData();
             if (interfaces == null || interfaces.size() == 0) {
                 // Wait for the OVSDB update to sync up the Local cache.
@@ -549,8 +549,8 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
                 continue;
             }
             interfaceUUID = interfaces.toArray()[0].toString();
-            Row intf =ovsdbConfigService.getRow(node,
-                                                ovsdbConfigService.getTableName(node, Interface.class), interfaceUUID);
+            Row intf = ovsdbConfigurationService.getRow(node,
+                                                ovsdbConfigurationService.getTableName(node, Interface.class), interfaceUUID);
             if (intf == null) {
                 interfaceUUID = null;
             }
@@ -568,15 +568,15 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
      * Add a Patch Port to a Bridge
      */
     private Status addPatchPort (Node node, String bridgeUUID, String portName, String peerPortName) throws Exception {
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
 
         logger.debug("addPatchPort: node: {}, bridgeUUID: {}, port: {}, peer: {}",
                      node, bridgeUUID, portName, peerPortName);
 
         /* Check if the port already exists. */
-        Row bridgeRow = ovsdbConfigService.getRow(node,
-                                                  ovsdbConfigService.getTableName(node, Bridge.class), bridgeUUID);
-        Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeRow);
+        Row bridgeRow = ovsdbConfigurationService.getRow(node,
+                                                  ovsdbConfigurationService.getTableName(node, Bridge.class), bridgeUUID);
+        Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeRow);
         if (bridge != null) {
             if (isPortOnBridge(node, bridge, portName)) {
                 logger.debug("addPatchPort: Port {} already in Bridge, Node {}", portName, node);
@@ -587,11 +587,11 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
             return new Status(StatusCode.NOTFOUND, "Could not find "+portName+" in Bridge");
         }
 
-        Port patchPort = ovsdbConfigService.createTypedRow(node, Port.class);
+        Port patchPort = ovsdbConfigurationService.createTypedRow(node, Port.class);
         patchPort.setName(portName);
         // Create patch port and interface
         StatusWithUuid statusWithUuid =
-                ovsdbConfigService.insertRow(node, patchPort.getSchema().getName(), bridgeUUID, patchPort.getRow());
+                ovsdbConfigurationService.insertRow(node, patchPort.getSchema().getName(), bridgeUUID, patchPort.getRow());
         if (!statusWithUuid.isSuccess()) return statusWithUuid;
 
         String patchPortUUID = statusWithUuid.getUuid().toString();
@@ -599,8 +599,8 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
         String interfaceUUID = null;
         int timeout = 6;
         while ((interfaceUUID == null) && (timeout > 0)) {
-            Row portRow = ovsdbConfigService.getRow(node, patchPort.getSchema().getName(), patchPortUUID);
-            patchPort = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+            Row portRow = ovsdbConfigurationService.getRow(node, patchPort.getSchema().getName(), patchPortUUID);
+            patchPort = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
             Set<UUID> interfaces = patchPort.getInterfacesColumn().getData();
             if (interfaces == null || interfaces.size() == 0) {
                 // Wait for the OVSDB update to sync up the Local cache.
@@ -615,12 +615,12 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
             return new Status(StatusCode.INTERNALERROR);
         }
 
-        Interface intf = ovsdbConfigService.createTypedRow(node, Interface.class);
+        Interface intf = ovsdbConfigurationService.createTypedRow(node, Interface.class);
         intf.setType("patch");
         Map<String, String> options = Maps.newHashMap();
         options.put("peer", peerPortName);
         intf.setOptions(options);
-        return ovsdbConfigService.updateRow(node,
+        return ovsdbConfigurationService.updateRow(node,
                                             intf.getSchema().getName(),
                                             patchPortUUID,
                                             interfaceUUID,
@@ -632,10 +632,10 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
      */
     private Status addBridge(Node node, String bridgeName,
                              String localPatchName, String remotePatchName) throws Exception {
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
 
         String bridgeUUID = this.getBridgeUuid(node, bridgeName);
-        Bridge bridge = ovsdbConfigService.createTypedRow(node, Bridge.class);
+        Bridge bridge = ovsdbConfigurationService.createTypedRow(node, Bridge.class);
         Set<String> failMode = new HashSet<>();
         failMode.add("secure");
         bridge.setFailMode(failMode);
@@ -664,19 +664,19 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
         if (bridgeUUID == null) {
             bridge.setName(bridgeName);
 
-            StatusWithUuid statusWithUuid = ovsdbConfigService.insertRow(node,
+            StatusWithUuid statusWithUuid = ovsdbConfigurationService.insertRow(node,
                                                                          bridge.getSchema().getName(),
                                                                          null,
                                                                          bridge.getRow());
             if (!statusWithUuid.isSuccess()) return statusWithUuid;
             bridgeUUID = statusWithUuid.getUuid().toString();
-            Port port = ovsdbConfigService.createTypedRow(node, Port.class);
+            Port port = ovsdbConfigurationService.createTypedRow(node, Port.class);
             port.setName(bridgeName);
-            Status status = ovsdbConfigService.insertRow(node, port.getSchema().getName(), bridgeUUID, port.getRow());
+            Status status = ovsdbConfigurationService.insertRow(node, port.getSchema().getName(), bridgeUUID, port.getRow());
             logger.debug("addBridge: Inserting Bridge {} {} with protocols {} and status {}",
                          bridgeName, bridgeUUID, protocols, status);
         } else {
-            Status status = ovsdbConfigService.updateRow(node,
+            Status status = ovsdbConfigurationService.updateRow(node,
                                                          bridge.getSchema().getName(),
                                                          null,
                                                          bridgeUUID,
@@ -685,7 +685,7 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
                          bridgeName, bridgeUUID, protocols, status);
         }
 
-        ovsdbConfigService.setOFController(node, bridgeUUID);
+        ovsdbConfigurationService.setOFController(node, bridgeUUID);
 
         if (localPatchName != null &&
             remotePatchName != null &&
index 6283564b2145112b2b18c1a9cd2cc315493dbb69..f9031388dd7d4233055fb4538468a34f26e92853 100644 (file)
@@ -12,9 +12,8 @@ package org.opendaylight.ovsdb.openstack.netvirt.impl;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.ovsdb.lib.notation.Row;
 import org.opendaylight.ovsdb.lib.notation.Version;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
 import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
 import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
 
 import com.google.common.collect.Maps;
@@ -27,10 +26,10 @@ import java.net.InetAddress;
 import java.util.Map;
 import java.util.Set;
 
-public class ConfigurationServiceImpl implements ConfigurationService {
+public class ConfigurationServiceImpl implements org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService {
     static final Logger logger = LoggerFactory.getLogger(ConfigurationServiceImpl.class);
 
-    private volatile OvsdbConfigService ovsdbConfigService;
+    private volatile OvsdbConfigurationService ovsdbConfigurationService;
 
     private String integrationBridgeName;
     private String networkBridgeName;
@@ -132,8 +131,8 @@ public class ConfigurationServiceImpl implements ConfigurationService {
     public InetAddress getTunnelEndPoint(Node node) {
         InetAddress address = null;
         try {
-            Map<String, Row> ovsTable = ovsdbConfigService.getRows(node,
-                    ovsdbConfigService.getTableName(node, OpenVSwitch.class));
+            Map<String, Row> ovsTable = ovsdbConfigurationService.getRows(node,
+                    ovsdbConfigurationService.getTableName(node, OpenVSwitch.class));
 
             if (ovsTable == null) {
                 logger.error("OpenVSwitch table is null for Node {} ", node);
@@ -142,7 +141,7 @@ public class ConfigurationServiceImpl implements ConfigurationService {
 
             // While there is only one entry in the HashMap, we can't access it by index...
             for (Row row : ovsTable.values()) {
-                OpenVSwitch ovsRow = ovsdbConfigService.getTypedRow(node, OpenVSwitch.class, row);
+                OpenVSwitch ovsRow = ovsdbConfigurationService.getTypedRow(node, OpenVSwitch.class, row);
                 Map<String, String> configs = ovsRow.getOtherConfigColumn().getData();
 
                 if (configs == null) {
@@ -184,8 +183,8 @@ public class ConfigurationServiceImpl implements ConfigurationService {
             }
         }
 
-        Map<String, Row> ovsRows = ovsdbConfigService.getRows(node,
-                ovsdbConfigService.getTableName(node, OpenVSwitch.class));
+        Map<String, Row> ovsRows = ovsdbConfigurationService.getRows(node,
+                ovsdbConfigurationService.getTableName(node, OpenVSwitch.class));
 
         if (ovsRows == null) {
             logger.info("The OVS node {} has no Open_vSwitch rows", node.toString());
@@ -195,7 +194,7 @@ public class ConfigurationServiceImpl implements ConfigurationService {
         Version ovsVersion = null;
         // While there is only one entry in the HashMap, we can't access it by index...
         for (Row row : ovsRows.values()) {
-            OpenVSwitch ovsRow = ovsdbConfigService.getTypedRow(node, OpenVSwitch.class, row);
+            OpenVSwitch ovsRow = ovsdbConfigurationService.getTypedRow(node, OpenVSwitch.class, row);
             Set<String> versionSet = ovsRow.getOvsVersionColumn().getData();
             if (versionSet != null && versionSet.iterator().hasNext()) {
                 ovsVersion = Version.fromString(versionSet.iterator().next());
index 0c02c03bbdad14b1f91c68b6e13f67e4f9e53c6c..875b9ea71dd7b6b42c5af19dc675d9c122b4cf22 100644 (file)
@@ -20,8 +20,8 @@ import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
 import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
 import org.opendaylight.ovsdb.openstack.netvirt.api.VlanConfigurationCache;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
 import org.opendaylight.ovsdb.schema.openvswitch.Interface;
 import org.opendaylight.ovsdb.schema.openvswitch.Port;
 
@@ -37,8 +37,8 @@ public class TenantNetworkManagerImpl implements TenantNetworkManager {
 
     // The implementation for each of these services is resolved by the OSGi Service Manager
     private volatile NetworkingProviderManager networkingProviderManager;
-    private volatile OvsdbConfigService ovsdbConfigService;
-    private volatile IConnectionServiceInternal connectionService;
+    private volatile OvsdbConfigurationService ovsdbConfigurationService;
+    private volatile OvsdbConnectionService connectionService;
     private volatile INeutronNetworkCRUD neutronNetworkCache;
     private volatile INeutronPortCRUD neutronPortCache;
     private volatile VlanConfigurationCache vlanConfigurationCache;
@@ -65,7 +65,7 @@ public class TenantNetworkManagerImpl implements TenantNetworkManager {
 
     @Override
     public void programInternalVlan(Node node, String portUUID, NeutronNetwork network) {
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
 
         int vlan = vlanConfigurationCache.getInternalVlan(node, network.getID());
         logger.debug("Programming Vlan {} on {}", vlan, portUUID);
@@ -74,16 +74,16 @@ public class TenantNetworkManagerImpl implements TenantNetworkManager {
             return;
         }
 
-        Port port = ovsdbConfigService.createTypedRow(node, Port.class);
+        Port port = ovsdbConfigurationService.createTypedRow(node, Port.class);
         OvsdbSet<Long> tags = new OvsdbSet<>();
         tags.add((long) vlan);
         port.setTag(tags);
-        ovsdbConfigService.updateRow(node, port.getSchema().getName(), null, portUUID, port.getRow());
+        ovsdbConfigurationService.updateRow(node, port.getSchema().getName(), null, portUUID, port.getRow());
     }
 
     @Override
     public boolean isTenantNetworkPresentInNode(Node node, String segmentationId) {
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
 
         String networkId = this.getNetworkId(segmentationId);
         if (networkId == null) {
@@ -118,14 +118,14 @@ public class TenantNetworkManagerImpl implements TenantNetworkManager {
             }
              */
             // External-id based more accurate VM Location identification
-            Map<String, Row> ifTable = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+            Map<String, Row> ifTable = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
             if (ifTable == null) {
                 logger.debug("Interface table is null for Node {} ", node);
                 return false;
             }
 
             for (Row row : ifTable.values()) {
-                Interface intf = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+                Interface intf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
                 Map<String, String> externalIds = intf.getExternalIdsColumn().getData();
                 if (externalIds != null && externalIds.get(Constants.EXTERNAL_ID_INTERFACE_ID) != null) {
                     if (this.isInterfacePresentInTenantNetwork(externalIds.get(Constants.EXTERNAL_ID_INTERFACE_ID), networkId)) {
index 2b05d114443f0b2a26fc93908e9ecc6f73b5a775..0684e570cacaf8e428b29e565256895a7f1b1e2b 100644 (file)
@@ -17,7 +17,7 @@ import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.openstack.netvirt.NodeConfiguration;
 import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
 import org.opendaylight.ovsdb.openstack.netvirt.api.VlanConfigurationCache;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
 import org.opendaylight.ovsdb.schema.openvswitch.Interface;
 import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
 import org.opendaylight.ovsdb.schema.openvswitch.Port;
@@ -36,7 +36,7 @@ public class VlanConfigurationCacheImpl implements VlanConfigurationCache {
     private Map<String, NodeConfiguration> configurationCache = Maps.newConcurrentMap();
 
     private volatile TenantNetworkManager tenantNetworkManager;
-    private volatile OvsdbConfigService ovsdbConfigService;
+    private volatile OvsdbConfigurationService ovsdbConfigurationService;
 
     private NodeConfiguration getNodeConfiguration(Node node){
         String nodeUuid = getNodeUUID(node);
@@ -51,10 +51,10 @@ public class VlanConfigurationCacheImpl implements VlanConfigurationCache {
     }
 
     private String getNodeUUID(Node node) {
-        Preconditions.checkNotNull(ovsdbConfigService);
+        Preconditions.checkNotNull(ovsdbConfigurationService);
         String nodeUuid = new String();
         try {
-            Map<String, Row> ovsTable = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, OpenVSwitch.class));
+            Map<String, Row> ovsTable = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, OpenVSwitch.class));
             nodeUuid = (String)ovsTable.keySet().toArray()[0];
         }
         catch (Exception e) {
@@ -71,7 +71,7 @@ public class VlanConfigurationCacheImpl implements VlanConfigurationCache {
         String networkId = null;
 
         try {
-            Map<String, Row> portRows = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Port.class));
+            Map<String, Row> portRows = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Port.class));
 
             if (portRows == null){
                 logger.debug("Port table is null for Node {}", node);
@@ -79,7 +79,7 @@ public class VlanConfigurationCacheImpl implements VlanConfigurationCache {
             }
 
             for (Row row : portRows.values()) {
-                Port port = ovsdbConfigService.getTypedRow(node, Port.class, row);
+                Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, row);
 
                 if (port.getTagColumn() == null) continue;
                 Set<Long> tags = port.getTagColumn().getData();
@@ -94,8 +94,10 @@ public class VlanConfigurationCacheImpl implements VlanConfigurationCache {
                 }
 
                 for (UUID ifaceId : port.getInterfacesColumn().getData()) {
-                    Row ifaceRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Interface.class), ifaceId.toString());
-                    Interface iface = ovsdbConfigService.getTypedRow(node, Interface.class, ifaceRow);
+                    Row ifaceRow = ovsdbConfigurationService
+                            .getRow(node, ovsdbConfigurationService.getTableName(node, Interface.class),
+                                    ifaceId.toString());
+                    Interface iface = ovsdbConfigurationService.getTypedRow(node, Interface.class, ifaceRow);
 
                     if (iface == null) {
                         logger.debug("Interface table is null");
index 37d4e3407d6490eb096555fa48c9570098641f22..a8dfc945ad3b5c9f2a0f2f7fa745d0d8ea36d22c 100755 (executable)
         <extensions>true</extensions>
         <configuration>
           <instructions>
-            <Import-Package>org.opendaylight.controller.sal.packet,
-                            org.opendaylight.controller.sal.action,
-                            org.opendaylight.controller.sal.discovery,
-                            org.opendaylight.controller.sal.topology,
-                            org.opendaylight.controller.sal.core,
-                            org.opendaylight.controller.sal.flowprogrammer,
-                            org.opendaylight.controller.sal.reader,
-                            org.opendaylight.controller.sal.inventory,
-                            org.opendaylight.controller.sal.match,
-                            org.opendaylight.controller.sal.utils,
-                            org.opendaylight.controller.sal.connection,
-                            org.opendaylight.controller.clustering.services,
-                            org.opendaylight.controller.sal.networkconfig.bridgedomain,
-                            org.opendaylight.ovsdb.lib.error,
-                            org.opendaylight.ovsdb.lib.notation,
-                            org.opendaylight.ovsdb.lib.operations,
-                            org.opendaylight.ovsdb.lib.message,
-                            org.opendaylight.ovsdb.schema.openvswitch,
-                            org.apache.commons.lang3.builder,
-                            org.apache.commons.lang3.tuple,
-                            org.apache.felix.dm,
-                            org.slf4j,
-                            org.eclipse.osgi.framework.console,
-                            org.osgi.framework,
-                            javax.net.ssl,
-                            *</Import-Package>
+            <Import-Package>
+              org.opendaylight.controller.sal.packet,
+              org.opendaylight.controller.sal.action,
+              org.opendaylight.controller.sal.discovery,
+              org.opendaylight.controller.sal.topology,
+              org.opendaylight.controller.sal.core,
+              org.opendaylight.controller.sal.flowprogrammer,
+              org.opendaylight.controller.sal.reader,
+              org.opendaylight.controller.sal.inventory,
+              org.opendaylight.controller.sal.match,
+              org.opendaylight.controller.sal.utils,
+              org.opendaylight.controller.sal.connection,
+              org.opendaylight.controller.clustering.services,
+              org.opendaylight.controller.sal.networkconfig.bridgedomain,
+              org.opendaylight.ovsdb.lib.error,
+              org.opendaylight.ovsdb.lib.notation,
+              org.opendaylight.ovsdb.lib.operations,
+              org.opendaylight.ovsdb.lib.message,
+              org.opendaylight.ovsdb.schema.openvswitch,
+              org.apache.commons.lang3.builder,
+              org.apache.commons.lang3.tuple,
+              org.apache.felix.dm,
+              org.slf4j,
+              org.eclipse.osgi.framework.console,
+              org.osgi.framework,
+              javax.net.ssl,
+              *
+            </Import-Package>
             <Embed-Dependency>httpclient,commons-codec,httpcore-nio,javax.servlet-api,portlet-api,commons-collections;type=!pom;inline=false</Embed-Dependency>
             <Embed-Transitive>true</Embed-Transitive>
-            <Bundle-Activator>org.opendaylight.ovsdb.plugin.Activator</Bundle-Activator>
-            <Export-Package>org.opendaylight.ovsdb.plugin</Export-Package>
+            <Bundle-Activator>org.opendaylight.ovsdb.plugin.internal.Activator</Bundle-Activator>
+            <Private-Package>
+              org.opendaylight.ovsdb.plugin.impl,
+              org.opendaylight.ovsdb.plugin.internal
+            </Private-Package>
+            <Export-Package>
+              <!-- ToDo: Remove this line after the deprecated APIs have been removed -->
+              org.opendaylight.ovsdb.plugin,
+              org.opendaylight.ovsdb.plugin.api
+            </Export-Package>
           </instructions>
           <manifestLocation>${project.basedir}/META-INF</manifestLocation>
         </configuration>
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/ChannelConnectionHandler.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/ChannelConnectionHandler.java
deleted file mode 100644 (file)
index 776695b..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Brent Salisbury
- */
-package org.opendaylight.ovsdb.plugin;
-
-import org.opendaylight.controller.sal.core.Node;
-
-import io.netty.channel.ChannelFuture;
-import io.netty.channel.ChannelFutureListener;
-
-public class ChannelConnectionHandler implements ChannelFutureListener {
-    Node node;
-    ConnectionService connectionService;
-    public Node getNode() {
-        return node;
-    }
-    public void setNode(Node node) {
-        this.node = node;
-    }
-    public ConnectionService getConnectionService() {
-        return connectionService;
-    }
-    public void setConnectionService(ConnectionService connectionService) {
-        this.connectionService = connectionService;
-    }
-    @Override
-    public void operationComplete(ChannelFuture arg0) throws Exception {
-        connectionService.channelClosed(node);
-    }
-}
index 2c7ae15e0be10da7744c5a82d4a78ae1be99c20c..a01be568c6d924d8b1651ceb14095cdfebd1023a 100644 (file)
@@ -12,10 +12,15 @@ package org.opendaylight.ovsdb.plugin;
 import org.opendaylight.controller.sal.core.ConstructionException;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.ovsdb.lib.OvsdbClient;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class Connection {
+/**
+ * OVSDB Plugin Connection
+ * @deprecated as of release 1.0.0, replaced by {@link org.opendaylight.ovsdb.plugin.api.Connection}
+ */
+@Deprecated public class Connection {
     private Node node;
     private String identifier;
     private OvsdbClient client;
index 925438a4ad13d8e5f819bd142f56562af085d360..3b28d6498604f6a8d57a196dea9dacd2d96fe8af 100644 (file)
@@ -9,13 +9,18 @@
  */
 package org.opendaylight.ovsdb.plugin;
 
-import java.util.List;
-import java.util.Map;
-
 import org.opendaylight.controller.sal.connection.ConnectionConstants;
 import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.ovsdb.plugin.api.Connection;
 
-public interface IConnectionServiceInternal {
+import java.util.List;
+import java.util.Map;
+
+/**
+ * OVSDB Plugin Connection Service
+ * @deprecated as of release 1.0.0, replaced by {@link org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService}
+ */
+@Deprecated public interface IConnectionServiceInternal {
     public Connection getConnection(Node node);
     public List<Node> getNodes();
     public Node connect(String identifier, Map<ConnectionConstants, String> params);
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/InsertRequest.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/InsertRequest.java
deleted file mode 100644 (file)
index e604f11..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Brent Salisbury
- */
-package org.opendaylight.ovsdb.plugin;\r
-\r
-import java.util.Map;\r
-import com.fasterxml.jackson.annotation.JsonProperty;\r
-\r
-public class InsertRequest {\r
-    public String op;\r
-    public String table;\r
-    @JsonProperty("uuid-name")\r
-    public Object uuidName;\r
-    public Map<String, Object> row;\r
-\r
-    public InsertRequest(String op, String table, String uuidName, Map<String, Object> row){\r
-        this.op = op;\r
-        this.table = table;\r
-        this.uuidName = uuidName;\r
-        this.row = row;\r
-    }\r
-}\r
index 0cdbac09df25363b5a3cd7630ce528e6295f1712..7db2bf6535269a63fd15d7f806537a492f9c66c3 100644 (file)
@@ -9,9 +9,6 @@
  */
 package org.opendaylight.ovsdb.plugin;
 
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.Property;
 import org.opendaylight.controller.sal.core.UpdateType;
@@ -19,7 +16,14 @@ import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
 import org.opendaylight.ovsdb.lib.message.TableUpdates;
 import org.opendaylight.ovsdb.lib.notation.Row;
 
-public interface InventoryServiceInternal extends IPluginInInventoryService {
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * OVSDB Plugin Inventory Service
+ * @deprecated as of release 1.0.0, replaced by {@link org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService }
+ */
+@Deprecated public interface InventoryServiceInternal extends IPluginInInventoryService {
     public ConcurrentMap<String, ConcurrentMap<String, Row>> getCache(Node n, String databaseName);
     public ConcurrentMap<String, Row> getTableCache(Node n, String databaseName, String tableName);
     public Row getRow (Node n, String databaseName, String tableName, String uuid);
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/MutateRequest.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/MutateRequest.java
deleted file mode 100644 (file)
index e0f0331..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Brent Salisbury
- */
-package org.opendaylight.ovsdb.plugin;\r
-\r
-import java.util.List;\r
-\r
-public class MutateRequest {\r
-    public String op = "mutate";\r
-    public String table;\r
-    public List<Object> where;\r
-    public List<Object> mutations;\r
-\r
-    public MutateRequest(String table, List<Object> where, List<Object> mutations){\r
-        this.table = table;\r
-        this.where = where;\r
-        this.mutations = mutations;\r
-    }\r
-}\r
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/NodeConnectorFactory.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/NodeConnectorFactory.java
deleted file mode 100644 (file)
index af9a280..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Brent Salisbury
- */
-package org.opendaylight.ovsdb.plugin;
-
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.utils.INodeConnectorFactory;
-import org.opendaylight.controller.sal.core.Node;
-
-public class NodeConnectorFactory implements INodeConnectorFactory
-    {
-      void init() {
-      }
-
-      /**
-       * Function called by the dependency manager when at least one dependency
-       * become unsatisfied or when the component is shutting down because for
-       * example bundle is being stopped.
-       *
-       */
-      void destroy() {
-      }
-
-      /**
-       * Function called by dependency manager after "init ()" is called and after
-       * the services provided by the class are registered in the service registry
-       *
-       */
-      void start() {
-      }
-
-      /**
-       * Function called by the dependency manager before the services exported by
-       * the component are unregistered, this will be followed by a "destroy ()"
-       * calls
-       *
-       */
-      void stop() {
-      }
-
-      public NodeConnector fromStringNoNode(String typeStr, String IDStr,
-              Node n){
-          if(typeStr.equals("OVS")){
-              try {
-                  return new NodeConnector(typeStr, IDStr, n);
-              } catch (Exception ex) {
-                  return null;
-              }
-          }
-          return null;
-      }
-}
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/NodeFactory.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/NodeFactory.java
deleted file mode 100644 (file)
index 7d0ecf9..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Brent Salisbury
- */
-package org.opendaylight.ovsdb.plugin;
-
-import org.opendaylight.controller.sal.core.ConstructionException;
-import org.opendaylight.controller.sal.utils.INodeFactory;
-import org.opendaylight.controller.sal.core.Node;
-
-public class NodeFactory implements INodeFactory
-    {
-      void init() {
-      }
-
-      /**
-       * Function called by the dependency manager when at least one dependency
-       * become unsatisfied or when the component is shutting down because for
-       * example bundle is being stopped.
-       *
-       */
-      void destroy() {
-      }
-
-      /**
-       * Function called by dependency manager after "init ()" is called and after
-       * the services provided by the class are registered in the service registry
-       *
-       */
-      void start() {
-      }
-
-      /**
-       * Function called by the dependency manager before the services exported by
-       * the component are unregistered, this will be followed by a "destroy ()"
-       * calls
-       *
-       */
-      void stop() {
-      }
-
-      public Node fromString(String nodeType, String nodeId){
-          if(nodeType.equals("OVS"))
-              try{
-                  return new Node("OVS", nodeId);
-              } catch(ConstructionException e)
-              {
-                  return null;
-              }
-          return null;
-      }
-}
index 2547103273a44f1f3ee8b4181c63939a10e38f77..c649c832e166dd6210dfc52f5aed0313d7d81c92 100644 (file)
@@ -1,8 +1,24 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
 package org.opendaylight.ovsdb.plugin;
-import java.util.Map;
 
 import com.google.common.collect.Maps;
-public class OvsVswitchdSchemaConstants {
+
+import java.util.Map;
+
+/**
+ * Open vSwitch Schema Constants
+ * @deprecated as of release 1.0.0, replaced by {@link org.opendaylight.ovsdb.plugin.api.OvsVswitchdSchemaConstants }
+ */
+@Deprecated public class OvsVswitchdSchemaConstants {
     public static String DATABASE_NAME = "Open_vSwitch";
 
     private static final String OVSDB_AUTOCONFIGURECONTROLLER = "ovsdb.autoconfigurecontroller";
index 38afce540b33f013bcec918ad4785155c589fa4f..579be1d78d832bff15ddd9e1b4ec993d590fc91a 100644 (file)
@@ -9,17 +9,22 @@
  */
 package org.opendaylight.ovsdb.plugin;
 
-import java.util.List;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ExecutionException;
-
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.utils.Status;
 import org.opendaylight.ovsdb.lib.notation.Row;
 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
 import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.plugin.api.StatusWithUuid;
 
-public interface OvsdbConfigService {
+import java.util.List;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutionException;
+
+/**
+ * OVSDB Plugin Configuration Service
+ * @deprecated as of release 1.0.0, replaced by {@link org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService }
+ */
+@Deprecated public interface OvsdbConfigService {
 
     /**
      * This version of insertRow is a short-term replacement for the older & now deprecated method of the same name.
@@ -43,7 +48,7 @@ public interface OvsdbConfigService {
      * @param rowUuid UUID of the row that is being updated
      * @param row Row of table Content to be Updated. Include just those columns that needs to be updated.
      */
-    public Status updateRow (Node node, String tableName, String parentUuid, String rowUuid, Row row);
+    public Status updateRow(Node node, String tableName, String parentUuid, String rowUuid, Row row);
 
     /**
      * This version of deleteRow is a short-term replacement for the older & now deprecated method of the same name.
@@ -54,7 +59,7 @@ public interface OvsdbConfigService {
      * @param rowUuid UUID of the row that is being deleted
      */
 
-    public Status deleteRow (Node node, String tableName, String rowUUID);
+    public Status deleteRow(Node node, String tableName, String rowUUID);
 
     /**
      * This version of getRow is a short-term replacement for the older & now deprecated method of the same name.
@@ -98,7 +103,7 @@ public interface OvsdbConfigService {
      * @return Boolean representing success or failure of the operation.
      *
      * @throws InterruptedException
-     * @throws ExecutionException
+     * @throws java.util.concurrent.ExecutionException
      */
     public Boolean setOFController(Node node, String bridgeUUID) throws InterruptedException, ExecutionException;
 
index 37a738f968824617b74b8f4cfa3305d7429eeffe..d2a6769cdfd52a472dce81daccbc7b4647a2df0b 100644 (file)
@@ -12,7 +12,11 @@ package org.opendaylight.ovsdb.plugin;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.ovsdb.lib.notation.Row;
 
-public interface OvsdbInventoryListener {
+/**
+ * OVSDB Plugin Inventory Listener
+ * @deprecated as of release 1.0.0, replaced by {@link org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener }
+ */
+@Deprecated public interface OvsdbInventoryListener {
     public void nodeAdded(Node node);
     public void nodeRemoved(Node node);
     public void rowAdded(Node node, String tableName, String uuid, Row row);
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/OvsdbMessage.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/OvsdbMessage.java
deleted file mode 100644 (file)
index 9a123fd..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Evan Zeller
- */
-package org.opendaylight.ovsdb.plugin;\r
-\r
-import java.util.Random;\r
-\r
-public class OvsdbMessage {\r
-    String methodName;\r
-    Object[] argument;\r
-    String id;\r
-\r
-    public OvsdbMessage(String method, Object[] arg){\r
-        this.methodName = method;\r
-        this.argument = arg;\r
-        Random x = new Random();\r
-        this.id = Integer.toString(x.nextInt(10000));\r
-    }\r
-}\r
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/ReadService.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/ReadService.java
deleted file mode 100644 (file)
index 8836344..0000000
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Evan Zeller
- */
-package org.opendaylight.ovsdb.plugin;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.opendaylight.controller.sal.action.Action;
-import org.opendaylight.controller.sal.action.Controller;
-import org.opendaylight.controller.sal.action.Drop;
-import org.opendaylight.controller.sal.action.Flood;
-import org.opendaylight.controller.sal.action.FloodAll;
-import org.opendaylight.controller.sal.action.HwPath;
-import org.opendaylight.controller.sal.action.Loopback;
-import org.opendaylight.controller.sal.action.Output;
-import org.opendaylight.controller.sal.action.PopVlan;
-import org.opendaylight.controller.sal.action.PushVlan;
-import org.opendaylight.controller.sal.action.SetDlDst;
-import org.opendaylight.controller.sal.action.SetDlSrc;
-import org.opendaylight.controller.sal.action.SetDlType;
-import org.opendaylight.controller.sal.action.SetNwDst;
-import org.opendaylight.controller.sal.action.SetNwSrc;
-import org.opendaylight.controller.sal.action.SetNwTos;
-import org.opendaylight.controller.sal.action.SetTpDst;
-import org.opendaylight.controller.sal.action.SetTpSrc;
-import org.opendaylight.controller.sal.action.SetVlanCfi;
-import org.opendaylight.controller.sal.action.SetVlanId;
-import org.opendaylight.controller.sal.action.SetVlanPcp;
-import org.opendaylight.controller.sal.action.SwPath;
-import org.opendaylight.controller.sal.core.ConstructionException;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.core.NodeTable;
-import org.opendaylight.controller.sal.flowprogrammer.Flow;
-import org.opendaylight.controller.sal.match.Match;
-import org.opendaylight.controller.sal.match.MatchType;
-import org.opendaylight.controller.sal.reader.FlowOnNode;
-import org.opendaylight.controller.sal.reader.IPluginInReadService;
-import org.opendaylight.controller.sal.reader.NodeConnectorStatistics;
-import org.opendaylight.controller.sal.reader.NodeDescription;
-import org.opendaylight.controller.sal.reader.NodeTableStatistics;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-/**
- * Stub Implementation for IPluginInReadService used by SAL
- *
- *
- */
-public class ReadService implements IPluginInReadService {
-    private static final Logger logger = LoggerFactory
-            .getLogger(ReadService.class);
-
-    /**
-     * Function called by the dependency manager when all the required
-     * dependencies are satisfied
-     *
-     */
-    void init() {
-    }
-
-    /**
-     * Function called by the dependency manager when at least one dependency
-     * become unsatisfied or when the component is shutting down because for
-     * example bundle is being stopped.
-     *
-     */
-    void destroy() {
-    }
-
-    /**
-     * Function called by dependency manager after "init ()" is called and after
-     * the services provided by the class are registered in the service registry
-     *
-     */
-    void start() {
-    }
-
-    /**
-     * Function called by the dependency manager before the services exported by
-     * the component are unregistered, this will be followed by a "destroy ()"
-     * calls
-     *
-     */
-    void stop() {
-    }
-
-    @Override
-    public FlowOnNode readFlow(Node node, Flow flow, boolean cached) {
-        FlowOnNode fn1 = new FlowOnNode(flow);
-        fn1.setByteCount(100);
-        fn1.setDurationNanoseconds(400);
-        fn1.setDurationSeconds(40);
-        fn1.setTableId((byte) 0x1);
-        fn1.setPacketCount(200);
-        return fn1;
-    }
-
-    @Override
-    public List<FlowOnNode> readAllFlow(Node node, boolean cached) {
-
-        ArrayList<FlowOnNode> list = new ArrayList<FlowOnNode>();
-        ArrayList<Action> actionList = new ArrayList<Action>();
-        actionList.add(new Drop()); //IT assumes this is first element
-        actionList.add(new Loopback());
-        actionList.add(new Flood());
-        actionList.add(new FloodAll());
-        actionList.add(new Controller());
-        actionList.add(new SwPath());
-        actionList.add(new HwPath());
-        try {
-            actionList.add(new Output(new NodeConnector("STUB", 0xCAFE, node)));
-        } catch (ConstructionException e) {
-
-        }
-        byte dst[] = { (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5 };
-        byte src[] = { (byte) 5, (byte) 4, (byte) 3, (byte) 2, (byte) 1 };
-        actionList.add(new SetDlSrc(src));
-        actionList.add(new SetDlDst(dst));
-        actionList.add(new SetDlType(10));
-
-        actionList.add(new SetVlanId(2));
-        actionList.add(new SetVlanPcp(3));
-        actionList.add(new SetVlanCfi(1));
-
-        actionList.add(new PopVlan());
-        actionList.add(new PushVlan(0x8100, 1, 1, 1234));
-
-        try {
-            actionList.add(new SetNwSrc(InetAddress.getByName("2.2.2.2")));
-            actionList.add(new SetNwDst(InetAddress.getByName("1.1.1.1")));
-        } catch (UnknownHostException e) {
-
-        }
-        actionList.add(new SetNwTos(0x10));
-        actionList.add(new SetTpSrc(4201));
-        actionList.add(new SetTpDst(8080));
-
-        short priority = 3500; //IT assumes this value
-        for (Action a : actionList) {
-            Flow flow = new Flow();
-            Match match = new Match();
-            try {
-                match.setField(MatchType.NW_DST,
-                        InetAddress.getByName("1.1.1.1"));
-            } catch (UnknownHostException e) {
-
-            }
-            flow.setMatch(match);
-            List<Action> actions = new ArrayList<Action>();
-            actions.add(a);
-            flow.setActions(actions);
-            flow.setPriority(priority++);
-            flow.setIdleTimeout((short) 1000);
-            flow.setHardTimeout((short) 2000);
-            flow.setId(12345);
-
-            FlowOnNode fn1 = new FlowOnNode(flow);
-            fn1.setByteCount(100);
-            fn1.setDurationNanoseconds(400);
-            fn1.setDurationSeconds(40);
-            fn1.setTableId((byte) 0x1);
-            fn1.setPacketCount(200);
-
-            list.add(fn1);
-        }
-        return list;
-    }
-
-    @Override
-    public NodeDescription readDescription(Node node, boolean cached) {
-        NodeDescription desc = new NodeDescription();
-        desc.setDescription("This is a sample node description");
-        desc.setHardware("stub hardware");
-        desc.setSoftware("stub software");
-        desc.setSerialNumber("123");
-        desc.setManufacturer("opendaylight");
-        return desc;
-    }
-
-    @Override
-    public NodeConnectorStatistics readNodeConnector(NodeConnector connector,
-            boolean cached) {
-        NodeConnectorStatistics stats = new NodeConnectorStatistics();
-        stats.setNodeConnector(connector);
-        stats.setCollisionCount(4);
-        stats.setReceiveByteCount(1000);
-        stats.setReceiveCRCErrorCount(1);
-        stats.setReceiveDropCount(2);
-        stats.setReceiveErrorCount(3);
-        stats.setReceiveFrameErrorCount(5);
-        stats.setReceiveOverRunErrorCount(6);
-        stats.setReceivePacketCount(250);
-        stats.setTransmitByteCount(5000);
-        stats.setTransmitDropCount(50);
-        stats.setTransmitErrorCount(10);
-        stats.setTransmitPacketCount(500);
-
-        return stats;
-    }
-
-    @Override
-    public List<NodeConnectorStatistics> readAllNodeConnector(Node node,
-            boolean cached) {
-        NodeConnectorStatistics stats = new NodeConnectorStatistics();
-        try {
-            NodeConnector nc = new NodeConnector("STUB", 0xCAFE, node);
-            stats.setNodeConnector(nc);
-        } catch (ConstructionException e) {
-            // couldn't create nodeconnector.
-        }
-        stats.setCollisionCount(4);
-        stats.setReceiveByteCount(1000);
-        stats.setReceiveCRCErrorCount(1);
-        stats.setReceiveDropCount(2);
-        stats.setReceiveErrorCount(3);
-        stats.setReceiveFrameErrorCount(5);
-        stats.setReceiveOverRunErrorCount(6);
-        stats.setReceivePacketCount(250);
-        stats.setTransmitByteCount(5000);
-        stats.setTransmitDropCount(50);
-        stats.setTransmitErrorCount(10);
-        stats.setTransmitPacketCount(500);
-
-        List<NodeConnectorStatistics> result = new ArrayList<NodeConnectorStatistics>();
-        result.add(stats);
-        return result;
-    }
-
-    @Override
-    public long getTransmitRate(NodeConnector connector) {
-        return 100;
-    }
-
-    @Override
-    public NodeTableStatistics readNodeTable(NodeTable table, boolean b) {
-        NodeTableStatistics stats = new NodeTableStatistics();
-        stats.setNodeTable(table);
-        stats.setActiveCount(4);
-        stats.setLookupCount(4);
-        stats.setMatchedCount(4);
-
-        return stats;
-    }
-
-    @Override
-    public List<NodeTableStatistics> readAllNodeTable(Node node, boolean cached) {
-        NodeTableStatistics stats = new NodeTableStatistics();
-        try {
-            NodeTable nt = new NodeTable(NodeTable.NodeTableIDType.OPENFLOW, Byte.valueOf("10"), node);
-            stats.setNodeTable(nt);
-        } catch (ConstructionException e) {
-            // couldn't create nodetable.
-        }
-
-        stats.setActiveCount(4);
-        stats.setLookupCount(4);
-        stats.setMatchedCount(4);
-
-        List<NodeTableStatistics> result = new ArrayList<NodeTableStatistics>();
-        result.add(stats);
-        return result;
-    }
-}
index 9929de6a0c99f22f5b4acf13bb940b8a660898f2..2335509098bd8ae0242ecf126d29fe56ff9c9d03 100644 (file)
@@ -15,8 +15,9 @@ import org.opendaylight.ovsdb.lib.notation.UUID;
 
 /**
  * Extends the Status class to allow functions to return a uuid
+ * @deprecated as of release 1.0.0, replaced by {@link org.opendaylight.ovsdb.plugin.api.StatusWithUuid }
  */
-public class StatusWithUuid extends Status {
+@Deprecated public class StatusWithUuid extends Status {
     private static final long serialVersionUID = -5413085099514964003L;
     private UUID uuid;
 
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/UpdateRequest.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/UpdateRequest.java
deleted file mode 100644 (file)
index 38549b5..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Brent Salisbury
- */
-package org.opendaylight.ovsdb.plugin;\r
-\r
-\r
-import java.util.ArrayList;\r
-import java.util.Map;\r
-\r
-public class UpdateRequest {\r
-    public String op;\r
-    public String table;\r
-    public ArrayList<Object> where;\r
-    public Map<String, Object> row;\r
-\r
-    public UpdateRequest(String op, String table, ArrayList<Object> where, Map<String, Object> row){\r
-        this.op = op;\r
-        this.table = table;\r
-        this.where = where;\r
-        this.row = row;\r
-    }\r
-}\r
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/Connection.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/Connection.java
new file mode 100644 (file)
index 0000000..1dc1e8f
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Brent Salisbury
+ */
+package org.opendaylight.ovsdb.plugin.api;
+
+import org.opendaylight.controller.sal.core.ConstructionException;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.ovsdb.lib.OvsdbClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Connection {
+    private Node node;
+    private String identifier;
+    private OvsdbClient client;
+
+    public Long getIdCounter() {
+        return idCounter;
+    }
+
+    public void setIdCounter(Long idCounter) {
+        this.idCounter = idCounter;
+    }
+
+    private Long idCounter;
+
+    private static final Logger logger = LoggerFactory.getLogger(Connection.class);
+
+    public Connection(String identifier, OvsdbClient client) {
+
+        super();
+
+        this.identifier = identifier;
+        this.client = client;
+        this.idCounter = 0L;
+        try {
+            node = new Node("OVS", identifier);
+        } catch (ConstructionException e) {
+            logger.error("Error creating OVS node with identifier " + identifier, e);
+        }
+    }
+
+    public String getIdentifier() {
+        return identifier;
+    }
+
+    public void setIdentifier(String identifier) {
+        this.identifier = identifier;
+    }
+
+    public OvsdbClient getClient() {
+        return this.client;
+    }
+
+    public void setClient(OvsdbClient client) {
+        this.client = client;
+    }
+
+    public Node getNode() {
+        return node;
+    }
+
+    public void setNode(Node node) {
+        this.node = node;
+    }
+
+    public void disconnect() {
+        client.disconnect();
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((identifier == null) ? 0 : identifier.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) return true;
+        if (obj == null) return false;
+        if (getClass() != obj.getClass()) return false;
+        Connection other = (Connection) obj;
+        if (identifier == null) {
+            if (other.identifier != null) return false;
+        } else if (!identifier.equals(other.identifier)) return false;
+        return true;
+    }
+}
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/OvsVswitchdSchemaConstants.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/OvsVswitchdSchemaConstants.java
new file mode 100644 (file)
index 0000000..3155ce6
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.plugin.api;
+
+import java.util.Map;
+
+import com.google.common.collect.Maps;
+
+public final class OvsVswitchdSchemaConstants {
+    public static String DATABASE_NAME = "Open_vSwitch";
+
+    private static final String OVSDB_AUTOCONFIGURECONTROLLER = "ovsdb.autoconfigurecontroller";
+    private static final boolean defaultAutoConfigureController = true;
+    private static boolean autoConfigureController = defaultAutoConfigureController;
+
+    private static Map<String, String[]> columnToMutate = Maps.newHashMap();
+    public static String[] getParentColumnToMutate(String childTabletoInsert) {
+        return columnToMutate.get(childTabletoInsert);
+    }
+    private static void addParentColumnToMutate(String childTable, String parentTable, String columnName) {
+        String[] parentColumn = {parentTable, columnName};
+        columnToMutate.put(childTable, parentColumn);
+    }
+
+    static {
+        addParentColumnToMutate("Bridge", "Open_vSwitch", "bridges");
+        addParentColumnToMutate("Port", "Bridge", "ports");
+        addParentColumnToMutate("Interface", "Port", "interfaces");
+        addParentColumnToMutate("SSL", "Open_vSwitch", "ssl");
+        addParentColumnToMutate("IPFIX", "Bridge", "ipfix");
+        addParentColumnToMutate("sFlow", "Bridge", "sflow");
+        addParentColumnToMutate("Flow_Table", "Bridge", "flow_tables");
+        addParentColumnToMutate("QoS", "Port", "qos");
+        addParentColumnToMutate("NetFlow", "Bridge", "netflow");
+        addParentColumnToMutate("Mirror", "Bridge", "mirrors");
+        addParentColumnToMutate("Manager", "Open_vSwitch", "manager_options");
+        addParentColumnToMutate("Controller", "Bridge", "controller");
+        // Keep the default value if the property is not set
+        if (System.getProperty(OVSDB_AUTOCONFIGURECONTROLLER) != null)
+            autoConfigureController = Boolean.getBoolean(OVSDB_AUTOCONFIGURECONTROLLER);
+    }
+
+    public static boolean shouldConfigureController (String databaseName, String tableName) {
+        if (autoConfigureController && databaseName.equals(DATABASE_NAME) && tableName.equals("Bridge")) return true;
+        return false;
+    }
+
+    public enum PortType {
+        VLAN("vlan"),
+        TUNNEL("Tunnel"),
+        BONDING("Bonding"),
+        PATCH("patch"),
+        INTERNAL("internal");
+
+        private PortType(String name) {
+            this.name = name;
+        }
+
+        private String name;
+
+        @Override
+        public String toString() {
+            return name;
+        }
+    }
+
+}
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/OvsdbConfigurationService.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/OvsdbConfigurationService.java
new file mode 100644 (file)
index 0000000..7b81cc0
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Brent Salisbury
+ */
+package org.opendaylight.ovsdb.plugin.api;
+
+import java.util.List;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutionException;
+
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.ovsdb.lib.notation.Row;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+
+public interface OvsdbConfigurationService {
+
+    /**
+     * This version of insertRow is a short-term replacement for the older & now deprecated method of the same name.
+     * This API assumes an Open_vSwitch database Schema.
+     *
+     * @param node OVSDB Node
+     * @param tableName Table on which the row is inserted
+     * @param parentUuid UUID of the parent table to which this operation will result in attaching/mutating.
+     * @param row Row of table Content to be inserted
+     * @return UUID of the inserted Row
+     */
+    public StatusWithUuid insertRow(Node node, String tableName, String parentUuid, Row<GenericTableSchema> row);
+
+    /**
+     * This version of updateRow is a short-term replacement for the older & now deprecated method of the same name.
+     * This API assumes an Open_vSwitch database Schema.
+     *
+     * @param node OVSDB Node
+     * @param tableName Table on which the row is Updated
+     * @param parentUuid UUID of the parent row on which this operation might result in mutating.
+     * @param rowUuid UUID of the row that is being updated
+     * @param row Row of table Content to be Updated. Include just those columns that needs to be updated.
+     */
+    public Status updateRow (Node node, String tableName, String parentUuid, String rowUuid, Row row);
+
+    /**
+     * This version of deleteRow is a short-term replacement for the older & now deprecated method of the same name.
+     * This API assumes an Open_vSwitch database Schema.
+     *
+     * @param node OVSDB Node
+     * @param tableName Table on which the row is Updated
+     * @param rowUuid UUID of the row that is being deleted
+     */
+
+    public Status deleteRow (Node node, String tableName, String rowUUID);
+
+    /**
+     * This version of getRow is a short-term replacement for the older & now deprecated method of the same name.
+     * This API assumes an Open_vSwitch database Schema.
+     *
+     * @param node OVSDB Node
+     * @param tableName Table Name
+     * @param rowUuid UUID of the row being queried
+     * @return a row with a list of Column data that corresponds to an unique Row-identifier called uuid in a given table.
+     */
+
+    public Row getRow(Node node, String tableName, String uuid);
+
+    /**
+     * This version of getRows is a short-term replacement for the older & now deprecated method of the same name.
+     * This API assumes an Open_vSwitch database Schema.
+     *
+     * @param node OVSDB Node
+     * @param tableName Table Name
+     * @return List of rows that makes the entire Table.
+     */
+
+    public ConcurrentMap<String, Row> getRows(Node node, String tableName);
+
+    /**
+     * Returns all the Tables in a given Ndoe.
+     * This API assumes an Open_vSwitch database Schema.
+     *
+     * @param node OVSDB node
+     * @return List of Table Names that make up Open_vSwitch schema.
+     */
+    public List<String> getTables(Node node);
+
+    /**
+     * setOFController is a convenience method used by existing applications to setup Openflow Controller on
+     * a Open_vSwitch Bridge.
+     * This API assumes an Open_vSwitch database Schema.
+     *
+     * @param node Node
+     * @param bridgeUUID uuid of the Bridge for which the ip-address of Openflow Controller should be programmed.
+     * @return Boolean representing success or failure of the operation.
+     *
+     * @throws InterruptedException
+     * @throws ExecutionException
+     */
+    public Boolean setOFController(Node node, String bridgeUUID) throws InterruptedException, ExecutionException;
+
+    public <T extends TypedBaseTable<?>> String getTableName(Node node, Class<T> typedClass);
+    public <T extends TypedBaseTable<?>> T getTypedRow(Node node, Class<T> typedClass, Row row);
+    public <T extends TypedBaseTable<?>> T createTypedRow(Node node, Class<T> typedClass);
+}
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/OvsdbConnectionService.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/OvsdbConnectionService.java
new file mode 100644 (file)
index 0000000..4ad98e5
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Brent Salisbury
+ */
+package org.opendaylight.ovsdb.plugin.api;
+
+import java.util.List;
+import java.util.Map;
+
+import org.opendaylight.controller.sal.connection.ConnectionConstants;
+import org.opendaylight.controller.sal.core.Node;
+
+public interface OvsdbConnectionService {
+    public Connection getConnection(Node node);
+    public List<Node> getNodes();
+    public Node connect(String identifier, Map<ConnectionConstants, String> params);
+}
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/OvsdbInventoryListener.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/OvsdbInventoryListener.java
new file mode 100644 (file)
index 0000000..4c7d239
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Brent Salisbury
+ */
+package org.opendaylight.ovsdb.plugin.api;
+
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.ovsdb.lib.notation.Row;
+
+public interface OvsdbInventoryListener {
+    public void nodeAdded(Node node);
+    public void nodeRemoved(Node node);
+    public void rowAdded(Node node, String tableName, String uuid, Row row);
+    public void rowUpdated(Node node, String tableName, String uuid, Row old, Row row);
+    public void rowRemoved(Node node, String tableName, String uuid, Row row, Object context);
+}
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/OvsdbInventoryService.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/OvsdbInventoryService.java
new file mode 100644 (file)
index 0000000..8c41e35
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Brent Salisbury
+ */
+package org.opendaylight.ovsdb.plugin.api;
+
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.core.Property;
+import org.opendaylight.controller.sal.core.UpdateType;
+import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
+import org.opendaylight.ovsdb.lib.message.TableUpdates;
+import org.opendaylight.ovsdb.lib.notation.Row;
+
+public interface OvsdbInventoryService extends IPluginInInventoryService {
+    public ConcurrentMap<String, ConcurrentMap<String, Row>> getCache(Node n, String databaseName);
+    public ConcurrentMap<String, Row> getTableCache(Node n, String databaseName, String tableName);
+    public Row getRow (Node n, String databaseName, String tableName, String uuid);
+    public void updateRow(Node n, String databaseName, String tableName, String uuid, Row row);
+    public void removeRow(Node n, String databaseName, String tableName, String uuid);
+    public void processTableUpdates(Node n, String databaseName,TableUpdates tableUpdates);
+    public void printCache(Node n);
+
+    public void addNode(Node n, Set<Property> props);
+    public void notifyNodeAdded(Node n);
+    public void removeNode(Node n);
+    public void addNodeProperty(Node node, UpdateType type, Set<Property> props);
+}
\ No newline at end of file
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/StatusWithUuid.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/api/StatusWithUuid.java
new file mode 100644 (file)
index 0000000..be8625a
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * [[ Authors will Fill in the Copyright header ]]
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Hugo Trippaers
+ */
+package org.opendaylight.ovsdb.plugin.api;
+
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+
+/**
+ * Extends the Status class to allow functions to return a uuid
+ */
+public class StatusWithUuid extends Status {
+    private static final long serialVersionUID = -5413085099514964003L;
+    private UUID uuid;
+
+    public StatusWithUuid(StatusCode errorCode) {
+        super(errorCode);
+    }
+
+    public StatusWithUuid(StatusCode errorCode, String description) {
+        super(errorCode, description);
+    }
+
+    public StatusWithUuid(StatusCode errorCode, long requestId) {
+        super(errorCode, requestId);
+    }
+
+    public StatusWithUuid(StatusCode errorCode, UUID uuid) {
+        super(errorCode);
+        this.uuid = uuid;
+    }
+
+    public UUID getUuid() {
+        return uuid;
+    }
+
+}
similarity index 95%
rename from plugin/src/main/java/org/opendaylight/ovsdb/plugin/ConfigurationService.java
rename to plugin/src/main/java/org/opendaylight/ovsdb/plugin/impl/ConfigurationServiceImpl.java
index c5490fccac800b6637be2964c7639c81e30a9c02..57be21b91f92f8e7a80ed66d069541bae383e4b5 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Authors : Madhu Venugopal, Brent Salisbury, Keith Burns
  */
-package org.opendaylight.ovsdb.plugin;
+package org.opendaylight.ovsdb.plugin.impl;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
 
@@ -48,6 +48,13 @@ import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
 import org.opendaylight.ovsdb.lib.schema.TableSchema;
 import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
+import org.opendaylight.ovsdb.plugin.api.Connection;
+import org.opendaylight.ovsdb.plugin.api.OvsVswitchdSchemaConstants;
+import org.opendaylight.ovsdb.plugin.api.StatusWithUuid;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.schema.openvswitch.Controller;
 import org.opendaylight.ovsdb.schema.openvswitch.Interface;
@@ -62,14 +69,16 @@ import org.slf4j.LoggerFactory;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.util.concurrent.ListenableFuture;
 
-public class ConfigurationService implements IPluginInBridgeDomainConfigService, OvsdbConfigService,
-                                             CommandProvider
+public class ConfigurationServiceImpl implements IPluginInBridgeDomainConfigService,
+                                                 OvsdbConfigurationService,
+                                                 OvsdbConfigService,
+                                                 CommandProvider
 {
     private static final Logger logger = LoggerFactory
-            .getLogger(ConfigurationService.class);
+            .getLogger(ConfigurationServiceImpl.class);
 
-    IConnectionServiceInternal connectionService;
-    InventoryServiceInternal inventoryServiceInternal;
+    OvsdbConnectionService connectionService;
+    OvsdbInventoryService ovsdbInventoryService;
     boolean forceConnect = false;
     protected static final String OPENFLOW_10 = "1.0";
     protected static final String OPENFLOW_13 = "1.3";
@@ -111,23 +120,23 @@ public class ConfigurationService implements IPluginInBridgeDomainConfigService,
     void stop() {
     }
 
-    public void setConnectionServiceInternal(IConnectionServiceInternal connectionService) {
+    public void setConnectionServiceInternal(OvsdbConnectionService connectionService) {
         this.connectionService = connectionService;
     }
 
-    public void unsetConnectionServiceInternal(IConnectionServiceInternal connectionService) {
+    public void unsetConnectionServiceInternal(OvsdbConnectionService connectionService) {
         if (this.connectionService == connectionService) {
             this.connectionService = null;
         }
     }
 
-    public void setInventoryServiceInternal(InventoryServiceInternal inventoryServiceInternal) {
-        this.inventoryServiceInternal = inventoryServiceInternal;
+    public void setOvsdbInventoryService(OvsdbInventoryService ovsdbInventoryService) {
+        this.ovsdbInventoryService = ovsdbInventoryService;
     }
 
-    public void unsetInventoryServiceInternal(InventoryServiceInternal inventoryServiceInternal) {
-        if (this.inventoryServiceInternal == inventoryServiceInternal) {
-            this.inventoryServiceInternal = null;
+    public void unsetInventoryServiceInternal(OvsdbInventoryService ovsdbInventoryService) {
+        if (this.ovsdbInventoryService == ovsdbInventoryService) {
+            this.ovsdbInventoryService = null;
         }
     }
 
@@ -375,20 +384,20 @@ public class ConfigurationService implements IPluginInBridgeDomainConfigService,
 
     @Override
     public ConcurrentMap<String, Row> getRows(Node node, String tableName) {
-        ConcurrentMap<String, Row> ovsTable = inventoryServiceInternal.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME,  tableName);
+        ConcurrentMap<String, Row> ovsTable = ovsdbInventoryService.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME,  tableName);
         return ovsTable;
     }
 
     @Override
     public Row getRow(Node node, String tableName, String uuid) {
-        Map<String, Row> ovsTable = inventoryServiceInternal.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME,  tableName);
+        Map<String, Row> ovsTable = ovsdbInventoryService.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME,  tableName);
         if (ovsTable == null) return null;
         return ovsTable.get(uuid);
     }
 
     @Override
     public List<String> getTables(Node node) {
-        ConcurrentMap<String, ConcurrentMap<String, Row>> cache  = inventoryServiceInternal.getCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME);
+        ConcurrentMap<String, ConcurrentMap<String, Row>> cache  = ovsdbInventoryService.getCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME);
         if (cache == null) return null;
         return new ArrayList<String>(cache.keySet());
     }
@@ -523,7 +532,7 @@ public class ConfigurationService implements IPluginInBridgeDomainConfigService,
     }
 
 
-    Boolean setBridgeOFController(Node node, String bridgeIdentifier) {
+    public Boolean setBridgeOFController(Node node, String bridgeIdentifier) {
         if (connectionService == null) {
             logger.error("Couldn't refer to the ConnectionService");
             return false;
@@ -533,7 +542,7 @@ public class ConfigurationService implements IPluginInBridgeDomainConfigService,
             Connection connection = connectionService.getConnection(node);
             Bridge bridge = connection.getClient().getTypedRowWrapper(Bridge.class, null);
 
-            Map<String, Row> brTableCache = inventoryServiceInternal.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME, bridge.getSchema().getName());
+            Map<String, Row> brTableCache = ovsdbInventoryService.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME, bridge.getSchema().getName());
             for (String uuid : brTableCache.keySet()) {
                 bridge = connection.getClient().getTypedRowWrapper(Bridge.class, brTableCache.get(uuid));
                 if (bridge.getName().contains(bridgeIdentifier)) {
@@ -856,7 +865,7 @@ public class ConfigurationService implements IPluginInBridgeDomainConfigService,
             ci.println("Invalid Node");
             return;
         }
-        inventoryServiceInternal.printCache(node);
+        ovsdbInventoryService.printCache(node);
     }
 
     public void _forceConnect (CommandInterpreter ci) {
@@ -1104,7 +1113,7 @@ public class ConfigurationService implements IPluginInBridgeDomainConfigService,
         Connection connection = connectionService.getConnection(node);
         Bridge bridge = connection.getClient().getTypedRowWrapper(Bridge.class, null);
         List<String> brlist = new ArrayList<String>();
-        Map<String, Row> brTableCache = inventoryServiceInternal.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME, bridge.getSchema().getName());
+        Map<String, Row> brTableCache = ovsdbInventoryService.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME, bridge.getSchema().getName());
         if(brTableCache != null){
             for (String uuid : brTableCache.keySet()) {
                 bridge = connection.getClient().getTypedRowWrapper(Bridge.class, brTableCache.get(uuid));
similarity index 86%
rename from plugin/src/main/java/org/opendaylight/ovsdb/plugin/ConnectionService.java
rename to plugin/src/main/java/org/opendaylight/ovsdb/plugin/impl/ConnectionServiceImpl.java
index 30b4ad5667bad468f6d6068788d580e1339cf1a9..e4b49a6005b86609d9b80ec7f928aba4beaf2dc8 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Authors : Madhu Venugopal, Brent Salisbury, Evan Zeller
  */
-package org.opendaylight.ovsdb.plugin;
+package org.opendaylight.ovsdb.plugin.impl;
 
 import io.netty.channel.ChannelHandler;
 
@@ -41,6 +41,13 @@ import org.opendaylight.ovsdb.lib.message.TableUpdates;
 import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
 import org.opendaylight.ovsdb.lib.schema.TableSchema;
+import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
+import org.opendaylight.ovsdb.plugin.api.Connection;
+import org.opendaylight.ovsdb.plugin.internal.IPAddressProperty;
+import org.opendaylight.ovsdb.plugin.internal.L4PortProperty;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -51,41 +58,28 @@ import com.google.common.collect.Lists;
  * Represents the openflow plugin component in charge of programming the flows
  * the flow programming and relay them to functional modules above SAL.
  */
-public class ConnectionService implements IPluginInConnectionService, IConnectionServiceInternal, OvsdbConnectionListener {
-    protected static final Logger logger = LoggerFactory.getLogger(ConnectionService.class);
+public class ConnectionServiceImpl implements IPluginInConnectionService,
+                                              OvsdbConnectionService,
+                                              IConnectionServiceInternal,
+                                              OvsdbConnectionListener {
+    protected static final Logger logger = LoggerFactory.getLogger(ConnectionServiceImpl.class);
 
     // Properties that can be set in config.ini
     private static final Integer defaultOvsdbPort = 6640;
 
-    private OvsdbConnection connectionLib;
+
     private ConcurrentMap<String, Connection> ovsdbConnections = new ConcurrentHashMap<String, Connection>();
     private List<ChannelHandler> handlers = null;
-    private InventoryServiceInternal inventoryServiceInternal;
-
-    public InventoryServiceInternal getInventoryServiceInternal() {
-        return inventoryServiceInternal;
-    }
 
-    public void setInventoryServiceInternal(InventoryServiceInternal inventoryServiceInternal) {
-        this.inventoryServiceInternal = inventoryServiceInternal;
-    }
-
-    public void unsetInventoryServiceInternal(InventoryServiceInternal inventoryServiceInternal) {
-        if (this.inventoryServiceInternal == inventoryServiceInternal) {
-            this.inventoryServiceInternal = null;
-        }
-    }
+    private volatile OvsdbInventoryService ovsdbInventoryService;
+    private volatile OvsdbConnection connectionLib;
 
-    public void setOvsdbConnection(OvsdbConnection connectionService) {
-        connectionLib = connectionService;
-        // It is not correct to register the service here. Rather, we should depend on the
-        // Service created by createServiceDependency() and hook to it via Apache DM.
-        // Using this temporarily till the Service Dependency is resolved.
-        connectionLib.registerForPassiveConnection(this);
+    public void setOvsdbInventoryService(OvsdbInventoryService inventoryService) {
+        this.ovsdbInventoryService = inventoryService;
     }
 
-    public void unsetOvsdbConnection(OvsdbConnection connectionService) {
-        connectionLib = null;
+    public void setOvsdbConnection(OvsdbConnection ovsdbConnection) {
+        this.connectionLib = ovsdbConnection;
     }
 
     public void init() {
@@ -128,7 +122,7 @@ public class ConnectionService implements IPluginInConnectionService, IConnectio
         if (connection != null) {
             ovsdbConnections.remove(identifier);
             connection.disconnect();
-            inventoryServiceInternal.removeNode(node);
+            ovsdbInventoryService.removeNode(node);
             return new Status(StatusCode.SUCCESS);
         } else {
             return new Status(StatusCode.NOTFOUND);
@@ -212,6 +206,7 @@ public class ConnectionService implements IPluginInConnectionService, IConnectio
             @Override
             public void run() {
                 try {
+                    logger.info("Initialize inventory for {}", connection.toString());
                     initializeInventoryForNewNode(connection);
                 } catch (InterruptedException | ExecutionException | IOException e) {
                     logger.error("Failed to initialize inventory for node with identifier " + identifier, e);
@@ -230,7 +225,7 @@ public class ConnectionService implements IPluginInConnectionService, IConnectio
     public void channelClosed(Node node) throws Exception {
         logger.info("Connection to Node : {} closed", node);
         disconnect(node);
-        inventoryServiceInternal.removeNode(node);
+        ovsdbInventoryService.removeNode(node);
     }
 
     private void initializeInventoryForNewNode (Connection connection) throws InterruptedException, ExecutionException, IOException {
@@ -242,7 +237,8 @@ public class ConnectionService implements IPluginInConnectionService, IConnectio
         Set<Property> props = new HashSet<Property>();
         props.add(addressProp);
         props.add(l4Port);
-        inventoryServiceInternal.addNode(connection.getNode(), props);
+        logger.info("Add node to ovsdb inventory service {}", connection.getNode().toString());
+        ovsdbInventoryService.addNode(connection.getNode(), props);
 
         List<String> databases = client.getDatabases().get();
         if (databases == null) {
@@ -252,9 +248,10 @@ public class ConnectionService implements IPluginInConnectionService, IConnectio
         for (String database : databases) {
             DatabaseSchema dbSchema = client.getSchema(database).get();
             TableUpdates updates = this.monitorTables(connection.getNode(), dbSchema);
-            inventoryServiceInternal.processTableUpdates(connection.getNode(), dbSchema.getName(), updates);
+            ovsdbInventoryService.processTableUpdates(connection.getNode(), dbSchema.getName(), updates);
         }
-        inventoryServiceInternal.notifyNodeAdded(connection.getNode());
+        logger.info("Notifying Inventory Listeners for Node Added: {}", connection.getNode().toString());
+        ovsdbInventoryService.notifyNodeAdded(connection.getNode());
     }
 
     public TableUpdates monitorTables(Node node, DatabaseSchema dbSchema) throws ExecutionException, InterruptedException, IOException {
@@ -307,7 +304,7 @@ public class ConnectionService implements IPluginInConnectionService, IConnectio
 
         @Override
         public void update(TableUpdates result, DatabaseSchema dbSchema) {
-            inventoryServiceInternal.processTableUpdates(node, dbSchema.getName(), result);
+            ovsdbInventoryService.processTableUpdates(node, dbSchema.getName(), result);
         }
 
         @Override
similarity index 87%
rename from plugin/src/main/java/org/opendaylight/ovsdb/plugin/InventoryService.java
rename to plugin/src/main/java/org/opendaylight/ovsdb/plugin/impl/InventoryServiceImpl.java
index 58b27fd9b02e58e8ba9dfc9d946dbee8495f1868..5f5c437d92131b13868e6eac5dda7ad2d0b54f51 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Authors : Madhu Venugopal, Brent Salisbury
  */
-package org.opendaylight.ovsdb.plugin;
+package org.opendaylight.ovsdb.plugin.impl;
 
 import java.util.Collections;
 import java.util.HashMap;
@@ -31,11 +31,16 @@ import org.opendaylight.controller.sal.core.UpdateType;
 import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
 import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService;
 import org.opendaylight.controller.sal.utils.HexEncode;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.opendaylight.ovsdb.lib.message.TableUpdate;
 import org.opendaylight.ovsdb.lib.message.TableUpdates;
 import org.opendaylight.ovsdb.lib.notation.Row;
 import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.plugin.InventoryServiceInternal;
+import org.opendaylight.ovsdb.plugin.internal.NodeDatabase;
+import org.opendaylight.ovsdb.plugin.api.OvsVswitchdSchemaConstants;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 
 import com.google.common.collect.Sets;
@@ -49,16 +54,20 @@ import com.google.common.collect.Maps;
  *
  *
  */
-public class InventoryService implements IPluginInInventoryService, InventoryServiceInternal {
+public class InventoryServiceImpl implements IPluginInInventoryService,
+                                             OvsdbInventoryService,
+                                             InventoryServiceInternal {
     private static final Logger logger = LoggerFactory
-            .getLogger(InventoryService.class);
+            .getLogger(InventoryServiceImpl.class);
     private final Set<IPluginOutInventoryService> pluginOutInventoryServices =
             new CopyOnWriteArraySet<IPluginOutInventoryService>();
     private ConcurrentMap<Node, Map<String, Property>> nodeProps = new ConcurrentHashMap<Node, Map<String, Property>>();
     private ConcurrentMap<NodeConnector, Map<String, Property>> nodeConnectorProps = new ConcurrentHashMap<NodeConnector, Map<String, Property>>();
-    private ConcurrentMap<Node, NodeDB> dbCache = Maps.newConcurrentMap();
+    private ConcurrentMap<Node, NodeDatabase> dbCache = Maps.newConcurrentMap();
     private ScheduledExecutorService executor;
-    private OvsdbConfigService configurationService;
+    private OvsdbConfigurationService ovsdbConfigurationService;
+
+    private volatile IPluginOutInventoryService salInventoryService;
 
     private Set<OvsdbInventoryListener> ovsdbInventoryListeners = Sets.newCopyOnWriteArraySet();
 
@@ -108,12 +117,12 @@ public class InventoryService implements IPluginInInventoryService, InventorySer
             this.pluginOutInventoryServices.remove(service);
     }
 
-    public void setConfigurationService(OvsdbConfigService service) {
-        configurationService = service;
+    public void setOvsdbConfigurationService(OvsdbConfigurationService service) {
+        ovsdbConfigurationService = service;
     }
 
-    public void unsetConfigurationService(OvsdbConfigService service) {
-        configurationService = null;
+    public void unsetConfigurationService(OvsdbConfigurationService service) {
+        ovsdbConfigurationService = null;
     }
 
     @Override
@@ -130,7 +139,7 @@ public class InventoryService implements IPluginInInventoryService, InventorySer
 
     @Override
     public ConcurrentMap<String, ConcurrentMap<String, Row>> getCache(Node n, String databaseName) {
-        NodeDB db = dbCache.get(n);
+        NodeDatabase db = dbCache.get(n);
         if (db == null) return null;
         return db.getDatabase(databaseName);
     }
@@ -138,7 +147,7 @@ public class InventoryService implements IPluginInInventoryService, InventorySer
 
     @Override
     public ConcurrentMap<String, Row> getTableCache(Node n, String databaseName, String tableName) {
-        NodeDB db = dbCache.get(n);
+        NodeDatabase db = dbCache.get(n);
         if (db == null) return null;
         return db.getTableCache(databaseName, tableName);
     }
@@ -146,16 +155,16 @@ public class InventoryService implements IPluginInInventoryService, InventorySer
 
     @Override
     public Row getRow(Node n, String databaseName, String tableName, String uuid) {
-        NodeDB db = dbCache.get(n);
+        NodeDatabase db = dbCache.get(n);
         if (db == null) return null;
         return db.getRow(databaseName, tableName, uuid);
     }
 
     @Override
     public void updateRow(Node n, String databaseName, String tableName, String uuid, Row row) {
-        NodeDB db = dbCache.get(n);
+        NodeDatabase db = dbCache.get(n);
         if (db == null) {
-            db = new NodeDB();
+            db = new NodeDatabase();
             dbCache.put(n, db);
         }
         db.updateRow(databaseName, tableName, uuid, row);
@@ -163,15 +172,15 @@ public class InventoryService implements IPluginInInventoryService, InventorySer
 
     @Override
     public void removeRow(Node n, String databaseName, String tableName, String uuid) {
-        NodeDB db = dbCache.get(n);
+        NodeDatabase db = dbCache.get(n);
         if (db != null) db.removeRow(databaseName, tableName, uuid);
     }
 
     @Override
     public void processTableUpdates(Node n, String databaseName, TableUpdates tableUpdates) {
-        NodeDB db = dbCache.get(n);
+        NodeDatabase db = dbCache.get(n);
         if (db == null) {
-            db = new NodeDB();
+            db = new NodeDatabase();
             dbCache.put(n, db);
         }
 
@@ -217,7 +226,7 @@ public class InventoryService implements IPluginInInventoryService, InventorySer
                 @Override
                 public void run() {
                     try {
-                        if (configurationService != null) configurationService.setOFController(node, uuid.toString());
+                        if (ovsdbConfigurationService != null) ovsdbConfigurationService.setOFController(node, uuid.toString());
                     } catch (InterruptedException | ExecutionException e) {
                         e.printStackTrace();
                     }
@@ -242,8 +251,6 @@ public class InventoryService implements IPluginInInventoryService, InventorySer
                         Set<Property> props = new HashSet<Property>();
                         props.add(descProp);
 
-                        IPluginOutInventoryService salInventoryService = (IPluginOutInventoryService) ServiceHelper.getInstance(
-                                IPluginOutInventoryService.class, "default", this);
                         if (salInventoryService != null) {
                             logger.debug("Updating Bridge Name {} on OF node {}", bridgeName, ofNode);
                             salInventoryService.updateNode(ofNode, UpdateType.CHANGED, props);
@@ -265,7 +272,7 @@ public class InventoryService implements IPluginInInventoryService, InventorySer
 
     @Override
     public void printCache(Node n) {
-        NodeDB db = dbCache.get(n);
+        NodeDatabase db = dbCache.get(n);
         if (db != null) db.printTableCache();
     }
 
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/impl/NodeConnectorFactory.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/impl/NodeConnectorFactory.java
new file mode 100644 (file)
index 0000000..0240f90
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Brent Salisbury
+ */
+package org.opendaylight.ovsdb.plugin.impl;
+
+import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.utils.INodeConnectorFactory;
+import org.opendaylight.controller.sal.core.Node;
+
+public class NodeConnectorFactory implements INodeConnectorFactory {
+    public NodeConnector fromStringNoNode(String typeStr, String IDStr,
+              Node n){
+          if(typeStr.equals("OVS")){
+              try {
+                  return new NodeConnector(typeStr, IDStr, n);
+              } catch (Exception ex) {
+                  return null;
+              }
+          }
+          return null;
+      }
+}
diff --git a/plugin/src/main/java/org/opendaylight/ovsdb/plugin/impl/NodeFactory.java b/plugin/src/main/java/org/opendaylight/ovsdb/plugin/impl/NodeFactory.java
new file mode 100644 (file)
index 0000000..1ad2697
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Brent Salisbury
+ */
+package org.opendaylight.ovsdb.plugin.impl;
+
+import org.opendaylight.controller.sal.core.ConstructionException;
+import org.opendaylight.controller.sal.utils.INodeFactory;
+import org.opendaylight.controller.sal.core.Node;
+
+public class NodeFactory implements INodeFactory {
+
+      public Node fromString(String nodeType, String nodeId){
+          if(nodeType.equals("OVS"))
+              try{
+                  return new Node("OVS", nodeId);
+              } catch(ConstructionException e)
+              {
+                  return null;
+              }
+          return null;
+      }
+}
similarity index 70%
rename from plugin/src/main/java/org/opendaylight/ovsdb/plugin/Activator.java
rename to plugin/src/main/java/org/opendaylight/ovsdb/plugin/internal/Activator.java
index 07d4b37c5c820f14d2b18bed994d22eaa1318dde..ab7c194e62e67e693fed0cc7fb320ae1a51f672f 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Authors : Madhu Venugopal, Brent Salisbury
  */
-package org.opendaylight.ovsdb.plugin;
+package org.opendaylight.ovsdb.plugin.internal;
 
 import java.util.Dictionary;
 import java.util.Hashtable;
@@ -25,6 +25,20 @@ import org.opendaylight.controller.sal.utils.GlobalConstants;
 import org.opendaylight.controller.sal.utils.INodeConnectorFactory;
 import org.opendaylight.controller.sal.utils.INodeFactory;
 import org.opendaylight.ovsdb.lib.OvsdbConnection;
+import org.opendaylight.ovsdb.lib.OvsdbConnectionListener;
+import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
+import org.opendaylight.ovsdb.plugin.InventoryServiceInternal;
+import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService;
+import org.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.ConnectionServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.InventoryServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.NodeConnectorFactory;
+import org.opendaylight.ovsdb.plugin.impl.NodeFactory;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -61,28 +75,27 @@ public class Activator extends ComponentActivatorAbstractBase {
     }
     @Override
     public Object[] getGlobalImplementations() {
-        Object[] res = { ConnectionService.class, ConfigurationService.class, NodeFactory.class, NodeConnectorFactory.class, InventoryService.class };
+        Object[] res = { ConnectionServiceImpl.class, ConfigurationServiceImpl.class, NodeFactory.class, NodeConnectorFactory.class, InventoryServiceImpl.class };
         return res;
     }
 
     @Override
     public void configureGlobalInstance(Component c, Object imp){
-        if (imp.equals(ConfigurationService.class)) {
+        if (imp.equals(ConfigurationServiceImpl.class)) {
             // export the service to be used by SAL
             Dictionary<String, Object> props = new Hashtable<String, Object>();
             // Set the protocolPluginType property which will be used
             // by SAL
             props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
             c.setInterface(new String[] { IPluginInBridgeDomainConfigService.class.getName(),
+                                          OvsdbConfigurationService.class.getName(),
                                           OvsdbConfigService.class.getName()}, props);
 
             c.add(createServiceDependency()
-                    .setService(IConnectionServiceInternal.class)
-                    .setCallbacks("setConnectionServiceInternal", "unsetConnectionServiceInternal")
+                    .setService(OvsdbConnectionService.class)
                     .setRequired(true));
             c.add(createServiceDependency()
-                    .setService(InventoryServiceInternal.class)
-                    .setCallbacks("setInventoryServiceInternal", "unsetInventoryServiceInternal")
+                    .setService(OvsdbInventoryService.class)
                     .setRequired(true));
             c.add(createServiceDependency()
                     .setService(IClusterGlobalServices.class)
@@ -90,7 +103,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                     .setRequired(false));
         }
 
-        if (imp.equals(ConnectionService.class)) {
+        if (imp.equals(ConnectionServiceImpl.class)) {
             // export the service to be used by SAL
             Dictionary<String, Object> props = new Hashtable<String, Object>();
             // Set the protocolPluginType property which will be used
@@ -98,36 +111,35 @@ public class Activator extends ComponentActivatorAbstractBase {
             props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
             c.setInterface(
                     new String[] {IPluginInConnectionService.class.getName(),
+                                  OvsdbConnectionService.class.getName(),
+                                  OvsdbConnectionListener.class.getName(),
                                   IConnectionServiceInternal.class.getName()}, props);
-
             c.add(createServiceDependency()
-                    .setService(InventoryServiceInternal.class)
-                    .setCallbacks("setInventoryServiceInternal", "unsetInventoryServiceInternal")
+                    .setService(OvsdbInventoryService.class)
                     .setRequired(true));
             c.add(createServiceDependency()
                     .setService(OvsdbConnection.class)
-                    .setCallbacks("setOvsdbConnection", "unsetOvsdbConnection")
                     .setRequired(true));
         }
 
-        if (imp.equals(InventoryService.class)) {
-            Dictionary<String, Object> props = new Hashtable<String, Object>();
+        if (imp.equals(InventoryServiceImpl.class)) {
+            Dictionary<String, Object> props = new Hashtable<>();
             props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
             props.put("scope", "Global");
             c.setInterface(
-                    new String[] {IPluginInInventoryService.class.getName(),
-                            InventoryServiceInternal.class.getName()}, props);
+                    new String[]{IPluginInInventoryService.class.getName(),
+                                 OvsdbInventoryService.class.getName(),
+                                 InventoryServiceInternal.class.getName()}, props);
             c.add(createServiceDependency()
-                    .setService(IPluginOutInventoryService.class, "(scope=Global)")
-                    .setCallbacks("setPluginOutInventoryServices",
-                            "unsetPluginOutInventoryServices")
-                    .setRequired(true));
+                          .setService(IPluginOutInventoryService.class, "(scope=Global)")
+                          .setCallbacks("setPluginOutInventoryServices",
+                                        "unsetPluginOutInventoryServices")
+                          .setRequired(true));
             c.add(createServiceDependency()
                     .setService(OvsdbInventoryListener.class)
                     .setCallbacks("listenerAdded", "listenerRemoved"));
             c.add(createServiceDependency()
-                    .setService(OvsdbConfigService.class)
-                    .setCallbacks("setConfigurationService", "unsetConfigurationService")
+                    .setService(OvsdbConfigurationService.class)
                     .setRequired(false));
         }
 
similarity index 93%
rename from plugin/src/main/java/org/opendaylight/ovsdb/plugin/Encapsulation.java
rename to plugin/src/main/java/org/opendaylight/ovsdb/plugin/internal/Encapsulation.java
index e33ae72475f35afcb89d031c7f6eb2dfdd0e0502..02c152d978e895ac629814c0520c2c7bfcad74c3 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Authors : Brent Salisbury, Evan Zeller
  */
-package org.opendaylight.ovsdb.plugin;
+package org.opendaylight.ovsdb.plugin.internal;
 
 public enum Encapsulation {
 
similarity index 96%
rename from plugin/src/main/java/org/opendaylight/ovsdb/plugin/IPAddressProperty.java
rename to plugin/src/main/java/org/opendaylight/ovsdb/plugin/internal/IPAddressProperty.java
index 3caa2a19b57a0e25dfc997d00c9ab8de4de90232..3111df22404876eed80c7a51074591df5c58bde3 100644 (file)
@@ -8,7 +8,7 @@
  * Authors : Madhu Venugopal, Brent Salisbury
  */
 
-package org.opendaylight.ovsdb.plugin;
+package org.opendaylight.ovsdb.plugin.internal;
 import java.net.InetAddress;
 
 import javax.xml.bind.annotation.XmlAccessType;
similarity index 96%
rename from plugin/src/main/java/org/opendaylight/ovsdb/plugin/L4PortProperty.java
rename to plugin/src/main/java/org/opendaylight/ovsdb/plugin/internal/L4PortProperty.java
index 8cd82f1e1713d964ecd87810c8d77c3fac9402b1..c31bdee3d4575dad45769a210218f05951020a4b 100644 (file)
@@ -8,7 +8,7 @@
  * Authors : Madhu Venugopal, Brent Salisbury
  */
 
-package org.opendaylight.ovsdb.plugin;
+package org.opendaylight.ovsdb.plugin.internal;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
similarity index 98%
rename from plugin/src/main/java/org/opendaylight/ovsdb/plugin/NodeDB.java
rename to plugin/src/main/java/org/opendaylight/ovsdb/plugin/internal/NodeDatabase.java
index 7e70173028f9ed0eb9d7b916bc096c79045501e8..4a80e82f909c0f9f01d57d1d859a9ea3de1740ae 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Authors : Madhu Venugopal, Brent Salisbury
  */
-package org.opendaylight.ovsdb.plugin;
+package org.opendaylight.ovsdb.plugin.internal;
 
 import java.util.Collection;
 import java.util.Map;
@@ -19,7 +19,7 @@ import org.opendaylight.ovsdb.lib.notation.Row;
 
 import com.google.common.collect.Maps;
 
-public class NodeDB {
+public class NodeDatabase {
     ConcurrentMap<String, TableDB> dbCache = Maps.newConcurrentMap();
 
     public ConcurrentMap<String, ConcurrentMap<String, Row>> getDatabase(String dbName) {
index 07a168395b02caf8a248d8a597dd3f4b4380ff61..1a63a0713c010c3acdd4422afaf09ed717901f4c 100644 (file)
@@ -16,6 +16,10 @@ import java.util.Map;
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.networkconfig.bridgedomain.ConfigConstants;
+import org.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.ConnectionServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.InventoryServiceImpl;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -27,7 +31,7 @@ public class BridgeDomainConfigBridgeTestCases extends PluginTestBase {
     public void addBridge() throws Throwable{
 
         TestObjects testObjects = getTestConnection();
-        ConnectionService connectionService = testObjects.connectionService;
+        ConnectionServiceImpl connectionService = testObjects.connectionService;
         Node node = testObjects.node;
 
         /**
@@ -36,7 +40,7 @@ public class BridgeDomainConfigBridgeTestCases extends PluginTestBase {
          * @param node Node serving this configuration service
          * @param bridgeDomainIdentifier String representation of a Bridge Domain
          */
-        ConfigurationService configurationService = testObjects.configurationService;
+        ConfigurationServiceImpl configurationService = testObjects.configurationService;
         configurationService.createBridgeDomain(node, BRIDGE_NAME, null);
     }
 
@@ -44,8 +48,8 @@ public class BridgeDomainConfigBridgeTestCases extends PluginTestBase {
     public void getBridgeDomains() throws Throwable{
 
         TestObjects testObjects = getTestConnection();
-        ConnectionService connectionService = testObjects.connectionService;
-        InventoryService inventoryService = testObjects.inventoryService;
+        ConnectionServiceImpl connectionService = testObjects.connectionService;
+        InventoryServiceImpl inventoryService = testObjects.inventoryService;
         Node node = testObjects.node;
 
         /**
@@ -54,7 +58,7 @@ public class BridgeDomainConfigBridgeTestCases extends PluginTestBase {
          * @param node Node serving this configuration service
          *
          */
-        ConfigurationService configurationService = testObjects.configurationService;
+        ConfigurationServiceImpl configurationService = testObjects.configurationService;
         List<String> ls = configurationService.getBridgeDomains(node);
     }
 
@@ -63,7 +67,7 @@ public class BridgeDomainConfigBridgeTestCases extends PluginTestBase {
         TestObjects testObjects = getTestConnection();
         Node node = testObjects.node;
 
-        ConfigurationService configurationService = testObjects.configurationService;
+        ConfigurationServiceImpl configurationService = testObjects.configurationService;
         configurationService.setBridgeOFController(node, BRIDGE_NAME);
 
     }
@@ -71,7 +75,7 @@ public class BridgeDomainConfigBridgeTestCases extends PluginTestBase {
     @Test
     public void setBridgeConfig() throws Throwable{
         TestObjects testObjects = getTestConnection();
-        ConnectionService connectionService = testObjects.connectionService;
+        ConnectionServiceImpl connectionService = testObjects.connectionService;
         Node node = testObjects.node;
 
         Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
@@ -81,7 +85,7 @@ public class BridgeDomainConfigBridgeTestCases extends PluginTestBase {
         //Will accept multiple array pairs. Pairs must be arrays not maps.
         configs.put(ConfigConstants.CUSTOM, exterIDPairs);
 
-        ConfigurationService configurationService = testObjects.configurationService;
+        ConfigurationServiceImpl configurationService = testObjects.configurationService;
         configurationService.addBridgeDomainConfig(node, BRIDGE_NAME, configs);
     }
 
index 3faee6a37990e4e72cb6c295b7c37d93785b6494..94037f1607a939352576602e67b10c3154d79f20 100644 (file)
@@ -11,6 +11,8 @@ package org.opendaylight.ovsdb.plugin;
 
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -37,8 +39,8 @@ public class BridgeDomainConfigManagerTestCases extends PluginTestBase {
          * @param String with IP and connection type ex. type:ip:port
          *
          */
-        ConfigurationService configurationService = testObjects.configurationService;
+        ConfigurationServiceImpl configurationService = testObjects.configurationService;
         configurationService.setManager(node, manager);
     }
 
-}
+}
\ No newline at end of file
index 11a09108f5113d689bba5255028a03ca2cd1fb36..94765c0b48c6fbb65b04f4581ae464671f244825 100644 (file)
@@ -18,6 +18,10 @@ import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.networkconfig.bridgedomain.ConfigConstants;
+import org.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.ConnectionServiceImpl;
+import org.opendaylight.ovsdb.plugin.internal.Encapsulation;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -40,9 +44,9 @@ public class BridgeDomainConfigPortTestCases extends PluginTestBase {
     @Test
     public void addPort() throws Throwable{
         TestObjects testObjects = getTestConnection();
-        ConnectionService connectionService = testObjects.connectionService;
+        ConnectionServiceImpl connectionService = testObjects.connectionService;
         Node node = testObjects.node;
-        ConfigurationService configurationService = testObjects.configurationService;
+        ConfigurationServiceImpl configurationService = testObjects.configurationService;
         configurationService.addPort(node, BRIDGE_NAME, PORT_NAME, null);
     }
 
@@ -54,12 +58,12 @@ public class BridgeDomainConfigPortTestCases extends PluginTestBase {
     @Test
     public void addPortVlan() throws Throwable{
         TestObjects testObjects = getTestConnection();
-        ConnectionService connectionService = testObjects.connectionService;
+        ConnectionServiceImpl connectionService = testObjects.connectionService;
         Node node = testObjects.node;
 
         int vlanid = 100;
 
-        ConfigurationService configurationService = testObjects.configurationService;
+        ConfigurationServiceImpl configurationService = testObjects.configurationService;
         Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
         configs.put(ConfigConstants.TYPE, "VLAN");
         configs.put(ConfigConstants.VLAN, vlanid+"");
@@ -84,7 +88,7 @@ public class BridgeDomainConfigPortTestCases extends PluginTestBase {
         String tunencap = encap.toString();
         String tunnelendpoint = FAKE_IP;
 
-        ConfigurationService configurationService = testObjects.configurationService;
+        ConfigurationServiceImpl configurationService = testObjects.configurationService;
         Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
         configs.put(ConfigConstants.TYPE, "TUNNEL");
         configs.put(ConfigConstants.TUNNEL_TYPE, tunencap);
@@ -100,10 +104,10 @@ public class BridgeDomainConfigPortTestCases extends PluginTestBase {
     @Test
     public void deletePort() throws Throwable{
         TestObjects testObjects = getTestConnection();
-        ConnectionService connectionService = testObjects.connectionService;
+        ConnectionServiceImpl connectionService = testObjects.connectionService;
         Node node = testObjects.node;
 
-        ConfigurationService configurationService = testObjects.configurationService;
+        ConfigurationServiceImpl configurationService = testObjects.configurationService;
         configurationService.deletePort(node, BRIDGE_NAME, PORT_NAME);
     }
 
index 5c088aaa5525e3e57c6dadefa89580506393f620..8911a5b0a570cd74275ca75588cb0214b5102a43 100644 (file)
@@ -20,6 +20,9 @@ import org.opendaylight.controller.sal.connection.ConnectionConstants;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.ConnectionServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.InventoryServiceImpl;
 
 public abstract class PluginTestBase {
     private final static String identifier = "TEST";
@@ -38,12 +41,12 @@ public abstract class PluginTestBase {
     }
 
     public class TestObjects {
-        public final ConnectionService connectionService;
-        public final InventoryService inventoryService;
-        public final ConfigurationService configurationService;
+        public final ConnectionServiceImpl connectionService;
+        public final InventoryServiceImpl inventoryService;
+        public final ConfigurationServiceImpl configurationService;
         public final Node node;
 
-        public TestObjects(ConnectionService connectionService, Node node, InventoryService inventoryService, ConfigurationService configurationService) {
+        public TestObjects(ConnectionServiceImpl connectionService, Node node, InventoryServiceImpl inventoryService, ConfigurationServiceImpl configurationService) {
             this.connectionService = connectionService;
             this.inventoryService = inventoryService;
             this.configurationService = configurationService;
@@ -66,19 +69,19 @@ public abstract class PluginTestBase {
         Node.NodeIDType.registerIDType("OVS", String.class);
         NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class,
                 "OVS");
-        InventoryService inventoryService = new InventoryService();
+        InventoryServiceImpl inventoryService = new InventoryServiceImpl();
         inventoryService.init();
 
-        ConnectionService connectionService = new ConnectionService();
+        ConnectionServiceImpl connectionService = new ConnectionServiceImpl();
         connectionService.init();
-        InventoryService inventory = new InventoryService();
+        InventoryServiceImpl inventory = new InventoryServiceImpl();
         inventory.init();
-        connectionService.setInventoryServiceInternal(inventory);
+        connectionService.setOvsdbInventoryService(inventory);
         connectionService.setOvsdbConnection(OvsdbConnectionService.getService());
-        ConfigurationService configurationService = new ConfigurationService();
+        ConfigurationServiceImpl configurationService = new ConfigurationServiceImpl();
         configurationService.setConnectionServiceInternal(connectionService);
-        configurationService.setInventoryServiceInternal(inventory);
-        inventory.setConfigurationService(configurationService);
+        configurationService.setOvsdbInventoryService(inventory);
+        inventory.setOvsdbConfigurationService(configurationService);
 
         Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
 
index a212eff28b8939de4a9b80f89cac0311fd7eca84..75f9a4276d603808311d70faad499e8a6091917e 100644 (file)
@@ -11,6 +11,9 @@ package org.opendaylight.ovsdb.plugin;
 
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.ConnectionServiceImpl;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -26,9 +29,9 @@ public class TearDown extends PluginTestBase {
     public void deleteBridge() throws Throwable{
 
         TestObjects testObjects = getTestConnection();
-        ConnectionService connectionService = testObjects.connectionService;
+        ConnectionServiceImpl connectionService = testObjects.connectionService;
         Node node = testObjects.node;
-        ConfigurationService configurationService = testObjects.configurationService;
+        ConfigurationServiceImpl configurationService = testObjects.configurationService;
         configurationService.deleteBridgeDomain(node, BRIDGE_NAME);
     }