Fix logging issues in natservice 78/69278/2
authorStephen Kitt <skitt@redhat.com>
Thu, 8 Mar 2018 14:41:44 +0000 (15:41 +0100)
committerSam Hague <shague@redhat.com>
Fri, 9 Mar 2018 01:30:01 +0000 (01:30 +0000)
Change-Id: I249b8d5805c552e4f569a16aa764e864f00f8950
Signed-off-by: Stephen Kitt <skitt@redhat.com>
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/EvpnDnatFlowProgrammer.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/ExternalRoutersListener.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/InterfaceStateEventListener.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptManager.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptSwitchHA.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NatRouterInterfaceListener.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NatTunnelInterfaceStateListener.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NatUtil.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/RouterToVpnListener.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/VpnFloatingIpHandler.java

index 21d5c1f57cf8a0204f051e6f79ac8ad14db1841f..acb696986e79c0b3a42bd82e1aecb439caa51718 100644 (file)
@@ -198,7 +198,7 @@ public class EvpnDnatFlowProgrammer {
                     NatUtil.waitForTransactionToComplete(writeFlowInvTx);
                 } else {
                     LOG.error("onAddFloatingIp : Error {} in rpc call to create custom Fib entries for Floating "
-                            + "IP Prefix {} on DPN {}, {}", result.getErrors(), externalIp, dpnId);
+                            + "IP Prefix {} on DPN {}", result.getErrors(), externalIp, dpnId);
                 }
             }
         }, MoreExecutors.directExecutor());
@@ -320,7 +320,7 @@ public class EvpnDnatFlowProgrammer {
                     NatUtil.waitForTransactionToComplete(removeFlowInvTx);
                 } else {
                     LOG.error("onRemoveFloatingIp : Error {} in rpc call to remove custom Fib entries for Floating "
-                            + "IP Prefix {} on DPN {}, {}", result.getErrors(), externalIp, dpnId);
+                            + "IP Prefix {} on DPN {}", result.getErrors(), externalIp, dpnId);
                 }
             }
         }, MoreExecutors.directExecutor());
index 3c23b873753e324f3040906bfe38f1f6ca4087c6..8d5242f69f664052c8609c210161dd18e3dc1ad5 100644 (file)
@@ -1890,7 +1890,7 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                         natPfibSubnetFlowRef);
                 mdsalManager.removeFlowToTx(natPfibFlowEntity, removeFlowInvTx);
                 LOG.debug("removeNaptFlowsFromActiveSwitch : Removed the flow in table {} with external subnet "
-                        + "Vpn Id {} as metadata on Napt Switch {} and vpnId {}", NwConstants.NAPT_PFIB_TABLE,
+                        + "Vpn Id {} as metadata on Napt Switch {}", NwConstants.NAPT_PFIB_TABLE,
                         subnetVpnId, dpnId);
             }
         }
