Bugfix to String allocation logic for label in KubevirtPrometheusAssuranceManager.

Change-Id: I4345a0c92e84f54545a83ee25a3c2bf7506bc353
diff --git a/apps/kubevirt-networking/app/src/main/java/org/onosproject/kubevirtnetworking/impl/KubevirtPrometheusAssuranceManager.java b/apps/kubevirt-networking/app/src/main/java/org/onosproject/kubevirtnetworking/impl/KubevirtPrometheusAssuranceManager.java
index f9abc78..c9fdc48 100644
--- a/apps/kubevirt-networking/app/src/main/java/org/onosproject/kubevirtnetworking/impl/KubevirtPrometheusAssuranceManager.java
+++ b/apps/kubevirt-networking/app/src/main/java/org/onosproject/kubevirtnetworking/impl/KubevirtPrometheusAssuranceManager.java
@@ -221,8 +221,6 @@
             return;
         }
 
-        String[] fipLabelValues = new String[5];
-
         nodeService.completeNodes(GATEWAY).forEach(node -> {
             flowRuleService.getFlowEntries(node.intgBridge()).forEach(flowEntry -> {
 
@@ -235,6 +233,8 @@
                         return;
                     }
 
+                    String[] fipLabelValues = new String[5];
+
                     fipLabelValues[0] = floatingIp.id();
                     fipLabelValues[1] = floatingIp.floatingIp().toString();
                     fipLabelValues[2] = node.hostname();
@@ -251,6 +251,8 @@
                         return;
                     }
 
+                    String[] fipLabelValues = new String[5];
+
                     fipLabelValues[0] = floatingIp.id();
                     fipLabelValues[1] = floatingIp.floatingIp().toString();
                     fipLabelValues[2] = node.hostname();
@@ -271,8 +273,6 @@
             return;
         }
 
-        String[] snatLabelValues = new String[3];
-
         routerService.routers().stream().filter(router -> router.enableSnat() &&
                         router.electedGateway() != null &&
                         router.peerRouter() != null &&
@@ -289,17 +289,25 @@
                         return;
                     }
 
+
+
                     flowRuleService.getFlowEntries(gateway.intgBridge()).forEach(flowEntry -> {
                         if (((IndexTableId) flowEntry.table()).id() == GW_ENTRY_TABLE &&
                                 flowEntry.priority() == PRIORITY_STATEFUL_SNAT_RULE) {
-                            snatLabelValues[0] = router.name();
-                            snatLabelValues[1] = routerSnatIp;
-                            snatLabelValues[2] = gateway.hostname();
+
                             if (isSnatUpstreamFlorEntryForRouter(router, flowEntry)) {
+                                String[] snatLabelValues = new String[3];
+                                snatLabelValues[0] = router.name();
+                                snatLabelValues[1] = routerSnatIp;
+                                snatLabelValues[2] = gateway.hostname();
                                 pktSNATTx.labels(snatLabelValues).set(flowEntry.packets());
                                 byteSNATTx.labels(snatLabelValues).set(flowEntry.bytes());
 
                             } else if (isSnatDownstreamFlorEntryForRouter(routerSnatIp, flowEntry)) {
+                                String[] snatLabelValues = new String[3];
+                                snatLabelValues[0] = router.name();
+                                snatLabelValues[1] = routerSnatIp;
+                                snatLabelValues[2] = gateway.hostname();
                                 pktSNATRx.labels(snatLabelValues).set(flowEntry.packets());
                                 byteSNATRx.labels(snatLabelValues).set(flowEntry.bytes());
                             }