Bug fix for IgnoreDhcp rules after switch restart. Also fixed NPE in group handler,
and made recognizing ofdpa software more generic to handle premium versions on accton switches.

Change-Id: Ie1f40dd934c2a1adb75174c90c2d6f1b71f98d3a
diff --git a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp4HandlerImpl.java b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp4HandlerImpl.java
index 2c8cf92..d715c06 100644
--- a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp4HandlerImpl.java
+++ b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp4HandlerImpl.java
@@ -243,6 +243,17 @@
         });
     }
 
+    @Override
+    public void removeIgnoreVlanState(IgnoreDhcpConfig config) {
+        if (config == null) {
+            ignoredVlans.clear();
+            return;
+        }
+        config.ignoredVlans().forEach((deviceId, vlanId) -> {
+            ignoredVlans.remove(deviceId, vlanId);
+        });
+    }
+
     public void setDhcpServerConfigs(Collection<DhcpServerConfig> configs, List<DhcpServerInfo> serverInfoList) {
         if (configs.size() == 0) {
             // no config to update
diff --git a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
index dcfc901..be1584a 100644
--- a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
+++ b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp6HandlerImpl.java
@@ -250,6 +250,17 @@
     }
 
     @Override
+    public void removeIgnoreVlanState(IgnoreDhcpConfig config) {
+        if (config == null) {
+            ignoredVlans.clear();
+            return;
+        }
+        config.ignoredVlans().forEach((deviceId, vlanId) -> {
+            ignoredVlans.remove(deviceId, vlanId);
+        });
+    }
+
+    @Override
     public void processDhcpPacket(PacketContext context, BasePacket payload) {
         checkNotNull(payload, "DHCP6 payload can't be null");
         checkState(payload instanceof DHCP6, "Payload is not a DHCP6");
diff --git a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/DhcpRelayManager.java b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/DhcpRelayManager.java
index d4ae20a..123c4b1 100644
--- a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/DhcpRelayManager.java
+++ b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/DhcpRelayManager.java
@@ -521,6 +521,8 @@
         private void deviceAvailabilityChanged(Device device) {
             if (deviceService.isAvailable(device.id())) {
                 updateIgnoreVlanConfigs();
+            } else {
+                removeIgnoreVlanState();
             }
         }
 
@@ -529,5 +531,11 @@
             v4Handler.updateIgnoreVlanConfig(config);
             v6Handler.updateIgnoreVlanConfig(config);
         }
+
+        private void removeIgnoreVlanState() {
+            IgnoreDhcpConfig config = cfgService.getConfig(appId, IgnoreDhcpConfig.class);
+            v4Handler.removeIgnoreVlanState(config);
+            v6Handler.removeIgnoreVlanState(config);
+        }
     }
 }
diff --git a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/api/DhcpHandler.java b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/api/DhcpHandler.java
index 5397d18..71f7734 100644
--- a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/api/DhcpHandler.java
+++ b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/api/DhcpHandler.java
@@ -169,4 +169,11 @@
      * @param config the config
      */
     void updateIgnoreVlanConfig(IgnoreDhcpConfig config);
+
+    /**
+     * Remove internal state for IgnoreDhcp.
+     *
+     * @param config the config
+     */
+    void removeIgnoreVlanState(IgnoreDhcpConfig config);
 }
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
index 300f2a2..2c4fb5e 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
@@ -449,6 +449,14 @@
             int edgeLabel = dskey.destinationSet().getEdgeLabel(destSw);
             Integer nextId = nhops.nextId();
 
+            if (currNeighbors == null || nextHops == null) {
+                log.warn("fixing hash groups but found currNeighbors:{} or nextHops:{}"
+                        + " in targetSw:{} for dstSw:{}", currNeighbors, nextHops,
+                        targetSw, destSw);
+                success &= false;
+                continue;
+            }
+
             Set<DeviceId> diff;
             if (revoke) {
                 diff = Sets.difference(currNeighbors, nextHops);
diff --git a/drivers/default/src/main/resources/onos-drivers.xml b/drivers/default/src/main/resources/onos-drivers.xml
index 3684457..5637221 100644
--- a/drivers/default/src/main/resources/onos-drivers.xml
+++ b/drivers/default/src/main/resources/onos-drivers.xml
@@ -119,7 +119,7 @@
 
     <!-- OFDPA drivers from vendors -->
     <driver name="accton-ofdpa3" extends="ofdpa3"
-            manufacturer="Accton Corp\." hwVersion=".*" swVersion="ofdpa 3.*">
+            manufacturer="Accton Corp\." hwVersion=".*" swVersion="ofdpa.*">
     </driver>
 
     <driver name="znyx-ofdpa" extends="ofdpa3"