@@ -2005,7 +2005,7 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
         for (String ip : externalIps) {
             String extIp = removeMaskFromIp(ip);
             String naptFlowRef = getFlowRefNaptPreFib(dpnId, NwConstants.NAPT_PFIB_TABLE, extVpnId);
-            LOG.info("removeNaptFlowsFromActiveSwitch : Remove the flow in the for the active switch"
+            LOG.info("removeNaptFlowsFromActiveSwitch : Remove the flow in table {} for the active switch"
                 + " with the DPN ID {} and router ID {} and IP {} flowRef {}",
                 NwConstants.NAPT_PFIB_TABLE, dpnId, routerId, extIp, naptFlowRef);
             FlowEntity natPfibVpnFlowEntity = NatUtil.buildFlowEntity(dpnId, NwConstants.NAPT_PFIB_TABLE, naptFlowRef);
@@ -2538,10 +2538,10 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                                              long routerId, boolean isSnatCfgd, WriteTransaction writeFlowInvTx,
                                              ProviderTypes extNwProvType) {
         long changedVpnId = bgpVpnId;
-        String logMsg = "installFlowsWithUpdatedVpnId : Update the BGP VPN ID {}";
+        String idType = "BGP VPN";
         if (bgpVpnId == NatConstants.INVALID_ID) {
             changedVpnId = routerId;
-            logMsg = "installFlowsWithUpdatedVpnId : Update the router ID {}";
+            idType = "router";
         }
 
         List<BigInteger> switches = NatUtil.getDpnsForRouter(dataBroker, routerName);
@@ -2560,33 +2560,42 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                     groupId = installGroup(dpnId, routerName, bucketInfoForNonNaptSwitches);
                 }
 
-                LOG.debug("{} in the SNAT miss entry pointing to group {} in the non NAPT switch {}",
-                        logMsg, changedVpnId, groupId, dpnId);
+                LOG.debug(
+                        "installFlowsWithUpdatedVpnId : Update the {} ID {} in the SNAT miss entry pointing to group "
+                                + "{} in the non NAPT switch {}", idType, changedVpnId, groupId, dpnId);
                 FlowEntity flowEntity = buildSnatFlowEntityWithUpdatedVpnId(dpnId, routerName, groupId, changedVpnId);
                 mdsalManager.addFlowToTx(flowEntity, writeFlowInvTx);
             } else {
-                LOG.debug("{} in the SNAT miss entry pointing to group in the primary switch {}",
-                        logMsg, changedVpnId, primarySwitchId);
+                LOG.debug(
+                        "installFlowsWithUpdatedVpnId : Update the {} ID {} in the SNAT miss entry pointing to group "
+                                + "in the primary switch {}", idType, changedVpnId, primarySwitchId);
                 FlowEntity flowEntity =
                     buildSnatFlowEntityWithUpdatedVpnIdForPrimrySwtch(primarySwitchId, routerName, changedVpnId);
                 mdsalManager.addFlowToTx(flowEntity, writeFlowInvTx);
 
-                LOG.debug("{} in the Terminating Service table (table ID 36) which forwards the packet"
-                    + " to the table 46 in the Primary switch {}", logMsg, changedVpnId, primarySwitchId);
+                LOG.debug(
+                        "installFlowsWithUpdatedVpnId : Update the {} ID {} in the Terminating Service table (table "
+                                + "ID 36) which forwards the packet to the table 46 in the Primary switch {}",
+                        idType, changedVpnId, primarySwitchId);
                 installTerminatingServiceTblEntryWithUpdatedVpnId(primarySwitchId, routerName, routerId,
                         changedVpnId, writeFlowInvTx, extNwProvType);
 
-                LOG.debug("{} in the Outbound NAPT table (table ID 46) which punts the packet to the"
-                    + " controller in the Primary switch {}", logMsg, changedVpnId, primarySwitchId);
+                LOG.debug(
+                        "installFlowsWithUpdatedVpnId : Update the {} ID {} in the Outbound NAPT table (table ID 46) "
+                                + "which punts the packet to the controller in the Primary switch {}",
+                        idType, changedVpnId, primarySwitchId);
                 createOutboundTblEntryWithBgpVpn(primarySwitchId, routerId, changedVpnId, writeFlowInvTx);
 
-                LOG.debug("{} in the NAPT PFIB TABLE which forwards the outgoing packet to FIB Table in the"
-                        + "Primary switch {}", logMsg, changedVpnId, primarySwitchId);
+                LOG.debug(
+                        "installFlowsWithUpdatedVpnId : Update the {} ID {} in the NAPT PFIB TABLE which forwards the"
+                                + " outgoing packet to FIB Table in the Primary switch {}",
+                        idType, changedVpnId, primarySwitchId);
                 installNaptPfibEntryWithBgpVpn(primarySwitchId, routerId, changedVpnId, writeFlowInvTx);
 
-                LOG.debug("{} in the NAPT flows for the Outbound NAPT table (table ID 46) and the "
-                        + "INBOUND NAPT table (table ID 44) in the Primary switch {}",
-                        logMsg, changedVpnId, primarySwitchId);
+                LOG.debug(
+                        "installFlowsWithUpdatedVpnId : Update the {} ID {} in the NAPT flows for the Outbound NAPT "
+                                + "table (table ID 46) and the INBOUND NAPT table (table ID 44) in the Primary switch"
+                                + " {}", idType, changedVpnId, primarySwitchId);
                 updateNaptFlowsWithVpnId(primarySwitchId, routerName, routerId, bgpVpnId);
 
                 LOG.debug("installFlowsWithUpdatedVpnId : Installing SNAT PFIB flow in the primary switch {}",
index a3fc74b667415ed36dd8b8ef1369ecbd40446b9e..3d5c4f6b221bf298d0e084ac88ba2262096fc4ce 100644 (file)
@@ -187,7 +187,7 @@ public class InterfaceStateEventListener
                         removeNatFlow(naptSwitch, NwConstants.OUTBOUND_NAPT_TABLE, routerId, internalIp, portnum);
                     } catch (Exception ex) {
                         LOG.error("removeSnatEntriesForPort : Failed to remove snat flow for internalIP {} with "
-                                + "Port {} protocol {} for routerId {} in OUTBOUNDTABLE of NaptSwitch {}: {}",
+                                + "Port {} protocol {} for routerId {} in OUTBOUNDTABLE of NaptSwitch {}",
                             internalIp, portnum, protocol, routerId, naptSwitch, ex);
                     }
                     //Get the external IP address and the port from the model
@@ -220,7 +220,7 @@ public class InterfaceStateEventListener
                         naptManager.removePortFromPool(internalIpPort, externalIpAddress);
                     } catch (Exception ex) {
                         LOG.error("removeSnatEntriesForPort : releaseIpExtPortMapping failed, Removal of "
-                            + "ipportmap {} for router {} failed {}", internalIpPort, routerId, ex);
+                            + "ipportmap {} for router {} failed", internalIpPort, routerId, ex);
                     }
                 }
             }
