From: Michael Vorburger Date: Thu, 7 Jun 2018 16:13:01 +0000 (+0200) Subject: defer OVSDB port 6640 opening until system is ready X-Git-Tag: release/fluorine~28 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=ba2690440109f818ca3a314c185e27702659e32a;p=ovsdb.git defer OVSDB port 6640 opening until system is ready JIRA: OVSDB-458 Change-Id: Ic51e0bf3144489b0dc0297191d01c16bdc0e26a5 Signed-off-by: Michael Vorburger --- diff --git a/southbound/southbound-features/odl-ovsdb-southbound-impl/pom.xml b/southbound/southbound-features/odl-ovsdb-southbound-impl/pom.xml index ff9721926..a22a1dc95 100644 --- a/southbound/southbound-features/odl-ovsdb-southbound-impl/pom.xml +++ b/southbound/southbound-features/odl-ovsdb-southbound-impl/pom.xml @@ -26,6 +26,13 @@ and is available at http://www.eclipse.org/legal/epl-v10.html ODL :: ovsdb :: ${project.artifactId} + + org.opendaylight.infrautils + odl-infrautils-ready + 1.4.0-SNAPSHOT + xml + features + org.opendaylight.controller odl-mdsal-broker diff --git a/southbound/southbound-impl/pom.xml b/southbound/southbound-impl/pom.xml index 7cb0fa112..3b0073bc5 100644 --- a/southbound/southbound-impl/pom.xml +++ b/southbound/southbound-impl/pom.xml @@ -65,6 +65,11 @@ and is available at http://www.eclipse.org/legal/epl-v10.html com.google.guava guava + + org.opendaylight.infrautils + ready-api + 1.4.0-SNAPSHOT + org.opendaylight.infrautils diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java index 990a0df76..0365316c4 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java @@ -23,6 +23,7 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; import org.opendaylight.infrautils.diagstatus.DiagStatusService; import org.opendaylight.infrautils.diagstatus.ServiceState; +import org.opendaylight.infrautils.ready.SystemReadyMonitor; import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.mdsal.dom.api.DOMSchemaService; import org.opendaylight.mdsal.eos.binding.api.Entity; @@ -47,7 +48,9 @@ import org.slf4j.LoggerFactory; public class SouthboundProvider implements ClusteredDataTreeChangeListener, AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(SouthboundProvider.class); + private static final String ENTITY_TYPE = "ovsdb-southbound-provider"; + private static final String SKIP_MONITORING_MANAGER_STATUS_PARAM = "skip-monitoring-manager-status"; public static DataBroker getDb() { return db; @@ -64,7 +67,8 @@ public class SouthboundProvider implements ClusteredDataTreeChangeListener operTopologyRegistration; private final OvsdbDiagStatusProvider ovsdbStatusProvider; @@ -74,16 +78,16 @@ public class SouthboundProvider implements ClusteredDataTreeChangeListener { + ovsdbConnection.startOvsdbManager(); + LOG.info("Started OVSDB Manager (in system ready listener)"); + }); //mdsal registration/deregistration in mdsal update callback should be avoided new Thread(() -> { if (operTopologyRegistration != null) { diff --git a/southbound/southbound-impl/src/main/resources/org/opendaylight/blueprint/southbound.xml b/southbound/southbound-impl/src/main/resources/org/opendaylight/blueprint/southbound.xml index 987c6b5f4..9402c7249 100644 --- a/southbound/southbound-impl/src/main/resources/org/opendaylight/blueprint/southbound.xml +++ b/southbound/southbound-impl/src/main/resources/org/opendaylight/blueprint/southbound.xml @@ -14,6 +14,8 @@ interface="org.opendaylight.mdsal.dom.api.DOMSchemaService" /> + @@ -33,6 +35,7 @@ + diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundProviderTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundProviderTest.java index 254e559d1..3551b5e31 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundProviderTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundProviderTest.java @@ -26,6 +26,9 @@ import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTest; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; import org.opendaylight.infrautils.diagstatus.DiagStatusService; +import org.opendaylight.infrautils.ready.SystemReadyListener; +import org.opendaylight.infrautils.ready.SystemReadyMonitor; +import org.opendaylight.infrautils.ready.SystemState; import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.mdsal.dom.api.DOMSchemaService; import org.opendaylight.mdsal.eos.binding.api.Entity; @@ -69,6 +72,7 @@ public class SouthboundProviderTest extends AbstractDataBrokerTest { Mockito.mock(OvsdbConnection.class), Mockito.mock(DOMSchemaService.class), Mockito.mock(BindingNormalizedNodeSerializer.class), + new ImmediateSystemReadyMonitor(), Mockito.mock(DiagStatusService.class))) { // Initiate the session @@ -95,6 +99,7 @@ public class SouthboundProviderTest extends AbstractDataBrokerTest { Mockito.mock(OvsdbConnection.class), Mockito.mock(DOMSchemaService.class), Mockito.mock(BindingNormalizedNodeSerializer.class), + new ImmediateSystemReadyMonitor(), Mockito.mock(DiagStatusService.class))) { // Initiate the session @@ -123,6 +128,7 @@ public class SouthboundProviderTest extends AbstractDataBrokerTest { Mockito.mock(OvsdbConnection.class), Mockito.mock(DOMSchemaService.class), Mockito.mock(BindingNormalizedNodeSerializer.class), + new ImmediateSystemReadyMonitor(), Mockito.mock(DiagStatusService.class))) { southboundProvider.init(); @@ -146,6 +152,7 @@ public class SouthboundProviderTest extends AbstractDataBrokerTest { Mockito.mock(OvsdbConnection.class), Mockito.mock(DOMSchemaService.class), Mockito.mock(BindingNormalizedNodeSerializer.class), + new ImmediateSystemReadyMonitor(), Mockito.mock(DiagStatusService.class))) { southboundProvider.init(); @@ -177,4 +184,18 @@ public class SouthboundProviderTest extends AbstractDataBrokerTest { topologyIid).checkedGet().isPresent()); } } + + private static class ImmediateSystemReadyMonitor implements SystemReadyMonitor { + + @Override + public SystemState getSystemState() { + return SystemState.ACTIVE; + } + + @Override + public void registerListener(SystemReadyListener listener) { + listener.onSystemBootReady(); + } + + } }