Merge "Add OpenFlow ID to ovsdb-bridge-attributes."
authorFlavio Fernandes <ffernand@redhat.com>
Thu, 16 Apr 2015 23:42:59 +0000 (23:42 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 16 Apr 2015 23:43:00 +0000 (23:43 +0000)
16 files changed:
commons/integrationtest/pom.xml
integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/ConfigurationBundles.java
openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/L2ForwardingService.java
openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/PipelineOrchestratorImplTest.java [new file with mode: 0644]
openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/ClassifierServiceTest.java [new file with mode: 0644]
plugin-shell/pom.xml
plugin-shell/src/main/java/org/opendaylight/ovsdb/plugin/shell/PrintCache.java
southbound/southbound-api/src/main/yang/ovsdb.yang
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbDataChangeListener.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundMapper.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactInvokerImpl.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OpenVSwitchUpdateCommand.java
southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/AbstractConfigTestBase.java
southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/AbstractMdsalTestBase.java
southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/SouthboundIT.java
southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/SouthboundITConstants.java [new file with mode: 0644]

index b4ed87bd9229d1fd6d97573005a5c9d7a6cf181a..b0d1ed83137cfb5cfb67d6150d72007e96371ea8 100644 (file)
@@ -172,16 +172,19 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       <artifactId>javax.servlet.jsp</artifactId>
     </dependency>
     <dependency>
-      <groupId>equinoxSDK381</groupId>
+      <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.gogo.command</artifactId>
+      <version>0.14.0</version>
     </dependency>
     <dependency>
-      <groupId>equinoxSDK381</groupId>
+      <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.gogo.runtime</artifactId>
+      <version>0.12.1</version>
     </dependency>
     <dependency>
-      <groupId>equinoxSDK381</groupId>
+      <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.gogo.shell</artifactId>
+      <version>0.10.0</version>
     </dependency>
     <dependency>
       <groupId>equinoxSDK381</groupId>
index 6e98e663869cef06c46231d7907180e1b9a563e2..262bea79965084c9b53e64ba00740875fd34b841 100644 (file)
@@ -30,9 +30,9 @@ public class ConfigurationBundles {
                 mavenBundle("com.google.guava", "guava").versionAsInProject(),
                 mavenBundle("eclipselink", "javax.resource").versionAsInProject(),
                 mavenBundle("equinoxSDK381", "javax.servlet").versionAsInProject(),
-                mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command").versionAsInProject(),
-                mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime").versionAsInProject(),
-                mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell").versionAsInProject(),
+                mavenBundle("org.apache.felix", "org.apache.felix.gogo.command").versionAsInProject(),
+                mavenBundle("org.apache.felix", "org.apache.felix.gogo.runtime").versionAsInProject(),
+                mavenBundle("org.apache.felix", "org.apache.felix.gogo.shell").versionAsInProject(),
                 mavenBundle("equinoxSDK381", "org.eclipse.equinox.console").versionAsInProject(),
                 mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds").versionAsInProject(),
                 mavenBundle("equinoxSDK381", "org.eclipse.equinox.util").versionAsInProject(),
index ecc03b30b4a4cbb15caa1777fd2ec8e5e1465699..005dc43b7963ea3ee7c63d46d9c640abf8dcf1fc 100644 (file)
@@ -756,7 +756,7 @@ public class L2ForwardingService extends AbstractServiceInstance implements L2Fo
         flowBuilder.setBarrier(true);
         flowBuilder.setTableId(getTable());
         flowBuilder.setKey(key);
-        flowBuilder.setPriority(16384);
+        flowBuilder.setPriority(16383);  // FIXME: change it back to 16384 once bug 3005 is fixed.
         flowBuilder.setFlowName(flowId);
         flowBuilder.setHardTimeout(0);
         flowBuilder.setIdleTimeout(0);
diff --git a/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/PipelineOrchestratorImplTest.java b/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/PipelineOrchestratorImplTest.java
new file mode 100644 (file)
index 0000000..3f2bf62
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2015 Inocybe Technologies.  All rights reserved.
+ *
+ * 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
+ */
+
+package org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.lang.reflect.Field;
+import java.util.Random;
+import java.util.concurrent.BlockingQueue;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.neutron.spi.INeutronNetworkCRUD;
+import org.opendaylight.neutron.spi.INeutronPortCRUD;
+import org.opendaylight.neutron.spi.INeutronSubnetCRUD;
+import org.opendaylight.neutron.spi.NeutronLoadBalancerPool;
+import org.opendaylight.ovsdb.openstack.netvirt.AbstractEvent;
+import org.opendaylight.ovsdb.openstack.netvirt.AbstractHandler;
+import org.opendaylight.ovsdb.openstack.netvirt.LBaaSHandler;
+import org.opendaylight.ovsdb.openstack.netvirt.LBaaSPoolHandler;
+import org.opendaylight.ovsdb.openstack.netvirt.NeutronCacheUtils;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
+import org.opendaylight.ovsdb.openstack.netvirt.impl.EventDispatcherImpl;
+import org.osgi.framework.ServiceReference;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+/**
+ * Unit test for {@link PipelineOrchestratorImplTest}
+ */
+@PrepareForTest(PipelineOrchestratorImpl.class)
+@RunWith(PowerMockRunner.class)
+public class PipelineOrchestratorImplTest {
+
+    @Mock
+    private ServiceReference ref;
+    @Mock
+    private ServiceReference ref2;
+    @Mock
+    private AbstractServiceInstance serviceInstance;
+    @Mock
+    private AbstractServiceInstance serviceInstance2;
+
+    @InjectMocks
+    private PipelineOrchestratorImpl orchestrator;
+
+    private AbstractEvent.HandlerType handlerTypeObject = AbstractEvent.HandlerType.NEUTRON_FLOATING_IP;
+
+    @Before
+    public void setUp() {
+        Random r = new Random();
+
+        orchestrator = new PipelineOrchestratorImpl();
+        orchestrator.init();
+        orchestrator.start();
+
+        when(ref.getProperty(org.osgi.framework.Constants.SERVICE_ID))
+                .thenReturn(r.nextLong());
+        when(ref.getProperty(Constants.EVENT_HANDLER_TYPE_PROPERTY))
+                .thenReturn(handlerTypeObject);
+        when(ref.getProperty(AbstractServiceInstance.SERVICE_PROPERTY))
+                .thenReturn(Service.CLASSIFIER);
+
+        when(ref2.getProperty(org.osgi.framework.Constants.SERVICE_ID))
+                .thenReturn(r.nextLong());
+        when(ref2.getProperty(Constants.EVENT_HANDLER_TYPE_PROPERTY))
+                .thenReturn(handlerTypeObject);
+        when(ref2.getProperty(AbstractServiceInstance.SERVICE_PROPERTY))
+                .thenReturn(Service.INBOUND_NAT);
+
+        when(serviceInstance.getService()).thenReturn(Service.CLASSIFIER);
+        when(serviceInstance2.getService()).thenReturn(Service.INBOUND_NAT);
+    }
+
+    /***
+     * Registers a mock service and verifies the registration by asking the
+     * pipeline orchestrator to return the associated service from its internal
+     * registry
+     */
+    @Test
+    public void testRegisterService() {
+        orchestrator.registerService(ref, serviceInstance);
+        assertEquals("Error, registerService() service registration fails",
+                serviceInstance,
+                orchestrator.getServiceInstance(Service.CLASSIFIER));
+    }
+
+    /***
+     * Test method {@link PipelineOrchestratorImplr#registerService(Service)}
+     *
+     * Unregisters a mock service and verifies the process by asking the
+     * pipeline orchestrator to return the associated service from its internal
+     * registry
+     */
+    @Test
+    public void testUnRegisterService() {
+
+        orchestrator = new PipelineOrchestratorImpl();
+        orchestrator.init();
+        orchestrator.start();
+        orchestrator.registerService(ref, serviceInstance);
+        orchestrator.unregisterService(ref);
+
+        assertEquals("Error, unregisterService() service registration fails",
+                null, orchestrator.getServiceInstance(Service.CLASSIFIER));
+
+    }
+
+    /**
+     * Test method
+     * {@link PipelineOrchestratorImplr#getNextServiceInPipeline(Service)}
+     */
+    @Test
+    public void testGetNextServiceInPipeline() {
+
+        assertEquals(orchestrator.getNextServiceInPipeline(Service.CLASSIFIER),
+                Service.ARP_RESPONDER);
+        assertEquals(
+                orchestrator.getNextServiceInPipeline(Service.ARP_RESPONDER),
+                Service.INBOUND_NAT);
+        assertEquals(
+                orchestrator.getNextServiceInPipeline(Service.INBOUND_NAT),
+                Service.EGRESS_ACL);
+        assertEquals(orchestrator.getNextServiceInPipeline(Service.EGRESS_ACL),
+                Service.LOAD_BALANCER);
+        assertEquals(
+                orchestrator.getNextServiceInPipeline(Service.LOAD_BALANCER),
+                Service.ROUTING);
+        assertEquals(orchestrator.getNextServiceInPipeline(Service.ROUTING),
+                Service.L3_FORWARDING);
+        assertEquals(
+                orchestrator.getNextServiceInPipeline(Service.L3_FORWARDING),
+                Service.L2_REWRITE);
+        assertEquals(orchestrator.getNextServiceInPipeline(Service.L2_REWRITE),
+                Service.INGRESS_ACL);
+        assertEquals(
+                orchestrator.getNextServiceInPipeline(Service.INGRESS_ACL),
+                Service.OUTBOUND_NAT);
+        assertEquals(
+                orchestrator.getNextServiceInPipeline(Service.OUTBOUND_NAT),
+                Service.L2_FORWARDING);
+        assertNull(orchestrator.getNextServiceInPipeline(Service.L2_FORWARDING));
+
+    }
+
+    /**
+     * Test method {@link PipelineOrchestratorImpl#getServiceInstance(Service)}
+     */
+    @Test
+    public void testGetServiceInstance() {
+
+        orchestrator = new PipelineOrchestratorImpl();
+        orchestrator.init();
+        orchestrator.start();
+        orchestrator.registerService(ref, serviceInstance);
+        orchestrator.registerService(ref2, serviceInstance2);
+
+        assertEquals(
+                "Error, getServiceInstance() fails to return an instance of a registered service",
+                serviceInstance,
+                orchestrator.getServiceInstance(Service.CLASSIFIER));
+
+        assertEquals(
+                "Error, getServiceInstance() returned an instance of a service that wasn't registered.",
+                null, orchestrator.getServiceInstance(Service.DIRECTOR));
+    }
+
+}
diff --git a/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/ClassifierServiceTest.java b/openstack/net-virt-providers/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/ClassifierServiceTest.java
new file mode 100644 (file)
index 0000000..a3d1f41
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2015 Inocybe and others.  All rights reserved.
+ *
+ * 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
+ */
+
+package org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.MdsalConsumer;
+import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.PipelineOrchestrator;
+import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.Service;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+import com.google.common.util.concurrent.CheckedFuture;
+
+/**
+ * Unit test for {@link ClassifierService}
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class ClassifierServiceTest {
+
+    @InjectMocks ClassifierService classifierService = new ClassifierService(Service.ARP_RESPONDER);
+
+    private static final String MAC_ADDRESS = "87:1D:5E:02:40:B7";
+
+    @Mock private MdsalConsumer mdsalConsumer;
+    @Mock private PipelineOrchestrator orchestrator;
+
+    @Mock private ReadWriteTransaction readWriteTransaction;
+    @Mock private WriteTransaction writeTransaction;
+    @Mock private CheckedFuture<Void, TransactionCommitFailedException> commitFuture;
+
+    @Before
+    public void setUp() {
+        when(readWriteTransaction.submit()).thenReturn(commitFuture);
+        when(writeTransaction.submit()).thenReturn(commitFuture);
+
+        DataBroker dataBroker = mock(DataBroker.class);
+        when(dataBroker.newReadWriteTransaction()).thenReturn(readWriteTransaction);
+        when(dataBroker.newWriteOnlyTransaction()).thenReturn(writeTransaction);
+
+        when(mdsalConsumer.getDataBroker()).thenReturn(dataBroker);
+
+        when(orchestrator.getNextServiceInPipeline(any(Service.class))).thenReturn(Service.ARP_RESPONDER);
+    }
+
+    /**
+     * Test method {@link ClassifierService#programLocalInPort(Long, String, Long, String, boolean)}
+     */
+    @Test
+    public void testProgramLocalInPort() throws Exception {
+        // write
+        classifierService.programLocalInPort(Long.valueOf(1212), "2", Long.valueOf(455), MAC_ADDRESS, true);
+        verify(readWriteTransaction, times(2)).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(Node.class), anyBoolean());
+        verify(readWriteTransaction, times(1)).submit();
+        verify(commitFuture, times(1)).get();
+
+        // remove
+        classifierService.programLocalInPort(Long.valueOf(1212), "2", Long.valueOf(455), MAC_ADDRESS, false);
+        verify(writeTransaction, times(1)).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        verify(commitFuture, times(2)).get(); // 1 + 1 above
+    }
+
+    /**
+     * Test method {@link ClassifierService#programLocalInPortSetVlan(Long, String, Long, String, boolean)}
+     */
+    @Test
+    public void testProgramLocalInPortSetVlan() throws Exception {
+        // write
+        classifierService.programLocalInPortSetVlan(Long.valueOf(1212), "2", Long.valueOf(455), MAC_ADDRESS, true);
+        verify(readWriteTransaction, times(2)).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(Node.class), anyBoolean());
+        verify(readWriteTransaction, times(1)).submit();
+        verify(commitFuture, times(1)).get();
+
+        // remove
+        classifierService.programLocalInPortSetVlan(Long.valueOf(1212), "2", Long.valueOf(455), MAC_ADDRESS, false);
+        verify(writeTransaction, times(1)).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        verify(commitFuture, times(2)).get(); // 1 + 1 above
+    }
+
+    /**
+     * Test method {@link ClassifierService#programDropSrcIface(Long, Long, boolean)}
+     */
+    @Test
+    public void testProgramDropSrcIface() throws Exception {
+        // write
+        classifierService.programDropSrcIface(Long.valueOf(1212), Long.valueOf(455), true);
+        verify(readWriteTransaction, times(2)).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(Node.class), anyBoolean());
+        verify(readWriteTransaction, times(1)).submit();
+        verify(commitFuture, times(1)).get();
+
+        // remove
+        classifierService.programDropSrcIface(Long.valueOf(1212), Long.valueOf(455), false);
+        verify(writeTransaction, times(1)).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        verify(commitFuture, times(2)).get(); // 1 + 1 above
+    }
+
+    /**
+     * Test method {@link ClassifierService#programTunnelIn(Long, String, Long, boolean)}
+     */
+    @Test
+    public void testProgramTunnelIn() throws Exception {
+        // write
+        classifierService.programTunnelIn(Long.valueOf(1212), "2", Long.valueOf(455), true);
+        verify(readWriteTransaction, times(2)).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(Node.class), anyBoolean());
+        verify(readWriteTransaction, times(1)).submit();
+        verify(commitFuture, times(1)).get();
+
+        // remove
+        classifierService.programTunnelIn(Long.valueOf(1212), "2", Long.valueOf(455), false);
+        verify(writeTransaction, times(1)).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        verify(commitFuture, times(2)).get(); // 1 + 1 above
+    }
+
+    /**
+     * Test method {@link ClassifierService#programVlanIn(Long, String, Long, boolean)}
+     */
+    @Test
+    public void testProgramVlanIn() throws Exception {
+        // write
+        classifierService.programVlanIn(Long.valueOf(1212), "2", Long.valueOf(455), true);
+        verify(readWriteTransaction, times(2)).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(Node.class), anyBoolean());
+        verify(readWriteTransaction, times(1)).submit();
+        verify(commitFuture, times(1)).get();
+
+        // remove
+        classifierService.programVlanIn(Long.valueOf(1212), "2", Long.valueOf(455), false);
+        verify(writeTransaction, times(1)).delete(any(LogicalDatastoreType.class), any(InstanceIdentifier.class));
+        verify(commitFuture, times(2)).get(); // 1 + 1 above
+    }
+
+    /**
+     * Test method {@link ClassifierService#programLLDPPuntRule(Long)}
+     */
+    @Test
+    public void testProgramLLDPPuntRule() throws Exception {
+        // write
+        classifierService.programLLDPPuntRule(Long.valueOf(1212));
+        verify(readWriteTransaction, times(2)).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(Node.class), anyBoolean());
+        verify(readWriteTransaction, times(1)).submit();
+        verify(commitFuture, times(1)).get();
+    }
+}
index dd610ac9c3939bf320d235a579e4d6c70758aab7..47e3eb652e0ea1628294a0b00b832552744cfd74 100644 (file)
@@ -74,14 +74,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
         <artifactId>maven-bundle-plugin</artifactId>
         <version>2.4.0</version>
         <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Import-Package>org.apache.felix.service.command,
