[ONOS-5038] Bug fix for "pending_add" flow rules

Corrects deviceIds when build Nicira extension flow rules.

Change-Id: I8dc196d36e5518fe172769b2b957c929a7136d52
diff --git a/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackFloatingIpManager.java b/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackFloatingIpManager.java
index 236d04d..b984ecc 100644
--- a/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackFloatingIpManager.java
+++ b/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackFloatingIpManager.java
@@ -241,8 +241,8 @@
                     .setEthDst(associatedVm.mac())
                     .setIpDst(associatedVm.ipAddresses().stream().findFirst().get())
                     .setTunnelId(Long.valueOf(associatedVm.annotations().value(VXLAN_ID)))
-                    .extension(buildExtension(deviceService, cnodeId, dataIp.get().getIp4Address()),
-                               cnodeId)
+                    .extension(buildExtension(deviceService, gnodeId, dataIp.get().getIp4Address()),
+                               gnodeId)
                     .setOutput(nodeService.tunnelPort(gnodeId).get())
                     .build();
 
diff --git a/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackPnatHandler.java b/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackPnatHandler.java
index b6c998a..9431e4f 100644
--- a/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackPnatHandler.java
+++ b/apps/openstacknetworking/routing/src/main/java/org/onosproject/openstacknetworking/routing/OpenstackPnatHandler.java
@@ -316,7 +316,7 @@
 
         tBuilder.setIpSrc(externalIp);
         gatewayService.getGatewayNodes().stream().forEach(gateway -> {
-            TrafficTreatment.Builder tmpBuilder = tBuilder;
+            TrafficTreatment.Builder tmpBuilder = DefaultTrafficTreatment.builder(tBuilder.build());
             tmpBuilder.setOutput(gatewayService.getUplinkPort(gateway.getGatewayDeviceId()));
             ForwardingObjective fo = DefaultForwardingObjective.builder()
                     .withSelector(sBuilder.build())
@@ -376,7 +376,7 @@
 
         gatewayService.getGatewayDeviceIds().stream().forEach(deviceId -> {
             DeviceId srcDeviceId = srcVm.get().location().deviceId();
-            TrafficTreatment.Builder tmpBuilder = tBuilder;
+            TrafficTreatment.Builder tmpBuilder = DefaultTrafficTreatment.builder(tBuilder.build());
             tmpBuilder.extension(RulePopulatorUtil.buildExtension(
                     deviceService,
                     deviceId,