Merge "Log the address and port when binding fails"
authorAnil Vishnoi <vishnoianil@gmail.com>
Thu, 10 Jan 2019 17:17:51 +0000 (17:17 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 10 Jan 2019 17:17:51 +0000 (17:17 +0000)
117 files changed:
applications/arbitratorreconciliation/impl/pom.xml
applications/device-ownership-service/pom.xml
applications/device-ownership-service/src/main/java/org/opendaylight/openflowplugin/applications/deviceownershipservice/impl/DeviceOwnershipServiceImpl.java
applications/device-ownership-service/src/main/resources/OSGI-INF/blueprint/device-ownership-state-service.xml [deleted file]
applications/forwardingrules-manager/pom.xml
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/ForwardingRulesManagerImpl.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FrmReconciliationServiceImpl.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/recovery/impl/OpenflowServiceRecoveryHandlerImpl.java
applications/forwardingrules-manager/src/main/resources/OSGI-INF/blueprint/forwardingrules-manager.xml
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyIncrementalImpl.java
applications/lldp-speaker/src/main/java/org/opendaylight/openflowplugin/applications/lldpspeaker/LLDPSpeaker.java
applications/lldp-speaker/src/main/java/org/opendaylight/openflowplugin/applications/lldpspeaker/LLDPUtil.java
applications/of-switch-config-pusher/pom.xml
applications/of-switch-config-pusher/src/main/java/org/opendaylight/openflowplugin/openflow/ofswitch/config/DefaultConfigPusher.java
applications/of-switch-config-pusher/src/main/resources/OSGI-INF/blueprint/of-switch-config-pusher.xml
applications/reconciliation-framework/pom.xml
applications/reconciliation-framework/src/main/java/org/opendaylight/openflowplugin/applications/reconciliation/impl/ReconciliationManagerImpl.java
applications/reconciliation-framework/src/main/resources/OSGI-INF/blueprint/commands.xml
applications/reconciliation-framework/src/main/resources/OSGI-INF/blueprint/reconciliation-framework.xml [deleted file]
applications/topology-lldp-discovery/pom.xml
applications/topology-lldp-discovery/src/main/java/org/opendaylight/openflowplugin/applications/topology/lldp/LLDPActivator.java
applications/topology-lldp-discovery/src/main/java/org/opendaylight/openflowplugin/applications/topology/lldp/LLDPDiscoveryListener.java
applications/topology-lldp-discovery/src/main/java/org/opendaylight/openflowplugin/applications/topology/lldp/LLDPLinkAger.java
applications/topology-lldp-discovery/src/main/resources/OSGI-INF/blueprint/topology-lldp-discovery.xml
applications/topology-manager/pom.xml
applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/FlowCapableTopologyProvider.java
applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/NodeChangeListenerImpl.java
applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/OperationProcessor.java
applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/TerminationPointChangeListenerImpl.java
applications/topology-manager/src/main/resources/OSGI-INF/blueprint/topology-manager.xml [deleted file]
artifacts/pom.xml
distribution/karaf/pom.xml
extension/features-extension-aggregator/features-openflowplugin-extension/pom.xml
extension/features-extension-aggregator/odl-openflowplugin-nxm-extensions/pom.xml
extension/features-extension-aggregator/odl-openflowplugin-onf-extensions/pom.xml
extension/features-extension-aggregator/pom.xml
extension/openflowplugin-extension-api/src/main/java/org/opendaylight/openflowplugin/extension/api/AugmentationGroupingResolver.java [new file with mode: 0644]
extension/openflowplugin-extension-api/src/main/java/org/opendaylight/openflowplugin/extension/api/GroupingResolver.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpOpConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpShaConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpSpaConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpThaConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/ArpTpaConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/CtMarkConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/CtStateConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/CtTpDstConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/CtTpSrcConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/CtZoneConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthDstConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthSrcConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthTypeConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/MatchUtil.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshFlagsConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshMdtypeConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshNpConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NshTtlConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc1Convertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc2Convertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc3Convertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/Nshc4Convertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NsiConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NspConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/NxmInPortConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/PktMarkConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/RegConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TcpDstConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TcpSrcConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TunIPv4DstConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TunIPv4SrcConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/TunIdConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/UdpDstConvertor.java
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/UdpSrcConvertor.java
features-aggregator/features-openflowplugin/pom.xml
features-aggregator/odl-openflowplugin-app-arbitratorreconciliation/pom.xml
features-aggregator/odl-openflowplugin-app-bulk-o-matic/pom.xml
features-aggregator/odl-openflowplugin-app-config-pusher/pom.xml
features-aggregator/odl-openflowplugin-app-forwardingrules-manager/pom.xml
features-aggregator/odl-openflowplugin-app-forwardingrules-sync/pom.xml
features-aggregator/odl-openflowplugin-app-lldp-speaker/pom.xml
features-aggregator/odl-openflowplugin-app-notifications/pom.xml
features-aggregator/odl-openflowplugin-app-reconciliation-framework/pom.xml
features-aggregator/odl-openflowplugin-app-southbound-cli/pom.xml
features-aggregator/odl-openflowplugin-app-table-miss-enforcer/pom.xml
features-aggregator/odl-openflowplugin-app-topology-lldp-discovery/pom.xml
features-aggregator/odl-openflowplugin-app-topology-manager/pom.xml
features-aggregator/odl-openflowplugin-app-topology/pom.xml
features-aggregator/odl-openflowplugin-drop-test/pom.xml
features-aggregator/odl-openflowplugin-flow-services-rest/pom.xml
features-aggregator/odl-openflowplugin-flow-services/pom.xml
features-aggregator/odl-openflowplugin-libraries/pom.xml
features-aggregator/odl-openflowplugin-nsf-model/pom.xml
features-aggregator/odl-openflowplugin-southbound/pom.xml
features-aggregator/pom.xml
openflowjava/features-openflowjava-aggregator/features-openflowjava/pom.xml
openflowjava/features-openflowjava-aggregator/odl-openflowjava-protocol/pom.xml
openflowjava/features-openflowjava-aggregator/pom.xml
openflowjava/openflow-protocol-impl/pom.xml
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SwitchConnectionProviderFactoryImpl.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SwitchConnectionProviderImpl.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/TcpChannelInitializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/TcpHandler.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/UdpHandler.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/AbstractConnectionAdapter.java
openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/TcpHandlerTest.java
openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/SwitchConnectionProviderImpl02Test.java
openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/SwitchConnectionProviderImplTest.java
openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/UdpHandlerTest.java
openflowjava/openflow-protocol-it/src/test/java/org/opendaylight/openflowjava/protocol/it/integration/IntegrationTest.java
openflowplugin-impl/pom.xml
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/OpenflowPluginDiagStatusProvider.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/listener/SystemNotificationsListenerImpl.java
openflowplugin/pom.xml
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/util/InventoryDataServiceUtil.java
parent/pom.xml
test-provider/pom.xml
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestActivator.java
test-provider/src/main/resources/OSGI-INF/blueprint/test-provider.xml [deleted file]

index 2946b62d339b262ed68f0c4cd280d2988e8e0867..c83e37e2eb46cddeb1ab2fa894bc42e0b3191ed5 100644 (file)
             <plugin>
                 <groupId>org.apache.aries.blueprint</groupId>
                 <artifactId>blueprint-maven-plugin</artifactId>
+                <configuration>
+                    <scanPaths>
+                        <scanPath>org.opendaylight.openflowplugin.applications.arbitratorreconciliation</scanPath>
+                    </scanPaths>
+                </configuration>
             </plugin>
         </plugins>
     </build>
index cfaf5729c44f3ee45d981d1e6e3a12184b81d906..518b9a2c681ef573b476a4ba4eb3c18af731efe5 100644 (file)
             <groupId>org.opendaylight.mdsal</groupId>
             <artifactId>mdsal-eos-binding-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>javax.inject</groupId>
+            <artifactId>javax.inject</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.blueprint</groupId>
+            <artifactId>blueprint-maven-plugin-annotation</artifactId>
+            <optional>true</optional>
+        </dependency>
     </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.aries.blueprint</groupId>
+                <artifactId>blueprint-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>
index ec397ea82cb2c713b244a99ee5116417aed60580..c011a45a1ad6eb4fcaf08226367668ca59d846e6 100644 (file)
@@ -8,11 +8,15 @@
 package org.opendaylight.openflowplugin.applications.deviceownershipservice.impl;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
 import java.util.Optional;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.regex.Pattern;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Singleton;
+import org.apache.aries.blueprint.annotation.service.Reference;
+import org.apache.aries.blueprint.annotation.service.Service;
 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipChange;
 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipListener;
 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService;
@@ -22,6 +26,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.co
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Singleton
+@Service(classes = DeviceOwnershipService.class)
 public class DeviceOwnershipServiceImpl implements DeviceOwnershipService, EntityOwnershipListener {
     private static final Logger LOG = LoggerFactory.getLogger(DeviceOwnershipServiceImpl.class);
     private static final String SERVICE_ENTITY_TYPE = "org.opendaylight.mdsal.ServiceEntityType";
@@ -30,15 +36,17 @@ public class DeviceOwnershipServiceImpl implements DeviceOwnershipService, Entit
     private final EntityOwnershipService eos;
     private final ConcurrentMap<String, EntityOwnershipState> ownershipStateCache = new ConcurrentHashMap<>();
 
-    public DeviceOwnershipServiceImpl(final EntityOwnershipService entityOwnershipService) {
+    public DeviceOwnershipServiceImpl(@Reference final EntityOwnershipService entityOwnershipService) {
         this.eos = entityOwnershipService;
     }
 
+    @PostConstruct
     public void start() {
         registerEntityOwnershipListener();
         LOG.info("DeviceOwnershipService started");
     }
 
+    @PreDestroy
     public void close() {
         LOG.info("DeviceOwnershipService closed");
     }
diff --git a/applications/device-ownership-service/src/main/resources/OSGI-INF/blueprint/device-ownership-state-service.xml b/applications/device-ownership-service/src/main/resources/OSGI-INF/blueprint/device-ownership-state-service.xml
deleted file mode 100644 (file)
index 45bd17f..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
-           odl:use-default-for-reference-types="true">
-
-    <reference id="entityOwnershipService" interface="org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService"/>
-
-    <bean id="deviceOwnershipService" class="org.opendaylight.openflowplugin.applications.deviceownershipservice.impl.DeviceOwnershipServiceImpl"
-          init-method="start"
-          destroy-method="close">
-        <argument ref="entityOwnershipService"/>
-    </bean>
-
-    <service ref="deviceOwnershipService"
-             interface="org.opendaylight.openflowplugin.applications.deviceownershipservice.DeviceOwnershipService"
-             odl:type="default"/>
-
-</blueprint>
index 96911c92a8d52574e4f7c1fa3e193be4ae1a54e6..494ee56a8604c7bed606579eb29435f8df4abe7e 100644 (file)
       <artifactId>arbitratorreconciliation-api</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.aries.blueprint</groupId>
+      <artifactId>blueprint-maven-plugin-annotation</artifactId>
+      <optional>true</optional>
+    </dependency>
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.aries.blueprint</groupId>
+        <artifactId>blueprint-maven-plugin</artifactId>
+        <configuration>
+          <scanPaths>
+            <scanPath>org.opendaylight.openflowplugin.applications.frm</scanPath>
+          </scanPaths>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
   <scm>
     <connection>scm:git:ssh://git.opendaylight.org:29418/openflowplugin.git</connection>
     <developerConnection>scm:git:ssh://git.opendaylight.org:29418/openflowplugin.git</developerConnection>
index 6deef293c323b01e5b3ec5f9779c6121730b1598..361b6e97153c7b41522a4207d35ae54dba1ebc98 100644 (file)
@@ -16,6 +16,11 @@ import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.atomic.AtomicLong;
 import javax.annotation.Nonnull;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import org.apache.aries.blueprint.annotation.service.Reference;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -61,6 +66,7 @@ import org.slf4j.LoggerFactory;
  * provide all RPC services.
  *
  */
+@Singleton
 public class ForwardingRulesManagerImpl implements ForwardingRulesManager {
     private static final Logger LOG = LoggerFactory.getLogger(ForwardingRulesManagerImpl.class);
 
@@ -99,14 +105,16 @@ public class ForwardingRulesManagerImpl implements ForwardingRulesManager {
     private final OpenflowServiceRecoveryHandler openflowServiceRecoveryHandler;
     private final ServiceRecoveryRegistry serviceRecoveryRegistry;
 
-    public ForwardingRulesManagerImpl(final DataBroker dataBroker, final RpcProviderRegistry rpcRegistry,
+    @Inject
+    public ForwardingRulesManagerImpl(@Reference final DataBroker dataBroker,
+                                      @Reference final RpcProviderRegistry rpcRegistry,
                                       final ForwardingRulesManagerConfig config,
-                                      final MastershipChangeServiceManager mastershipChangeServiceManager,
-                                      final ClusterSingletonServiceProvider clusterSingletonService,
-                                      final ConfigurationService configurationService,
-                                      final ReconciliationManager reconciliationManager,
+                                      @Reference final MastershipChangeServiceManager mastershipChangeServiceManager,
+                                      @Reference final ClusterSingletonServiceProvider clusterSingletonService,
+                                      @Reference final ConfigurationService configurationService,
+                                      @Reference final ReconciliationManager reconciliationManager,
                                       final OpenflowServiceRecoveryHandler openflowServiceRecoveryHandler,
-                                      final ServiceRecoveryRegistry serviceRecoveryRegistry) {
+                                      @Reference final ServiceRecoveryRegistry serviceRecoveryRegistry) {
         disableReconciliation = config.isDisableReconciliation();
         staleMarkingEnabled = config.isStaleMarkingEnabled();
         reconciliationRetryCount = config.getReconciliationRetryCount();
@@ -141,6 +149,7 @@ public class ForwardingRulesManagerImpl implements ForwardingRulesManager {
     }
 
     @Override
+    @PostConstruct
     public void start() {
         nodeConfigurator = new NodeConfiguratorImpl();
         this.devicesGroupRegistry = new DevicesGroupRegistry();
@@ -167,6 +176,7 @@ public class ForwardingRulesManagerImpl implements ForwardingRulesManager {
     }
 
     @Override
+    @PreDestroy
     public void close() throws Exception {
         configurationServiceRegistration.close();
 
index 0af6532e9da3ea8998d7c558d9469cf61c0ca827..29856894be0d48ac72934376b25cecce888a4b27 100644 (file)
@@ -12,6 +12,10 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.apache.aries.blueprint.annotation.service.Service;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
@@ -29,12 +33,15 @@ import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Singleton
+@Service(classes = FrmReconciliationService.class)
 public class FrmReconciliationServiceImpl implements FrmReconciliationService {
 
     private static final Logger LOG = LoggerFactory.getLogger(FrmReconciliationServiceImpl.class);
 
     private final ForwardingRulesManagerImpl forwardingRulesManagerImpl;
 
+    @Inject
     public FrmReconciliationServiceImpl(ForwardingRulesManagerImpl forwardingRulesManagerImpl) {
         this.forwardingRulesManagerImpl = forwardingRulesManagerImpl;
     }
index b9bd0f30831f78f121faf01ce9cb8681c8cdd54b..c1053e90d73693c594ba0c3c15701b2caff63da1 100644 (file)
@@ -9,6 +9,8 @@ package org.opendaylight.openflowplugin.applications.frm.recovery.impl;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
+import org.apache.aries.blueprint.annotation.service.Reference;
+import org.apache.aries.blueprint.annotation.service.Service;
 import org.opendaylight.openflowplugin.applications.frm.recovery.OpenflowServiceRecoveryHandler;
 import org.opendaylight.serviceutils.srm.RecoverableListener;
 import org.opendaylight.serviceutils.srm.ServiceRecoveryInterface;
@@ -18,6 +20,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @Singleton
+@Service(classes = OpenflowServiceRecoveryHandler.class)
 public class OpenflowServiceRecoveryHandlerImpl implements ServiceRecoveryInterface,
         OpenflowServiceRecoveryHandler {
 
@@ -26,7 +29,7 @@ public class OpenflowServiceRecoveryHandlerImpl implements ServiceRecoveryInterf
     private final ServiceRecoveryRegistry serviceRecoveryRegistry;
 
     @Inject
-    public OpenflowServiceRecoveryHandlerImpl(final ServiceRecoveryRegistry serviceRecoveryRegistry) {
+    public OpenflowServiceRecoveryHandlerImpl(@Reference final ServiceRecoveryRegistry serviceRecoveryRegistry) {
         LOG.info("Registering openflowplugin service recovery handlers");
         this.serviceRecoveryRegistry = serviceRecoveryRegistry;
         serviceRecoveryRegistry.registerServiceRecoveryRegistry(buildServiceRegistryKey(), this);
index a848eafd54586e5c78cacd263a08e7126a84cdba..b69d74b2eba012570b1a1eefb6e71bcc2cf3e7d5 100644 (file)
@@ -4,43 +4,7 @@
            xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
         odl:use-default-for-reference-types="true">
 
-  <service ref="openflowServiceRecoveryHandler"
-           interface="org.opendaylight.openflowplugin.applications.frm.recovery.OpenflowServiceRecoveryHandler"
-           odl:type="default"/>
-  <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"/>
-  <reference id="rpcRegistry" interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"/>
-  <reference id="clusterSingletonService" interface="org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider"/>
-  <reference id="mastershipChangeServiceManager" interface="org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager"/>
-  <reference id="configurationService" interface="org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService"/>
-  <reference id="reconciliationservice" interface="org.opendaylight.openflowplugin.applications.reconciliation.ReconciliationManager"/>
-  <reference id="serviceRecoveryRegistry" interface="org.opendaylight.serviceutils.srm.ServiceRecoveryRegistry"/>
-
-  <odl:clustered-app-config id="frmConfig"
+  <odl:clustered-app-config id="forwardingRulesManagerConfig"
         binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.forwardingrules.manager.config.rev160511.ForwardingRulesManagerConfig"/>
 
-  <bean id="openflowServiceRecoveryHandler"
-        class="org.opendaylight.openflowplugin.applications.frm.recovery.impl.OpenflowServiceRecoveryHandlerImpl">
-    <argument ref="serviceRecoveryRegistry"/>
-  </bean>
-  <bean id="frmManager" class="org.opendaylight.openflowplugin.applications.frm.impl.ForwardingRulesManagerImpl"
-        init-method="start" destroy-method="close">
-    <argument ref="dataBroker"/>
-    <argument ref="rpcRegistry"/>
-    <argument ref="frmConfig"/>
-    <argument ref="mastershipChangeServiceManager"/>
-    <argument ref="clusterSingletonService"/>
-    <argument ref="configurationService"/>
-    <argument ref="reconciliationservice"/>
-    <argument ref="openflowServiceRecoveryHandler"/>
-    <argument ref="serviceRecoveryRegistry"/>
-  </bean>
-
-  <bean id="frmReconciliationService"
-          class="org.opendaylight.openflowplugin.applications.frm.impl.FrmReconciliationServiceImpl">
-    <argument ref="frmManager"/>
-  </bean>
-  <service ref="frmReconciliationService"
-           interface="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.frm.reconciliation.service.rev180227.FrmReconciliationService"
-           odl:type="default"/>
-
 </blueprint>
index 2e69f01900abe50ac0d72985f8e1f6e55d934956..c99d3a3ff715cd4ac338bc6ad41030580e3f325d 100644 (file)
@@ -78,28 +78,28 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
         //resultVehicle = updateTableFeatures(nodeIdent, configTree);
 
         resultVehicle = Futures.transformAsync(resultVehicle, input -> {
-            if (!input.isSuccessful()) {
+            // if (!input.isSuccessful()) {
                 //TODO chain errors but not skip processing on first error return Futures.immediateFuture(input);
                 //final ListenableFuture<RpcResult<Void>> singleVoidUpdateResult = Futures.transform(
                 //        Futures.asList Arrays.asList(input, output),
                 //        ReconcileUtil.<UpdateFlowOutput>createRpcResultCondenser("TODO"));
-            }
+            // }
             return addMissingGroups(nodeId, nodeIdent, diffInput.getGroupsToAddOrUpdate(), counters);
         }, MoreExecutors.directExecutor());
         Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "addMissingGroups"),
                 MoreExecutors.directExecutor());
         resultVehicle = Futures.transformAsync(resultVehicle, input -> {
-            if (!input.isSuccessful()) {
+            // if (!input.isSuccessful()) {
                 //TODO chain errors but not skip processing on first error return Futures.immediateFuture(input);
-            }
+            // }
             return addMissingMeters(nodeId, nodeIdent, diffInput.getMetersToAddOrUpdate(), counters);
         }, MoreExecutors.directExecutor());
         Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "addMissingMeters"),
                 MoreExecutors.directExecutor());
         resultVehicle = Futures.transformAsync(resultVehicle, input -> {
-            if (!input.isSuccessful()) {
+            // if (!input.isSuccessful()) {
                 //TODO chain errors but not skip processing on first error return Futures.immediateFuture(input);
-            }
+            // }
             return addMissingFlows(nodeId, nodeIdent, diffInput.getFlowsToAddOrUpdate(), counters);
         }, MoreExecutors.directExecutor());
         Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "addMissingFlows"),
@@ -107,25 +107,25 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
 
 
         resultVehicle = Futures.transformAsync(resultVehicle, input -> {
-            if (!input.isSuccessful()) {
+            // if (!input.isSuccessful()) {
                 //TODO chain errors but not skip processing on first error return Futures.immediateFuture(input);
-            }
+            // }
             return removeRedundantFlows(nodeId, nodeIdent, diffInput.getFlowsToRemove(), counters);
         }, MoreExecutors.directExecutor());
         Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "removeRedundantFlows"),
                 MoreExecutors.directExecutor());
         resultVehicle = Futures.transformAsync(resultVehicle, input -> {
-            if (!input.isSuccessful()) {
+            // if (!input.isSuccessful()) {
                 //TODO chain errors but not skip processing on first error return Futures.immediateFuture(input);
-            }
+            // }
             return removeRedundantMeters(nodeId, nodeIdent, diffInput.getMetersToRemove(), counters);
         }, MoreExecutors.directExecutor());
         Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "removeRedundantMeters"),
                 MoreExecutors.directExecutor());
         resultVehicle = Futures.transformAsync(resultVehicle, input -> {
-            if (!input.isSuccessful()) {
+            // if (!input.isSuccessful()) {
                 //TODO chain errors but not skip processing on first error return Futures.immediateFuture(input);
-            }
+            // }
             return removeRedundantGroups(nodeId, nodeIdent, diffInput.getGroupsToRemove(), counters);
         }, MoreExecutors.directExecutor());
         Futures.addCallback(resultVehicle, FxChainUtil.logResultCallback(nodeId, "removeRedundantGroups"),
index ac77346ffdc266ce50e6c296325a2a70d534a65d..84358e0bb049df9ecac197684706f7be44e04f6b 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.openflowplugin.applications.lldpspeaker;
 
+import static org.opendaylight.infrautils.utils.concurrent.LoggingFutures.addErrorLogging;
+
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import java.security.NoSuchAlgorithmException;
@@ -133,7 +135,8 @@ public class LLDPSpeaker implements NodeConnectorEventsObserver, Runnable, AutoC
                 if (deviceOwnershipService.isEntityOwned(nodeId.getValue())) {
                     LOG.debug("Node is owned by this controller, sending LLDP packet through port {}",
                             nodeConnectorId.getValue());
-                    packetProcessingService.transmitPacket(nodeConnectorMap.get(ncIID));
+                    addErrorLogging(packetProcessingService.transmitPacket(nodeConnectorMap.get(ncIID)), LOG,
+                            "transmitPacket() failed");
                 } else {
                     LOG.debug("Node {} is not owned by this controller, so skip sending LLDP packet on port {}",
                             nodeId.getValue(), nodeConnectorId.getValue());
index 869e92618c531589603f4a504781403369a6fd55..28b4268c1e16e5f087eb813c4bfe447a048c2777 100644 (file)
@@ -5,15 +5,14 @@
  * 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.applications.lldpspeaker;
 
 import static org.opendaylight.openflowplugin.applications.topology.lldp.utils.LLDPDiscoveryUtils.getValueForLLDPPacketIntegrityEnsuring;
 
+import com.google.common.base.Strings;
 import java.math.BigInteger;
 import java.security.NoSuchAlgorithmException;
 import javax.annotation.Nonnull;
-import org.apache.commons.lang3.StringUtils;
 import org.opendaylight.openflowplugin.libraries.liblldp.EtherTypes;
 import org.opendaylight.openflowplugin.libraries.liblldp.Ethernet;
 import org.opendaylight.openflowplugin.libraries.liblldp.HexEncode;
@@ -119,6 +118,6 @@ public final class LLDPUtil {
     }
 
     private static String bigIntegerToPaddedHex(final BigInteger dataPathId) {
-        return StringUtils.leftPad(dataPathId.toString(16), 16, "0");
+        return Strings.padStart(dataPathId.toString(16), 16, '0');
     }
 }
index 73caa58f5c91684e21dfd752976349dd20bb5b03..c5928645948d1aaa4be19aaabac460adfdd86d9e 100644 (file)
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>javax.inject</groupId>
+            <artifactId>javax.inject</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.blueprint</groupId>
+            <artifactId>blueprint-maven-plugin-annotation</artifactId>
+            <optional>true</optional>
+        </dependency>
     </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.aries.blueprint</groupId>
+                <artifactId>blueprint-maven-plugin</artifactId>
+                <configuration>
+                    <scanPaths>
+                        <scanPath>org.opendaylight.openflowplugin.openflow.ofswitch.config</scanPath>
+                    </scanPaths>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
index 6a2bfe896409d54f9ab4d55d7622eb7d199780af..9ae9e180fac55690dc89843201a35557afb9bb58 100644 (file)
@@ -12,6 +12,11 @@ import com.google.common.base.Preconditions;
 import java.util.Collection;
 import java.util.concurrent.Future;
 import javax.annotation.Nonnull;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import org.apache.aries.blueprint.annotation.service.Reference;
 import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType;
@@ -36,6 +41,7 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Singleton
 public class DefaultConfigPusher implements AutoCloseable, ClusteredDataTreeChangeListener<FlowCapableNode> {
     private static final Logger LOG = LoggerFactory.getLogger(DefaultConfigPusher.class);
     private static final long STARTUP_LOOP_TICK = 500L;
@@ -45,8 +51,9 @@ public class DefaultConfigPusher implements AutoCloseable, ClusteredDataTreeChan
     private final DeviceOwnershipService deviceOwnershipService;
     private ListenerRegistration<?> listenerRegistration;
 
-    public DefaultConfigPusher(NodeConfigService nodeConfigService, DataBroker dataBroker,
-            DeviceOwnershipService deviceOwnershipService) {
+    @Inject
+    public DefaultConfigPusher(NodeConfigService nodeConfigService, @Reference DataBroker dataBroker,
+            @Reference DeviceOwnershipService deviceOwnershipService) {
         this.nodeConfigService = nodeConfigService;
         this.dataBroker = dataBroker;
         this.deviceOwnershipService = Preconditions.checkNotNull(deviceOwnershipService,
@@ -54,6 +61,7 @@ public class DefaultConfigPusher implements AutoCloseable, ClusteredDataTreeChan
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
+    @PostConstruct
     public void start() {
         try {
             final InstanceIdentifier<FlowCapableNode> path = InstanceIdentifier.create(Nodes.class).child(Node.class)
@@ -71,6 +79,7 @@ public class DefaultConfigPusher implements AutoCloseable, ClusteredDataTreeChan
     }
 
     @Override
+    @PreDestroy
     public void close() {
         if (listenerRegistration != null) {
             listenerRegistration.close();
index f303c62da2ea3e37ba47bb7c62fe9b3cd660056f..f56ddc8ed29b37f584c998299fe88451ee9d3040 100644 (file)
@@ -3,15 +3,6 @@
            xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
            odl:use-default-for-reference-types="true">
 
-  <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"/>
-  <reference id="deviceOwnershipService" interface="org.opendaylight.openflowplugin.applications.deviceownershipservice.DeviceOwnershipService"/>
-
   <odl:rpc-service id="nodeConfigService" interface="org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.NodeConfigService"/>
 
-  <bean id="LLDPPacketPuntEnforcer" class="org.opendaylight.openflowplugin.openflow.ofswitch.config.DefaultConfigPusher"
-          init-method="start" destroy-method="close">
-    <argument ref="nodeConfigService"/>
-    <argument ref="dataBroker"/>
-    <argument ref="deviceOwnershipService"/>
-  </bean>
 </blueprint>
\ No newline at end of file
index 57bdc2d681ff8e302e34fc6423b152746f68413f..f0201b4a019da4f470cbb25e520b64de50034aab 100644 (file)
             <artifactId>org.apache.karaf.shell.console</artifactId>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>javax.inject</groupId>
+            <artifactId>javax.inject</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.blueprint</groupId>
+            <artifactId>blueprint-maven-plugin-annotation</artifactId>
+            <optional>true</optional>
+        </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.aries.blueprint</groupId>
+                <artifactId>blueprint-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
     <scm>
         <connection>scm:git:ssh://git.opendaylight.org:29418/openflowplugin.git</connection>
         <developerConnection>scm:git:ssh://git.opendaylight.org:29418/openflowplugin.git</developerConnection>
index 2eb4d395dc2bd67fb9ed1af4243a367c9d93f478..fab79142df4a27ab8f977ed0c8d61f83d679f807 100644 (file)
@@ -21,6 +21,12 @@ import java.util.concurrent.ConcurrentSkipListMap;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 import javax.annotation.Nonnull;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import org.apache.aries.blueprint.annotation.service.Reference;
+import org.apache.aries.blueprint.annotation.service.Service;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeException;
 import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager;
@@ -32,6 +38,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Singleton
+@Service(classes = ReconciliationManager.class)
 public class ReconciliationManagerImpl implements ReconciliationManager, ReconciliationFrameworkEvent {
     private static final Logger LOG = LoggerFactory.getLogger(ReconciliationManagerImpl.class);
 
@@ -42,11 +50,13 @@ public class ReconciliationManagerImpl implements ReconciliationManager, Reconci
     private final Map<ResultState, Integer> resultStateMap = new ConcurrentHashMap<>();
     private final AtomicReference<ResultState> decidedResultState = new AtomicReference<>(ResultState.DONOTHING);
 
-    public ReconciliationManagerImpl(MastershipChangeServiceManager mastershipChangeServiceManager) {
+    @Inject
+    public ReconciliationManagerImpl(@Reference MastershipChangeServiceManager mastershipChangeServiceManager) {
         this.mastershipChangeServiceManager = Preconditions
                 .checkNotNull(mastershipChangeServiceManager, "MastershipChangeServiceManager can not be null!");
     }
 
+    @PostConstruct
     public void start() throws MastershipChangeException {
         mastershipChangeServiceManager.reconciliationFrameworkRegistration(this);
         LOG.info("ReconciliationManager has started successfully.");
@@ -88,6 +98,7 @@ public class ReconciliationManagerImpl implements ReconciliationManager, Reconci
     }
 
     @Override
+    @PreDestroy
     public void close() throws Exception {
     }
 
index 03aff8336e45922cd7276a228152704105217927..85dadeadea3c25b20fd4bfa9d06693e1de5a0079 100644 (file)
@@ -3,14 +3,11 @@
            xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
            odl:use-default-for-reference-types="true">
 
-    <reference id="reconciliationManagerRef"
-               interface="org.opendaylight.openflowplugin.applications.reconciliation.ReconciliationManager"
-               availability="optional"/>
     <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
         <command>
             <action class="org.opendaylight.openflowplugin.applications.reconciliation.cli.GetRegisteredServices">
                 <property name="reconciliationManager"
-                          ref="reconciliationManagerRef"/>
+                          ref="reconciliationManagerImpl"/>
             </action>
         </command>
     </command-bundle>
diff --git a/applications/reconciliation-framework/src/main/resources/OSGI-INF/blueprint/reconciliation-framework.xml b/applications/reconciliation-framework/src/main/resources/OSGI-INF/blueprint/reconciliation-framework.xml
deleted file mode 100644 (file)
index f5ad65a..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
-           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
-           odl:use-default-for-reference-types="true">
-
-  <reference id="mastershipChangeServiceManager"
-             interface="org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager"/>
-  <bean id="reconciliationManagerImpl"
-        class="org.opendaylight.openflowplugin.applications.reconciliation.impl.ReconciliationManagerImpl"
-        init-method="start"
-        destroy-method="close">
-    <argument ref="mastershipChangeServiceManager"/>
-  </bean>
-  <service ref="reconciliationManagerImpl"
-           interface="org.opendaylight.openflowplugin.applications.reconciliation.ReconciliationManager"
-           odl:type="default"/>
-
-</blueprint>
\ No newline at end of file
index d190e4e73197dafa85af11fd7ba52f2677d3049f..1e843bd7e6691c26008bd3d9244b0d0c5365b92d 100644 (file)
       <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
-
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.aries.blueprint</groupId>
+      <artifactId>blueprint-maven-plugin-annotation</artifactId>
+      <optional>true</optional>
+    </dependency>
 
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.aries.blueprint</groupId>
+        <artifactId>blueprint-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+
   <scm>
     <connection>scm:git:ssh://git.opendaylight.org:29418/openflowplugin.git</connection>
     <developerConnection>scm:git:ssh://git.opendaylight.org:29418/openflowplugin.git</developerConnection>
index f3709a694b251e1441342e295674f37579820d6f..ff1daf03c8a6564a2940ebc3b62a08bbcbf354d8 100644 (file)
@@ -8,6 +8,10 @@
 package org.opendaylight.openflowplugin.applications.topology.lldp;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import org.apache.aries.blueprint.annotation.service.Reference;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.lldp.discovery.config.rev160511.TopologyLldpDiscoveryConfig;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
@@ -15,6 +19,7 @@ import org.opendaylight.yangtools.yang.binding.NotificationListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Singleton
 public class LLDPActivator implements AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(LLDPActivator.class);
 
@@ -23,7 +28,9 @@ public class LLDPActivator implements AutoCloseable {
     private final ListenerRegistration<NotificationListener> lldpNotificationRegistration;
 
     @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
-    public LLDPActivator(NotificationProviderService notificationService, LLDPDiscoveryListener lldpDiscoveryListener,
+    @Inject
+    public LLDPActivator(@Reference NotificationProviderService notificationService,
+                         LLDPDiscoveryListener lldpDiscoveryListener,
                          TopologyLldpDiscoveryConfig topologyLldpDiscoveryConfig) {
         lldpSecureKey = topologyLldpDiscoveryConfig.getLldpSecureKey();
 
@@ -35,6 +42,7 @@ public class LLDPActivator implements AutoCloseable {
     }
 
     @Override
+    @PreDestroy
     public void close() {
         lldpNotificationRegistration.close();
 
index 04989513f6ecfca30d962f9bda2adde8ea41ec67..b5363da4b78e4f28f5eb78e58b717ce3448d9087 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.openflowplugin.applications.topology.lldp;
 
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import org.apache.aries.blueprint.annotation.service.Reference;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService;
 import org.opendaylight.openflowplugin.applications.topology.lldp.utils.LLDPDiscoveryUtils;
@@ -20,6 +23,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.Pa
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Singleton
 public class LLDPDiscoveryListener implements PacketProcessingListener {
     private static final Logger LOG = LoggerFactory.getLogger(LLDPDiscoveryListener.class);
 
@@ -27,9 +31,9 @@ public class LLDPDiscoveryListener implements PacketProcessingListener {
     private final NotificationProviderService notificationService;
     private final EntityOwnershipService eos;
 
-
-    public LLDPDiscoveryListener(final NotificationProviderService notificationService, final LLDPLinkAger lldpLinkAger,
-            final EntityOwnershipService entityOwnershipService) {
+    @Inject
+    public LLDPDiscoveryListener(@Reference final NotificationProviderService notificationService,
+            final LLDPLinkAger lldpLinkAger, @Reference final EntityOwnershipService entityOwnershipService) {
         this.notificationService = notificationService;
         this.lldpLinkAger = lldpLinkAger;
         this.eos = entityOwnershipService;
index 738ba0299e819b95780a4bc32d9e823495fe7610..22ffb11b11afdf9df28f7e52d5e963f369cc51ae 100644 (file)
@@ -16,6 +16,10 @@ import java.util.Timer;
 import java.util.TimerTask;
 import java.util.concurrent.ConcurrentHashMap;
 import javax.annotation.Nonnull;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import org.apache.aries.blueprint.annotation.service.Reference;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService;
 import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationListener;
@@ -29,6 +33,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Singleton
 public class LLDPLinkAger implements ConfigurationListener, AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(LLDPLinkAger.class);
     private final long linkExpirationTime;
@@ -41,9 +46,11 @@ public class LLDPLinkAger implements ConfigurationListener, AutoCloseable {
     /**
      * default ctor - start timer.
      */
+    @Inject
     public LLDPLinkAger(final TopologyLldpDiscoveryConfig topologyLldpDiscoveryConfig,
-            final NotificationProviderService notificationService,
-            final ConfigurationService configurationService, final EntityOwnershipService entityOwnershipService) {
+            @Reference final NotificationProviderService notificationService,
+            @Reference final ConfigurationService configurationService,
+            @Reference final EntityOwnershipService entityOwnershipService) {
         this.linkExpirationTime = topologyLldpDiscoveryConfig.getTopologyLldpExpirationInterval().getValue();
         this.notificationService = notificationService;
         this.configurationServiceRegistration = configurationService.registerListener(this);
@@ -60,6 +67,7 @@ public class LLDPLinkAger implements ConfigurationListener, AutoCloseable {
     }
 
     @Override
+    @PreDestroy
     public void close() throws Exception {
         timer.cancel();
         linkToDate.clear();
@@ -105,11 +113,7 @@ public class LLDPLinkAger implements ConfigurationListener, AutoCloseable {
         Optional.ofNullable(TopologyLLDPDiscoveryProperty.forValue(propertyName)).ifPresent(lldpDiscoveryProperty -> {
             switch (lldpDiscoveryProperty) {
                 case LLDP_SECURE_KEY:
-                    LOG.warn("Runtime update not supported for property {}", lldpDiscoveryProperty);
-                    break;
                 case TOPOLOGY_LLDP_INTERVAL:
-                    LOG.warn("Runtime update not supported for property {}", lldpDiscoveryProperty);
-                    break;
                 case TOPOLOGY_LLDP_EXPIRATION_INTERVAL:
                     LOG.warn("Runtime update not supported for property {}", lldpDiscoveryProperty);
                     break;
index 2d7ca120fbbaf87fe61ad6823fc113a147b59bb5..ad552b5e9167aaf3db7d3614d208b26101afd861 100644 (file)
@@ -4,11 +4,7 @@
            xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
         odl:use-default-for-reference-types="true">
 
-  <reference id="notificationService" interface="org.opendaylight.controller.sal.binding.api.NotificationProviderService"/>
-  <reference id="configurationService" interface="org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService"/>
-  <reference id="entityOwnershipService" interface="org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService"/>
-
-  <odl:clustered-app-config id="topologyLLDPConfig"
+  <odl:clustered-app-config id="topologyLldpDiscoveryConfig"
       binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.lldp.discovery.config.rev160511.TopologyLldpDiscoveryConfig">
     <odl:default-config><![CDATA[
       <topology-lldp-discovery-config xmlns="urn:opendaylight:params:xml:ns:yang:topology-lldp-discovery:config">
     ]]></odl:default-config>
   </odl:clustered-app-config>
 
-  <bean id="lldpLinkAger" class="org.opendaylight.openflowplugin.applications.topology.lldp.LLDPLinkAger"
-          destroy-method="close">
-    <argument ref="topologyLLDPConfig"/>
-    <argument ref="notificationService"/>
-    <argument ref="configurationService"/>
-    <argument ref="entityOwnershipService"/>
-  </bean>
-
-  <bean id="lldpDiscoveryListener" class="org.opendaylight.openflowplugin.applications.topology.lldp.LLDPDiscoveryListener">
-    <argument ref="notificationService"/>
-    <argument ref="lldpLinkAger"/>
-    <argument ref="entityOwnershipService"/>
-  </bean>
-
-  <bean id="LLDPActivator" class="org.opendaylight.openflowplugin.applications.topology.lldp.LLDPActivator"
-         destroy-method="close">
-    <argument ref="notificationService"/>
-    <argument ref="lldpDiscoveryListener"/>
-    <argument ref="topologyLLDPConfig"/>
-  </bean>
 </blueprint>
\ No newline at end of file
index 3d7fd49c3c87336e8705a1d908f9ca62161c0aca..bc2673c9adf9de3c6325bbb6e890798c7094310e 100644 (file)
       <artifactId>slf4j-log4j12</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.aries.blueprint</groupId>
+      <artifactId>blueprint-maven-plugin-annotation</artifactId>
+      <optional>true</optional>
+    </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.aries.blueprint</groupId>
+        <artifactId>blueprint-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
   <scm>
     <connection>scm:git:ssh://git.opendaylight.org:29418/openflowplugin.git</connection>
     <developerConnection>scm:git:ssh://git.opendaylight.org:29418/openflowplugin.git</developerConnection>
index 0249510756e19ad912078e8351a457a6f61fc88a..b17c1159d89048a26dc2956fe095d5038bd95c46 100644 (file)
@@ -12,6 +12,11 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.concurrent.ExecutionException;
 import javax.annotation.Nonnull;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import org.apache.aries.blueprint.annotation.service.Reference;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
@@ -31,6 +36,7 @@ import org.opendaylight.yangtools.yang.binding.NotificationListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Singleton
 public class FlowCapableTopologyProvider implements ClusterSingletonService, AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(FlowCapableTopologyProvider.class);
     private static final String TOPOLOGY_PROVIDER = "ofp-topology-manager";
@@ -45,10 +51,12 @@ public class FlowCapableTopologyProvider implements ClusterSingletonService, Aut
     private ListenerRegistration<NotificationListener> listenerRegistration;
     private ClusterSingletonServiceRegistration singletonServiceRegistration;
 
-    public FlowCapableTopologyProvider(final DataBroker dataBroker,
-                                       final NotificationProviderService notificationService,
+    @Inject
+    public FlowCapableTopologyProvider(@Reference final DataBroker dataBroker,
+                                       @Reference final NotificationProviderService notificationService,
                                        final OperationProcessor processor,
-                                       final ClusterSingletonServiceProvider clusterSingletonServiceProvider) {
+                                       @Reference final ClusterSingletonServiceProvider
+                                               clusterSingletonServiceProvider) {
         this.dataBroker = dataBroker;
         this.notificationService = notificationService;
         this.processor = processor;
@@ -58,6 +66,7 @@ public class FlowCapableTopologyProvider implements ClusterSingletonService, Aut
     /**
      * Gets called on start of a bundle.
      */
+    @PostConstruct
     public void start() {
         final TopologyKey key = new TopologyKey(new TopologyId(TOPOLOGY_ID));
         this.topologyPathIID = InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, key);
@@ -72,6 +81,7 @@ public class FlowCapableTopologyProvider implements ClusterSingletonService, Aut
     }
 
     @Override
+    @PreDestroy
     public void close() {
         this.transactionChainManager.close();
         if (this.listenerRegistration != null) {
index ce6b5c559f2721c3bea809e2af7dbc01188bf84a..596e671aa41fbacbf2aa5d70db9a755dbc3260c5 100644 (file)
@@ -9,6 +9,10 @@ package org.opendaylight.openflowplugin.applications.topology.manager;
 
 import java.util.Collection;
 import javax.annotation.Nonnull;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import org.apache.aries.blueprint.annotation.service.Reference;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -24,10 +28,12 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Singleton
 public class NodeChangeListenerImpl extends DataTreeChangeListenerImpl<FlowCapableNode> {
     private static final Logger LOG = LoggerFactory.getLogger(NodeChangeListenerImpl.class);
 
-    public NodeChangeListenerImpl(final DataBroker dataBroker, final OperationProcessor operationProcessor) {
+    @Inject
+    public NodeChangeListenerImpl(@Reference final DataBroker dataBroker, final OperationProcessor operationProcessor) {
         // TODO: listener on FlowCapableNode. what if node id in Node.class is changed (it won't be caught by this
         // listener)
         super(operationProcessor, dataBroker,
@@ -54,6 +60,12 @@ public class NodeChangeListenerImpl extends DataTreeChangeListenerImpl<FlowCapab
         }
     }
 
+    @Override
+    @PreDestroy
+    public void close() throws Exception {
+        super.close();
+    }
+
     private void processRemovedNode(final DataTreeModification<FlowCapableNode> modification) {
         final InstanceIdentifier<FlowCapableNode> iiToNodeInInventory = modification.getRootPath().getRootIdentifier();
         final NodeId nodeId = provideTopologyNodeId(iiToNodeInInventory);
index d70a43479db326a94a5f56f6f731fdee5a4e42a2..8a9963f30ab7e06c66c147e4289444ea641d9f12 100644 (file)
@@ -9,11 +9,17 @@ package org.opendaylight.openflowplugin.applications.topology.manager;
 
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import org.apache.aries.blueprint.annotation.service.Reference;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.openflowplugin.common.txchain.TransactionChainManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Singleton
 public final class OperationProcessor implements AutoCloseable, Runnable {
     private static final Logger LOG = LoggerFactory.getLogger(OperationProcessor.class);
     private static final int MAX_TRANSACTION_OPERATIONS = 100;
@@ -25,7 +31,8 @@ public final class OperationProcessor implements AutoCloseable, Runnable {
     private TransactionChainManager transactionChainManager;
     private volatile boolean finishing = false;
 
-    public OperationProcessor(final DataBroker dataBroker) {
+    @Inject
+    public OperationProcessor(@Reference final DataBroker dataBroker) {
         transactionChainManager = new TransactionChainManager(dataBroker, TOPOLOGY_MANAGER);
         transactionChainManager.activateTransactionManager();
         transactionChainManager.initialSubmitWriteTransaction();
@@ -43,6 +50,7 @@ public final class OperationProcessor implements AutoCloseable, Runnable {
         }
     }
 
+    @PostConstruct
     public void start() {
         thread.start();
     }
@@ -90,6 +98,7 @@ public final class OperationProcessor implements AutoCloseable, Runnable {
     }
 
     @Override
+    @PreDestroy
     public void close() {
         thread.interrupt();
         try {
index 808e2c8110edb690c95f049ccfe140aac56b7c5b..e166bd6e83d8fb75d8b804cbfb163d4e1fd447c2 100644 (file)
@@ -11,6 +11,10 @@ import java.util.Collection;
 import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import javax.annotation.Nonnull;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import org.apache.aries.blueprint.annotation.service.Reference;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -31,10 +35,12 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Singleton
 public class TerminationPointChangeListenerImpl extends DataTreeChangeListenerImpl<FlowCapableNodeConnector> {
     private static final Logger LOG = LoggerFactory.getLogger(TerminationPointChangeListenerImpl.class);
 
-    public TerminationPointChangeListenerImpl(final DataBroker dataBroker,
+    @Inject
+    public TerminationPointChangeListenerImpl(@Reference final DataBroker dataBroker,
                                               final OperationProcessor operationProcessor) {
         super(operationProcessor, dataBroker,
               InstanceIdentifier.builder(Nodes.class).child(Node.class).child(NodeConnector.class)
@@ -62,6 +68,12 @@ public class TerminationPointChangeListenerImpl extends DataTreeChangeListenerIm
         }
     }
 
+    @Override
+    @PreDestroy
+    public void close() throws Exception {
+        super.close();
+    }
+
     private void processRemovedTerminationPoints(final DataTreeModification<FlowCapableNodeConnector> modification) {
         final InstanceIdentifier<FlowCapableNodeConnector> removedNode = modification.getRootPath().getRootIdentifier();
         final TpId terminationPointId = provideTopologyTerminationPointId(removedNode);
diff --git a/applications/topology-manager/src/main/resources/OSGI-INF/blueprint/topology-manager.xml b/applications/topology-manager/src/main/resources/OSGI-INF/blueprint/topology-manager.xml
deleted file mode 100644 (file)
index 01e5d6b..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
-        odl:use-default-for-reference-types="true">
-
-  <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"/>
-  <reference id="notificationService" interface="org.opendaylight.controller.sal.binding.api.NotificationProviderService"/>
-  <reference id="clusterSingletonService" interface="org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider"/>
-
-  <bean id="operationProcessor" class="org.opendaylight.openflowplugin.applications.topology.manager.OperationProcessor"
-          init-method="start" destroy-method="close">
-    <argument ref="dataBroker"/>
-  </bean>
-
-  <bean id="termPointChangeListener" class="org.opendaylight.openflowplugin.applications.topology.manager.TerminationPointChangeListenerImpl"
-          destroy-method="close">
-    <argument ref="dataBroker"/>
-    <argument ref="operationProcessor"/>
-  </bean>
-
-  <bean id="nodeChangeListener" class="org.opendaylight.openflowplugin.applications.topology.manager.NodeChangeListenerImpl"
-          destroy-method="close">
-    <argument ref="dataBroker"/>
-    <argument ref="operationProcessor"/>
-  </bean>
-
-  <bean id="topologyProvider" class="org.opendaylight.openflowplugin.applications.topology.manager.FlowCapableTopologyProvider"
-          init-method="start" destroy-method="close">
-    <argument ref="dataBroker"/>
-    <argument ref="notificationService"/>
-    <argument ref="operationProcessor"/>
-    <argument ref="clusterSingletonService"/>
-  </bean>
-</blueprint>
index 78eac87b65e72e54e513e28a20d697de44c88cb1..4ea5f564802eea9a7392db544a752037b161293b 100644 (file)
@@ -13,7 +13,7 @@
   <parent>
     <groupId>org.opendaylight.odlparent</groupId>
     <artifactId>odlparent-lite</artifactId>
-    <version>4.0.2</version>
+    <version>4.0.5</version>
     <relativePath/>
   </parent>
 
index af4367830d77e25f9cfc73fa19ed4be17ce9a4a3..c8f477fa8bca74d27cfee0a85cbb296d6bee7323 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.opendaylight.odlparent</groupId>
     <artifactId>karaf4-parent</artifactId>
-    <version>4.0.2</version>
+    <version>4.0.5</version>
   </parent>
   <groupId>org.opendaylight.openflowplugin</groupId>
   <artifactId>openflowplugin-karaf</artifactId>
index b0067fd36d49658be64a064dd08dee763e10931d..388725f411211eb572ad3dc49ff730b8b8e7f9ac 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>feature-repo-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index 42fd7a0325bdcd3b38ba2a7becc7dd5a5659b826..4939c98b7312fdc28f1747c92bff11004f89bb17 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index 8ded3667084a3a4ff7a18d570461ffa85f60449c..dac669b0d617279b96c50e1912150691447ae31c 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index 7957825f3445ef3326bce03eee173832537fc975..1cbb4be061dea837b89ab06f1135298625814c30 100644 (file)
@@ -3,7 +3,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
     <modelVersion>4.0.0</modelVersion>
diff --git a/extension/openflowplugin-extension-api/src/main/java/org/opendaylight/openflowplugin/extension/api/AugmentationGroupingResolver.java b/extension/openflowplugin-extension-api/src/main/java/org/opendaylight/openflowplugin/extension/api/AugmentationGroupingResolver.java
new file mode 100644 (file)
index 0000000..4bc991e
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2018 Pantheon Technologies, s.r.o. 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.extension.api;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.annotations.Beta;
+import java.util.HashSet;
+import java.util.Optional;
+import java.util.Set;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.concepts.Immutable;
+import org.opendaylight.yangtools.yang.binding.Augmentable;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ * Resolver providing a bridge between a grouping and its various instantiations via augment. This is useful for
+ * extracting the grouping's content from a DataObject's augmentations without knowing from which instantiation it
+ * comes from.
+ *
+ * <p>
+ * Typical use case is, given a base grouping module:
+ * <pre>
+ *     module foo;
+ *
+ *     grouping foo {
+ *         container augmentable {
+ *
+ *         }
+ *     }
+ * </pre>
+ * and a module independent of it:
+ * <pre>
+ *     module bar;
+ *
+ *     container bar {
+ *         uses foo:foo;
+ *     }
+ * </pre>
+ * and
+ * <pre>
+ *     module baz;
+ *
+ *     container baz {
+ *         uses foo:foo;
+ *     }
+ * </pre>
+ * an external module can perform:
+ * <pre>
+ *     module xyzzy;
+ *
+ *     import bar { prefix bar; }
+ *     import baz { prefix baz; }
+ *
+ *     grouping something {
+ *         // ...
+ *     }
+ *
+ *     augment /bar:bar/bar:augmentable {
+ *         uses something;
+ *     }
+ *
+ *     augment /baz:baz/baz:augmentable {
+ *         uses something;
+ *     }
+ * </pre>
+ * The augmentations of {@code bar} and {@code baz} instantiations of {@code grouping foo} have an equivalent
+ * augmentation introduced by {@code xyzzy}. This equivalence is not expressed is generated code, in that it is
+ * not apparent given {@code bar} or {@code baz} there is an augmentation which provides {@code something}.
+ *
+ * <p>
+ * This class provides the static knowledge to ask for the contents of {@code something} given an instance of
+ * {@code augmentable}, without knowing which augmentation introduces it.
+ *
+ * @param <G> Grouping type
+ * @param <T> Augmentable type
+ */
+@Beta
+public final class AugmentationGroupingResolver<G extends DataObject, T extends Augmentable<T>> implements Immutable {
+    private final Class<? extends Augmentation<T>>[] augmentations;
+    private final Class<G> grouping;
+
+    AugmentationGroupingResolver(final Class<G> grouping, final Class<? extends Augmentation<T>>[] augmentations) {
+        this.grouping = requireNonNull(grouping);
+        this.augmentations = requireNonNull(augmentations);
+    }
+
+    public @NonNull Optional<G> findExtension(final T data) {
+        requireNonNull(data);
+
+        for (Class<? extends Augmentation<T>> cls : augmentations) {
+            final Augmentation<T> potential = data.augmentation(cls);
+            if (potential != null) {
+                return Optional.of(grouping.cast(potential));
+            }
+        }
+        return Optional.empty();
+    }
+
+    public static <G extends DataObject, T extends Augmentable<T>> @NonNull Builder<G, T> builder(
+            final Class<G> groupingClass) {
+        return new Builder<>(groupingClass);
+    }
+
+    @SuppressWarnings("unchecked")
+    public static <T extends Augmentable<T>> @NonNull Factory<T> factory(final Class<T> augmentableClass,
+            final Set<Class<? extends Augmentation<T>>> augmentationClasses) {
+        // Defensive copy via .clone() to guard against evil Set implementations
+        final Class<?>[] array = augmentationClasses.toArray(new Class<?>[0]).clone();
+
+        // Defensive check of all array elements
+        for (Class<?> clazz : array) {
+            checkArgument(Augmentation.class.isAssignableFrom(clazz), "Class %s is not an Augmentation", clazz);
+        }
+
+        return new Factory<>((Class<? extends Augmentation<T>>[]) array);
+    }
+
+    public static final class Builder<G extends DataObject, T extends Augmentable<T>>
+            implements org.opendaylight.yangtools.concepts.Builder<AugmentationGroupingResolver<G, T>> {
+        private final Set<Class<? extends Augmentation<T>>> augmentations = new HashSet<>();
+        private final Class<G> grouping;
+
+        Builder(final Class<G> groupingClass) {
+            grouping = requireNonNull(groupingClass);
+        }
+
+        public <X extends Augmentation<T>> @NonNull Builder<G, T> addAugmentationClass(
+                final Class<X> augmentationClass) {
+            checkAssignable(grouping, augmentationClass);
+            augmentations.add(augmentationClass);
+            return this;
+        }
+
+        @Override
+        @SuppressWarnings("unchecked")
+        public @NonNull AugmentationGroupingResolver<G, T> build() {
+            return new AugmentationGroupingResolver<>(grouping,
+                    (Class<? extends Augmentation<T>>[]) augmentations.toArray(new Class<?>[0]));
+        }
+    }
+
+    public static final class Factory<T extends Augmentable<T>> implements Immutable {
+        private final Class<? extends Augmentation<T>>[] augmentations;
+
+        Factory(final Class<? extends Augmentation<T>>[] augmentations) {
+            this.augmentations = requireNonNull(augmentations);
+        }
+
+        public <G extends DataObject> @NonNull AugmentationGroupingResolver<G, T> createResolver(
+                final Class<G> groupingClass) {
+            for (Class<? extends Augmentation<T>> cls : augmentations) {
+                checkAssignable(groupingClass, cls);
+            }
+
+            return new AugmentationGroupingResolver<>(groupingClass, augmentations);
+        }
+    }
+
+    static void checkAssignable(final Class<?> groupingClass, final Class<?> augmentationClass) {
+        checkArgument(groupingClass.isAssignableFrom(augmentationClass), "%s is not compatible with grouping %s",
+            augmentationClass, groupingClass);
+    }
+}
index a8191947bec43e3675ef4e2c11bfc4d2bfb1a860..886719c1cab26ed4dd799be46c03ca473328449d 100644 (file)
@@ -24,13 +24,15 @@ import org.opendaylight.yangtools.yang.binding.Augmentation;
  *
  * @param <G> grouping
  * @param <T> Augmentable
+ * @deprecated Use {@link AugmentationGroupingResolver} instead.
  */
+@Deprecated
 public class GroupingResolver<G, T extends Augmentable<T>> {
 
     Class<G> commonInterface;
     Set<Class<? extends Augmentation<T>>> classes;
 
-    public GroupingResolver(Class<G> commonInterface) {
+    public GroupingResolver(final Class<G> commonInterface) {
         this.commonInterface = commonInterface;
         classes = new HashSet<>();
     }
@@ -41,7 +43,7 @@ public class GroupingResolver<G, T extends Augmentable<T>> {
      * @param cls equivalent augmentation class
      * @return this for chaining
      */
-    public <X extends Augmentation<T>> GroupingResolver<G, T> add(Class<X> cls) {
+    public <X extends Augmentation<T>> GroupingResolver<G, T> add(final Class<X> cls) {
         Preconditions.checkArgument(commonInterface.isAssignableFrom(cls));
         classes.add(cls);
         return this;
@@ -52,7 +54,7 @@ public class GroupingResolver<G, T extends Augmentable<T>> {
      *
      * @param clses set of equivalent augmentation classes
      */
-    public void setAugmentations(Set<Class<? extends Augmentation<T>>> clses) {
+    public void setAugmentations(final Set<Class<? extends Augmentation<T>>> clses) {
         for (Class<? extends Augmentation<T>> cls : clses) {
             Preconditions.checkArgument(commonInterface.isAssignableFrom(cls));
         }
@@ -66,7 +68,7 @@ public class GroupingResolver<G, T extends Augmentable<T>> {
      * @return shared grouping
      */
     @SuppressWarnings("unchecked")
-    public Optional<G> getExtension(T data) {
+    public Optional<G> getExtension(final T data) {
         for (Class<? extends Augmentation<T>> cls : classes) {
             Augmentation<T> potential = data.augmentation(cls);
             if (potential != null) {
index fd569699474a22b54b689ccc217a32c41e0b6243..c31f6e6e41f447c0792de1cff8a8210600c7d8d4 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -52,7 +52,7 @@ public class ArpOpConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorF
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmOfArpOpGrouping> matchGrouping = MatchUtil.ARP_OP_RESOLVER.getExtension(extension);
+        Optional<NxmOfArpOpGrouping> matchGrouping = MatchUtil.ARP_OP_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index f75749ad0e485151145ea1c163e8eaa23b37e01a..5d820f3e8bfc750ec517408acaf4d93637ba52e3 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -53,7 +53,7 @@ public class ArpShaConvertor implements ConvertorToOFJava<MatchEntry>, Convertor
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxArpShaGrouping> matchGrouping = MatchUtil.ARP_SHA_RESOLVER.getExtension(extension);
+        Optional<NxmNxArpShaGrouping> matchGrouping = MatchUtil.ARP_SHA_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 9f05096cc95f462553807f43a6bc9427363a3146..5dbafde1bc8c984210c5083de9dc9d1f07ae2fcc 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -55,7 +55,7 @@ public class ArpSpaConvertor implements ConvertorToOFJava<MatchEntry>, Convertor
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmOfArpSpaGrouping> matchGrouping = MatchUtil.ARP_SPA_RESOLVER.getExtension(extension);
+        Optional<NxmOfArpSpaGrouping> matchGrouping = MatchUtil.ARP_SPA_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index ef161c0b54ad05f197112bed6a6de29819d87001..7d7b4d12b6a42bddd44e4394f2f84c888c94de52 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -54,7 +54,7 @@ public class ArpThaConvertor implements ConvertorToOFJava<MatchEntry>, Convertor
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxArpThaGrouping> matchGrouping = MatchUtil.ARP_THA_RESOLVER.getExtension(extension);
+        Optional<NxmNxArpThaGrouping> matchGrouping = MatchUtil.ARP_THA_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 66fcd44079966ce083cb2d5429d775f739c4e3e9..20771cc33e991d2873444aa10a0c1d68080a8d93 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -55,7 +55,7 @@ public class ArpTpaConvertor implements ConvertorToOFJava<MatchEntry>, Convertor
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmOfArpTpaGrouping> matchGrouping = MatchUtil.ARP_TPA_RESOLVER.getExtension(extension);
+        Optional<NxmOfArpTpaGrouping> matchGrouping = MatchUtil.ARP_TPA_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 6b39053b2044cac60b192e35a2f0eef8068da379..3b5ce00643e406f724f1f44d4226195b1f0d614f 100755 (executable)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -50,7 +49,7 @@ public class CtMarkConvertor implements ConvertorToOFJava<MatchEntry>, Convertor
      */
     @Override
     public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
-        CtMarkCaseValue ctMarkCaseValue = ((CtMarkCaseValue) input.getMatchEntryValue());
+        CtMarkCaseValue ctMarkCaseValue = (CtMarkCaseValue) input.getMatchEntryValue();
         NxmNxCtMarkBuilder ctMarkBuilder = new NxmNxCtMarkBuilder();
         ctMarkBuilder.setCtMark(ctMarkCaseValue.getCtMarkValues().getCtMark());
         ctMarkBuilder.setMask(ctMarkCaseValue.getCtMarkValues().getMask());
@@ -69,7 +68,7 @@ public class CtMarkConvertor implements ConvertorToOFJava<MatchEntry>, Convertor
      */
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxCtMarkGrouping> matchGrouping = MatchUtil.CT_MARK_RESOLVER.getExtension(extension);
+        Optional<NxmNxCtMarkGrouping> matchGrouping = MatchUtil.CT_MARK_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 71d81c567b8c98ff1faf967dc77cbc75ff7f58fe..5c37adfc7851057d0213d955a91a8814c95ba80f 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -57,7 +56,7 @@ public class CtStateConvertor implements ConvertorToOFJava<MatchEntry>, Converto
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxCtStateGrouping> matchGrouping = MatchUtil.CT_STATE_RESOLVER.getExtension(extension);
+        Optional<NxmNxCtStateGrouping> matchGrouping = MatchUtil.CT_STATE_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index b963a0624d0ab8551116ef557288bc527935a909..8c6bcfea907e8090677d247864f65495b3181899 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -42,7 +41,7 @@ public class CtTpDstConvertor implements ConvertorToOFJava<MatchEntry>, Converto
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxCtTpDstGrouping> matchGrouping = MatchUtil.CT_TP_DST_RESOLVER.getExtension(extension);
+        Optional<NxmNxCtTpDstGrouping> matchGrouping = MatchUtil.CT_TP_DST_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 13b23249fc448cc9ce300b199b1023a7e58cb438..dfde71063cdab5476dbd473acb1244c27adb23b2 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -42,7 +41,7 @@ public class CtTpSrcConvertor implements ConvertorToOFJava<MatchEntry>, Converto
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxCtTpSrcGrouping> matchGrouping = MatchUtil.CT_TP_SRC_RESOLVER.getExtension(extension);
+        Optional<NxmNxCtTpSrcGrouping> matchGrouping = MatchUtil.CT_TP_SRC_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 62e064a224eacdde9457b4099edd75220b0b6057..cc64c360343552c89985f47e246f57f93d9417e9 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -56,7 +55,7 @@ public class CtZoneConvertor implements ConvertorToOFJava<MatchEntry>, Convertor
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxCtZoneGrouping> matchGrouping = MatchUtil.CT_ZONE_RESOLVER.getExtension(extension);
+        Optional<NxmNxCtZoneGrouping> matchGrouping = MatchUtil.CT_ZONE_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 30800db56711f8152be795b4f63bc2fbad7848aa..6b7f4c2409926b07dc9302da52eabb005747e8ef 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -54,7 +54,7 @@ public class EthDstConvertor implements ConvertorToOFJava<MatchEntry>, Convertor
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmOfEthDstGrouping> matchGrouping = MatchUtil.ETH_DST_RESOLVER.getExtension(extension);
+        Optional<NxmOfEthDstGrouping> matchGrouping = MatchUtil.ETH_DST_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index b061caa0d9f48841d495615d0957e9dc0360545d..2390dabef1eb980d85a2ddc64d39886ac516977b 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -54,7 +54,7 @@ public class EthSrcConvertor implements ConvertorToOFJava<MatchEntry>, Convertor
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmOfEthSrcGrouping> matchGrouping = MatchUtil.ETH_SRC_RESOLVER.getExtension(extension);
+        Optional<NxmOfEthSrcGrouping> matchGrouping = MatchUtil.ETH_SRC_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index cc510bd6784d635e3e8ef1b0a04b425247271043..951ebe972dde3a976c6080cd281e63558f57ad88 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -53,7 +53,7 @@ public class EthTypeConvertor implements ConvertorToOFJava<MatchEntry>, Converto
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmOfEthTypeGrouping> matchGrouping = MatchUtil.ETH_TYPE_RESOLVER.getExtension(extension);
+        Optional<NxmOfEthTypeGrouping> matchGrouping = MatchUtil.ETH_TYPE_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index a660a2117c16e1ac1043a292fa2e5332b6c59ad1..74f9eb343b715a075ee62884e70f825c5222e244 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -9,12 +9,12 @@ package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
 import com.google.common.base.Joiner;
 import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableSet;
 import com.google.common.primitives.Longs;
 import com.google.common.primitives.UnsignedBytes;
-import java.util.HashSet;
 import java.util.Iterator;
-import java.util.Set;
-import org.opendaylight.openflowplugin.extension.api.GroupingResolver;
+import org.opendaylight.openflowplugin.extension.api.AugmentationGroupingResolver;
+import org.opendaylight.openflowplugin.extension.api.AugmentationGroupingResolver.Factory;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCaseBuilder;
@@ -81,125 +81,93 @@ public final class MatchUtil {
     private static final Splitter SPLITTER = Splitter.on('.');
     private static final Joiner JOINER = Joiner.on('.');
 
-    private static final Set<Class<? extends Augmentation<Extension>>> AUGMENTATIONS_OF_EXTENSION = new HashSet<>();
-    public static final GroupingResolver<NxmNxRegGrouping, Extension> REG_RESOLVER = new GroupingResolver<>(
-            NxmNxRegGrouping.class);
-    public static final GroupingResolver<NxmNxTunIdGrouping, Extension> TUN_ID_RESOLVER = new GroupingResolver<>(
-            NxmNxTunIdGrouping.class);
-    public static final GroupingResolver<NxmNxArpShaGrouping, Extension> ARP_SHA_RESOLVER = new GroupingResolver<>(
-            NxmNxArpShaGrouping.class);
-    public static final GroupingResolver<NxmNxArpThaGrouping, Extension> ARP_THA_RESOLVER = new GroupingResolver<>(
-            NxmNxArpThaGrouping.class);
-    public static final GroupingResolver<NxmOfArpOpGrouping, Extension> ARP_OP_RESOLVER = new GroupingResolver<>(
-            NxmOfArpOpGrouping.class);
-    public static final GroupingResolver<NxmOfArpSpaGrouping, Extension> ARP_SPA_RESOLVER = new GroupingResolver<>(
-            NxmOfArpSpaGrouping.class);
-    public static final GroupingResolver<NxmOfArpTpaGrouping, Extension> ARP_TPA_RESOLVER = new GroupingResolver<>(
-            NxmOfArpTpaGrouping.class);
-    public static final GroupingResolver<NxmNxTunIpv4DstGrouping, Extension> TUN_IPV4_DST_RESOLVER =
-            new GroupingResolver<>(NxmNxTunIpv4DstGrouping.class);
-    public static final GroupingResolver<NxmNxTunIpv4SrcGrouping, Extension> TUN_IPV4_SRC_RESOLVER =
-            new GroupingResolver<>(NxmNxTunIpv4SrcGrouping.class);
-    public static final GroupingResolver<NxmOfEthDstGrouping, Extension> ETH_DST_RESOLVER = new GroupingResolver<>(
-            NxmOfEthDstGrouping.class);
-    public static final GroupingResolver<NxmOfEthSrcGrouping, Extension> ETH_SRC_RESOLVER = new GroupingResolver<>(
-            NxmOfEthSrcGrouping.class);
-    public static final GroupingResolver<NxmOfEthTypeGrouping, Extension> ETH_TYPE_RESOLVER = new GroupingResolver<>(
-            NxmOfEthTypeGrouping.class);
-    public static final GroupingResolver<NxmNxNsiGrouping, Extension> NSI_RESOLVER = new GroupingResolver<>(
-            NxmNxNsiGrouping.class);
-    public static final GroupingResolver<NxmNxNspGrouping, Extension> NSP_RESOLVER = new GroupingResolver<>(
-            NxmNxNspGrouping.class);
-    public static final GroupingResolver<NxmNxNshc1Grouping, Extension> NSC1_RESOLVER = new GroupingResolver<>(
-            NxmNxNshc1Grouping.class);
-    public static final GroupingResolver<NxmNxNshc2Grouping, Extension> NSC2_RESOLVER = new GroupingResolver<>(
-            NxmNxNshc2Grouping.class);
-    public static final GroupingResolver<NxmNxNshc3Grouping, Extension> NSC3_RESOLVER = new GroupingResolver<>(
-            NxmNxNshc3Grouping.class);
-    public static final GroupingResolver<NxmNxNshc4Grouping, Extension> NSC4_RESOLVER = new GroupingResolver<>(
-            NxmNxNshc4Grouping.class);
-    public static final GroupingResolver<NxmNxNshFlagsGrouping, Extension> NSH_FLAGS_RESOLVER =
-            new GroupingResolver<>(NxmNxNshFlagsGrouping.class);
-    public static final GroupingResolver<NxmNxNshMdtypeGrouping, Extension> NSH_MDTYPE_RESOLVER =
-            new GroupingResolver<>(NxmNxNshMdtypeGrouping.class);
-    public static final GroupingResolver<NxmNxNshNpGrouping, Extension> NSH_NP_RESOLVER = new GroupingResolver<>(
-            NxmNxNshNpGrouping.class);
-    public static final GroupingResolver<NxmNxNshTtlGrouping, Extension> NSH_TTL_RESOLVER =
-            new GroupingResolver<>(NxmNxNshTtlGrouping.class);
-    public static final GroupingResolver<NxmOfTcpSrcGrouping, Extension> TCP_SRC_RESOLVER = new GroupingResolver<>(
-            NxmOfTcpSrcGrouping.class);
-    public static final GroupingResolver<NxmOfTcpDstGrouping, Extension> TCP_DST_RESOLVER = new GroupingResolver<>(
-            NxmOfTcpDstGrouping.class);
-    public static final GroupingResolver<NxmOfUdpSrcGrouping, Extension> UDP_SRC_RESOLVER = new GroupingResolver<>(
-            NxmOfUdpSrcGrouping.class);
-    public static final GroupingResolver<NxmOfUdpDstGrouping, Extension> UDP_DST_RESOLVER = new GroupingResolver<>(
-            NxmOfUdpDstGrouping.class);
-    public static final GroupingResolver<NxmNxCtMarkGrouping, Extension> CT_MARK_RESOLVER = new GroupingResolver<>(
-            NxmNxCtMarkGrouping.class);
-    public static final GroupingResolver<NxmNxCtStateGrouping, Extension> CT_STATE_RESOLVER = new GroupingResolver<>(
-            NxmNxCtStateGrouping.class);
-    public static final GroupingResolver<NxmNxCtZoneGrouping, Extension> CT_ZONE_RESOLVER = new GroupingResolver<>(
-            NxmNxCtZoneGrouping.class);
-    public static final GroupingResolver<NxmNxCtTpSrcGrouping, Extension> CT_TP_SRC_RESOLVER = new GroupingResolver<>(
-            NxmNxCtTpSrcGrouping.class);
-    public static final GroupingResolver<NxmNxCtTpDstGrouping, Extension> CT_TP_DST_RESOLVER = new GroupingResolver<>(
-            NxmNxCtTpDstGrouping.class);
-    public static final GroupingResolver<NxmNxPktMarkGrouping, Extension> PKT_MARK_RESOLVER = new GroupingResolver<>(
-            NxmNxPktMarkGrouping.class);
-    public static final GroupingResolver<NxmOfInPortGrouping, Extension> NXM_OF_INPORT_RESOLVER =
-            new GroupingResolver<>(NxmOfInPortGrouping.class);
+    public static final AugmentationGroupingResolver<NxmNxRegGrouping, Extension> REG_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxTunIdGrouping, Extension> TUN_ID_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxArpShaGrouping, Extension> ARP_SHA_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxArpThaGrouping, Extension> ARP_THA_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmOfArpOpGrouping, Extension> ARP_OP_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmOfArpSpaGrouping, Extension> ARP_SPA_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmOfArpTpaGrouping, Extension> ARP_TPA_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxTunIpv4DstGrouping, Extension> TUN_IPV4_DST_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxTunIpv4SrcGrouping, Extension> TUN_IPV4_SRC_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmOfEthDstGrouping, Extension> ETH_DST_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmOfEthSrcGrouping, Extension> ETH_SRC_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmOfEthTypeGrouping, Extension> ETH_TYPE_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxNsiGrouping, Extension> NSI_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxNspGrouping, Extension> NSP_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxNshc1Grouping, Extension> NSC1_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxNshc2Grouping, Extension> NSC2_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxNshc3Grouping, Extension> NSC3_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxNshc4Grouping, Extension> NSC4_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxNshFlagsGrouping, Extension> NSH_FLAGS_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxNshMdtypeGrouping, Extension> NSH_MDTYPE_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxNshNpGrouping, Extension> NSH_NP_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxNshTtlGrouping, Extension> NSH_TTL_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmOfTcpSrcGrouping, Extension> TCP_SRC_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmOfTcpDstGrouping, Extension> TCP_DST_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmOfUdpSrcGrouping, Extension> UDP_SRC_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmOfUdpDstGrouping, Extension> UDP_DST_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxCtMarkGrouping, Extension> CT_MARK_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxCtStateGrouping, Extension> CT_STATE_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxCtZoneGrouping, Extension> CT_ZONE_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxCtTpSrcGrouping, Extension> CT_TP_SRC_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxCtTpDstGrouping, Extension> CT_TP_DST_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmNxPktMarkGrouping, Extension> PKT_MARK_RESOLVER;
+    public static final AugmentationGroupingResolver<NxmOfInPortGrouping, Extension> NXM_OF_INPORT_RESOLVER;
 
     static {
-        AUGMENTATIONS_OF_EXTENSION.add(NxAugMatchRpcAddFlow.class);
-        AUGMENTATIONS_OF_EXTENSION.add(NxAugMatchRpcRemoveFlow.class);
-        AUGMENTATIONS_OF_EXTENSION.add(NxAugMatchRpcUpdateFlowOriginal.class);
-        AUGMENTATIONS_OF_EXTENSION.add(NxAugMatchRpcUpdateFlowUpdated.class);
-        AUGMENTATIONS_OF_EXTENSION.add(NxAugMatchNodesNodeTableFlow.class);
-        AUGMENTATIONS_OF_EXTENSION.add(NxAugMatchNotifSwitchFlowRemoved.class);
-        AUGMENTATIONS_OF_EXTENSION.add(NxAugMatchNotifPacketIn.class);
-        //augmentationsOfExtension.add(NxAugMatchNotifUpdateFlowStats.class);
-        AUGMENTATIONS_OF_EXTENSION.add(NxAugMatchPacketInMessage.class);
-        REG_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        TUN_ID_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        ARP_SHA_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        ARP_THA_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        ARP_OP_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        ARP_SPA_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        ARP_TPA_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        TUN_IPV4_DST_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        TUN_IPV4_SRC_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        ETH_DST_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        ETH_SRC_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        ETH_TYPE_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        NSP_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        NSI_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        NSC1_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        NSC2_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        NSC3_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        NSC4_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        NSH_FLAGS_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        NSH_MDTYPE_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        NSH_NP_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        NSH_TTL_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        TCP_SRC_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        TCP_DST_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        UDP_SRC_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        UDP_DST_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        CT_STATE_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        CT_ZONE_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        NXM_OF_INPORT_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        CT_MARK_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        CT_TP_SRC_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        CT_TP_DST_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
-        PKT_MARK_RESOLVER.setAugmentations(AUGMENTATIONS_OF_EXTENSION);
+        final Factory<Extension> factory = AugmentationGroupingResolver.factory(Extension.class, ImmutableSet.of(
+            NxAugMatchRpcAddFlow.class,
+            NxAugMatchRpcRemoveFlow.class,
+            NxAugMatchRpcUpdateFlowOriginal.class,
+            NxAugMatchRpcUpdateFlowUpdated.class,
+            NxAugMatchNodesNodeTableFlow.class,
+            NxAugMatchNotifSwitchFlowRemoved.class,
+            NxAugMatchNotifPacketIn.class,
+            // NxAugMatchNotifUpdateFlowStats.class,
+            NxAugMatchPacketInMessage.class));
+
+        REG_RESOLVER = factory.createResolver(NxmNxRegGrouping.class);
+        TUN_ID_RESOLVER = factory.createResolver(NxmNxTunIdGrouping.class);
+        ARP_SHA_RESOLVER = factory.createResolver(NxmNxArpShaGrouping.class);
+        ARP_THA_RESOLVER = factory.createResolver(NxmNxArpThaGrouping.class);
+        ARP_OP_RESOLVER = factory.createResolver(NxmOfArpOpGrouping.class);
+        ARP_SPA_RESOLVER = factory.createResolver(NxmOfArpSpaGrouping.class);
+        ARP_TPA_RESOLVER = factory.createResolver(NxmOfArpTpaGrouping.class);
+        TUN_IPV4_DST_RESOLVER = factory.createResolver(NxmNxTunIpv4DstGrouping.class);
+        TUN_IPV4_SRC_RESOLVER = factory.createResolver(NxmNxTunIpv4SrcGrouping.class);
+        ETH_DST_RESOLVER = factory.createResolver(NxmOfEthDstGrouping.class);
+        ETH_SRC_RESOLVER = factory.createResolver(NxmOfEthSrcGrouping.class);
+        ETH_TYPE_RESOLVER = factory.createResolver(NxmOfEthTypeGrouping.class);
+        NSP_RESOLVER = factory.createResolver(NxmNxNspGrouping.class);
+        NSI_RESOLVER = factory.createResolver(NxmNxNsiGrouping.class);
+        NSC1_RESOLVER = factory.createResolver(NxmNxNshc1Grouping.class);
+        NSC2_RESOLVER = factory.createResolver(NxmNxNshc2Grouping.class);
+        NSC3_RESOLVER = factory.createResolver(NxmNxNshc3Grouping.class);
+        NSC4_RESOLVER = factory.createResolver(NxmNxNshc4Grouping.class);
+        NSH_FLAGS_RESOLVER = factory.createResolver(NxmNxNshFlagsGrouping.class);
+        NSH_MDTYPE_RESOLVER = factory.createResolver(NxmNxNshMdtypeGrouping.class);
+        NSH_NP_RESOLVER = factory.createResolver(NxmNxNshNpGrouping.class);
+        NSH_TTL_RESOLVER = factory.createResolver(NxmNxNshTtlGrouping.class);
+        TCP_SRC_RESOLVER = factory.createResolver(NxmOfTcpSrcGrouping.class);
+        TCP_DST_RESOLVER = factory.createResolver(NxmOfTcpDstGrouping.class);
+        UDP_SRC_RESOLVER = factory.createResolver(NxmOfUdpSrcGrouping.class);
+        UDP_DST_RESOLVER = factory.createResolver(NxmOfUdpDstGrouping.class);
+        CT_STATE_RESOLVER = factory.createResolver(NxmNxCtStateGrouping.class);
+        CT_ZONE_RESOLVER = factory.createResolver(NxmNxCtZoneGrouping.class);
+        NXM_OF_INPORT_RESOLVER = factory.createResolver(NxmOfInPortGrouping.class);
+        CT_MARK_RESOLVER = factory.createResolver(NxmNxCtMarkGrouping.class);
+        CT_TP_SRC_RESOLVER = factory.createResolver(NxmNxCtTpSrcGrouping.class);
+        CT_TP_DST_RESOLVER = factory.createResolver(NxmNxCtTpDstGrouping.class);
+        PKT_MARK_RESOLVER = factory.createResolver(NxmNxPktMarkGrouping.class);
     }
 
     private MatchUtil() {
     }
 
-    public static MatchEntryBuilder createDefaultMatchEntryBuilder(Class<? extends MatchField> matchField,
-                                                                   Class<? extends OxmClassBase> oxmClass,
-                                                                   MatchEntryValue matchEntryValue) {
+    public static MatchEntryBuilder createDefaultMatchEntryBuilder(final Class<? extends MatchField> matchField,
+                                                                   final Class<? extends OxmClassBase> oxmClass,
+                                                                   final MatchEntryValue matchEntryValue) {
         MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
         matchEntryBuilder.setHasMask(false);
         matchEntryBuilder.setOxmMatchField(matchField);
@@ -209,9 +177,9 @@ public final class MatchUtil {
     }
 
     public static <V extends Augmentation<ExperimenterIdCase>> MatchEntryBuilder createExperimenterMatchEntryBuilder(
-            Class<? extends MatchField> matchField,
-            long experimenterId,
-            NxExpMatchEntryValue value) {
+            final Class<? extends MatchField> matchField,
+            final long experimenterId,
+            final NxExpMatchEntryValue value) {
         ExperimenterBuilder experimenterBuilder = new ExperimenterBuilder();
         experimenterBuilder.setExperimenter(new ExperimenterId(experimenterId));
         ExperimenterIdCaseBuilder expCaseBuilder = new ExperimenterIdCaseBuilder();
@@ -221,7 +189,7 @@ public final class MatchUtil {
         return createDefaultMatchEntryBuilder(matchField, ExperimenterClass.class, expCaseBuilder.build());
     }
 
-    public static Long ipv4ToLong(Ipv4Address ipv4) {
+    public static Long ipv4ToLong(final Ipv4Address ipv4) {
         Iterator<String> iterator = SPLITTER.split(ipv4.getValue()).iterator();
         byte[] bytes = new byte[8];
         for (int i = 0; i < bytes.length; i++) {
@@ -235,7 +203,7 @@ public final class MatchUtil {
         return result;
     }
 
-    public static Ipv4Address longToIpv4Address(Long value) {
+    public static Ipv4Address longToIpv4Address(final Long value) {
         byte[] bytes = Longs.toByteArray(value);
         String[] strArray = new String[4];
         for (int i = 4; i < bytes.length; i++) {
index 91d1900cb701b0be6d787fd0ef1caf77bca1cd80..febcfb36f2d5918aef936f83ba6221f5a10eff60 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
@@ -61,7 +60,7 @@ public class NshFlagsConvertor implements ConvertorToOFJava<MatchEntry>, Convert
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxNshFlagsGrouping> matchGrouping = MatchUtil.NSH_FLAGS_RESOLVER.getExtension(extension);
+        Optional<NxmNxNshFlagsGrouping> matchGrouping = MatchUtil.NSH_FLAGS_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 4f7a22289e0521bf7d281fac651230f3bab25ad3..949702e19d83d1dd1a7704b48c285e77f79a5413 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
@@ -60,7 +59,7 @@ public class NshMdtypeConvertor implements ConvertorToOFJava<MatchEntry>, Conver
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxNshMdtypeGrouping> matchGrouping = MatchUtil.NSH_MDTYPE_RESOLVER.getExtension(extension);
+        Optional<NxmNxNshMdtypeGrouping> matchGrouping = MatchUtil.NSH_MDTYPE_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index fdb030555156018c27a52b5098d20d800d3ff7fd..c72c04b3faf74da7d79ea6599aa6f8c3d1451e2f 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
@@ -60,7 +59,7 @@ public class NshNpConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorF
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxNshNpGrouping> matchGrouping = MatchUtil.NSH_NP_RESOLVER.getExtension(extension);
+        Optional<NxmNxNshNpGrouping> matchGrouping = MatchUtil.NSH_NP_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 1242ce6be7494aaa455af14ebf2c413f7fc4fea1..f75757a5c0198294d33d10c8204b6b08e75d8341 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
@@ -58,7 +57,7 @@ public class NshTtlConvertor implements ConvertorToOFJava<MatchEntry>, Convertor
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxNshTtlGrouping> matchGrouping = MatchUtil.NSH_TTL_RESOLVER.getExtension(extension);
+        Optional<NxmNxNshTtlGrouping> matchGrouping = MatchUtil.NSH_TTL_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index cbb7288a8a6100c53834dd6c3c08e380a0799186..ee47eb720fa62b499e41f3e9bd024179eacc70c7 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
@@ -53,7 +53,7 @@ public class Nshc1Convertor implements ConvertorToOFJava<MatchEntry>, ConvertorF
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxNshc1Grouping> matchGrouping = MatchUtil.NSC1_RESOLVER.getExtension(extension);
+        Optional<NxmNxNshc1Grouping> matchGrouping = MatchUtil.NSC1_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index fdf894d7a6f477bd7fc604bbc7fd205e7340eb37..fcba288232912e0855ea07b1f1350097312d7a5c 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
@@ -53,7 +53,7 @@ public class Nshc2Convertor implements ConvertorToOFJava<MatchEntry>, ConvertorF
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxNshc2Grouping> matchGrouping = MatchUtil.NSC2_RESOLVER.getExtension(extension);
+        Optional<NxmNxNshc2Grouping> matchGrouping = MatchUtil.NSC2_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 89bb0e7ce9ce0d7c25f0e41df6d52b709b90be8f..c697eb9f18d30840ddd06576668d1f7a8cd0be8a 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
@@ -53,7 +53,7 @@ public class Nshc3Convertor implements ConvertorToOFJava<MatchEntry>, ConvertorF
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxNshc3Grouping> matchGrouping = MatchUtil.NSC3_RESOLVER.getExtension(extension);
+        Optional<NxmNxNshc3Grouping> matchGrouping = MatchUtil.NSC3_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index eb9ac9414e4e6b8bab7487b414d7d71ae509c4e1..2b61cfa1e5a4b83953df1f86e171caa208731170 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
@@ -53,7 +53,7 @@ public class Nshc4Convertor implements ConvertorToOFJava<MatchEntry>, ConvertorF
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxNshc4Grouping> matchGrouping = MatchUtil.NSC4_RESOLVER.getExtension(extension);
+        Optional<NxmNxNshc4Grouping> matchGrouping = MatchUtil.NSC4_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 95a9d139d723909e1d2ec0945067d39ce74e6b1c..b3bdceada347fa9bb50394857d624eb1e0eac061 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
@@ -55,7 +54,7 @@ public class NsiConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFro
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxNsiGrouping> matchGrouping = MatchUtil.NSI_RESOLVER.getExtension(extension);
+        Optional<NxmNxNsiGrouping> matchGrouping = MatchUtil.NSI_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index eb44b15015fdbc8b7cc9fd989522d93c1054b624..e612bfad5e6fd6cb261feea2881a13feef1df223 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowjava.nx.api.NiciraConstants;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
@@ -56,7 +55,7 @@ public class NspConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFro
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxNspGrouping> matchGrouping = MatchUtil.NSP_RESOLVER.getExtension(extension);
+        Optional<NxmNxNspGrouping> matchGrouping = MatchUtil.NSP_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index f3a33a1637852672ac07600ba9cc3b9393c61d64..04d20065122eeca417b03d84b25105c26b3bb685 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -50,8 +50,7 @@ public class NxmInPortConvertor implements ConvertorToOFJava<MatchEntry>,
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmOfInPortGrouping> matchGrouping = MatchUtil.NXM_OF_INPORT_RESOLVER
-                .getExtension(extension);
+        Optional<NxmOfInPortGrouping> matchGrouping = MatchUtil.NXM_OF_INPORT_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index c1fd148239757ee800136fda8d781f40505f06e3..dccffb02d8438d3606a8c602d92672360204e8b6 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -42,7 +41,7 @@ public class PktMarkConvertor implements ConvertorToOFJava<MatchEntry>, Converto
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxPktMarkGrouping> matchGrouping = MatchUtil.PKT_MARK_RESOLVER.getExtension(extension);
+        Optional<NxmNxPktMarkGrouping> matchGrouping = MatchUtil.PKT_MARK_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index dfd68766cd91bc7a5cc603df085a770a153f2522..2714ea920fa759458de9f3307413de569b33c5d4 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -7,8 +7,8 @@
  */
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
 import java.util.Objects;
+import java.util.Optional;
 import org.opendaylight.openflowjava.nx.codec.match.NiciraMatchCodecs;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
@@ -83,7 +83,7 @@ public class RegConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFro
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxRegGrouping> matchGrouping = MatchUtil.REG_RESOLVER.getExtension(extension);
+        Optional<NxmNxRegGrouping> matchGrouping = MatchUtil.REG_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 5c556c65486ee571a412e0bdcb36a0a881175eda..f0d543e2f35b36504cfc4510189a170a3d3a6aa0 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -57,7 +56,7 @@ public class TcpDstConvertor implements ConvertorToOFJava<MatchEntry>, Convertor
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmOfTcpDstGrouping> matchGrouping = MatchUtil.TCP_DST_RESOLVER.getExtension(extension);
+        Optional<NxmOfTcpDstGrouping> matchGrouping = MatchUtil.TCP_DST_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 8eaa8b2b4eb48b0397c02c9f096fe90cd0b643a5..7b09c567926a134c172a2dc00c266a96167fa3e7 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -56,7 +55,7 @@ public class TcpSrcConvertor implements ConvertorToOFJava<MatchEntry>, Convertor
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmOfTcpSrcGrouping> matchGrouping = MatchUtil.TCP_SRC_RESOLVER.getExtension(extension);
+        Optional<NxmOfTcpSrcGrouping> matchGrouping = MatchUtil.TCP_SRC_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 6c9af2287a83bf90d35165477ccf394668a10334..a34cc688ff12c7110e2bcbc56c9302d7ea9a15c6 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -73,7 +72,7 @@ public class TunIPv4DstConvertor implements ConvertorToOFJava<MatchEntry>, Conve
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxTunIpv4DstGrouping> matchGrouping = MatchUtil.TUN_IPV4_DST_RESOLVER.getExtension(extension);
+        Optional<NxmNxTunIpv4DstGrouping> matchGrouping = MatchUtil.TUN_IPV4_DST_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 0b8752deb97ec46d95a7da2b6b912a411155ed85..9da50d600ada637d14ff5923d3019035e2518007 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -73,7 +72,7 @@ public class TunIPv4SrcConvertor implements ConvertorToOFJava<MatchEntry>, Conve
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmNxTunIpv4SrcGrouping> matchGrouping = MatchUtil.TUN_IPV4_SRC_RESOLVER.getExtension(extension);
+        Optional<NxmNxTunIpv4SrcGrouping> matchGrouping = MatchUtil.TUN_IPV4_SRC_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index cb80d4c48ad673de7d0371920404218893484373..4f26d5c6a6b33c5c57c90146de0d3ca5c21a96a3 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -7,8 +7,8 @@
  */
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
 import java.math.BigInteger;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -52,7 +52,7 @@ public class TunIdConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorF
 
     @Override
     public MatchEntry convert(final Extension extension) {
-        Optional<NxmNxTunIdGrouping> matchGrouping = MatchUtil.TUN_ID_RESOLVER.getExtension(extension);
+        Optional<NxmNxTunIdGrouping> matchGrouping = MatchUtil.TUN_ID_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 0a93a9f793c63504d3b0103d53871fd2f5220128..5269e241153666f163c61ebd6e2e0c4875006cdb 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -57,7 +56,7 @@ public class UdpDstConvertor implements ConvertorToOFJava<MatchEntry>, Convertor
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmOfUdpDstGrouping> matchGrouping = MatchUtil.UDP_DST_RESOLVER.getExtension(extension);
+        Optional<NxmOfUdpDstGrouping> matchGrouping = MatchUtil.UDP_DST_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index 4ad47b3bc50e2fd488ff5961d5f9228471c1e0c2..9138c5266e872c3790d332fed6f8b5ee3e179e08 100644 (file)
@@ -5,10 +5,9 @@
  * 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.extension.vendor.nicira.convertor.match;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -57,7 +56,7 @@ public class UdpSrcConvertor implements ConvertorToOFJava<MatchEntry>, Convertor
 
     @Override
     public MatchEntry convert(Extension extension) {
-        Optional<NxmOfUdpSrcGrouping> matchGrouping = MatchUtil.UDP_SRC_RESOLVER.getExtension(extension);
+        Optional<NxmOfUdpSrcGrouping> matchGrouping = MatchUtil.UDP_SRC_RESOLVER.findExtension(extension);
         if (!matchGrouping.isPresent()) {
             throw new CodecPreconditionException(extension);
         }
index b8c9dde45085ec9ffd71171fbe37ab9b803b3e35..06f8849c9b5797c7d08c5481025c434d1da8172b 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>feature-repo-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index d553ee062fcfff7a5c2428fa297779c23158ce1c..01edd97ecdf7e1e3b65c5e5e41f719a0c6439b69 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index 0bd6bdd357a92755b0cd8751e5e4932205bb5a86..037f53de1a26e16d77971f2adcd4e0c18ee95353 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index 9a6369e92a753429bbca396f3e585963d42077c3..5e3f1bf1b5f089c31d1526e3257a4bdcd68752a6 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index 92d14fcc717d264c8eb5491b9997bb57a9f5d187..d0987e2c39e0169c021cebddfabe94b7ac00e8ec 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index 97d6fd45b3ea1259604be8d02f8a3b578ee1b343..e723c3b76843a7f15aae8c04406f4ca89fb7a43f 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index 782440e2ba824293027e7c139a1605806a418dee..027d5d00659150065666a54e938c7e6fab103d4d 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index ae79eca340890acdc53a8de6dfba2f0948af6bde..4dc38efa2cfd3a0697b90998e5444d9771793437 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index ec65f66ce7dfce8bd0d51b5d65ca20ea7e354187..7395775d1b2712a763dfc5583e75653eae9f0821 100644 (file)
@@ -4,7 +4,7 @@
 <parent>
     <groupId>org.opendaylight.odlparent</groupId>
     <artifactId>single-feature-parent</artifactId>
-    <version>4.0.2</version>
+    <version>4.0.5</version>
     <relativePath/>
 </parent>
 
index ddd56e564cbc890cf4958f908252cae7eb26763e..e740de5f191fa17f91fb367524017865c2d17fa5 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index fb0d043ad1344fde40b8bd09849ee4ca82d3cda3..d06d874bf0bc88b84c6ad4a143c27af048b1620a 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index 551bff49a79fee317ff89c081a6f8bc02a61b215..5d0e7cb674c18dbfc5f051654978410274df43e9 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index 962d494cadbd77892ee724b72a7aa43881721ba0..f294ddae1ad3aea5cc0e9c47703ebeb80b03ba18 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index e5262b148c0e35a7753156af5265598d148f47ac..3e2787d97e1295be805c97545e4e106c82c2b00a 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index 422b223ac0f82a13fc46b27ae97f3cec53dfbb44..91f1370ef97265c656d6b3c1b88b4a3d011f17a0 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index 731f4ae9b0be2613e20df9dc4cf08dc0ac4b6283..628c5fc465218e4f6ef2de66af17cab9d1b8d3a6 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index 2cd84f0c5a3fdfffe93475397df95973cd0f86d2..ae6ce47696f5bd94bc48862995a95d884189fe0e 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index 0a42c4c2816ec64a2aae8440443b4fc48802865f..32c5bcc4b81f3c648e67bef30b9145a006a54acf 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index 94f9252c35acd6e708723f8892091319bbc89d6f..cfc2c20c8224b3544411c72f81fc082126c903b0 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
@@ -21,7 +21,7 @@
             <dependency>
                 <groupId>org.opendaylight.mdsal</groupId>
                 <artifactId>mdsal-artifacts</artifactId>
-                <version>3.0.1</version>
+                <version>3.0.3</version>
                 <scope>import</scope>
                 <type>pom</type>
             </dependency>
index 38e01972178148042d66e68187c8f8ba32990f87..a725f494425f5ba8892d6b9427f2539d70cd46fb 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index 0cddbc15c60c3c4cd94d5da626d354905a437ed5..d5856182829ce673a52d9b15c1f0f3e875f6641d 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
index ea452269d0637d1973132d49785c2b95a2ee36f8..cbd1c7bcfb3d49d880d8cd1b325da24d48f20313 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.opendaylight.odlparent</groupId>
     <artifactId>feature-repo-parent</artifactId>
-    <version>4.0.2</version>
+    <version>4.0.5</version>
     <relativePath/>
   </parent>
 
index 72c244227c0657cd5fb015a1020be0f6c6aff1ca..79dccd5fd66a0e133bfb6de27e5ea7cc8b6e662e 100644 (file)
@@ -5,7 +5,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>4.0.2</version>
+        <version>4.0.5</version>
         <relativePath/>
     </parent>
 
@@ -33,7 +33,7 @@
             <dependency>
                 <groupId>org.opendaylight.mdsal</groupId>
                 <artifactId>mdsal-artifacts</artifactId>
-                <version>3.0.1</version>
+                <version>3.0.3</version>
                 <scope>import</scope>
                 <type>pom</type>
             </dependency>
             <type>xml</type>
             <classifier>features</classifier>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.infrautils</groupId>
+            <artifactId>odl-infrautils-diagstatus</artifactId>
+            <version>1.5.0-SNAPSHOT</version>
+            <type>xml</type>
+            <classifier>features</classifier>
+        </dependency>
         <!-- bundle dependencies -->
         <dependency>
             <groupId>${project.groupId}</groupId>
index da054ad272efb562c9b5e985dfc2f3cc93158e0c..b8049a0e17065f564ed9d495b56d791945b98270 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.opendaylight.odlparent</groupId>
     <artifactId>odlparent-lite</artifactId>
-    <version>4.0.2</version>
+    <version>4.0.5</version>
     <relativePath/>
   </parent>
 
index 4d782a1adaeb9697500b002e36bc190d93d50ae8..83da0b655b9e18e826082f11aaa1a739a19c80fb 100644 (file)
             <artifactId>slf4j-log4j12</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.infrautils</groupId>
+            <artifactId>infrautils-util</artifactId>
+            <version>${infrautils.version}</version>
+        </dependency>
         <dependency>
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.infrautils</groupId>
+            <artifactId>diagstatus-api</artifactId>
+            <version>${infrautils.version}</version>
+        </dependency>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
index 1cc8a15e443d4bdc69613b8a8460a9ae15f855ed..319c5b9622c9043dc55a745ef99a68966c69b59f 100644 (file)
@@ -11,8 +11,11 @@ import com.google.common.base.MoreObjects;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.List;
+import javax.inject.Inject;
 import javax.inject.Singleton;
+import org.apache.aries.blueprint.annotation.service.Reference;
 import org.apache.aries.blueprint.annotation.service.Service;
+import org.opendaylight.infrautils.diagstatus.DiagStatusService;
 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionConfiguration;
 import org.opendaylight.openflowjava.protocol.api.connection.ThreadConfiguration;
 import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;
@@ -32,9 +35,16 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow
 @Service(classes = SwitchConnectionProviderFactory.class)
 public class SwitchConnectionProviderFactoryImpl implements SwitchConnectionProviderFactory {
 
+    private final DiagStatusService diagStatusService;
+
+    @Inject
+    public SwitchConnectionProviderFactoryImpl(@Reference DiagStatusService diagStatusService) {
+        this.diagStatusService = diagStatusService;
+    }
+
     @Override
     public SwitchConnectionProvider newInstance(SwitchConnectionConfig config) {
-        return new SwitchConnectionProviderImpl(new ConnectionConfigurationImpl(config));
+        return new SwitchConnectionProviderImpl(new ConnectionConfigurationImpl(config), diagStatusService);
     }
 
     private static InetAddress getInetAddress(final IpAddress address) throws UnknownHostException {
index 9ead24b5cd43d1fff11e15a9b55ff2935f0a6d65..5d135be153f61a51bddcfa44a9ed505820a5dd9f 100755 (executable)
@@ -9,10 +9,19 @@
 
 package org.opendaylight.openflowjava.protocol.impl.core;
 
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.epoll.Epoll;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.opendaylight.infrautils.diagstatus.DiagStatusService;
+import org.opendaylight.infrautils.diagstatus.ServiceDescriptor;
+import org.opendaylight.infrautils.diagstatus.ServiceState;
+import org.opendaylight.infrautils.utils.concurrent.Executors;
 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionConfiguration;
 import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
@@ -60,8 +69,10 @@ import org.slf4j.LoggerFactory;
  */
 public class SwitchConnectionProviderImpl implements SwitchConnectionProvider, ConnectionInitializer {
 
-    private static final Logger LOG = LoggerFactory
-            .getLogger(SwitchConnectionProviderImpl.class);
+    private static final Logger LOG = LoggerFactory.getLogger(SwitchConnectionProviderImpl.class);
+    private static final String THREAD_NAME_PREFIX = "OFP-SwitchConnectionProvider-Udp/TcpHandler";
+    private static final String OPENFLOW_JAVA_SERVICE_NAME_PREFIX = "OPENFLOW_SERVER";
+
     private SwitchConnectionHandler switchConnectionHandler;
     private ServerFacade serverFacade;
     private final ConnectionConfiguration connConfig;
@@ -69,10 +80,24 @@ public class SwitchConnectionProviderImpl implements SwitchConnectionProvider, C
     private final SerializerRegistry serializerRegistry;
     private final DeserializerRegistry deserializerRegistry;
     private final DeserializationFactory deserializationFactory;
+    private final ListeningExecutorService listeningExecutorService;
+    private final DiagStatusService diagStatusService;
+    private final String diagStatusIdentifier;
+    private final String threadName;
     private TcpConnectionInitializer connectionInitializer;
 
-    public SwitchConnectionProviderImpl(ConnectionConfiguration connConfig) {
+    public SwitchConnectionProviderImpl(
+            @Nullable ConnectionConfiguration connConfig, DiagStatusService diagStatusService) {
         this.connConfig = connConfig;
+        String connectionSuffix = createConnectionSuffix(connConfig);
+
+        this.diagStatusService = diagStatusService;
+        this.diagStatusIdentifier = OPENFLOW_JAVA_SERVICE_NAME_PREFIX + connectionSuffix;
+        diagStatusService.register(diagStatusIdentifier);
+
+        this.threadName = THREAD_NAME_PREFIX + connectionSuffix;
+        this.listeningExecutorService = Executors.newListeningSingleThreadExecutor(threadName, LOG);
+
         serializerRegistry = new SerializerRegistryImpl();
         if (connConfig != null) {
             serializerRegistry.setGroupAddModConfig(connConfig.isGroupAddModEnabled());
@@ -84,6 +109,17 @@ public class SwitchConnectionProviderImpl implements SwitchConnectionProvider, C
         deserializationFactory = new DeserializationFactory(deserializerRegistry);
     }
 
+    // ID based, on configuration, used for diagstatus serviceIdentifier (ServiceDescriptor moduleServiceName)
+    private static String createConnectionSuffix(@Nullable ConnectionConfiguration config) {
+        if (config != null && config.getAddress() != null) {
+            return "-" + config.getAddress().toString() + "_" + config.getPort();
+        } else if (config != null) {
+            return "_" + config.getPort();
+        } else {
+            return "-null-config";
+        }
+    }
+
     @Override
     public void setSwitchConnectionHandler(final SwitchConnectionHandler switchConnectionHandler) {
         LOG.debug("setSwitchConnectionHandler");
@@ -97,7 +133,9 @@ public class SwitchConnectionProviderImpl implements SwitchConnectionProvider, C
             LOG.warn("Can not shutdown - not configured or started");
             throw new IllegalStateException("SwitchConnectionProvider is not started or not configured.");
         }
-        return serverFacade.shutdown();
+        ListenableFuture<Boolean> serverFacadeShutdownFuture = serverFacade.shutdown();
+        Executors.shutdownAndAwaitTermination(listeningExecutorService);
+        return serverFacadeShutdownFuture;
     }
 
     @Override
@@ -110,7 +148,19 @@ public class SwitchConnectionProviderImpl implements SwitchConnectionProvider, C
             if (switchConnectionHandler == null) {
                 throw new IllegalStateException("SwitchConnectionHandler is not set");
             }
-            new Thread(serverFacade).start();
+            Futures.addCallback(listeningExecutorService.submit(serverFacade), new FutureCallback<Object>() {
+
+                @Override
+                public void onFailure(Throwable throwable) {
+                    diagStatusService.report(new ServiceDescriptor(diagStatusIdentifier, throwable));
+                }
+
+                @Override
+                public void onSuccess(@Nullable Object nullResult) {
+                    diagStatusService.report(new ServiceDescriptor(
+                            diagStatusIdentifier, ServiceState.ERROR, threadName + " terminated"));
+                }
+            } , MoreExecutors.directExecutor());
             result = serverFacade.getIsOnlineFuture();
         } catch (RuntimeException e) {
             final SettableFuture<Boolean> exResult = SettableFuture.create();
@@ -122,7 +172,7 @@ public class SwitchConnectionProviderImpl implements SwitchConnectionProvider, C
 
     private ServerFacade createAndConfigureServer() {
         LOG.debug("Configuring ..");
-        ServerFacade server = null;
+        ServerFacade server;
         final ChannelInitializerFactory factory = new ChannelInitializerFactory();
         factory.setSwitchConnectionHandler(switchConnectionHandler);
         factory.setSwitchIdleTimeout(connConfig.getSwitchIdleTimeout());
@@ -138,7 +188,8 @@ public class SwitchConnectionProviderImpl implements SwitchConnectionProvider, C
         boolean isEpollEnabled = Epoll.isAvailable();
 
         if (TransportProtocol.TCP.equals(transportProtocol) || TransportProtocol.TLS.equals(transportProtocol)) {
-            server = new TcpHandler(connConfig.getAddress(), connConfig.getPort());
+            server = new TcpHandler(connConfig.getAddress(), connConfig.getPort(), () -> diagStatusService
+                            .report(new ServiceDescriptor(diagStatusIdentifier, ServiceState.OPERATIONAL)));
             final TcpChannelInitializer channelInitializer = factory.createPublishingChannelInitializer();
             ((TcpHandler) server).setChannelInitializer(channelInitializer);
             ((TcpHandler) server).initiateEventLoopGroups(connConfig.getThreadConfiguration(), isEpollEnabled);
@@ -148,7 +199,8 @@ public class SwitchConnectionProviderImpl implements SwitchConnectionProvider, C
             connectionInitializer.setChannelInitializer(channelInitializer);
             connectionInitializer.run();
         } else if (TransportProtocol.UDP.equals(transportProtocol)) {
-            server = new UdpHandler(connConfig.getAddress(), connConfig.getPort());
+            server = new UdpHandler(connConfig.getAddress(), connConfig.getPort(), () -> diagStatusService
+                    .report(new ServiceDescriptor(diagStatusIdentifier, ServiceState.OPERATIONAL)));
             ((UdpHandler) server).initiateEventLoopGroups(connConfig.getThreadConfiguration(), isEpollEnabled);
             ((UdpHandler) server).setChannelInitializer(factory.createUdpChannelInitializer());
         } else {
index ea32b251635a572cf358941ae38a99e263fd9771..f6e789065cd9fa9bef652764739887728d8b27a6 100644 (file)
@@ -76,8 +76,6 @@ public class TcpChannelInitializer extends ProtocolChannelInitializer<SocketChan
             LOG.debug("Calling OF plugin: {}", getSwitchConnectionHandler());
             getSwitchConnectionHandler().onSwitchConnected(connectionFacade);
             connectionFacade.checkListeners();
-            ch.pipeline().addLast(PipelineHandlers.IDLE_HANDLER.name(),
-                    new IdleHandler(getSwitchIdleTimeout(), TimeUnit.MILLISECONDS));
             boolean tlsPresent = false;
 
             // If this channel is configured to support SSL it will only support SSL
@@ -112,6 +110,8 @@ public class TcpChannelInitializer extends ProtocolChannelInitializer<SocketChan
             ch.pipeline().addLast(PipelineHandlers.OF_ENCODER.name(), ofEncoder);
             ch.pipeline().addLast(PipelineHandlers.DELEGATING_INBOUND_HANDLER.name(),
                     new DelegatingInboundHandler(connectionFacade));
+            ch.pipeline().addLast(PipelineHandlers.IDLE_HANDLER.name(),
+                    new IdleHandler(getSwitchIdleTimeout(), TimeUnit.MILLISECONDS));
             if (!tlsPresent) {
                 connectionFacade.fireConnectionReadyNotification();
             }
index 4eb67cfd51e6b3b570d613221ce2f9293144e1ec..288c58c92968612ad31f8117c7b2204d0351aa6a 100644 (file)
@@ -51,6 +51,7 @@ public class TcpHandler implements ServerFacade {
     private int port;
     private String address;
     private final InetAddress startupAddress;
+    private final Runnable readyRunnable;
     private EventLoopGroup workerGroup;
     private EventLoopGroup bossGroup;
     private final SettableFuture<Boolean> isOnlineFuture;
@@ -65,8 +66,8 @@ public class TcpHandler implements ServerFacade {
      *
      * @param port listening port of TCPHandler server
      */
-    public TcpHandler(final int port) {
-        this(null, port);
+    public TcpHandler(final int port, Runnable readyRunnable) {
+        this(null, port, readyRunnable);
     }
 
     /**
@@ -74,10 +75,11 @@ public class TcpHandler implements ServerFacade {
      * @param address listening address of TCPHandler server
      * @param port listening port of TCPHandler server
      */
-    public TcpHandler(final InetAddress address, final int port) {
+    public TcpHandler(final InetAddress address, final int port, Runnable readyRunnable) {
         this.port = port;
         this.startupAddress = address;
         isOnlineFuture = SettableFuture.create();
+        this.readyRunnable = readyRunnable;
     }
 
     /**
@@ -136,6 +138,10 @@ public class TcpHandler implements ServerFacade {
             LOG.debug("address from tcphandler: {}", address);
             isOnlineFuture.set(true);
             LOG.info("Switch listener started and ready to accept incoming tcp/tls connections on port: {}", port);
+
+            readyRunnable.run();
+
+            // This waits until this channel is closed, and rethrows the cause of the failure if this future failed.
             f.channel().closeFuture().sync();
         } catch (InterruptedException e) {
             LOG.error("Interrupted while waiting for port {} shutdown", port, e);
index ac61d67a7f5dce03966436609c689cbb46fdca44..0fef5d45399fdf67b956d48d296b9b1423836617 100644 (file)
@@ -32,11 +32,12 @@ import org.slf4j.LoggerFactory;
  */
 public final class UdpHandler implements ServerFacade {
 
-    private static final Logger LOG = LoggerFactory
-            .getLogger(UdpHandler.class);
+    private static final Logger LOG = LoggerFactory.getLogger(UdpHandler.class);
+
     private int port;
     private EventLoopGroup group;
     private final InetAddress startupAddress;
+    private final Runnable readyRunnable;
     private final SettableFuture<Boolean> isOnlineFuture;
     private UdpChannelInitializer channelInitializer;
     private ThreadConfiguration threadConfig;
@@ -47,8 +48,8 @@ public final class UdpHandler implements ServerFacade {
      *
      * @param port listening port of UdpHandler server
      */
-    public UdpHandler(final int port) {
-        this(null, port);
+    public UdpHandler(final int port, Runnable readyRunnable) {
+        this(null, port, readyRunnable);
     }
 
     /**
@@ -56,10 +57,11 @@ public final class UdpHandler implements ServerFacade {
      * @param address listening address of UdpHandler server
      * @param port listening port of UdpHandler server
      */
-    public UdpHandler(final InetAddress address, final int port) {
+    public UdpHandler(final InetAddress address, final int port, Runnable readyRunnable) {
         this.port = port;
         this.startupAddress = address;
         isOnlineFuture = SettableFuture.create();
+        this.readyRunnable = readyRunnable;
     }
 
     @Override
@@ -95,6 +97,8 @@ public final class UdpHandler implements ServerFacade {
             LOG.debug("Address from udpHandler: {}", address);
             isOnlineFuture.set(true);
             LOG.info("Switch listener started and ready to accept incoming udp connections on port: {}", port);
+            readyRunnable.run();
+            // This waits until this channel is closed, and rethrows the cause of the failure if this future failed.
             f.channel().closeFuture().sync();
         } catch (InterruptedException e) {
             LOG.error("Interrupted while waiting for port {} shutdown", port, e);
index 195cea24ec59c1f2978f65f5d7ae804deb907d08..151d25c1445b17f57a0ef8510e26772475d3c3b8 100644 (file)
@@ -106,7 +106,7 @@ abstract class AbstractConnectionAdapter implements ConnectionAdapter {
 
         responseCache = CacheBuilder.newBuilder().concurrencyLevel(1)
                 .expireAfterWrite(RPC_RESPONSE_EXPIRATION, TimeUnit.MINUTES).removalListener(REMOVAL_LISTENER).build();
-        LOG.info("The channel outbound queue size:{}", channelOutboundQueueSize);
+        LOG.debug("The channel outbound queue size:{}", channelOutboundQueueSize);
         this.output = new ChannelOutboundQueue(channel, channelOutboundQueueSize, address);
         channel.pipeline().addLast(output);
     }
index 3e284dd55181bb33db7fbd662640f82fffdf2164..8bbb0bc58558d4b4871de2fa13c97db2fe2bcaff 100644 (file)
@@ -55,8 +55,7 @@ public class TcpHandlerTest {
      */
     @Test
     public void testRunWithNullAddress() throws IOException, InterruptedException, ExecutionException  {
-
-        tcpHandler = new TcpHandler(null, 0);
+        tcpHandler = new TcpHandler(null, 0, () -> { });
         tcpHandler.setChannelInitializer(mockChannelInitializer);
 
         assertEquals("failed to start server", true, startupServer(false)) ;
@@ -69,8 +68,7 @@ public class TcpHandlerTest {
      */
     @Test
     public void testRunWithNullAddressOnEpoll() throws IOException, InterruptedException, ExecutionException  {
-
-        tcpHandler = new TcpHandler(null, 0);
+        tcpHandler = new TcpHandler(null, 0, () -> { });
         tcpHandler.setChannelInitializer(mockChannelInitializer);
 
         //Use Epoll native transport
@@ -84,8 +82,7 @@ public class TcpHandlerTest {
      */
     @Test
     public void testRunWithAddress() throws IOException, InterruptedException, ExecutionException  {
-
-        tcpHandler = new TcpHandler(serverAddress, 0);
+        tcpHandler = new TcpHandler(serverAddress, 0, () -> { });
         tcpHandler.setChannelInitializer(mockChannelInitializer);
 
         assertEquals("failed to start server", true, startupServer(false)) ;
@@ -98,8 +95,7 @@ public class TcpHandlerTest {
      */
     @Test
     public void testRunWithAddressOnEpoll() throws IOException, InterruptedException, ExecutionException  {
-
-        tcpHandler = new TcpHandler(serverAddress, 0);
+        tcpHandler = new TcpHandler(serverAddress, 0, () -> { });
         tcpHandler.setChannelInitializer(mockChannelInitializer);
 
         //Use Epoll native transport
@@ -114,7 +110,7 @@ public class TcpHandlerTest {
     @Test
     public void testRunWithEncryption() throws InterruptedException, IOException, ExecutionException {
         int serverPort = 28001;
-        tcpHandler = new TcpHandler(serverAddress, serverPort);
+        tcpHandler = new TcpHandler(serverAddress, serverPort, () -> { });
         tcpHandler.setChannelInitializer(mockChannelInitializer);
 
         assertEquals("failed to start server", true, startupServer(false));
@@ -133,7 +129,7 @@ public class TcpHandlerTest {
     @Test
     public void testRunWithEncryptionOnEpoll() throws InterruptedException, IOException, ExecutionException {
         int serverPort = 28001;
-        tcpHandler = new TcpHandler(serverAddress, serverPort);
+        tcpHandler = new TcpHandler(serverAddress, serverPort, () -> { });
         tcpHandler.setChannelInitializer(mockChannelInitializer);
 
         //Use Epoll native transport
@@ -157,7 +153,7 @@ public class TcpHandlerTest {
 
         try {
             firstBinder.bind(new InetSocketAddress(serverAddress, serverPort));
-            tcpHandler = new TcpHandler(serverAddress, serverPort);
+            tcpHandler = new TcpHandler(serverAddress, serverPort, () -> { });
             tcpHandler.setChannelInitializer(mockChannelInitializer);
             tcpHandler.initiateEventLoopGroups(null, false);
             tcpHandler.run();
@@ -177,7 +173,7 @@ public class TcpHandlerTest {
         try {
             firstBinder.bind(new InetSocketAddress(serverAddress, serverPort));
 
-            tcpHandler = new TcpHandler(serverAddress, serverPort);
+            tcpHandler = new TcpHandler(serverAddress, serverPort, () -> { });
             tcpHandler.setChannelInitializer(mockChannelInitializer);
             //Use Epoll native transport
             tcpHandler.initiateEventLoopGroups(null, true);
index ee39fd33ceffa08b9af7eec4ed8a49802a119902..e43e93b3ff16f73664eb0b27cb86c3598c9fa77d 100755 (executable)
@@ -15,6 +15,7 @@ import org.junit.Assert;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
+import org.opendaylight.infrautils.diagstatus.DiagStatusService;
 import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
 import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;
 import org.opendaylight.openflowjava.protocol.api.connection.TlsConfigurationImpl;
@@ -58,6 +59,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  * @author michal.polkorab
  */
 public class SwitchConnectionProviderImpl02Test {
+    @Mock DiagStatusService diagStatusService;
     @Mock SwitchConnectionHandler handler;
     @Mock OFGeneralSerializer serializer;
     @Mock OFGeneralDeserializer deserializer;
@@ -86,7 +88,7 @@ public class SwitchConnectionProviderImpl02Test {
         if (protocol != null) {
             createConfig(protocol);
         }
-        provider = new SwitchConnectionProviderImpl(config);
+        provider = new SwitchConnectionProviderImpl(config, diagStatusService);
     }
 
     private void createConfig(final TransportProtocol protocol) throws UnknownHostException {
index 54bcfa304c9d1f380cf9208586eca60802ee9933..4ebdd969838c5c1b763240a206ecbe01a51ce367 100644 (file)
@@ -19,6 +19,7 @@ import org.junit.Assert;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
+import org.opendaylight.infrautils.diagstatus.DiagStatusService;
 import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
 import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;
 import org.opendaylight.openflowjava.protocol.api.connection.TlsConfigurationImpl;
@@ -37,6 +38,7 @@ import org.slf4j.LoggerFactory;
 public class SwitchConnectionProviderImplTest {
 
     @Mock SwitchConnectionHandler handler;
+    @Mock DiagStatusService diagStatusService;
 
     private static final int SWITCH_IDLE_TIMEOUT = 2000;
     private static final int WAIT_TIMEOUT = 2000;
@@ -55,7 +57,7 @@ public class SwitchConnectionProviderImplTest {
         if (protocol != null) {
             createConfig(protocol);
         }
-        provider = new SwitchConnectionProviderImpl(config);
+        provider = new SwitchConnectionProviderImpl(config, diagStatusService);
     }
 
     private void createConfig(final TransportProtocol protocol) throws UnknownHostException {
@@ -77,8 +79,8 @@ public class SwitchConnectionProviderImplTest {
      * Tests provider startup - without configuration and {@link SwitchConnectionHandler}.
      */
     @Test
-    public void testStartup1() {
-        provider = new SwitchConnectionProviderImpl(config);
+    public void testStartup1() throws UnknownHostException {
+        startUp(null);
         final ListenableFuture<Boolean> future = provider.startup();
         try {
             future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
index b22530b91bf7f0e7d7dba6b9d337db92d196ebf4..feeef65b4179898e34d6e3e67642dfc2d427cd59 100644 (file)
@@ -49,7 +49,7 @@ public class UdpHandlerTest {
      */
     @Test
     public void testWithEmptyAddress() throws Exception {
-        udpHandler = new UdpHandler(null, 0);
+        udpHandler = new UdpHandler(null, 0, () -> { });
         udpHandler.setChannelInitializer(udpChannelInitializerMock);
         Assert.assertTrue("Wrong - start server", startupServer(false));
         try {
@@ -66,7 +66,7 @@ public class UdpHandlerTest {
      */
     @Test
     public void testWithEmptyAddressOnEpoll() throws Exception {
-        udpHandler = new UdpHandler(null, 0);
+        udpHandler = new UdpHandler(null, 0, () -> { });
         udpHandler.setChannelInitializer(udpChannelInitializerMock);
         Assert.assertTrue("Wrong - start server", startupServer(true));
         try {
@@ -84,7 +84,7 @@ public class UdpHandlerTest {
     @Test
     public void testWithAddressAndPort() throws Exception {
         int port = 9874;
-        udpHandler = new UdpHandler(InetAddress.getLocalHost(), port);
+        udpHandler = new UdpHandler(InetAddress.getLocalHost(), port, () -> { });
         udpHandler.setChannelInitializer(udpChannelInitializerMock);
         Assert.assertTrue("Wrong - start server", startupServer(false));
         try {
@@ -102,7 +102,7 @@ public class UdpHandlerTest {
     @Test
     public void testWithAddressAndPortOnEpoll() throws Exception {
         int port = 9874;
-        udpHandler = new UdpHandler(InetAddress.getLocalHost(), port);
+        udpHandler = new UdpHandler(InetAddress.getLocalHost(), port, () -> { });
         udpHandler.setChannelInitializer(udpChannelInitializerMock);
         Assert.assertTrue("Wrong - start server", startupServer(true));
         try {
index 31d366fea1aa040d9161a05392cd86457aa0447e..92c9d64bc9df7089c15431e000ec6a0e6d5d556c 100644 (file)
@@ -17,6 +17,8 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import org.junit.After;
 import org.junit.Test;
+import org.mockito.Mockito;
+import org.opendaylight.infrautils.diagstatus.DiagStatusService;
 import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;
 import org.opendaylight.openflowjava.protocol.api.connection.TlsConfigurationImpl;
 import org.opendaylight.openflowjava.protocol.impl.clients.ClientEvent;
@@ -86,7 +88,7 @@ public class IntegrationTest {
         connConfig.setTransferProtocol(protocol);
         mockPlugin = new MockPlugin();
 
-        switchConnectionProvider = new SwitchConnectionProviderImpl(connConfig);
+        switchConnectionProvider = new SwitchConnectionProviderImpl(connConfig, Mockito.mock(DiagStatusService.class));
         switchConnectionProvider.setSwitchConnectionHandler(mockPlugin);
         switchConnectionProvider.startup().get(CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS);
         if (protocol.equals(TransportProtocol.TCP) || protocol.equals(TransportProtocol.TLS)) {
index 73c535fc8dd7a22c5bed825bd9631323360aeab6..d6fd335615f031a66f9866597077708d12598a13 100644 (file)
             <plugin>
                 <groupId>org.apache.aries.blueprint</groupId>
                 <artifactId>blueprint-maven-plugin</artifactId>
+                <configuration>
+                    <scanPaths>
+                        <scanPath>org.opendaylight.openflowplugin.impl</scanPath>
+                    </scanPaths>
+                </configuration>
             </plugin>
             <plugin>
                 <groupId>org.apache.felix</groupId>
index 7b1fd45798a0ae0410605984294f30c6d3ae8984..bdaafb2429839752d50834e6381f6492340305c2 100644 (file)
@@ -7,54 +7,29 @@
  */
 package org.opendaylight.openflowplugin.impl;
 
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.util.List;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 import org.apache.aries.blueprint.annotation.service.Reference;
-import org.apache.aries.blueprint.annotation.service.Service;
 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.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
-import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProviderList;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @Singleton
-@Service(classes = ServiceStatusProvider.class)
-public class OpenflowPluginDiagStatusProvider implements ServiceStatusProvider {
+public class OpenflowPluginDiagStatusProvider {
 
     private static final Logger LOG = LoggerFactory.getLogger(OpenflowPluginDiagStatusProvider.class);
     private static final String OPENFLOW_SERVICE_NAME = "OPENFLOW";
-    private static final int OF_PORT_11 = 6633;
-    private static final int OF_PORT_13 = 6653;
 
     private final DiagStatusService diagStatusService;
-    private InetAddress defaultInetAddres;
-    private InetAddress legacyInetAddress;
 
     @Inject
-    public OpenflowPluginDiagStatusProvider(final @Reference DiagStatusService diagStatusService,
-                                            final SwitchConnectionProviderList switchConnectionProviders) {
+    public OpenflowPluginDiagStatusProvider(final @Reference DiagStatusService diagStatusService) {
         this.diagStatusService = diagStatusService;
-        setSwitchConnectionInetAddress(switchConnectionProviders);
         diagStatusService.register(OPENFLOW_SERVICE_NAME);
     }
 
-    private void setSwitchConnectionInetAddress(final List<SwitchConnectionProvider> switchConnectionProviders) {
-        switchConnectionProviders.forEach(switchConnectionProvider -> {
-            if (switchConnectionProvider.getConfiguration().getPort() == OF_PORT_11) {
-                legacyInetAddress = switchConnectionProvider.getConfiguration().getAddress();
-            } else if (switchConnectionProvider.getConfiguration().getPort() == OF_PORT_13) {
-                defaultInetAddres = switchConnectionProvider.getConfiguration().getAddress();
-            }
-        });
-    }
-
     public void reportStatus(ServiceState serviceState) {
         LOG.debug("reporting status as {} for {}", serviceState, OPENFLOW_SERVICE_NAME);
         diagStatusService.report(new ServiceDescriptor(OPENFLOW_SERVICE_NAME, serviceState));
@@ -69,39 +44,4 @@ public class OpenflowPluginDiagStatusProvider implements ServiceStatusProvider {
         LOG.debug("reporting status as {} for {}", serviceState, OPENFLOW_SERVICE_NAME);
         diagStatusService.report(new ServiceDescriptor(OPENFLOW_SERVICE_NAME, serviceState, description));
     }
-
-    @Override
-    public ServiceDescriptor getServiceDescriptor() {
-        if (getApplicationNetworkState(OF_PORT_13, defaultInetAddres)
-                && getApplicationNetworkState(OF_PORT_11, legacyInetAddress)) {
-            return new ServiceDescriptor(OPENFLOW_SERVICE_NAME, ServiceState.OPERATIONAL,
-                    "OF::PORTS:: 6653 and 6633 are up.");
-        } else {
-            return new ServiceDescriptor(OPENFLOW_SERVICE_NAME, ServiceState.ERROR,
-                    "OF::PORTS:: 6653 and 6633 are not up yet");
-        }
-    }
-
-    private boolean getApplicationNetworkState(int port, InetAddress inetAddress) {
-        Socket socket = null;
-        try {
-            if (inetAddress == null) {
-                socket = new Socket("localhost", port);
-            } else {
-                socket = new Socket(inetAddress, port);
-            }
-            LOG.debug("Socket connection established");
-            return true;
-        } catch (IOException e) {
-            return false;
-        } finally {
-            try {
-                if (socket != null) {
-                    socket.close();
-                }
-            } catch (IOException ex) {
-                LOG.error("Failed to close socket : {}", socket, ex);
-            }
-        }
-    }
 }
index 15bec2fe06c01a5e5b4044391c1fa4cd3809dbd8..8231e9db820cdfcbc22eea013c0e2e502ce25c01 100644 (file)
@@ -50,7 +50,7 @@ public class SystemNotificationsListenerImpl implements SystemNotificationsListe
 
     @Override
     public void onDisconnectEvent(final DisconnectEvent notification) {
-        LOG.debug("ConnectionEvent: Connection closed by device, Device:{}, NodeId:{}",
+        LOG.info("ConnectionEvent: Connection closed by device, Device:{}, NodeId:{}",
                 connectionContext.getConnectionAdapter().getRemoteAddress(), connectionContext.getSafeNodeIdForLOG());
         connectionContext.onConnectionClosed();
     }
index 8f78142c2def5e2b1cc9bbeb6d4c804e6f0156f5..4c2b9e860b17900432b3d37c830693ec9837daef 100644 (file)
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-        </dependency>
 
         <dependency>
             <groupId>junit</groupId>
index 4b834db095ef83e54c2d6f3c5f1607f8a7ee5dd7..6bd8eae90bca17d7dcdec401e4caba1c180a24a3 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -8,11 +8,11 @@
 package org.opendaylight.openflowplugin.openflow.md.util;
 
 import com.google.common.base.Splitter;
+import com.google.common.base.Strings;
 import java.math.BigInteger;
 import java.util.List;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
-import org.apache.commons.lang3.StringUtils;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
@@ -157,7 +157,7 @@ public abstract class InventoryDataServiceUtil {
      * @return string of size 16, padded with '0'
      */
     public static String bigIntegerToPaddedHex(final BigInteger dataPathId) {
-        return StringUtils.leftPad(dataPathId.toString(16), 16, "0");
+        return Strings.padStart(dataPathId.toString(16), 16, '0');
     }
 
     public static BigInteger extractDatapathId(final NodeRef ref) {
index 4b55403e0c7b405d46a59710c915024273ba999c..43f688faf0f354a20a75a45915ee14f10cc77cb1 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.mdsal</groupId>
         <artifactId>binding-parent</artifactId>
-        <version>3.0.1</version>
+        <version>3.0.3</version>
         <relativePath/>
     </parent>
 
@@ -85,8 +85,8 @@
                 </configuration>
             </plugin>
             <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>findbugs-maven-plugin</artifactId>
+                <groupId>com.github.spotbugs</groupId>
+                <artifactId>spotbugs-maven-plugin</artifactId>
                 <configuration>
                     <failOnError>true</failOnError>
                 </configuration>
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-pmd-plugin</artifactId>
-                        <version>3.0.1</version>
+                        <version>3.0.3</version>
                     </plugin>
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
index 78e4436030ee88bd55879c84c2852ae9f317e7bd..df6aa2af1523fc00318b1f9d62606761c5a3323f 100644 (file)
             <groupId>commons-lang</groupId>
             <artifactId>commons-lang</artifactId>
           </dependency>
+        <dependency>
+            <groupId>javax.inject</groupId>
+            <artifactId>javax.inject</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.blueprint</groupId>
+            <artifactId>blueprint-maven-plugin-annotation</artifactId>
+            <optional>true</optional>
+        </dependency>
     </dependencies>
 
     <build>
                 <artifactId>maven-bundle-plugin</artifactId>
                 <extensions>true</extensions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.aries.blueprint</groupId>
+                <artifactId>blueprint-maven-plugin</artifactId>
+            </plugin>
         </plugins>
     </build>
 </project>
index 732bca02404af63056e8a9b932bb6ab25cd44409..a62774cef3e0a8402a5f2b71e7eb6f186b2d883b 100644 (file)
@@ -8,6 +8,10 @@
 
 package org.opendaylight.openflowplugin.test;
 
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Singleton;
+import org.apache.aries.blueprint.annotation.service.Reference;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
@@ -15,6 +19,7 @@ import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Singleton
 public class OpenflowpluginTestActivator implements AutoCloseable {
     private static final Logger LOG = LoggerFactory
             .getLogger(OpenflowpluginTestActivator.class);
@@ -48,8 +53,8 @@ public class OpenflowpluginTestActivator implements AutoCloseable {
 
     public static final String NODE_ID = "foo:node:1";
 
-    public OpenflowpluginTestActivator(DataBroker dataBroker, NotificationProviderService notificationService,
-            BundleContext ctx) {
+    public OpenflowpluginTestActivator(@Reference DataBroker dataBroker,
+            @Reference NotificationProviderService notificationService, BundleContext ctx) {
         provider = new OpenflowpluginTestServiceProvider(dataBroker, notificationService);
         OpenflowpluginTestCommandProvider openflowpluginTestCommandProvider = new OpenflowpluginTestCommandProvider(
                 dataBroker, notificationService, ctx);
@@ -80,6 +85,7 @@ public class OpenflowpluginTestActivator implements AutoCloseable {
         this.groupCmdProvider = openflowPluginBulkGroupTransactionProvider;
     }
 
+    @PostConstruct
     public void init() {
         provider.register(rpcRegistry);
 
@@ -99,6 +105,7 @@ public class OpenflowpluginTestActivator implements AutoCloseable {
     }
 
     @Override
+    @PreDestroy
     @SuppressWarnings("checkstyle:IllegalCatch")
     public void close() {
         try {
diff --git a/test-provider/src/main/resources/OSGI-INF/blueprint/test-provider.xml b/test-provider/src/main/resources/OSGI-INF/blueprint/test-provider.xml
deleted file mode 100644 (file)
index d88f434..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
-    odl:use-default-for-reference-types="true">
-
-  <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"/>
-  <reference id="notificationService" interface="org.opendaylight.controller.sal.binding.api.NotificationProviderService"/>
-
-  <bean id="activator" class="org.opendaylight.openflowplugin.test.OpenflowpluginTestActivator"
-          init-method="init" destroy-method="close">
-    <argument ref="dataBroker"/>
-    <argument ref="notificationService"/>
-    <argument ref="blueprintBundleContext"/>
-  </bean>
-</blueprint>