Manage Acl For Existing TrafficTable Throwing Exception 58/84558/3
authorNing Zhang <zhangninglc@inspur.com>
Fri, 20 Sep 2019 09:03:18 +0000 (17:03 +0800)
committerAbhinav Gupta <abhinav.gupta@ericsson.com>
Thu, 21 Nov 2019 07:50:33 +0000 (07:50 +0000)
Issue Description:
=================
Elan id may be null, calling the intValue() must throws NPE.

ERROR:
java.lang.NullPointerException: null
    at org.opendaylight.netvirt.aclservice.utils.AclServiceUtils.createCtMarkInstructionForNewState(AclServiceUtils.java:1284)
    at org.opendaylight.netvirt.aclservice.AbstractAclServiceImpl.programAclForExistingTrafficTable(AbstractAclServiceImpl.java:481)

Solution:
================
Determine that the Elan id cannot be null before define ActionNxConntrack

Change-Id: I48a67f75f8ef73c1e44babc324157b9a85560512
Signed-off-by: Ning Zhang <zhangninglc@inspur.com>
aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/AbstractAclServiceImpl.java

index 15cc7eac8bce550ab744de774ffabbca49484e9f..65645cbcf789c46903eafcd8d62ae68d178dddde 100644 (file)
@@ -496,6 +496,11 @@ public abstract class AbstractAclServiceImpl implements AclServiceListener {
 
     private void programAclForExistingTrafficTable(AclInterface port, Ace ace, int addOrRemove, String flowName,
             List<MatchInfoBase> matches, Integer priority) {
+        if (port == null || port.getElanId() == null) {
+            LOG.debug("Acl interface or elan id is null, No need to update traffic flow table.");
+            return;
+        }
+
         AceIp acl = (AceIp) ace.getMatches().getAceType();
         final String newFlowName = flowName + this.directionString + "_" + port.getDpId() + "_" + port.getLPortTag()
                 + "_" + (acl.getAceIpVersion() instanceof AceIpv4 ? "_IPv4" : "_IPv6") + "_FlowAfterRuleDeleted";