Use config for hwvtepsouthbound 25/29125/2
authorVishal Thapar <vishal.thapar@ericsson.com>
Mon, 2 Nov 2015 12:12:54 +0000 (17:42 +0530)
committerVishal Thapar <vishal.thapar@ericsson.com>
Tue, 3 Nov 2015 20:48:06 +0000 (02:18 +0530)
This is counterpart to https://git.opendaylight.org/gerrit/27578

Patchset2:
Remove null check for ovsdbConnection in handleOwnershipChange. Since this
is always non-null, we end up not starting OVSDBManager for hwvtep.

Change-Id: I8900794cf4f75b837fd6efb406f18addc9cfe3a0
Signed-off-by: Vishal Thapar <vishal.thapar@ericsson.com>
hwvtepsouthbound/hwvtepsouthbound-features/pom.xml
hwvtepsouthbound/hwvtepsouthbound-features/src/main/features/features.xml
hwvtepsouthbound/hwvtepsouthbound-impl/pom.xml
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/config/default-config.xml
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundProvider.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/hwvtepsouthbound/impl/rev150901/HwvtepSouthboundModule.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/yang/hwvtepsouthbound-impl.yang

index 1a60860e7730997367c96745e72232913fd23e97..b881ebdd04b3ee6dfb40d16744f0c72cbf77e56c 100644 (file)
@@ -105,5 +105,12 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
       <artifactId>hwvtepsouthbound-api</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>library-features</artifactId>
+      <type>xml</type>
+      <classifier>features</classifier>
+      <version>${project.version}</version>
+    </dependency>
   </dependencies>
 </project>
index 366198c3ecec42cb10f70dff2920b76a7b4f68ab..88e88075a6f8321b0fe64ea27ccef0395cc89394 100644 (file)
@@ -15,6 +15,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   <repository>mvn:org.opendaylight.netconf/features-restconf/${restconf.version}/xml/features</repository>
   <repository>mvn:org.opendaylight.mdsal.model/features-mdsal-model/${mdsal.model.version}/xml/features</repository>
   <repository>mvn:org.opendaylight.dlux/features-dlux/${dlux.version}/xml/features</repository>
+  <repository>mvn:org.opendaylight.ovsdb/library-features/${project.version}/xml/features</repository>
   <feature name='odl-ovsdb-hwvtepsouthbound-api' version='${project.version}' description='OpenDaylight :: hwvtepsouthbound :: api'>
     <feature version='${mdsal.model.version}'>odl-mdsal-models</feature>
     <bundle>mvn:org.opendaylight.ovsdb/hwvtepsouthbound-api/${project.version}</bundle>
@@ -23,11 +24,13 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
     <feature version='${mdsal.version}'>odl-mdsal-broker</feature>
     <feature version='${project.version}'>odl-ovsdb-hwvtepsouthbound-api</feature>
     <bundle>mvn:org.opendaylight.ovsdb/hwvtepsouthbound-impl/${project.version}</bundle>
+    <bundle>mvn:org.opendaylight.ovsdb/library/${project.version}</bundle>
     <bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}</bundle>
     <bundle>mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}</bundle>
     <bundle>mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}</bundle>
     <bundle>mvn:com.fasterxml.jackson.datatype/jackson-datatype-json-org/${jackson.version}</bundle>
     <bundle>wrap:mvn:org.json/json/${org.json.version}</bundle>
+    <feature version='${project.version}'>odl-ovsdb-library</feature>
     <configfile finalname="${configfile.directory}/hwvtepsouthbound.xml">mvn:org.opendaylight.ovsdb/hwvtepsouthbound-impl/${project.version}/xml/config</configfile>
   </feature>
   <feature name='odl-ovsdb-hwvtepsouthbound-rest' version='${project.version}' description='OpenDaylight :: hwvtepsouthbound :: REST'>
index 4f30490d1875606c9a07ea9b0659f3924d1e41cc..eadf1ac67eeb918cfe4b82ec67c59c8179619263 100644 (file)
@@ -58,8 +58,8 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
         <artifactId>maven-bundle-plugin</artifactId>
         <configuration>
           <instructions>
-            <Private-Package>org.opendaylight.ovsdb.lib.*,org.opendaylight.ovsdb.schema.hardwarevtep</Private-Package>
-            <Export-Package>org.opendaylight.ovsdb.hwvtepsouthbound.*,org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hwvtepsouthbound.impl.rev150901</Export-Package>
+            <Private-Package>org.opendaylight.ovsdb.schema.hardwarevtep</Private-Package>
+            <Export-Package>org.opendaylight.ovsdb.hwvtepsouthbound.*,org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hwvtepsouthbound.impl.rev150901.*</Export-Package>
           </instructions>
         </configuration>
       </plugin>
index addeb2b16588846816dbad56cbb63c0af309ce5f..bd700948984dd773911e31bf9397d9f563115383 100644 (file)
@@ -11,6 +11,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   <required-capabilities>
     <!--  <capability>urn:opendaylight:params:xml:ns:yang:hwvtepsouthbound:impl?module=hwvtepsouthbound-impl&amp;revision=2015-09-01</capability> -->
       <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
