ONOS-4713, ONOS-4715 issues merge to master

Change-Id: I3e52af949005529cec18a85e49601c47f7e386f8
diff --git a/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java b/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java
index 3292e23..171195e 100644
--- a/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java
+++ b/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java
@@ -316,13 +316,15 @@
         Set<FiveTuple> fiveTupleSet = portChain.getLoadBalanceIdMapKeys();
         for (FiveTuple fiveTuple : fiveTupleSet) {
             id = portChain.getLoadBalanceId(fiveTuple);
+            nshSpi = NshServicePathId.of(getNshServicePathId(id, nshSpiId));
             if (processedIdList.contains(id)) {
-                // multiple five tuple can have single path.
+                // Multiple five tuple can have single path. In this case only
+                // the classifier rule need to delete
+                flowRuleInstaller.unInstallLoadBalancedClassifierRules(portChain, fiveTuple, nshSpi);
                 continue;
             } else {
                 processedIdList.add(id);
             }
-            nshSpi = NshServicePathId.of(getNshServicePathId(id, nshSpiId));
             flowRuleInstaller.unInstallLoadBalancedFlowRules(portChain, fiveTuple, nshSpi);
         }
 
@@ -507,6 +509,7 @@
             int portDst = 0;
             byte protocol = 0;
             MacAddress macSrc = packet.getSourceMAC();
+            MacAddress macDst = packet.getDestinationMAC();
             TenantId tenantId = getTenantId(macSrc);
 
             if (ethType == Ethernet.TYPE_IPV4) {
@@ -539,6 +542,8 @@
                     .setPortDst(PortNumber.portNumber(portDst))
                     .setProtocol(protocol)
                     .setTenantId(tenantId)
+                    .setMacSrc(macSrc)
+                    .setMacDst(macDst)
                     .build();
 
             PortChainId portChainId = findPortChainFromFiveTuple(fiveTuple);
@@ -577,13 +582,12 @@
          * Send packet back to classifier.
          *
          * @param context packet context
-         * @param connectPoint connect point of first service function
          */
         private void sendPacket(PacketContext context) {
 
             ConnectPoint sourcePoint = context.inPacket().receivedFrom();
 
-            TrafficTreatment treatment = DefaultTrafficTreatment.builder().setOutput(sourcePoint.port()).build();
+            TrafficTreatment treatment = DefaultTrafficTreatment.builder().setOutput(PortNumber.TABLE).build();
             OutboundPacket packet = new DefaultOutboundPacket(sourcePoint.deviceId(), treatment, context.inPacket()
                     .unparsed());
             packetService.emit(packet);