index 048f66d9cc5df9c64fc283ed93eddef2d96dde2e..421f14a1209305777a759d1847274061ac0051ef 100644 (file)
@@ -400,7 +400,7 @@ public class NaptManager {
             try {
                 removeFromIpMapDS(segmentId, address.getIpAddress());
             } catch (Exception e) {
-                LOG.error("releaseAddressMapping : Removal of  ipmap {} for router {} failed {}",
+                LOG.error("releaseAddressMapping : Removal of  ipmap {} for router {} failed",
                     address.getIpAddress(), segmentId, e);
                 return false;
             }
@@ -599,9 +599,9 @@ public class NaptManager {
                 NatUtil.buildSnatIntIpPortIdentifier(segmentId, address.getIpAddress(), protocolType),
                 intIpProtocolType);
         } catch (Exception ex) {
-            LOG.error("removeSnatIntIpPortDS : Failed to write into snat-internal-ip-port-info with exception",ex);
+            LOG.error("removeSnatIntIpPortDS : Failed to write into snat-internal-ip-port-info with exception", ex);
         }
-        LOG.debug("removeSnatIntIpPortDS : Removing SnatIp {} Port {} of router {} from SNATIntIpport datastore : {}",
+        LOG.debug("removeSnatIntIpPortDS : Removing SnatIp {} Port {} of router {} from SNATIntIpport datastore",
             address.getIpAddress(), address.getPortNumber(), segmentId);
     }
 
index 9a72205c864e47372587f2374479904c674e10ac..f80f85a660d63784472828ad54814238d24de15e 100644 (file)
@@ -230,7 +230,7 @@ public class NaptSwitchHA {
                         natPfibSubnetFlowRef);
                 mdsalManager.removeFlowToTx(natPfibFlowEntity, removeFlowInvTx);
                 LOG.debug("removeSnatFlowsInOldNaptSwitch : Removed the flow in table {} with external subnet "
-                                + "Vpn Id {} as metadata on Napt Switch {} and vpnId {}", NwConstants.NAPT_PFIB_TABLE,
+                                + "Vpn Id {} as metadata on Napt Switch {}", NwConstants.NAPT_PFIB_TABLE,
                         subnetVpnId, naptSwitch);
             }
         }
@@ -256,7 +256,7 @@ public class NaptSwitchHA {
                     BigInteger naptDpn = NatUtil.getPrimaryNaptfromRouterName(dataBroker, routerNameAssociated);
                     if (naptDpn != null && naptDpn.equals(naptSwitch)) {
                         LOG.debug("removeSnatFlowsInOldNaptSwitch : Napt switch {} is also acting as primary "
-                                + "for router {}", routerIdAssociated);
+                                + "for router {}", naptSwitch, routerIdAssociated);
                         switchSharedByRouters = true;
                         break;
                     }
@@ -348,7 +348,7 @@ public class NaptSwitchHA {
                 IpPortExternal ipPortExternal = ipPortMap.getIpPortExternal();
                 if (ipPortExternal == null) {
                     LOG.debug("removeSnatFlowsInOldNaptSwitch : External Ipport mapping not found for internalIp {} "
-                            + "with port {} for router", internalIp, internalPort, routerId);
+                            + "with port {} for router {}", internalIp, internalPort, routerId);
                     continue;
                 }
                 String externalIp = ipPortExternal.getIpAddress();
