Fix: do not add/remove SNAT rules when receiving FLAT vport events
Change-Id: Ib30a5d376bcb08b9a6eec595dee49b6607a8f07b
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackRoutingSnatHandler.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackRoutingSnatHandler.java
index 2a91d76..6cc90ba 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackRoutingSnatHandler.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackRoutingSnatHandler.java
@@ -1459,8 +1459,14 @@
}
if (getStatefulSnatFlag() && osNode.type() == GATEWAY) {
- instancePortService.instancePorts().forEach(instPort ->
- setGatewayToInstanceDownstreamRule(osNode, instPort, true));
+ instancePortService.instancePorts().forEach(instPort -> {
+ Type netType = osNetworkAdminService.networkType(instPort.networkId());
+
+ if (netType == FLAT) {
+ return;
+ }
+ setGatewayToInstanceDownstreamRule(osNode, instPort, true);
+ });
}
}
@@ -1470,8 +1476,15 @@
}
if (getStatefulSnatFlag() && osNode.type() == GATEWAY) {
- instancePortService.instancePorts().forEach(instPort ->
- setGatewayToInstanceDownstreamRule(osNode, instPort, false));
+ instancePortService.instancePorts().forEach(instPort -> {
+ Type netType = osNetworkAdminService.networkType(instPort.networkId());
+
+ if (netType == FLAT) {
+ return;
+ }
+
+ setGatewayToInstanceDownstreamRule(osNode, instPort, false);
+ });
}
}