<properties>
<mdsal.version>1.7.0-SNAPSHOT</mdsal.version>
<lldp.version>0.14.0-SNAPSHOT</lldp.version>
+ <infrautils.version>1.3.0-SNAPSHOT</infrautils.version>
</properties>
<dependencyManagement>
<classifier>features</classifier>
<type>xml</type>
</dependency>
-
+ <dependency>
+ <groupId>org.opendaylight.infrautils</groupId>
+ <artifactId>odl-infrautils-diagstatus</artifactId>
+ <version>${infrautils.version}</version>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </dependency>
<dependency>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>odl-openflowplugin-nsf-model</artifactId>
<artifactId>liblldp</artifactId>
<version>${lldp.version}</version>
</dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ </dependency>
<!-- config files -->
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-singleton-common-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.infrautils</groupId>
+ <artifactId>diagstatus-api</artifactId>
+ <version>${infrautils.version}</version>
+ </dependency>
</dependencies>
</project>
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.infrautils.diagstatus.DiagStatusService;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService;
EntityOwnershipService entityOwnershipService,
List<SwitchConnectionProvider> switchConnectionProviders,
ClusterSingletonServiceProvider singletonServiceProvider,
- MastershipChangeServiceManager mastershipChangeServiceManager);
+ MastershipChangeServiceManager mastershipChangeServiceManager,
+ DiagStatusService diagStatusService);
}
<reference id="notificationPublishService" interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"/>
<reference id="entityOwnershipService" interface="org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService"/>
<reference id="clusterSingletonServiceProvider" interface="org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider"/>
+ <reference id="diagStatusService" interface="org.opendaylight.infrautils.diagstatus.DiagStatusService" />
<reference id="defaultSwitchConnProvider" interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider"
odl:type="openflow-switch-connection-provider-default-impl"/>
</argument>
<argument ref="clusterSingletonServiceProvider"/>
<argument ref="mastershipChangeServiceManager"/>
+ <argument ref="diagStatusService"/>
</bean>
<service ref="openflowPluginProvider" odl:type="openflow-plugin-provider-impl">
<groupId>${project.groupId}.openflowjava</groupId>
<artifactId>openflow-protocol-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.infrautils</groupId>
+ <artifactId>diagstatus-api</artifactId>
+ <version>${infrautils.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.cdi</groupId>
+ <artifactId>pax-cdi-api</artifactId>
+ <optional>true</optional>
+ </dependency>
<dependency>
<groupId>${project.groupId}.openflowjava</groupId>
<artifactId>openflow-protocol-spi</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.infrautils.diagstatus.DiagStatusService;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider;
final EntityOwnershipService entityOwnershipService,
final List<SwitchConnectionProvider> switchConnectionProviders,
final ClusterSingletonServiceProvider singletonServiceProvider,
- final MastershipChangeServiceManager mastershipChangeServiceManager) {
+ final MastershipChangeServiceManager mastershipChangeServiceManager,
+ final DiagStatusService diagStatusService) {
LOG.info("Initializing new OFP southbound.");
final OpenFlowPluginProvider openflowPluginProvider = new OpenFlowPluginProviderImpl(
configurationService,
notificationPublishService,
singletonServiceProvider,
entityOwnershipService,
- mastershipChangeServiceManager);
+ mastershipChangeServiceManager,
+ diagStatusService);
openflowPluginProvider.initialize();
return openflowPluginProvider;
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.infrautils.diagstatus.DiagStatusService;
+import org.opendaylight.infrautils.diagstatus.ServiceState;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider;
import org.opendaylight.openflowplugin.impl.device.DeviceManagerImpl;
import org.opendaylight.openflowplugin.impl.device.initialization.DeviceInitializerProvider;
import org.opendaylight.openflowplugin.impl.device.initialization.DeviceInitializerProviderFactory;
+import org.opendaylight.openflowplugin.impl.diagstatus.OpenflowPluginDiagStatusProvider;
import org.opendaylight.openflowplugin.impl.lifecycle.ContextChainHolderImpl;
import org.opendaylight.openflowplugin.impl.protocol.deserialization.DeserializerInjector;
import org.opendaylight.openflowplugin.impl.protocol.serialization.SerializerInjector;
private ConnectionManager connectionManager;
private ListeningExecutorService executorService;
private ContextChainHolderImpl contextChainHolder;
+ private OpenflowPluginDiagStatusProvider openflowPluginStatusMonitor;
public static MessageIntelligenceAgency getMessageIntelligenceAgency() {
return MESSAGE_INTELLIGENCE_AGENCY;
final NotificationPublishService notificationPublishService,
final ClusterSingletonServiceProvider singletonServiceProvider,
final EntityOwnershipService entityOwnershipService,
- final MastershipChangeServiceManager mastershipChangeServiceManager) {
+ final MastershipChangeServiceManager mastershipChangeServiceManager,
+ final DiagStatusService diagStatusService) {
this.switchConnectionProviders = switchConnectionProviders;
this.dataBroker = dataBroker;
this.rpcProviderRegistry = rpcProviderRegistry;
deviceInitializerProvider = DeviceInitializerProviderFactory.createDefaultProvider();
config = new OpenFlowProviderConfigImpl(configurationService);
this.mastershipChangeServiceManager = mastershipChangeServiceManager;
+ openflowPluginStatusMonitor = new OpenflowPluginDiagStatusProvider(diagStatusService);
}
@Override
public void onSuccess(final List<Boolean> result) {
LOG.info("All switchConnectionProviders are up and running ({}).", result.size());
+ openflowPluginStatusMonitor.reportStatus(ServiceState.OPERATIONAL, "switch connections started");
}
@Override
public void onFailure(@Nonnull final Throwable throwable) {
LOG.warn("Some switchConnectionProviders failed to start.", throwable);
+ openflowPluginStatusMonitor.reportStatus(ServiceState.ERROR, "some switch connections failed to start");
}
});
}
gracefulShutdown(executorService);
gracefulShutdown(hashedWheelTimer);
unregisterMXBean(MESSAGE_INTELLIGENCE_AGENCY_MX_BEAN_NAME);
+ openflowPluginStatusMonitor.reportStatus(ServiceState.UNREGISTERED, "service shutting down");
}
@SuppressWarnings("checkstyle:IllegalCatch")
--- /dev/null
+/*
+ * Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. 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.openflowplugin.impl.diagstatus;
+
+import org.opendaylight.infrautils.diagstatus.DiagStatusService;
+import org.opendaylight.infrautils.diagstatus.ServiceDescriptor;
+import org.opendaylight.infrautils.diagstatus.ServiceState;
+import org.opendaylight.infrautils.diagstatus.ServiceStatusProvider;
+
+import org.ops4j.pax.cdi.api.OsgiServiceProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@OsgiServiceProvider(classes = ServiceStatusProvider.class)
+public class OpenflowPluginDiagStatusProvider implements ServiceStatusProvider {
+
+ private static final Logger LOG = LoggerFactory.getLogger(OpenflowPluginDiagStatusProvider.class);
+ private static final String OPENFLOW_SERVICE_NAME = "OPENFLOW";
+
+ private final DiagStatusService diagStatusService;
+ private volatile ServiceDescriptor serviceDescriptor;
+
+ public OpenflowPluginDiagStatusProvider(final DiagStatusService diagStatusService) {
+ this.diagStatusService = diagStatusService;
+ diagStatusService.register(OPENFLOW_SERVICE_NAME);
+ }
+
+ public void reportStatus(ServiceState serviceState, String description) {
+ LOG.debug("reporting status as {} for {}", serviceState, OPENFLOW_SERVICE_NAME);
+ serviceDescriptor = new ServiceDescriptor(OPENFLOW_SERVICE_NAME, serviceState, description);
+ diagStatusService.report(serviceDescriptor);
+ }
+
+ @Override
+ public ServiceDescriptor getServiceDescriptor() {
+ // TODO Check 6653/6633 port status to report dynamic status
+ return serviceDescriptor;
+ }
+}
\ No newline at end of file
odl:use-default-for-reference-types="true">
<odl:action-provider interface="org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService"/>
-
<bean id="ofPluginProviderFactory" class="org.opendaylight.openflowplugin.impl.OpenFlowPluginProviderFactoryImpl"/>
<service ref="ofPluginProviderFactory" interface="org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProviderFactory"/>
import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.infrautils.diagstatus.DiagStatusService;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider;
@Mock
NotificationPublishService notificationPublishService;
+ @Mock
+ DiagStatusService diagStatusService;
+
@Mock
WriteTransaction writeTransaction;
entityOwnershipService,
Lists.newArrayList(switchConnectionProvider),
clusterSingletonServiceProvider,
- mastershipChangeServiceManager);
+ mastershipChangeServiceManager,
+ diagStatusService);
verify(switchConnectionProvider).startup();
provider.close();
<yangtools.version>1.2.0</yangtools.version>
<argparse4j.version>0.7.0</argparse4j.version>
<exi.nagasena.version>0000.0002.0053.0</exi.nagasena.version>
+ <infrautils.version>1.3.0-SNAPSHOT</infrautils.version>
</properties>
<dependencyManagement>