@@ -422,7 +422,7 @@ public class NaptSwitchHA {
         } else {
             if (naptSwitch.equals(BigInteger.ZERO)) {
                 LOG.warn("isNaptSwitchDown : No napt switch is elected since all the switches for router {}"
-                        + " are down. SNAT IS NOT SUPPORTED FOR ROUTER {}", routerName);
+                        + " are down. SNAT IS NOT SUPPORTED FOR ROUTER {}", routerName, routerName);
                 boolean naptUpdatedStatus = updateNaptSwitch(routerName, naptSwitch);
                 if (!naptUpdatedStatus) {
                     LOG.debug("isNaptSwitchDown : Failed to update naptSwitch {} for router {} in ds",
@@ -638,7 +638,7 @@ public class NaptSwitchHA {
                             vpnId, routerId, bgpVpnId, sourceAddress, externalAddress, proto, extGwMacAddress);
                     } catch (RuntimeException ex) {
                         LOG.error("handleNatFlowsInNewNaptSwitch : Failed to add flow in OUTBOUND_NAPT_TABLE for "
-                                + "routerid {} dpnId {} ipport {}:{} proto {} extIpport {}:{} BgpVpnId {} - {}",
+                                + "routerid {} dpnId {} ipport {}:{} proto {} extIpport {}:{} BgpVpnId {}",
                             routerId, newNaptSwitch, internalIpAddress,
                             intportnum, proto, externalAddress, extportNumber, bgpVpnId, ex);
                         return false;
index 5f72b1252c97621572a74deac44eddf31eaeae02..5d398329f25f745564add88a8af45f44f58c3864 100644 (file)
@@ -72,7 +72,7 @@ public class NatRouterInterfaceListener
             MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION,
                 NatUtil.getRouterInterfaceId(interfaceName), getRouterInterface(interfaceName, routerId));
         } catch (Exception e) {
-            LOG.error("add: Unable to write data in RouterInterface model", e.getMessage());
+            LOG.error("add: Unable to write data in RouterInterface model", e);
         }
 
         org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces
index a5f5b485e5d76e3d42bfe3dc584086c399b8ad72..5525511b434b80ae202b1a7de3c3472127062d2f 100644 (file)
@@ -265,7 +265,7 @@ public class NatTunnelInterfaceStateListener
                     mdsalManager.removeFlowToTx(flowEntity, writeFlowInvTx);
 
                 } catch (Exception ex) {
-                    LOG.error("removeSNATFromDPN : SNAT->Failed to remove default SNAT miss entry flow entity {} : {}",
+                    LOG.error("removeSNATFromDPN : SNAT->Failed to remove default SNAT miss entry flow entity {}",
                         flowEntity, ex);
                     return;
                 }
@@ -604,7 +604,7 @@ public class NatTunnelInterfaceStateListener
             long groupId = externalRouterListner.installGroup(srcDpnId, routerName, bucketInfoForNonNaptSwitches);
 
             LOG.debug("hndlTepAddOnNonNaptSwitch : SNAT -> in the SNAT miss entry pointing to group {} "
-                    + "in the non NAPT switch {}", vpnId, groupId, srcDpnId);
+                    + "in the non NAPT switch {}", groupId, srcDpnId);
             FlowEntity flowEntity =
                 externalRouterListner.buildSnatFlowEntityWithUpdatedVpnId(srcDpnId, routerName, groupId, vpnId);
             mdsalManager.addFlowToTx(flowEntity, writeFlowInvTx);
@@ -961,8 +961,9 @@ public class NatTunnelInterfaceStateListener
             Uuid networkId = routerData.get().getNetworkId();
             if (networkId == null) {
                 LOG.error("hndlTepDelForSnatInEachRtr : SNAT->Ignoring TEP delete for the DPN {} having the router {} "
-                        + "since the Router instance {} not found in ExtRouters model b/w SRC IP {} and DST IP {} "
-                        + "and TUNNEL NAME {} ", dpnId, tunnelType, srcTepIp, destTepIp, tunnelName);
+                                + "since the Router instance {} not found in ExtRouters model b/w SRC IP {} and DST "
+                                + "IP {} and TUNNEL NAME {} ", dpnId, routerData.get().getRouterName(), tunnelType,
+                        srcTepIp, destTepIp, tunnelName);
                 return;
             }
 
