Add working integration-test
[ovsdb.git] / southbound / southbound-it / src / test / java / org / opendaylight / ovsdb / southbound / it / SouthboundIT.java
index 0e0f616dce07d4ccfbc60c86a4ffd355167e8f23..874a66cd4387f6e7261e57a94559236bfad68432 100644 (file)
@@ -105,7 +105,7 @@ public class SouthboundIT extends AbstractMdsalTestBase {
     private static String connectionType;
     private static Boolean setup = false;
     private static MdsalUtils mdsalUtils = null;
-    private static String extras = "false";
+    private static String extras = "true";
     private static final String NETVIRT = "org.opendaylight.ovsdb.openstack.net-virt";
     private static final String NETVIRTPROVIDERS = "org.opendaylight.ovsdb.openstack.net-virt-providers";
 
@@ -139,7 +139,6 @@ public class SouthboundIT extends AbstractMdsalTestBase {
 
     @Override
     public String getFeatureName() {
-        setExtras();
         return "odl-ovsdb-southbound-impl-ui";
     }
 
@@ -151,35 +150,36 @@ public class SouthboundIT extends AbstractMdsalTestBase {
 
     @Override
     public Option[] getFeaturesOptions() {
-        if (extras.equals("true")) {
+        /*if (extras.equals("true")) {
             Option[] options = new Option[] {
                     features("mvn:org.opendaylight.ovsdb/features-ovsdb/1.1.0-SNAPSHOT/xml/features",
                             "odl-ovsdb-openstack-sb")};
             return options;
-        } else {
+        } else {*/
             return new Option[]{};
-        }
+        //}
     }
 
     @Override
     public Option[] getLoggingOptions() {
         Option[] options = new Option[] {
-                /*editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
-                        "log4j.logger.org.opendaylight.ovsdb",
-                        LogLevelOption.LogLevel.DEBUG.name()),*/
                 editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
+                        "log4j.logger.org.opendaylight.ovsdb",
+                        LogLevelOption.LogLevel.DEBUG.name()),
+                /*editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
                         "log4j.logger.org.opendaylight.ovsdb.southbound-impl",
-                        LogLevelOption.LogLevel.DEBUG.name())
+                        LogLevelOption.LogLevel.DEBUG.name())*/
         };
 
+        LOG.info("getLoggingOptions extras: {}", extras);
         if (extras.equals("true")) {
             Option[] extraOptions = new Option[] {
                 editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
                         "log4j.logger.org.opendaylight.ovsdb",
                         LogLevelOption.LogLevel.DEBUG.name()),
-                editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
+                /*editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
                         "log4j.logger.org.opendaylight.ovsdb.openstack.net-virt",
-                        LogLevelOption.LogLevel.DEBUG.name())
+                        LogLevelOption.LogLevel.DEBUG.name())*/
             };
             options = ObjectArrays.concat(options, extraOptions, Option.class);
         }
@@ -197,9 +197,11 @@ public class SouthboundIT extends AbstractMdsalTestBase {
                 SouthboundITConstants.DEFAULT_SERVER_PORT);
         String connectionType = props.getProperty(SouthboundITConstants.CONNECTION_TYPE,
                 SouthboundITConstants.CONNECTION_TYPE_ACTIVE);
+        String extras = props.getProperty(SouthboundITConstants.SERVER_EXTRAS,
+                SouthboundITConstants.DEFAULT_SERVER_EXTRAS);
 
-        LOG.info("Using the following properties: mode= {}, ip:port= {}:{}",
-                connectionType, addressStr, portStr);
+        LOG.info("getPropertiesOptions: Using the following properties: mode= {}, ip:port= {}:{}, extras= {}",
+                connectionType, addressStr, portStr, extras);
 
         Option[] options = new Option[] {
                 editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
@@ -207,17 +209,20 @@ public class SouthboundIT extends AbstractMdsalTestBase {
                 editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
                         SouthboundITConstants.SERVER_PORT, portStr),
                 editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
-                        SouthboundITConstants.CONNECTION_TYPE, connectionType)
+                        SouthboundITConstants.CONNECTION_TYPE, connectionType),
+                editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
+                        SouthboundITConstants.SERVER_EXTRAS, extras)
         };
         return options;
     }
 
-    private void setExtras() {
+    @Override
+    public void setExtras() {
         Properties props = new Properties(System.getProperties());
         extras = props.getProperty(SouthboundITConstants.SERVER_EXTRAS,
                 SouthboundITConstants.DEFAULT_SERVER_EXTRAS);
-        LOG.info("extras: {}", extras);
-        System.out.println("extras: " + extras);
+        LOG.info("setExtras: {}", extras);
+        System.out.println("setExtras: " + extras);
     }
 
     @Before
@@ -241,8 +246,8 @@ public class SouthboundIT extends AbstractMdsalTestBase {
         portStr = bundleContext.getProperty(SouthboundITConstants.SERVER_PORT);
         connectionType = bundleContext.getProperty(SouthboundITConstants.CONNECTION_TYPE);
 
-        LOG.info("Using the following properties: mode= {}, ip:port= {}:{}",
-                connectionType, addressStr, portStr);
+        LOG.info("setUp: Using the following properties: mode= {}, ip:port= {}:{}, extras= {}",
+                connectionType, addressStr, portStr, extras);
         if (connectionType.equalsIgnoreCase(SouthboundITConstants.CONNECTION_TYPE_ACTIVE)) {
             if (addressStr == null) {
                 fail(usage());
@@ -252,6 +257,8 @@ public class SouthboundIT extends AbstractMdsalTestBase {
         mdsalUtils = new MdsalUtils(dataBroker);
         setup = true;
 
+        //setExtras();
+        LOG.info("setUp: extras: {}", extras);
         if (extras.equals("true")) {
             isBundleReady(bundleContext, NETVIRT);
             isBundleReady(bundleContext, NETVIRTPROVIDERS);
@@ -424,8 +431,8 @@ public class SouthboundIT extends AbstractMdsalTestBase {
                 new OvsdbTerminationPointAugmentationBuilder();
         ovsdbTerminationPointAugmentationBuilder.setInterfaceType(
                 new InterfaceTypeEntryBuilder()
-                .setInterfaceType(
-                        SouthboundMapper.createInterfaceType("internal"))
+                        .setInterfaceType(
+                                SouthboundMapper.createInterfaceType("internal"))
                         .build().getInterfaceType());
         return ovsdbTerminationPointAugmentationBuilder;
     }
@@ -991,4 +998,16 @@ public class SouthboundIT extends AbstractMdsalTestBase {
             }
         }
     }
+
+    @Test
+    public void testNetVirt() throws InterruptedException {
+        LOG.info(">>>>> waiting");
+        Thread.sleep(10000);
+        LOG.info(">>>>> back");
+
+        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
+        Node ovsdbNode = connectOvsdbNode(connectionInfo);
+        //Assert.assertFalse(disconnectOvsdbNode(connectionInfo));
+        Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
+    }
 }