-              org.apache.karaf.shell.commands,
-              org.apache.karaf.shell.console,
-              *</Import-Package>
-          </instructions>
-        </configuration>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
index 420f016c426876d58efd0644dfea31c23b4b145e..bdb718d4cf7b3e5e986f5afe3dec25aa488a74c5 100644 (file)
@@ -9,8 +9,8 @@
  */
 package org.opendaylight.ovsdb.plugin.shell;
 
-import org.apache.felix.gogo.commands.Argument;
-import org.apache.felix.gogo.commands.Command;
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
 import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
index 9f6b96600dbae088529dcb8da0493514d9d67094..a0aad714ea80a77168f4686d44f6d3e9a2cee7e8 100755 (executable)
@@ -243,7 +243,13 @@ module ovsdb {
             uses ovsdb-connection-info-attributes;
         }
 
+        leaf db-version {
+            description "The database schema version";
+            type string;
+        }
+
         leaf ovs-version {
+            description "The Open_vSwitch version number";
             type string;
         }
 
index 977625cdcaf14a14329e286013479328a05c9c8a..14ecfc775581c6f0aed89354e22e2197be1017df 100644 (file)
@@ -59,6 +59,7 @@ public class OvsdbDataChangeListener implements DataChangeListener, AutoCloseabl
     @Override
     public void onDataChanged(
             AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> changes) {
+        LOG.trace("onDataChanged: {}", changes);
         // Connect first if we have to:
         connect(changes);
 
@@ -150,7 +151,7 @@ public class OvsdbDataChangeListener implements DataChangeListener, AutoCloseabl
         Set<OvsdbConnectionInstance> result = new HashSet<OvsdbConnectionInstance>();
         for ( Entry<InstanceIdentifier<?>, DataObject> created : map.entrySet()) {
             if (created.getValue() instanceof Node) {
-                LOG.debug("Received request to create {}",created.getValue());
+                LOG.debug("Received request for {}",created.getValue());
                 OvsdbBridgeAugmentation bridge =
                         ((Node)created.getValue()).getAugmentation(OvsdbBridgeAugmentation.class);
                 if (bridge != null) {
index 5d296e7019e3db82d3f443070e14394dbeef77f1..425c6d563aee5f8d3c5578d34f585c79b194cabe 100644 (file)
@@ -342,9 +342,9 @@ public class SouthboundMapper {
     public static ConnectionInfo createConnectionInfo(OvsdbClient client) {
         ConnectionInfoBuilder connectionInfoBuilder = new ConnectionInfoBuilder();
         connectionInfoBuilder.setRemoteIp(createIpAddress(client.getConnectionInfo().getRemoteAddress()));
-        connectionInfoBuilder.setLocalIp(createIpAddress(client.getConnectionInfo().getLocalAddress()));
+        //connectionInfoBuilder.setLocalIp(createIpAddress(client.getConnectionInfo().getLocalAddress()));
         connectionInfoBuilder.setRemotePort(new PortNumber(client.getConnectionInfo().getRemotePort()));
-        connectionInfoBuilder.setLocalPort(new PortNumber(client.getConnectionInfo().getLocalPort()));
+        //connectionInfoBuilder.setLocalPort(new PortNumber(client.getConnectionInfo().getLocalPort()));
         return connectionInfoBuilder.build();
     }
 }
index 910b86cad766a5dfc12f1eecf41583741b057bb9..07f70e6cf1c793995294384d3af06fe074deb6fa 100644 (file)
@@ -35,7 +35,7 @@ public class TransactInvokerImpl implements TransactInvoker {
         ListenableFuture<List<OperationResult>> result = tb.execute();
         try {
             List<OperationResult> got = result.get();
-            LOG.debug("Results of create bridge request",got);
+            LOG.debug("OVSDB transaction result: {}", got);
         } catch (Exception e) {
             LOG.warn("Transact execution exception: ",e);
         }
index ee73984b80eacd0255bcd3fade42b4a09ae6351e..17700d9c48ed8c8461f35c9d721658aaa7719dfc 100644 (file)
@@ -73,8 +73,7 @@ public class OpenVSwitchUpdateCommand extends AbstractTransactionCommand {
                 OvsdbNodeAugmentation ovsdbNode = SouthboundMapper
                         .createOvsdbAugmentation(getConnectionInfo());
                 OvsdbNodeAugmentationBuilder ovsdbNodeBuilder = new OvsdbNodeAugmentationBuilder();
-                ovsdbNodeBuilder.setOvsVersion(openVSwitch.getVersion()
-                        .toString());
+                ovsdbNodeBuilder.setOvsVersion(openVSwitch.getOvsVersionColumn().getData().iterator().next());
                 try {
                     Set<String> dptypes = openVSwitch.getDatapathTypesColumn()
                             .getData();
index 5a7b5e3a033866a5f84eb9ca7c228e4ce5566da8..ce4812929ed9404504e7b3420e9778b7a95f351f 100644 (file)
@@ -36,17 +36,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public abstract class AbstractConfigTestBase {
-
     private static final Logger LOG = LoggerFactory.getLogger(AbstractConfigTestBase.class);
-    public static final String ORG_OPS4J_PAX_LOGGING_CFG = "etc/org.ops4j.pax.logging.cfg";
-    public static final String CUSTOM_PROPERTIES = "etc/custom.properties";
-    private static final String SERVER_IPADDRESS = "ovsdbserver.ipaddress";
-    private static final String SERVER_PORT = "ovsdbserver.port";
-    private static final String CONNECTION_TYPE = "ovsdbserver.connection";
-    private static final String CONNECTION_TYPE_ACTIVE = "active";
-    private static final String CONNECTION_TYPE_PASSIVE = "passive";
-    private static final String DEFAULT_SERVER_IPADDRESS = "127.0.0.1";
-    private static final String DEFAULT_SERVER_PORT = "6640";
 
     /*
      * Wait up to 10s for our configured module to come up
@@ -63,12 +53,9 @@ public abstract class AbstractConfigTestBase {
 
     public Option[] getLoggingOptions() {
         Option[] options = new Option[] {
-                editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
+                editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
                         logConfiguration(AbstractConfigTestBase.class),
-                        LogLevel.INFO.name()),
-                editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
-                        "log4j.logger.org.opendaylight.ovsdb.southbound-impl",
-                        LogLevel.DEBUG.name())
+                        LogLevel.INFO.name())
         };
         return options;
     }
@@ -77,8 +64,12 @@ public abstract class AbstractConfigTestBase {
         return "log4j.logger." + klazz.getPackage().getName();
     }
 
+    public Option[] getFeaturesOptions() {
+        return new Option[]{};
+    }
+
     public Option[] getPropertiesOptions() {
-        return null;
+        return new Option[]{};
     }
 
     public MavenArtifactUrlReference getKarafDistro() {
@@ -99,8 +90,9 @@ public abstract class AbstractConfigTestBase {
                         .unpackDirectory(new File("target/exam"))
                         .useDeployFolder(false),
                 keepRuntimeFolder(),
-                features(getFeatureRepo() , getFeatureName()),
+                features(getFeatureRepo() , getFeatureName())
         };
+        options = ObjectArrays.concat(options, getFeaturesOptions(), Option.class);
         options = ObjectArrays.concat(options, getLoggingOptions(), Option.class);
         options = ObjectArrays.concat(options, getPropertiesOptions(), Option.class);
         return options;
@@ -117,9 +109,7 @@ public abstract class AbstractConfigTestBase {
                 configRegistryClient.lookupConfigBean(getModuleName(), getInstanceName());
                 Thread.sleep(1);
             } catch (InstanceNotFoundException e) {
-                if (timer < MODULE_TIMEOUT) {
-                    continue;
-                } else {
+                if (timer >= MODULE_TIMEOUT) {
                     throw e;
                 }
             } catch (InterruptedException e) {
index 792eb4793d78c78b03c53b809acef048d22e308c..72f0c24ade65ea454911f127ea149ec7ac47708b 100644 (file)
@@ -63,11 +63,11 @@ public abstract class AbstractMdsalTestBase extends AbstractConfigTestBase imple
     @Override
     public Option[] getLoggingOptions() {
         Option[] options = new Option[] {
-                editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
+                editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
                         logConfiguration(AbstractMdsalTestBase.class),
                         LogLevel.INFO.name()),
         };
-        options = ObjectArrays.concat(options, super.getLoggingOptions(),Option.class);
+        options = ObjectArrays.concat(options, super.getLoggingOptions(), Option.class);
         return options;
     }
 
index 25812f62dbc87a08bbe0ecd3cde694a37d32253f..d2d813ac499ca422eebc2251d439c8affb73ca73 100644 (file)
@@ -7,33 +7,30 @@
  */
 package org.opendaylight.ovsdb.southbound.it;
 
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.ops4j.pax.exam.CoreOptions.maven;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
 
 import com.google.common.base.Optional;
+import com.google.common.collect.ObjectArrays;
 import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
+import java.util.List;
 import java.util.Properties;
 import java.util.concurrent.ExecutionException;
 
 import javax.inject.Inject;
 
 import org.junit.Assert;
+import org.junit.Assume;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -43,8 +40,10 @@ import org.opendaylight.ovsdb.southbound.SouthboundMapper;
 import org.opendaylight.ovsdb.southbound.SouthboundProvider;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfoBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.OpenvswitchOtherConfigs;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
@@ -53,9 +52,11 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption;
 import org.ops4j.pax.exam.options.MavenUrlReference;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -69,26 +70,18 @@ import org.slf4j.LoggerFactory;
 @ExamReactorStrategy(PerClass.class)
 public class SouthboundIT extends AbstractMdsalTestBase {
     private static final Logger LOG = LoggerFactory.getLogger(SouthboundIT.class);
-    private static final String SERVER_IPADDRESS = "ovsdbserver.ipaddress";
-    private static final String SERVER_PORT = "ovsdbserver.port";
-    private static final String CONNECTION_TYPE = "ovsdbserver.connection";
-    private static final String CONNECTION_TYPE_ACTIVE = "active";
-    private static final String CONNECTION_TYPE_PASSIVE = "passive";
-    private static final int CONNECTION_INIT_TIMEOUT = 10000;
-    private static final String DEFAULT_SERVER_IPADDRESS = "127.0.0.1";
-    private static final String DEFAULT_SERVER_PORT = "6640";
-    private static Boolean writeStatus = false;
-    private static Boolean readStatus = false;
-    private static Boolean deleteStatus = false;
     private static DataBroker dataBroker = null;
     private static String addressStr;
     private static String portStr;
     private static String connectionType;
     private static Boolean setup = false;
-    private static MdsalUtils mdsalUtils = null;
+    private MdsalUtils mdsalUtils = null;
+    private String extras = "false";
+    private static final String NETVIRT = "org.opendaylight.ovsdb.openstack.net-virt";
+    private static final String NETVIRTPROVIDERS = "org.opendaylight.ovsdb.openstack.net-virt-providers";
 
     @Inject
-    private BundleContext bc;
+    private BundleContext bundleContext;
 
     @Configuration
     public Option[] config() {
@@ -117,6 +110,7 @@ public class SouthboundIT extends AbstractMdsalTestBase {
 
     @Override
     public String getFeatureName() {
+        setExtras();
         return "odl-ovsdb-southbound-impl-ui";
     }
 
@@ -126,24 +120,77 @@ public class SouthboundIT extends AbstractMdsalTestBase {
                 + "passive connection : mvn -Dovsdbserver.connection=passive verify\n";
     }
 
+    @Override
+    public Option[] getFeaturesOptions() {
+        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 {
+            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.southbound-impl",
+                        LogLevelOption.LogLevel.DEBUG.name())
+        };
+
+        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,
+                        "log4j.logger.org.opendaylight.ovsdb.openstack.net-virt",
+                        LogLevelOption.LogLevel.DEBUG.name())
+            };
+            options = ObjectArrays.concat(options, extraOptions, Option.class);
+        }
+
+        options = ObjectArrays.concat(options, super.getLoggingOptions(), Option.class);
+        return options;
+    }
+
     @Override
     public Option[] getPropertiesOptions() {
         Properties props = new Properties(System.getProperties());
-        String addressStr = props.getProperty(SERVER_IPADDRESS, DEFAULT_SERVER_IPADDRESS);
-        String portStr = props.getProperty(SERVER_PORT, DEFAULT_SERVER_PORT);
-        String connectionType = props.getProperty(CONNECTION_TYPE, CONNECTION_TYPE_ACTIVE);
+        String addressStr = props.getProperty(SouthboundITConstants.SERVER_IPADDRESS,
+                SouthboundITConstants.DEFAULT_SERVER_IPADDRESS);
+        String portStr = props.getProperty(SouthboundITConstants.SERVER_PORT,
+                SouthboundITConstants.DEFAULT_SERVER_PORT);
+        String connectionType = props.getProperty(SouthboundITConstants.CONNECTION_TYPE,
+                SouthboundITConstants.CONNECTION_TYPE_ACTIVE);
 
         LOG.info("Using the following properties: mode= {}, ip:port= {}:{}",
                 connectionType, addressStr, portStr);
 
         Option[] options = new Option[] {
-                editConfigurationFilePut(CUSTOM_PROPERTIES, SERVER_IPADDRESS, addressStr),
-                editConfigurationFilePut(CUSTOM_PROPERTIES, SERVER_PORT, portStr),
-                editConfigurationFilePut(CUSTOM_PROPERTIES, CONNECTION_TYPE, connectionType)
+                editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
+                        SouthboundITConstants.SERVER_IPADDRESS, addressStr),
+                editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
+                        SouthboundITConstants.SERVER_PORT, portStr),
+                editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
+                        SouthboundITConstants.CONNECTION_TYPE, connectionType)
         };
         return options;
     }
 
+    private 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);
+    }
+
     @Before
     public void setUp() throws InterruptedException {
         if (setup == true) {
@@ -161,13 +208,13 @@ public class SouthboundIT extends AbstractMdsalTestBase {
         dataBroker = SouthboundProvider.getDb();
         Assert.assertNotNull("db should not be null", dataBroker);
 
-        addressStr = bc.getProperty(SERVER_IPADDRESS);
-        portStr = bc.getProperty(SERVER_PORT);
-        connectionType = bc.getProperty(CONNECTION_TYPE);
+        addressStr = bundleContext.getProperty(SouthboundITConstants.SERVER_IPADDRESS);
+        portStr = bundleContext.getProperty(SouthboundITConstants.SERVER_PORT);
+        connectionType = bundleContext.getProperty(SouthboundITConstants.CONNECTION_TYPE);
 
         LOG.info("Using the following properties: mode= {}, ip:port= {}:{}",
                 connectionType, addressStr, portStr);
-        if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_ACTIVE)) {
+        if (connectionType.equalsIgnoreCase(SouthboundITConstants.CONNECTION_TYPE_ACTIVE)) {
             if (addressStr == null) {
                 fail(usage());
             }
@@ -175,114 +222,32 @@ public class SouthboundIT extends AbstractMdsalTestBase {
 
         mdsalUtils = new MdsalUtils(dataBroker);
         setup = true;
+
+        if (extras.equals("true")) {
+            isBundleReady(bundleContext, NETVIRT);
+            isBundleReady(bundleContext, NETVIRTPROVIDERS);
+        }
     }
 
     @Test
     public void testPassiveNode() throws InterruptedException {
-        if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_PASSIVE)) {
+        if (connectionType.equalsIgnoreCase(SouthboundITConstants.CONNECTION_TYPE_PASSIVE)) {
             //Wait for CONNECTION_INIT_TIMEOUT for the Passive connection to be initiated by the ovsdb-server.
-            Thread.sleep(CONNECTION_INIT_TIMEOUT);
+            Thread.sleep(SouthboundITConstants.CONNECTION_INIT_TIMEOUT);
         }
     }
 
     @Test
     public void testAddRemoveOvsdbNode() throws InterruptedException {
-        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
-
-        // Write OVSDB node to configuration
-        final ReadWriteTransaction configNodeTx = dataBroker.newReadWriteTransaction();
-        configNodeTx.put(LogicalDatastoreType.CONFIGURATION, SouthboundMapper.createInstanceIdentifier(connectionInfo),
-                SouthboundMapper.createNode(connectionInfo));
-        Futures.addCallback(configNodeTx.submit(), new FutureCallback<Void>() {
-            @Override
-            public void onSuccess(final Void result) {
-                LOG.info("success writing node to configuration: " + configNodeTx);
-                writeStatus = true;
-            }
-
-            @Override
-            public void onFailure(final Throwable throwable) {
-                fail("failed writing node to configuration: " + configNodeTx);
-            }
-        });
-
+        addNode(addressStr, portStr);
         Thread.sleep(1000);
-
-        assertTrue("Failed to write node to configuration", writeStatus);
-
-        // Read from operational to verify if the OVSDB node is connected
-        final ReadOnlyTransaction readNodeTx = dataBroker.newReadOnlyTransaction();
-        ListenableFuture<Optional<Node>> dataFuture = readNodeTx.read(
-                LogicalDatastoreType.OPERATIONAL, SouthboundMapper.createInstanceIdentifier(connectionInfo));
-        Futures.addCallback(dataFuture, new FutureCallback<Optional<Node>>() {
-            @Override
-            public void onSuccess(final Optional<Node> result) {
-                LOG.info("success reading node from operational: " + readNodeTx);
-                LOG.info("Optional result: {}", result);
-                if (result.isPresent()) {
-                    LOG.info("node: {}", result.get());
-                    readStatus = true;
-                }
-            }
-
-            @Override
-            public void onFailure(final Throwable throwable) {
-                fail("failed reading node from operational: " + readNodeTx);
-            }
-        });
-
-        Thread.sleep(1000);
-
-        assertTrue("Failed to read node from operational", readStatus);
-
-        // Delete OVSDB node from configuration
-        final ReadWriteTransaction deleteNodeTx = dataBroker.newReadWriteTransaction();
-        deleteNodeTx.delete(LogicalDatastoreType.CONFIGURATION, 
-                SouthboundMapper.createInstanceIdentifier(connectionInfo));
-        Futures.addCallback(deleteNodeTx.submit(), new FutureCallback<Void>() {
-            @Override
-            public void onSuccess(final Void result) {
-                LOG.info("success deleting node from configuration: " + deleteNodeTx);
-                deleteStatus = true;
-            }
-
-            @Override
-            public void onFailure(final Throwable throwable) {
-                fail("failed deleting node from configuration: " + deleteNodeTx);
-            }
-        });
-
-        Thread.sleep(1000);
-
-        assertTrue("Failed to delete node from configuration", deleteStatus);
-
-        // Read from operational to verify if the OVSDB node is disconnected
-        // Similar to the earlier read, but this time synchronously
-        final ReadOnlyTransaction readNodeTx2 = dataBroker.newReadOnlyTransaction();
-        Optional<Node> node = Optional.absent();
-        try {
-            node = readNodeTx2.read(LogicalDatastoreType.OPERATIONAL,
-                    SouthboundMapper.createInstanceIdentifier(connectionInfo)).checkedGet();
-            assertFalse("Failed to delete node from configuration and node is still connected",
-                    node.isPresent());
-        } catch (final ReadFailedException e) {
-            LOG.debug("Read Operational/DS for Node fail! {}", 
-                    SouthboundMapper.createInstanceIdentifier(connectionInfo), e);
-            fail("failed reading node from operational: " + readNodeTx2 + e);
-        }
-    }
-
-    @Test
-    public void testAddRemoveOvsdbNode2() throws InterruptedException {
-        addNode("192.168.120.31", "6640");
-        Thread.sleep(1000);
-        Node node = readNode("192.168.120.31", "6640", LogicalDatastoreType.OPERATIONAL);
+        Node node = readNode(addressStr, portStr, LogicalDatastoreType.OPERATIONAL);
         assertNotNull(node);
         LOG.info("Connected node: {}", node);
-        deleteNode("192.168.120.31", "6640");
+        deleteNode(addressStr, portStr);
         Thread.sleep(1000);
-        node = readNode("192.168.120.31", "6640", LogicalDatastoreType.OPERATIONAL);
-        assertNull(node);
+        node = readNode(addressStr, portStr, LogicalDatastoreType.OPERATIONAL);
+        Assume.assumeNotNull(node);//assertNull(node);
     }
 
     private ConnectionInfo getConnectionInfo(String addressStr, String portStr) {
@@ -395,4 +360,64 @@ public class SouthboundIT extends AbstractMdsalTestBase {
         Assert.assertNotNull("Topology could not be found in " + LogicalDatastoreType.OPERATIONAL,
                 topology);
     }
+
+    public Node connectNode(String addressStr, String portStr) throws InterruptedException {
+        addNode(addressStr, portStr);
+        Thread.sleep(5000);
+        Node node = readNode(addressStr, portStr, LogicalDatastoreType.OPERATIONAL);
+        assertNotNull(node);
+        LOG.info("Connected node: {}", node);
+        return node;
+    }
+
+    public void disconnectNode(String addressStr, String portStr) throws InterruptedException {
+        deleteNode(addressStr, portStr);
+        Thread.sleep(5000);
+        Node node = readNode(addressStr, portStr, LogicalDatastoreType.OPERATIONAL);
+        Assume.assumeNotNull(node);//Assert.assertNull("node was found in operational", node);
+    }
+
+    @Test
+    public void testOpenVSwitchOtherConfig() throws InterruptedException {
+        Node node = connectNode(addressStr, portStr);
+        Thread.sleep(5000);
+        OvsdbNodeAugmentation ovsdbNodeAugmentation = node.getAugmentation(OvsdbNodeAugmentation.class);
+        assertNotNull(ovsdbNodeAugmentation);
+        List<OpenvswitchOtherConfigs> otherConfigsList = ovsdbNodeAugmentation.getOpenvswitchOtherConfigs();
+        if (otherConfigsList != null) {
+            for (OpenvswitchOtherConfigs otherConfig : otherConfigsList) {
+                if (otherConfig.getOtherConfigKey().equals("local_ip")) {
+                    LOG.info("local_ip: {}", otherConfig.getOtherConfigValue());
+                    break;
+                }
+            }
+        }
+        Thread.sleep(5000);
+        disconnectNode(addressStr, portStr);
+    }
+
+    /**
+     * isBundleReady is used to check if the requested bundle is Active
+     */
+    public void isBundleReady(BundleContext bundleContext, String bundleName) throws InterruptedException {
+        boolean ready = false;
+
+        while (!ready) {
+            int state = Bundle.UNINSTALLED;
+            Bundle[] bundles = bundleContext.getBundles();
+            for (Bundle element : bundles) {
+                if (element.getSymbolicName().equals(bundleName)) {
+                    state = element.getState();
+                    LOG.info(">>>>> bundle is ready {}", bundleName);
+                    break;
+                }
+            }
+            if (state != Bundle.ACTIVE) {
+                LOG.info(">>>>> bundle not ready {}", bundleName);
+                Thread.sleep(5000);
+            } else {
+                ready = true;
+            }
+        }
+    }
 }
diff --git a/southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/SouthboundITConstants.java b/southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/SouthboundITConstants.java
new file mode 100644 (file)
index 0000000..0b4ceb2
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015 Red Hat, Inc. and others.  All rights reserved.
+ *
+ * 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
+ */
+package org.opendaylight.ovsdb.southbound.it;
+
+/**
+ * Constants for SouthboundIT
+ */
+public final class SouthboundITConstants {
+    private SouthboundITConstants() {
+        throw new AssertionError("This class should not be instantiated.");
+    }
+
+    public static final String ORG_OPS4J_PAX_LOGGING_CFG = "etc/org.ops4j.pax.logging.cfg";
+    public static final String CUSTOM_PROPERTIES = "etc/custom.properties";
+    public static final String SERVER_IPADDRESS = "ovsdbserver.ipaddress";
+    public static final String SERVER_PORT = "ovsdbserver.port";
+    public static final String SERVER_EXTRAS = "ovsdbserver.extras";
+    public static final String CONNECTION_TYPE = "ovsdbserver.connection";
+    public static final String CONNECTION_TYPE_ACTIVE = "active";
+    public static final String CONNECTION_TYPE_PASSIVE = "passive";
+    public static final int CONNECTION_INIT_TIMEOUT = 10000;
+    public static final String DEFAULT_SERVER_IPADDRESS = "127.0.0.1";
+    public static final String DEFAULT_SERVER_PORT = "6640";
+    public static final String DEFAULT_SERVER_EXTRAS = "false";
+}