Adding Log statements, helps during debugging 51/59551/9
authorkiranvasudeva <kirankumar.v@altencalsoftlabs.com>
Tue, 27 Jun 2017 08:56:36 +0000 (14:26 +0530)
committerSam Hague <shague@redhat.com>
Fri, 7 Jul 2017 18:29:43 +0000 (18:29 +0000)
Change-Id: Iaff8515aeff1fed46b4552029c3520ed79015826
Signed-off-by: kiranvasudeva <kirankumar.v@altencalsoftlabs.com>
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/AbstractAclServiceImpl.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/AbstractEgressAclServiceImpl.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/AbstractIngressAclServiceImpl.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/StatefulEgressAclServiceImpl.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/StatefulIngressAclServiceImpl.java

index a1baebdcbbc7a5bb6e323c9eb498d0156bdeb9b1..b9f693a1a86b1b55b41b6fb6ebf381ac2cddcfca 100644 (file)
@@ -89,9 +89,10 @@ public abstract class AbstractAclServiceImpl implements AclServiceListener {
         }
         BigInteger dpId = port.getDpId();
         if (dpId == null || port.getLPortTag() == null) {
-            LOG.error("Unable to find DId from ACL interface with id {}", port.getInterfaceId());
+            LOG.error("Unable to find DpId from ACL interface with id {}", port.getInterfaceId());
             return false;
         }
+        LOG.debug("Applying ACL on port {} with DpId {}", port, dpId);
         programAclWithAllowedAddress(port, port.getAllowedAddressPairs(), Action.ADD, NwConstants.ADD_FLOW);
         updateRemoteAclFilterTable(port, NwConstants.ADD_FLOW);
         return true;
