JIRA: OVSDB-458
Change-Id: Ic51e0bf3144489b0dc0297191d01c16bdc0e26a5
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
<name>ODL :: ovsdb :: ${project.artifactId}</name>
<dependencies>
<name>ODL :: ovsdb :: ${project.artifactId}</name>
<dependencies>
+ <dependency>
+ <groupId>org.opendaylight.infrautils</groupId>
+ <artifactId>odl-infrautils-ready</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>odl-mdsal-broker</artifactId>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>odl-mdsal-broker</artifactId>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.infrautils</groupId>
+ <artifactId>ready-api</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </dependency>
<!-- external dependencies -->
<dependency>
<groupId>org.opendaylight.infrautils</groupId>
<!-- external dependencies -->
<dependency>
<groupId>org.opendaylight.infrautils</groupId>
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.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;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import org.opendaylight.mdsal.eos.binding.api.Entity;
public class SouthboundProvider implements ClusteredDataTreeChangeListener<Topology>, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(SouthboundProvider.class);
public class SouthboundProvider implements ClusteredDataTreeChangeListener<Topology>, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(SouthboundProvider.class);
private static final String ENTITY_TYPE = "ovsdb-southbound-provider";
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;
public static DataBroker getDb() {
return db;
private SouthboundPluginInstanceEntityOwnershipListener providerOwnershipChangeListener;
private final OvsdbConnection ovsdbConnection;
private final InstanceIdentifierCodec instanceIdentifierCodec;
private SouthboundPluginInstanceEntityOwnershipListener providerOwnershipChangeListener;
private final OvsdbConnection ovsdbConnection;
private final InstanceIdentifierCodec instanceIdentifierCodec;
- private static final String SKIP_MONITORING_MANAGER_STATUS_PARAM = "skip-monitoring-manager-status";
+ private final SystemReadyMonitor systemReadyMonitor;
+
private final AtomicBoolean registered = new AtomicBoolean(false);
private ListenerRegistration<SouthboundProvider> operTopologyRegistration;
private final OvsdbDiagStatusProvider ovsdbStatusProvider;
private final AtomicBoolean registered = new AtomicBoolean(false);
private ListenerRegistration<SouthboundProvider> operTopologyRegistration;
private final OvsdbDiagStatusProvider ovsdbStatusProvider;
final OvsdbConnection ovsdbConnection,
final DOMSchemaService schemaService,
final BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer,
final OvsdbConnection ovsdbConnection,
final DOMSchemaService schemaService,
final BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer,
+ final SystemReadyMonitor systemReadyMonitor,
final DiagStatusService diagStatusService) {
final DiagStatusService diagStatusService) {
this.db = dataBroker;
this.entityOwnershipService = entityOwnershipServiceDependency;
registration = null;
this.ovsdbConnection = ovsdbConnection;
this.db = dataBroker;
this.entityOwnershipService = entityOwnershipServiceDependency;
registration = null;
this.ovsdbConnection = ovsdbConnection;
- ovsdbStatusProvider = new OvsdbDiagStatusProvider(diagStatusService);
-
+ this.ovsdbStatusProvider = new OvsdbDiagStatusProvider(diagStatusService);
this.instanceIdentifierCodec = new InstanceIdentifierCodec(schemaService,
bindingNormalizedNodeSerializer);
this.instanceIdentifierCodec = new InstanceIdentifierCodec(schemaService,
bindingNormalizedNodeSerializer);
+ this.systemReadyMonitor = systemReadyMonitor;
LOG.info("SouthboundProvider ovsdbConnectionService Initialized");
}
LOG.info("SouthboundProvider ovsdbConnectionService Initialized");
}
if (!registered.getAndSet(true)) {
LOG.info("Starting the ovsdb port");
ovsdbConnection.registerConnectionListener(cm);
if (!registered.getAndSet(true)) {
LOG.info("Starting the ovsdb port");
ovsdbConnection.registerConnectionListener(cm);
- ovsdbConnection.startOvsdbManager();
+ LOG.info("Registering deferred system ready listener to start OVSDB Manager later");
+ systemReadyMonitor.registerListener(() -> {
+ 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) {
//mdsal registration/deregistration in mdsal update callback should be avoided
new Thread(() -> {
if (operTopologyRegistration != null) {
interface="org.opendaylight.mdsal.dom.api.DOMSchemaService" />
<reference id="bindingNormalizedNodeSerializer"
interface="org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer" />
interface="org.opendaylight.mdsal.dom.api.DOMSchemaService" />
<reference id="bindingNormalizedNodeSerializer"
interface="org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer" />
+ <reference id="systemReadyMonitor"
+ interface="org.opendaylight.infrautils.ready.SystemReadyMonitor" />
<reference id="diagStatusService" interface="org.opendaylight.infrautils.diagstatus.DiagStatusService" />
<cm:property-placeholder persistent-id="org.opendaylight.ovsdb.southbound" update-strategy="none">
<reference id="diagStatusService" interface="org.opendaylight.infrautils.diagstatus.DiagStatusService" />
<cm:property-placeholder persistent-id="org.opendaylight.ovsdb.southbound" update-strategy="none">
<argument ref="ovsdbConnection" />
<argument ref="schemaService" />
<argument ref="bindingNormalizedNodeSerializer" />
<argument ref="ovsdbConnection" />
<argument ref="schemaService" />
<argument ref="bindingNormalizedNodeSerializer" />
+ <argument ref="systemReadyMonitor" />
<argument ref="diagStatusService"/>
<property name="skipMonitoringManagerStatus" value="${skip-monitoring-manager-status}"/>
</bean>
<argument ref="diagStatusService"/>
<property name="skipMonitoringManagerStatus" value="${skip-monitoring-manager-status}"/>
</bean>
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.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;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import org.opendaylight.mdsal.eos.binding.api.Entity;
Mockito.mock(OvsdbConnection.class),
Mockito.mock(DOMSchemaService.class),
Mockito.mock(BindingNormalizedNodeSerializer.class),
Mockito.mock(OvsdbConnection.class),
Mockito.mock(DOMSchemaService.class),
Mockito.mock(BindingNormalizedNodeSerializer.class),
+ new ImmediateSystemReadyMonitor(),
Mockito.mock(DiagStatusService.class))) {
// Initiate the session
Mockito.mock(DiagStatusService.class))) {
// Initiate the session
Mockito.mock(OvsdbConnection.class),
Mockito.mock(DOMSchemaService.class),
Mockito.mock(BindingNormalizedNodeSerializer.class),
Mockito.mock(OvsdbConnection.class),
Mockito.mock(DOMSchemaService.class),
Mockito.mock(BindingNormalizedNodeSerializer.class),
+ new ImmediateSystemReadyMonitor(),
Mockito.mock(DiagStatusService.class))) {
// Initiate the session
Mockito.mock(DiagStatusService.class))) {
// Initiate the session
Mockito.mock(OvsdbConnection.class),
Mockito.mock(DOMSchemaService.class),
Mockito.mock(BindingNormalizedNodeSerializer.class),
Mockito.mock(OvsdbConnection.class),
Mockito.mock(DOMSchemaService.class),
Mockito.mock(BindingNormalizedNodeSerializer.class),
+ new ImmediateSystemReadyMonitor(),
Mockito.mock(DiagStatusService.class))) {
southboundProvider.init();
Mockito.mock(DiagStatusService.class))) {
southboundProvider.init();
Mockito.mock(OvsdbConnection.class),
Mockito.mock(DOMSchemaService.class),
Mockito.mock(BindingNormalizedNodeSerializer.class),
Mockito.mock(OvsdbConnection.class),
Mockito.mock(DOMSchemaService.class),
Mockito.mock(BindingNormalizedNodeSerializer.class),
+ new ImmediateSystemReadyMonitor(),
Mockito.mock(DiagStatusService.class))) {
southboundProvider.init();
Mockito.mock(DiagStatusService.class))) {
southboundProvider.init();
topologyIid).checkedGet().isPresent());
}
}
topologyIid).checkedGet().isPresent());
}
}
+
+ private static class ImmediateSystemReadyMonitor implements SystemReadyMonitor {
+
+ @Override
+ public SystemState getSystemState() {
+ return SystemState.ACTIVE;
+ }
+
+ @Override
+ public void registerListener(SystemReadyListener listener) {
+ listener.onSystemBootReady();
+ }
+
+ }