+      <capability>urn:opendaylight:params:xml:ns:yang:library:impl?module=library&amp;revision=2014-12-10</capability>
   </required-capabilities>
   <configuration>
 
@@ -35,6 +36,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
              <type xmlns:ns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:entity-ownership-service">ns:entity-ownership-service</type>
              <name>entity-ownership-service</name>
           </clustering-entity-ownership-service>
+          <connection-service>
+            <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:library:impl">prefix:connection-service</type>
+            <name>connection-service</name>
+          </connection-service>
         </module>
       </modules>
     </data>
index 622ca0364d4fba724d73d68dad5e121a49f4611a..44a278911b7ee950527ee95559c8ad8ca47641ab 100644 (file)
@@ -56,9 +56,12 @@ public class HwvtepSouthboundProvider implements BindingAwareProvider, AutoClose
     private HwvtepDataChangeListener hwvtepDTListener;
 
     public HwvtepSouthboundProvider(
-            EntityOwnershipService entityOwnershipServiceDependency) {
+            EntityOwnershipService entityOwnershipServiceDependency,
+            OvsdbConnection ovsdbConnection) {
         this.entityOwnershipService = entityOwnershipServiceDependency;
         registration = null;
+        this.ovsdbConnection = ovsdbConnection;
+        LOG.info("HwvtepSouthboundProvider ovsdbConnectionService: {}", ovsdbConnection);
     }
 
     @Override
@@ -82,11 +85,8 @@ public class HwvtepSouthboundProvider implements BindingAwareProvider, AutoClose
             if (ownershipStateOpt.isPresent()) {
                 EntityOwnershipState ownershipState = ownershipStateOpt.get();
                 if (ownershipState.hasOwner() && !ownershipState.isOwner()) {
-                    if (ovsdbConnection == null) {
-                        ovsdbConnection = new OvsdbConnectionService();
-                        ovsdbConnection.registerConnectionListener(cm);
-                        ovsdbConnection.startOvsdbManager(HwvtepSouthboundConstants.DEFAULT_OVSDB_PORT);
-                    }
+                    ovsdbConnection.registerConnectionListener(cm);
+                    ovsdbConnection.startOvsdbManager(HwvtepSouthboundConstants.DEFAULT_OVSDB_PORT);
                 }
             }
         } catch (CandidateAlreadyRegisteredException e) {
@@ -164,12 +164,8 @@ public class HwvtepSouthboundProvider implements BindingAwareProvider, AutoClose
         } else {
             LOG.info("*This* instance of HWVTEP southbound provider is set as a SLAVE instance");
         }
-        //TODO: How to make this co-exist with OvsdbSouthbound?
-        if (ovsdbConnection == null) {
-            ovsdbConnection = new OvsdbConnectionService();
-            ovsdbConnection.registerConnectionListener(cm);
-            ovsdbConnection.startOvsdbManager(HwvtepSouthboundConstants.DEFAULT_OVSDB_PORT);
-        }
+        ovsdbConnection.registerConnectionListener(cm);
+        ovsdbConnection.startOvsdbManager(HwvtepSouthboundConstants.DEFAULT_OVSDB_PORT);
     }
 
     private class HwvtepsbPluginInstanceEntityOwnershipListener implements EntityOwnershipListener {
index b4398e08c210779f63bfe1f287d4ee6fe3e94195..d88718838f8b8cfea6e791109dfa094127c27eb2 100644 (file)
@@ -30,7 +30,8 @@ public class HwvtepSouthboundModule extends org.opendaylight.yang.gen.v1.urn.ope
     public java.lang.AutoCloseable createInstance() {
         HwvtepSouthboundUtil.setInstanceIdentifierCodec(new InstanceIdentifierCodec(getSchemaServiceDependency(),
                         getBindingNormalizedNodeSerializerDependency()));
-        HwvtepSouthboundProvider provider = new HwvtepSouthboundProvider(getClusteringEntityOwnershipServiceDependency());
+        HwvtepSouthboundProvider provider = new HwvtepSouthboundProvider(getClusteringEntityOwnershipServiceDependency(),
+                        getConnectionServiceDependency());
         getBrokerDependency().registerProvider(provider);
         return provider;
     }
index f9a24e387464b413946ff2c6240496e98d176d9e..f0823322d63591dfa3874857e989ab12e4f67892 100644 (file)
@@ -7,6 +7,7 @@ module hwvtepsouthbound-impl {
     import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
     import opendaylight-entity-ownership-service {prefix eos; revision-date 2015-08-10;}
     import opendaylight-md-sal-dom {prefix dom; revision-date 2013-10-28;}
+    import library { prefix library; revision-date 2014-12-10; }
 
     description
         "Service definition for hwvtepsouthbound project";
@@ -56,6 +57,14 @@ module hwvtepsouthbound-impl {
                     }
                 }
             }
+            container connection-service {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity library:connection-service;
+                    }
+                }
+            }
         }
     }
 }