@@ -114,7 +115,7 @@ public abstract class AbstractAclServiceImpl implements AclServiceListener {
     public boolean unbindAcl(AclInterface port) {
         BigInteger dpId = port.getDpId();
         if (dpId == null) {
-            LOG.error("Unable to find DId from ACL interface with id {}", port.getInterfaceId());
+            LOG.error("Unable to find DpId from ACL interface with id {}", port.getInterfaceId());
             return false;
         }
         unbindService(port);
@@ -129,6 +130,8 @@ public abstract class AbstractAclServiceImpl implements AclServiceListener {
         boolean isPortSecurityEnableBefore = portBefore.getPortSecurityEnabled();
         // if port security is changed, apply/remove Acls
         if (isPortSecurityEnableBefore != isPortSecurityEnable) {
+            LOG.debug("On ACL update, Port security is {} for {}", isPortSecurityEnable ? "Enabled" :
+                    "Disabled", portAfter.getInterfaceId());
             if (isPortSecurityEnable) {
                 result = applyAcl(portAfter) && bindAcl(portAfter);
             } else {
@@ -137,6 +140,7 @@ public abstract class AbstractAclServiceImpl implements AclServiceListener {
         } else if (isPortSecurityEnable) {
             // Acls has been updated, find added/removed Acls and act accordingly.
             processInterfaceUpdate(portBefore, portAfter);
+            LOG.debug("On ACL update, ACL has been updated for {}", portAfter.getInterfaceId());
         }
 
         return result;
@@ -218,6 +222,7 @@ public abstract class AbstractAclServiceImpl implements AclServiceListener {
             Action action, int addOrRemove) {
         BigInteger dpId = port.getDpId();
         int lportTag = port.getLPortTag();
+        LOG.debug("Applying ACL Allowed Address on DpId {}, lportTag {}, Action {}", dpId, lportTag, action);
         List<Uuid> aclUuidList = port.getSecurityGroups();
         String portId = port.getInterfaceId();
         programGeneralFixedRules(dpId, "", allowedAddresses, lportTag, action, addOrRemove);
index e0fe07a6253c9298da14de42da3d7c510c248b05..a1a4b77759456a0479e7824087a5de43548e288f 100644 (file)
@@ -101,11 +101,13 @@ public abstract class AbstractEgressAclServiceImpl extends AbstractAclServiceImp
                 if (vpnId != null) {
                     instructions.add(MDSALUtil.buildAndGetWriteMetadaInstruction(MetaDataUtil.getVpnIdMetadata(vpnId),
                         MetaDataUtil.METADATA_MASK_VRFID, ++instructionKey));
+                    LOG.debug("Binding ACL service for interface {} with vpnId {}", interfaceName, vpnId);
                 } else {
                     Long elanTag = aclInterface.getElanId();
                     instructions.add(
                         MDSALUtil.buildAndGetWriteMetadaInstruction(MetaDataUtil.getElanTagMetadata(elanTag),
                         MetaDataUtil.METADATA_MASK_SERVICE, ++instructionKey));
+                    LOG.debug("Binding ACL service for interface {} with ElanTag {}", interfaceName, elanTag);
                 }
                 instructions.add(
                         MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.INGRESS_ACL_TABLE, ++instructionKey));
@@ -118,6 +120,7 @@ public abstract class AbstractEgressAclServiceImpl extends AbstractAclServiceImp
                 InstanceIdentifier<BoundServices> path =
                     AclServiceUtils.buildServiceId(interfaceName, serviceIndex, ServiceModeIngress.class);
 
+
                 WriteTransaction writeTxn = dataBroker.newWriteOnlyTransaction();
                 writeTxn.put(LogicalDatastoreType.CONFIGURATION, path, serviceInfo,
                         WriteTransaction.CREATE_MISSING_PARENTS);
@@ -140,6 +143,7 @@ public abstract class AbstractEgressAclServiceImpl extends AbstractAclServiceImp
                         ServiceModeIngress.class);
 
         DataStoreJobCoordinator dataStoreCoordinator = DataStoreJobCoordinator.getInstance();
+        LOG.debug("UnBinding ACL service for interface {}", interfaceName);
         dataStoreCoordinator.enqueueJob(interfaceName,
             () -> {
                 WriteTransaction writeTxn = dataBroker.newWriteOnlyTransaction();
@@ -154,9 +158,10 @@ public abstract class AbstractEgressAclServiceImpl extends AbstractAclServiceImp
     @Override
     protected void programGeneralFixedRules(BigInteger dpid, String dhcpMacAddress,
             List<AllowedAddressPairs> allowedAddresses, int lportTag, Action action, int addOrRemove) {
-        LOG.info("programFixedRules :  adding default rules.");
+        LOG.info("programFixedRules : {} default rules.", action == Action.ADD ? "adding" : "removing");
 
         if (action == Action.ADD || action == Action.REMOVE) {
+
             egressAclDhcpAllowClientTraffic(dpid, dhcpMacAddress, lportTag, addOrRemove);
             egressAclDhcpv6AllowClientTraffic(dpid, dhcpMacAddress, lportTag, addOrRemove);
             egressAclDhcpDropServerTraffic(dpid, dhcpMacAddress, lportTag, addOrRemove);
@@ -177,7 +182,6 @@ public abstract class AbstractEgressAclServiceImpl extends AbstractAclServiceImp
 
         // Remove common macs to avoid delete and add of ARP flows having same MAC.
         deletedAAPmacs.removeAll(addedAAPmacs);
-
         programArpRule(dpId, deletedAAPmacs, lportTag, NwConstants.DEL_FLOW);
         programArpRule(dpId, addedAAPmacs, lportTag, NwConstants.ADD_FLOW);
     }
@@ -185,7 +189,7 @@ public abstract class AbstractEgressAclServiceImpl extends AbstractAclServiceImp
     @Override
     protected boolean programAclRules(AclInterface port, List<Uuid> aclUuidList, int addOrRemove) {
         BigInteger dpId = port.getDpId();
-        LOG.trace("Applying custom rules DpId {}, lportTag {}", dpId, port.getLPortTag());
+        LOG.debug("Applying custom rules on DpId {}, lportTag {}", dpId, port.getLPortTag());
         if (aclUuidList == null || dpId == null) {
             LOG.warn("one of the egress acl parameters can not be null. sg {}, dpId {}",
                     aclUuidList, dpId);
@@ -211,6 +215,7 @@ public abstract class AbstractEgressAclServiceImpl extends AbstractAclServiceImp
             List<AllowedAddressPairs> syncAllowedAddresses) {
         SecurityRuleAttr aceAttr = AclServiceUtils.getAccesssListAttributes(ace);
         if (!aceAttr.getDirection().equals(DirectionEgress.class)) {
+            LOG.debug("Ignoring Ingress direction ACE Rule {}", ace.getRuleName());
             return;
         }
         Matches matches = ace.getMatches();
@@ -418,7 +423,8 @@ public abstract class AbstractEgressAclServiceImpl extends AbstractAclServiceImp
             matches.add(buildLPortTagMatch(lportTag));
 
             List<InstructionInfo> instructions = getDispatcherTableResubmitInstructions(new ArrayList<>());
-
+            LOG.debug(addOrRemove == NwConstants.DEL_FLOW ? "Deleting " : "Adding " + "ARP Rule on DPID {}, "
+                    + "lportTag {}", dpId, lportTag);
             String flowName = "Egress_ARP_" + dpId + "_" + lportTag + "_" + mac.getValue();
             syncFlow(dpId, NwConstants.INGRESS_ACL_TABLE, flowName,
                     AclConstants.PROTO_ARP_TRAFFIC_MATCH_PRIORITY, "ACL", 0, 0,
index 6419b6e78c9434294ceb8b45e695c0f1c40832db..fdea62ab57194c74f123c7a616a688f5e4cb21ff 100644 (file)
@@ -98,11 +98,13 @@ public abstract class AbstractIngressAclServiceImpl extends AbstractAclServiceIm
                 if (vpnId != null) {
                     instructions.add(MDSALUtil.buildAndGetWriteMetadaInstruction(MetaDataUtil.getVpnIdMetadata(vpnId),
                         MetaDataUtil.METADATA_MASK_VRFID, ++instructionKey));
+                    LOG.debug("Binding ACL service for interface {} with vpnId {}", interfaceName, vpnId);
                 } else {
                     Long elanTag = aclInterface.getElanId();
                     instructions.add(
                             MDSALUtil.buildAndGetWriteMetadaInstruction(MetaDataUtil.getElanTagMetadata(elanTag),
                             MetaDataUtil.METADATA_MASK_SERVICE, ++instructionKey));
+                    LOG.debug("Binding ACL service for interface {} with ElanTag {}", interfaceName, elanTag);
                 }
                 instructions.add(
                         MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.EGRESS_ACL_TABLE, ++instructionKey));
@@ -137,6 +139,7 @@ public abstract class AbstractIngressAclServiceImpl extends AbstractAclServiceIm
                 ServiceModeEgress.class);
 
         DataStoreJobCoordinator dataStoreCoordinator = DataStoreJobCoordinator.getInstance();
+        LOG.debug("UnBinding ACL service for interface {}", interfaceName);
         dataStoreCoordinator.enqueueJob(interfaceName,
             () -> {
                 WriteTransaction writeTxn = dataBroker.newWriteOnlyTransaction();
@@ -187,6 +190,7 @@ public abstract class AbstractIngressAclServiceImpl extends AbstractAclServiceIm
     @Override
     protected boolean programAclRules(AclInterface port, List<Uuid> aclUuidList,int addOrRemove) {
         BigInteger dpId = port.getDpId();
+        LOG.debug("Applying custom rules on DpId {}, lportTag {}", dpId, port.getLPortTag());
         if (aclUuidList == null || dpId == null) {
             LOG.warn("one of the ingress acl parameters can not be null. sg {}, dpId {}",
                     aclUuidList, dpId);
@@ -368,8 +372,9 @@ public abstract class AbstractIngressAclServiceImpl extends AbstractAclServiceIm
         List<MatchInfoBase> matches = new ArrayList<>();
         matches.add(MatchEthernetType.ARP);
         matches.add(buildLPortTagMatch(lportTag));
-
         List<InstructionInfo> instructions = getDispatcherTableResubmitInstructions(new ArrayList<>());
+        LOG.debug(addOrRemove == NwConstants.DEL_FLOW ? "Deleting " : "Adding " + "ARP Rule on DPID {}, "
+                + "lportTag {}", dpId, lportTag);
         String flowName = "Ingress_ARP_" + dpId + "_" + lportTag;
         syncFlow(dpId, NwConstants.EGRESS_ACL_TABLE, flowName,
                 AclConstants.PROTO_ARP_TRAFFIC_MATCH_PRIORITY, "ACL", 0, 0,
index d72142ed7954a61321302674f87c85fe26acba08..f12bd2d6a38168969e44cd5ea3bcd7d1fec60d10 100644 (file)
@@ -37,7 +37,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev16060
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 /**
  * Provides the stateful implementation for egress (w.r.t VM) ACL service.
  *
@@ -45,6 +44,7 @@ import org.slf4j.LoggerFactory;
  * Note: Table names used are w.r.t switch. Hence, switch ingress is VM egress
  * and vice versa.
  */
+
 public class StatefulEgressAclServiceImpl extends AbstractEgressAclServiceImpl {
 
     private static final Logger LOG = LoggerFactory.getLogger(StatefulEgressAclServiceImpl.class);
@@ -91,7 +91,6 @@ public class StatefulEgressAclServiceImpl extends AbstractEgressAclServiceImpl {
         // For flows related remote ACL, unique flow priority is used for
         // each flow to avoid overlapping flows
         int priority = getEgressSpecificAclFlowPriority(dpId, addOrRemove, flowName, packetHandling);
-
         syncFlow(dpId, NwConstants.INGRESS_ACL_FILTER_TABLE, flowName, priority, "ACL", 0, 0,
                 AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
         return flowName;
@@ -150,7 +149,8 @@ public class StatefulEgressAclServiceImpl extends AbstractEgressAclServiceImpl {
         programConntrackRecircRules(dpid, allowedAddresses, AclConstants.CT_STATE_UNTRACKED_PRIORITY,
             "Recirc", portId, write);
         programEgressConntrackDropRules(dpid, lportTag, write);
-        LOG.info("programEgressAclFixedConntrackRule :  default connection tracking rule are added.");
+        LOG.info("programEgressAclFixedConntrackRule :  default connection tracking rule are {} on DpId {}"
+                + "lportTag {}.", write == NwConstants.ADD_FLOW ? "added" : "removed", dpid, lportTag);
     }
 
     /**
@@ -185,6 +185,7 @@ public class StatefulEgressAclServiceImpl extends AbstractEgressAclServiceImpl {
      * @param addOrRemove whether to add or remove the flow
      */
     private void programEgressConntrackDropRules(BigInteger dpId, int lportTag, int addOrRemove) {
+        LOG.debug("Applying Egress ConnTrack Drop Rules on DpId {}, lportTag {}", dpId, lportTag);
         programConntrackDropRule(dpId, lportTag, AclConstants.CT_STATE_TRACKED_NEW_DROP_PRIORITY, "Tracked_New",
                 AclConstants.TRACKED_NEW_CT_STATE, AclConstants.TRACKED_NEW_CT_STATE_MASK, addOrRemove);
         programConntrackDropRule(dpId, lportTag, AclConstants.CT_STATE_TRACKED_INVALID_PRIORITY, "Tracked_Invalid",
index 1ca8f6d96cef18db4f5aab27f5a14ab21e9dc1b5..d0c14011a87ac1fec532898e28084dddc6ca2824 100644 (file)
@@ -161,7 +161,8 @@ public class StatefulIngressAclServiceImpl extends AbstractIngressAclServiceImpl
         programConntrackRecircRules(dpid, allowedAddresses, AclConstants.CT_STATE_UNTRACKED_PRIORITY,
             "Recirc",portId, write);
         programIngressConntrackDropRules(dpid, lportTag, write);
-        LOG.info("programIngressAclFixedConntrackRule :  default connection tracking rule are added.");
+        LOG.info("programEgressAclFixedConntrackRule :  default connection tracking rule are {} on DpId {}"
+                + "lportTag {}.", write == NwConstants.ADD_FLOW ? "added" : "removed", dpid, lportTag);
     }
 
     /**
@@ -196,6 +197,7 @@ public class StatefulIngressAclServiceImpl extends AbstractIngressAclServiceImpl
      * @param addOrRemove whether to add or remove the flow
      */
     private void programIngressConntrackDropRules(BigInteger dpId, int lportTag, int addOrRemove) {
+        LOG.debug("Applying Egress ConnTrack Drop Rules on DpId {}, lportTag {}", dpId, lportTag);
         programConntrackDropRule(dpId, lportTag, AclConstants.CT_STATE_TRACKED_NEW_DROP_PRIORITY, "Tracked_New",
                 AclConstants.TRACKED_NEW_CT_STATE, AclConstants.TRACKED_NEW_CT_STATE_MASK, addOrRemove);
         programConntrackDropRule(dpId, lportTag, AclConstants.CT_STATE_TRACKED_INVALID_PRIORITY, "Tracked_Invalid",