Skip to content

Commit 2484527

Browse files
richardlawleyyadvr
authored andcommitted
srx: Fix removing static NAT rules with Juniper SRX (apache#3310)
Fixed the logic for deleting static NAT rules on a Juniper SRX device. Previously the private (trust) rule was not being removed. Fixes apache#3309
1 parent 2f268fb commit 2484527

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,11 +2078,11 @@ private boolean manageStaticNatRule(SrxCommand command, String publicIp, String
20782078
xml = replaceXmlValue(xml, "rule-set", _privateZone);
20792079
xml = replaceXmlValue(xml, "from-zone", _privateZone);
20802080
xml = replaceXmlValue(xml, "rule-name", ruleName_private);
2081-
}
20822081

2083-
if (!sendRequestAndCheckResponse(command, xml, "name", ruleName_private))
2084-
{
2085-
throw new ExecutionException("Failed to delete trust static NAT rule from public IP " + publicIp + " to private IP " + privateIp);
2082+
if (!sendRequestAndCheckResponse(command, xml, "name", ruleName_private))
2083+
{
2084+
throw new ExecutionException("Failed to delete trust static NAT rule from public IP " + publicIp + " to private IP " + privateIp);
2085+
}
20862086
}
20872087
return true;
20882088
}
@@ -3568,6 +3568,7 @@ private boolean sendRequestAndCheckResponse(SrxCommand command, String xmlReques
35683568

35693569
case CHECK_IF_EXISTS:
35703570
case CHECK_IF_IN_USE:
3571+
case CHECK_PRIVATE_IF_EXISTS:
35713572
assert (keyAndValue != null && keyAndValue.length == 2) : "If the SrxCommand is " + command + ", both a key and value must be specified.";
35723573

35733574
key = keyAndValue[0];

0 commit comments

Comments
 (0)