@@ -176,8 +176,6 @@ public class CommandSetupHelper {
176176 @ Inject
177177 private IPAddressDao _ipAddressDao ;
178178 @ Inject
179- private FirewallRulesDao _firewallsDao ;
180- @ Inject
181179 private GuestOSDao _guestOSDao ;
182180
183181 @ Inject
@@ -854,11 +852,12 @@ public int compare(final PublicIpAddress o1, final PublicIpAddress o2) {
854852 int ipsWithrules = 0 ;
855853 int ipsStaticNat = 0 ;
856854 for (IPAddressVO ip : userIps ) {
857- if ( _firewallsDao .countRulesByIpIdAndState (ip .getId (), FirewallRule .State .Active ) > 0 ) {
855+ if ( _rulesDao .countRulesByIpIdAndState (ip .getId (), FirewallRule .State .Active ) > 0 ) {
858856 ipsWithrules ++;
859857 }
860858
861- // check onetoonenat and also check if the ip "add":false. If there are 2 PF remove 1 static nat add
859+ // check onetoonenat and also check if the ip "add":false. If there are 2 PF rules remove and
860+ // 1 static nat rule add
862861 if (ip .isOneToOneNat () && ip .getRuleState () == null ) {
863862 ipsStaticNat ++;
864863 }
@@ -871,10 +870,12 @@ public int compare(final PublicIpAddress o1, final PublicIpAddress o2) {
871870 final DataCenterVO dcVo = _dcDao .findById (router .getDataCenterId ());
872871 cmd .setAccessDetail (NetworkElementCommand .ZONE_NETWORK_TYPE , dcVo .getNetworkType ().toString ());
873872
874- // if there 1 static nat then it will be checked for remove at the resource
875- if (ipsWithrules == 0 && ipsStaticNat == 0 ) {
873+ // if there is 1 static nat then it will be checked for remove at the resource
874+ if (ipsWithrules == 0 && ipsStaticNat == 0 ) {
876875 // there is only one ip address for the network.
877876 cmd .setAccessDetail (NetworkElementCommand .NETWORK_PUB_LAST_IP , "true" );
877+ } else {
878+ cmd .setAccessDetail (NetworkElementCommand .NETWORK_PUB_LAST_IP , "false" );
878879 }
879880
880881 cmds .addCommand (ipAssocCommand , cmd );
0 commit comments