index 118feb0e72ae93eb6a4da013e56d8dbb0b972ad4..51fbb6e2f9e28116636941f9fc80baabe7768315 100644 (file)
@@ -1211,7 +1211,7 @@ public final class NatUtil {
             BigInteger vmDpnId = getDpnForInterface(ifaceMgrRpcService, vmInterfaceName);
             if (vmDpnId.equals(BigInteger.ZERO) || !vmDpnId.equals(curDpnId)) {
                 LOG.debug("removeFromDpnRoutersMap : DPN ID {} for the removed interface {} is not the same as that of "
-                        + "the DPN ID for the checked interface {} ",
+                        + "the DPN ID {} for the checked interface {}",
                     curDpnId, vpnInterfaceName, vmDpnId, vmInterfaceName);
                 continue;
             }
index 5edd4ae459867a34cabe6c82b35bfd89a71b55c5..de48cc1fdfe8df12f794f1d0b6ee4fb243818ebc 100644 (file)
@@ -78,7 +78,7 @@ public class RouterToVpnListener implements NeutronvpnListener {
                     extNwProvType);
         } else {
             LOG.debug("onRouterAssociatedToVpn : Ignoring the Router {} association with VPN {} "
-                    + "since it is not external router", routerName);
+                    + "since it is not external router", routerName, vpnName);
         }
 
         NatUtil.waitForTransactionToComplete(writeFlowInvTx);
@@ -114,7 +114,7 @@ public class RouterToVpnListener implements NeutronvpnListener {
                     extNwProvType);
         } else {
             LOG.debug("onRouterDisassociatedFromVpn : Ignoring the Router {} association with VPN {} "
-                    + "since it is not external router", routerName);
+                    + "since it is not external router", routerName, vpnName);
         }
 
         NatUtil.waitForTransactionToComplete(writeFlowInvTx);
@@ -137,7 +137,7 @@ public class RouterToVpnListener implements NeutronvpnListener {
             BigInteger dpnId = NatUtil.getDpnForInterface(interfaceManager, portName);
             if (dpnId.equals(BigInteger.ZERO)) {
                 LOG.warn("handleDNATConfigurationForRouterAssociation : DPN not found for {}, "
-                        + "skip handling of router {} association with vpn", portName, routerName, vpnName);
+                        + "skip handling of router {} association with vpn {}", portName, routerName, vpnName);
                 continue;
             }
 
@@ -171,7 +171,7 @@ public class RouterToVpnListener implements NeutronvpnListener {
             BigInteger dpnId = NatUtil.getDpnForInterface(interfaceManager, portName);
             if (dpnId.equals(BigInteger.ZERO)) {
                 LOG.debug("handleDNATConfigurationForRouterDisassociation : DPN not found for {}, "
-                        + "skip handling of router {} association with vpn", portName, routerName, vpnName);
+                        + "skip handling of router {} association with vpn {}", portName, routerName, vpnName);
                 continue;
             }
             List<InternalToExternalPortMap> intExtPortMapList = port.getInternalToExternalPortMap();
index 47f2e78127cfde8a51f0cbab33b3b916e26a6053..b3e784067a6f8f774457eafd7a6656e0f439a31a 100644 (file)
@@ -411,7 +411,7 @@ public class VpnFloatingIpHandler implements FloatingIPHandler {
             5, String.format("%s:%d", "TST Flow Entry ", serviceId), 0, 0,
             COOKIE_TUNNEL.add(BigInteger.valueOf(serviceId)), mkMatches, null);
         mdsalManager.removeFlowToTx(dpnId, flowEntity, removeFlowInvTx);
-        LOG.debug("removeTunnelTableEntry : Terminating service Entry for dpID {} : label : {} removed successfully {}",
+        LOG.debug("removeTunnelTableEntry : Terminating service Entry for dpID {} : label : {} removed successfully",
                 dpnId, serviceId);
     }
 
@@ -462,7 +462,7 @@ public class VpnFloatingIpHandler implements FloatingIPHandler {
 
         mdsalManager.addFlowToTx(dpId, flowEntity, writeFlowInvTx);
 
-        LOG.debug("makeLFibTableEntry : LFIB Entry for dpID {} : label : {} modified successfully {}", dpId, serviceId);
+        LOG.debug("makeLFibTableEntry : LFIB Entry for dpID {} : label : {} modified successfully", dpId, serviceId);
     }
 
     private void removeLFibTableEntry(BigInteger dpnId, long serviceId, WriteTransaction removeFlowInvTx) {