CLOUDSTACK-2585: Failed to apply new PF rules after deleting the existing PF Rule with Cisco VNMC Provider Each rule created in VNMC under a policy object needs to have an unique order value. Rules are evaluated based on this value. Eariler order was computed based on the rule count under a policy object. This resulted in duplicate order value when rules get deleted and recreated. Changed the logic to compute order based on the CS db id of the rule which is unique.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/83f84add Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/83f84add Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/83f84add Branch: refs/heads/vmsync Commit: 83f84adda2715eae60c47738eee886a48fbc5b03 Parents: 5d3e6bd Author: Koushik Das <koushik....@citrix.com> Authored: Wed May 22 14:49:48 2013 +0530 Committer: Koushik Das <koushik....@citrix.com> Committed: Wed May 22 14:49:48 2013 +0530 ---------------------------------------------------------------------- .../cloud/network/cisco/CiscoVnmcConnection.java | 22 ++-- .../network/cisco/CiscoVnmcConnectionImpl.java | 112 ++++++--------- .../cloud/network/resource/CiscoVnmcResource.java | 20 ++-- .../network/resource/CiscoVnmcResourceTest.java | 22 ++-- 4 files changed, 77 insertions(+), 99 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83f84add/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnection.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnection.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnection.java index 28e2535..be4814a 100644 --- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnection.java +++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnection.java @@ -74,16 +74,16 @@ public interface CiscoVnmcConnection { String ipAddress) throws ExecutionException; public boolean createTenantVDCDNatRule(String tenantName, - String identifier, String policyIdentifier, + long ruleId, String policyIdentifier, String publicIp) throws ExecutionException; public boolean deleteTenantVDCDNatRule(String tenantName, - String identifier, String policyIdentifier) + long ruleId, String policyIdentifier) throws ExecutionException; public boolean createTenantVDCAclRuleForDNat(String tenantName, - String identifier, String policyIdentifier, + long ruleId, String policyIdentifier, String ipAddress) throws ExecutionException; @@ -104,17 +104,17 @@ public interface CiscoVnmcConnection { String ipAddress) throws ExecutionException; public boolean createTenantVDCPFRule(String tenantName, - String identifier, String policyIdentifier, + long ruleId, String policyIdentifier, String protocol, String publicIp, String startPort, String endPort) throws ExecutionException; public boolean deleteTenantVDCPFRule(String tenantName, - String identifier, String policyIdentifier) + long ruleId, String policyIdentifier) throws ExecutionException; public boolean createTenantVDCAclRuleForPF(String tenantName, - String identifier, String policyIdentifier, + long ruleId, String policyIdentifier, String protocol, String ipAddress, String startPort, String endPort) throws ExecutionException; @@ -138,29 +138,29 @@ public interface CiscoVnmcConnection { throws ExecutionException; public boolean createTenantVDCIngressAclRule(String tenantName, - String identifier, String policyIdentifier, + long ruleId, String policyIdentifier, String protocol, String sourceStartIp, String sourceEndIp, String destStartPort, String destEndPort) throws ExecutionException; public boolean createTenantVDCIngressAclRule(String tenantName, - String identifier, String policyIdentifier, + long ruleId, String policyIdentifier, String protocol, String sourceStartIp, String sourceEndIp) throws ExecutionException; public boolean createTenantVDCEgressAclRule(String tenantName, - String identifier, String policyIdentifier, + long ruleId, String policyIdentifier, String protocol, String sourceStartIp, String sourceEndIp, String destStartPort, String destEndPort) throws ExecutionException; public boolean createTenantVDCEgressAclRule(String tenantName, - String identifier, String policyIdentifier, + long ruleId, String policyIdentifier, String protocol, String sourceStartIp, String sourceEndIp) throws ExecutionException; public boolean deleteTenantVDCAclRule(String tenantName, - String identifier, String policyIdentifier) throws ExecutionException; + long ruleId, String policyIdentifier) throws ExecutionException; public boolean createTenantVDCAclPolicy(String tenantName, String identifier) throws ExecutionException; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83f84add/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java index a9e8cf6..72ecc67 100644 --- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java +++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java @@ -490,12 +490,8 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { xml = replaceXmlValue(xml, "srcendip", endSourceIp); xml = replaceXmlValue(xml, "ippoolname", getNameForSourceNatIpPool(tenantName)); - List<String> rules = listChildren(getDnForSourceNatPolicy(tenantName)); - int order = 100; - if (rules != null) { - order += rules.size(); - } - xml = replaceXmlValue(xml, "order", Integer.toString(order)); + long order = 100; + xml = replaceXmlValue(xml, "order", Long.toString(order)); String response = sendRequest(service, xml); return verifySuccess(response); @@ -671,12 +667,13 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { @Override public boolean createTenantVDCIngressAclRule(String tenantName, - String identifier, String policyIdentifier, + long ruleId, String policyIdentifier, String protocol, String sourceStartIp, String sourceEndIp, String destStartPort, String destEndPort) throws ExecutionException { String xml = VnmcXml.CREATE_INGRESS_ACL_RULE.getXml(); String service = VnmcXml.CREATE_INGRESS_ACL_RULE.getService(); + String identifier = Long.toString(ruleId); xml = replaceXmlValue(xml, "cookie", _cookie); xml = replaceXmlValue(xml, "aclruledn", getDnForAclRule(tenantName, identifier, policyIdentifier)); xml = replaceXmlValue(xml, "aclrulename", getNameForAclRule(tenantName, identifier)); @@ -688,12 +685,8 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { xml = replaceXmlValue(xml, "deststartport", destStartPort); xml = replaceXmlValue(xml, "destendport", destEndPort); - List<String> rules = listChildren(getDnForAclPolicy(tenantName, policyIdentifier)); - int order = 100; - if (rules != null) { - order += rules.size(); - } - xml = replaceXmlValue(xml, "order", Integer.toString(order)); + long order = 100 + ruleId; + xml = replaceXmlValue(xml, "order", Long.toString(order)); String response = sendRequest(service, xml); return verifySuccess(response); @@ -701,11 +694,12 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { @Override public boolean createTenantVDCIngressAclRule(String tenantName, - String identifier, String policyIdentifier, + long ruleId, String policyIdentifier, String protocol, String sourceStartIp, String sourceEndIp) throws ExecutionException { String xml = VnmcXml.CREATE_GENERIC_INGRESS_ACL_RULE.getXml(); String service = VnmcXml.CREATE_GENERIC_INGRESS_ACL_RULE.getService(); + String identifier = Long.toString(ruleId); xml = replaceXmlValue(xml, "cookie", _cookie); xml = replaceXmlValue(xml, "aclruledn", getDnForAclRule(tenantName, identifier, policyIdentifier)); xml = replaceXmlValue(xml, "aclrulename", getNameForAclRule(tenantName, identifier)); @@ -715,12 +709,8 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { xml = replaceXmlValue(xml, "sourcestartip", sourceStartIp); xml = replaceXmlValue(xml, "sourceendip", sourceEndIp); - List<String> rules = listChildren(getDnForAclPolicy(tenantName, policyIdentifier)); - int order = 100; - if (rules != null) { - order += rules.size(); - } - xml = replaceXmlValue(xml, "order", Integer.toString(order)); + long order = 100 + ruleId; + xml = replaceXmlValue(xml, "order", Long.toString(order)); String response = sendRequest(service, xml); return verifySuccess(response); @@ -728,12 +718,13 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { @Override public boolean createTenantVDCEgressAclRule(String tenantName, - String identifier, String policyIdentifier, + long ruleId, String policyIdentifier, String protocol, String sourceStartIp, String sourceEndIp, String destStartPort, String destEndPort) throws ExecutionException { String xml = VnmcXml.CREATE_EGRESS_ACL_RULE.getXml(); String service = VnmcXml.CREATE_EGRESS_ACL_RULE.getService(); + String identifier = Long.toString(ruleId); xml = replaceXmlValue(xml, "cookie", _cookie); xml = replaceXmlValue(xml, "aclruledn", getDnForAclRule(tenantName, identifier, policyIdentifier)); xml = replaceXmlValue(xml, "aclrulename", getNameForAclRule(tenantName, identifier)); @@ -745,12 +736,8 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { xml = replaceXmlValue(xml, "deststartport", destStartPort); xml = replaceXmlValue(xml, "destendport", destEndPort); - List<String> rules = listChildren(getDnForAclPolicy(tenantName, policyIdentifier)); - int order = 100; - if (rules != null) { - order += rules.size(); - } - xml = replaceXmlValue(xml, "order", Integer.toString(order)); + long order = 100 + ruleId; + xml = replaceXmlValue(xml, "order", Long.toString(order)); String response = sendRequest(service, xml); return verifySuccess(response); @@ -758,7 +745,7 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { @Override public boolean createTenantVDCEgressAclRule(String tenantName, - String identifier, String policyIdentifier, + long ruleId, String policyIdentifier, String protocol, String sourceStartIp, String sourceEndIp) throws ExecutionException { String xml = VnmcXml.CREATE_GENERIC_EGRESS_ACL_RULE.getXml(); String service = VnmcXml.CREATE_GENERIC_EGRESS_ACL_RULE.getService(); @@ -768,6 +755,8 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { } else { // specific protocol xml = replaceXmlValue(xml, "protocolvalue", protocol); } + + String identifier = Long.toString(ruleId); xml = replaceXmlValue(xml, "cookie", _cookie); xml = replaceXmlValue(xml, "aclruledn", getDnForAclRule(tenantName, identifier, policyIdentifier)); xml = replaceXmlValue(xml, "aclrulename", getNameForAclRule(tenantName, identifier)); @@ -776,19 +765,16 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { xml = replaceXmlValue(xml, "sourcestartip", sourceStartIp); xml = replaceXmlValue(xml, "sourceendip", sourceEndIp); - List<String> rules = listChildren(getDnForAclPolicy(tenantName, policyIdentifier)); - int order = 100; - if (rules != null) { - order += rules.size(); - } - xml = replaceXmlValue(xml, "order", Integer.toString(order)); + long order = 100 + ruleId; + xml = replaceXmlValue(xml, "order", Long.toString(order)); String response = sendRequest(service, xml); return verifySuccess(response); } @Override - public boolean deleteTenantVDCAclRule(String tenantName, String identifier, String policyIdentifier) throws ExecutionException { + public boolean deleteTenantVDCAclRule(String tenantName, long ruleId, String policyIdentifier) throws ExecutionException { + String identifier = Long.toString(ruleId); return deleteTenantVDCRule( getDnForAclRule(tenantName, identifier, policyIdentifier), getNameForAclRule(tenantName, identifier)); @@ -1001,11 +987,13 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { @Override public boolean createTenantVDCPFRule(String tenantName, - String identifier, String policyIdentifier, + long ruleId, String policyIdentifier, String protocol, String publicIp, String startPort, String endPort) throws ExecutionException { String xml = VnmcXml.CREATE_PF_RULE.getXml(); String service = VnmcXml.CREATE_PF_RULE.getService(); + + String identifier = Long.toString(ruleId); xml = replaceXmlValue(xml, "cookie", _cookie); xml = replaceXmlValue(xml, "natruledn", getDnForPFRule(tenantName, identifier, policyIdentifier)); xml = replaceXmlValue(xml, "natrulename", getNameForPFRule(tenantName, identifier)); @@ -1017,20 +1005,16 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { xml = replaceXmlValue(xml, "endport", endPort); xml = replaceXmlValue(xml, "protocolvalue", protocol); - List<String> rules = listChildren(getDnForPFPolicy(tenantName, policyIdentifier)); - int order = 100; - if (rules != null) { - order += rules.size(); - } - xml = replaceXmlValue(xml, "order", Integer.toString(order)); + long order = 100 + ruleId; + xml = replaceXmlValue(xml, "order", Long.toString(order)); String response = sendRequest(service, xml); return verifySuccess(response); } @Override - public boolean deleteTenantVDCPFRule(String tenantName, String identifier, - String policyIdentifier) throws ExecutionException { + public boolean deleteTenantVDCPFRule(String tenantName, long ruleId, String policyIdentifier) throws ExecutionException { + String identifier = Long.toString(ruleId); return deleteTenantVDCRule( getDnForPFRule(tenantName, identifier, policyIdentifier), getNameForPFRule(tenantName, identifier)); @@ -1038,11 +1022,13 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { @Override public boolean createTenantVDCAclRuleForPF(String tenantName, - String identifier, String policyIdentifier, String protocol, + long ruleId, String policyIdentifier, String protocol, String ipAddress, String startPort, String endPort) throws ExecutionException { String xml = VnmcXml.CREATE_ACL_RULE_FOR_PF.getXml(); String service = VnmcXml.CREATE_ACL_RULE_FOR_PF.getService(); + + String identifier = Long.toString(ruleId); xml = replaceXmlValue(xml, "cookie", _cookie); xml = replaceXmlValue(xml, "aclruledn", getDnForAclRule(tenantName, identifier, policyIdentifier)); xml = replaceXmlValue(xml, "aclrulename", getNameForAclRule(tenantName, identifier)); @@ -1053,12 +1039,8 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { xml = replaceXmlValue(xml, "startport", startPort); xml = replaceXmlValue(xml, "endport", endPort); - List<String> rules = listChildren(getDnForAclPolicy(tenantName, policyIdentifier)); - int order = 100; - if (rules != null) { - order += rules.size(); - } - xml = replaceXmlValue(xml, "order", Integer.toString(order)); + long order = 100 + ruleId; + xml = replaceXmlValue(xml, "order", Long.toString(order)); String response = sendRequest(service, xml); return verifySuccess(response); @@ -1127,10 +1109,12 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { @Override public boolean createTenantVDCDNatRule(String tenantName, - String identifier, String policyIdentifier, String publicIp) + long ruleId, String policyIdentifier, String publicIp) throws ExecutionException { String xml = VnmcXml.CREATE_DNAT_RULE.getXml(); String service = VnmcXml.CREATE_DNAT_RULE.getService(); + + String identifier = Long.toString(ruleId); xml = replaceXmlValue(xml, "cookie", _cookie); xml = replaceXmlValue(xml, "natruledn", getDnForDNatRule(tenantName, identifier, policyIdentifier)); xml = replaceXmlValue(xml, "natrulename", getNameForDNatRule(tenantName, identifier)); @@ -1138,21 +1122,17 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { xml = replaceXmlValue(xml, "ippoolname", getNameForDNatIpPool(tenantName, identifier)); xml = replaceXmlValue(xml, "ip", publicIp); - List<String> rules = listChildren(getDnForDNatPolicy(tenantName, policyIdentifier)); - int order = 100; - if (rules != null) { - order += rules.size(); - } - xml = replaceXmlValue(xml, "order", Integer.toString(order)); + long order = 100 + ruleId; + xml = replaceXmlValue(xml, "order", Long.toString(order)); String response = sendRequest(service, xml); return verifySuccess(response); } @Override - public boolean deleteTenantVDCDNatRule(String tenantName, - String identifier, String policyIdentifier) + public boolean deleteTenantVDCDNatRule(String tenantName, long ruleId, String policyIdentifier) throws ExecutionException { + String identifier = Long.toString(ruleId); return deleteTenantVDCRule( getDnForDNatRule(tenantName, identifier, policyIdentifier), getNameForDNatRule(tenantName, identifier)); @@ -1160,10 +1140,12 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { @Override public boolean createTenantVDCAclRuleForDNat(String tenantName, - String identifier, String policyIdentifier, String ipAddress) + long ruleId, String policyIdentifier, String ipAddress) throws ExecutionException { String xml = VnmcXml.CREATE_ACL_RULE_FOR_DNAT.getXml(); String service = VnmcXml.CREATE_ACL_RULE_FOR_DNAT.getService(); + + String identifier = Long.toString(ruleId); xml = replaceXmlValue(xml, "cookie", _cookie); xml = replaceXmlValue(xml, "aclruledn", getDnForAclRule(tenantName, identifier, policyIdentifier)); xml = replaceXmlValue(xml, "aclrulename", getNameForAclRule(tenantName, identifier)); @@ -1171,12 +1153,8 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { xml = replaceXmlValue(xml, "actiontype", "permit"); xml = replaceXmlValue(xml, "ip", ipAddress); - List<String> rules = listChildren(getDnForAclPolicy(tenantName, policyIdentifier)); - int order = 100; - if (rules != null) { - order += rules.size(); - } - xml = replaceXmlValue(xml, "order", Integer.toString(order)); + long order = 100 + ruleId; + xml = replaceXmlValue(xml, "order", Long.toString(order)); String response = sendRequest(service, xml); return verifySuccess(response); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83f84add/plugins/network-elements/cisco-vnmc/src/com/cloud/network/resource/CiscoVnmcResource.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/resource/CiscoVnmcResource.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/resource/CiscoVnmcResource.java index 29bbbe6..fc0c334 100644 --- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/resource/CiscoVnmcResource.java +++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/resource/CiscoVnmcResource.java @@ -174,7 +174,7 @@ public class CiscoVnmcResource implements ServerResource { cmd.setPod(""); cmd.setPrivateIpAddress(_ip); cmd.setStorageIpAddress(""); - cmd.setVersion(""); + cmd.setVersion(CiscoVnmcResource.class.getPackage().getImplementationVersion()); cmd.setGuid(_guid); return new StartupCommand[] { cmd }; } @@ -359,7 +359,7 @@ public class CiscoVnmcResource implements ServerResource { for (FirewallRuleTO rule : publicIpRulesMap.get(publicIp)) { if (rule.revoked()) { - if (!_connection.deleteTenantVDCAclRule(tenant, Long.toString(rule.getId()), policyIdentifier)) { + if (!_connection.deleteTenantVDCAclRule(tenant, rule.getId(), policyIdentifier)) { throw new ExecutionException("Failed to delete ACL rule in VNMC for guest network with vlan " + vlanId); } } else { @@ -368,14 +368,14 @@ public class CiscoVnmcResource implements ServerResource { if (!rule.getProtocol().equalsIgnoreCase("icmp") && rule.getSrcPortRange() != null) { if (!_connection.createTenantVDCIngressAclRule(tenant, - Long.toString(rule.getId()), policyIdentifier, + rule.getId(), policyIdentifier, rule.getProtocol().toUpperCase(), externalIpRange[0], externalIpRange[1], Integer.toString(rule.getSrcPortRange()[0]), Integer.toString(rule.getSrcPortRange()[1]))) { throw new ExecutionException("Failed to create ACL ingress rule in VNMC for guest network with vlan " + vlanId); } } else { if (!_connection.createTenantVDCIngressAclRule(tenant, - Long.toString(rule.getId()), policyIdentifier, + rule.getId(), policyIdentifier, rule.getProtocol().toUpperCase(), externalIpRange[0], externalIpRange[1])) { throw new ExecutionException("Failed to create ACL ingress rule in VNMC for guest network with vlan " + vlanId); } @@ -384,7 +384,7 @@ public class CiscoVnmcResource implements ServerResource { if ((rule.getProtocol().equalsIgnoreCase("tcp") || rule.getProtocol().equalsIgnoreCase("udp")) && rule.getSrcPortRange() != null) { if (!_connection.createTenantVDCEgressAclRule(tenant, - Long.toString(rule.getId()), policyIdentifier, + rule.getId(), policyIdentifier, rule.getProtocol().toUpperCase(), externalIpRange[0], externalIpRange[1], Integer.toString(rule.getSrcPortRange()[0]), Integer.toString(rule.getSrcPortRange()[1]))) { @@ -392,7 +392,7 @@ public class CiscoVnmcResource implements ServerResource { } } else { if (!_connection.createTenantVDCEgressAclRule(tenant, - Long.toString(rule.getId()), policyIdentifier, + rule.getId(), policyIdentifier, rule.getProtocol().toUpperCase(), externalIpRange[0], externalIpRange[1])) { throw new ExecutionException("Failed to create ACL egress rule in VNMC for guest network with vlan " + vlanId); } @@ -472,7 +472,7 @@ public class CiscoVnmcResource implements ServerResource { for (StaticNatRuleTO rule : publicIpRulesMap.get(publicIp)) { if (rule.revoked()) { - if (!_connection.deleteTenantVDCDNatRule(tenant, Long.toString(rule.getId()), policyIdentifier)) { + if (!_connection.deleteTenantVDCDNatRule(tenant, rule.getId(), policyIdentifier)) { throw new ExecutionException("Failed to delete DNAT rule in VNMC for guest network with vlan " + vlanId); } } else { @@ -481,7 +481,7 @@ public class CiscoVnmcResource implements ServerResource { } if (!_connection.createTenantVDCDNatRule(tenant, - Long.toString(rule.getId()), policyIdentifier, rule.getSrcIp())) { + rule.getId(), policyIdentifier, rule.getSrcIp())) { throw new ExecutionException("Failed to create DNAT rule in VNMC for guest network with vlan " + vlanId); } } @@ -558,7 +558,7 @@ public class CiscoVnmcResource implements ServerResource { for (PortForwardingRuleTO rule : publicIpRulesMap.get(publicIp)) { if (rule.revoked()) { - if (!_connection.deleteTenantVDCPFRule(tenant, Long.toString(rule.getId()), policyIdentifier)) { + if (!_connection.deleteTenantVDCPFRule(tenant, rule.getId(), policyIdentifier)) { throw new ExecutionException("Failed to delete PF rule in VNMC for guest network with vlan " + vlanId); } } else { @@ -571,7 +571,7 @@ public class CiscoVnmcResource implements ServerResource { } if (!_connection.createTenantVDCPFRule(tenant, - Long.toString(rule.getId()), policyIdentifier, + rule.getId(), policyIdentifier, rule.getProtocol().toUpperCase(), rule.getSrcIp(), Integer.toString(rule.getSrcPortRange()[0]), Integer.toString(rule.getSrcPortRange()[1]))) { throw new ExecutionException("Failed to create PF rule in VNMC for guest network with vlan " + vlanId); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83f84add/plugins/network-elements/cisco-vnmc/test/com/cloud/network/resource/CiscoVnmcResourceTest.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/cisco-vnmc/test/com/cloud/network/resource/CiscoVnmcResourceTest.java b/plugins/network-elements/cisco-vnmc/test/com/cloud/network/resource/CiscoVnmcResourceTest.java index f1942ea..b3821d7 100755 --- a/plugins/network-elements/cisco-vnmc/test/com/cloud/network/resource/CiscoVnmcResourceTest.java +++ b/plugins/network-elements/cisco-vnmc/test/com/cloud/network/resource/CiscoVnmcResourceTest.java @@ -163,13 +163,13 @@ public class CiscoVnmcResourceTest { when(_connection.createTenantVDCAclPolicySet(anyString(), anyBoolean())).thenReturn(true); when(_connection.createTenantVDCAclPolicy(anyString(), anyString())).thenReturn(true); when(_connection.createTenantVDCAclPolicyRef(anyString(), anyString(), anyBoolean())).thenReturn(true); - when(_connection.deleteTenantVDCAclRule(anyString(), anyString(), anyString())).thenReturn(true); + when(_connection.deleteTenantVDCAclRule(anyString(), anyLong(), anyString())).thenReturn(true); when(_connection.createTenantVDCIngressAclRule( - anyString(), anyString(), anyString(), + anyString(), anyLong(), anyString(), anyString(), anyString(), anyString(), anyString(), anyString())).thenReturn(true); when(_connection.createTenantVDCEgressAclRule( - anyString(), anyString(), anyString(), + anyString(), anyLong(), anyString(), anyString(), anyString(), anyString(), anyString(), anyString())).thenReturn(true); when(_connection.associateAclPolicySet(anyString())).thenReturn(true); @@ -201,13 +201,13 @@ public class CiscoVnmcResourceTest { when(_connection.createTenantVDCDNatPolicyRef(anyString(), anyString())).thenReturn(true); when(_connection.createTenantVDCAclPolicy(anyString(), anyString())).thenReturn(true); when(_connection.createTenantVDCAclPolicyRef(anyString(), anyString(), anyBoolean())).thenReturn(true); - when(_connection.deleteTenantVDCDNatRule(anyString(), anyString(), anyString())).thenReturn(true); - when(_connection.deleteTenantVDCAclRule(anyString(), anyString(), anyString())).thenReturn(true); + when(_connection.deleteTenantVDCDNatRule(anyString(), anyLong(), anyString())).thenReturn(true); + when(_connection.deleteTenantVDCAclRule(anyString(), anyLong(), anyString())).thenReturn(true); when(_connection.createTenantVDCDNatIpPool(anyString(), anyString(), anyString())).thenReturn(true); when(_connection.createTenantVDCDNatRule(anyString(), - anyString(), anyString(), anyString())).thenReturn(true); + anyLong(), anyString(), anyString())).thenReturn(true); when(_connection.createTenantVDCAclRuleForDNat(anyString(), - anyString(), anyString(), anyString())).thenReturn(true); + anyLong(), anyString(), anyString())).thenReturn(true); when(_connection.associateAclPolicySet(anyString())).thenReturn(true); Answer answer = _resource.executeRequest(cmd); @@ -237,15 +237,15 @@ public class CiscoVnmcResourceTest { when(_connection.createTenantVDCPFPolicyRef(anyString(), anyString())).thenReturn(true); when(_connection.createTenantVDCAclPolicy(anyString(), anyString())).thenReturn(true); when(_connection.createTenantVDCAclPolicyRef(anyString(), anyString(), anyBoolean())).thenReturn(true); - when(_connection.deleteTenantVDCPFRule(anyString(), anyString(), anyString())).thenReturn(true); - when(_connection.deleteTenantVDCAclRule(anyString(), anyString(), anyString())).thenReturn(true); + when(_connection.deleteTenantVDCPFRule(anyString(), anyLong(), anyString())).thenReturn(true); + when(_connection.deleteTenantVDCAclRule(anyString(), anyLong(), anyString())).thenReturn(true); when(_connection.createTenantVDCPFIpPool(anyString(), anyString(), anyString())).thenReturn(true); when(_connection.createTenantVDCPFPortPool(anyString(), anyString(), anyString(), anyString())).thenReturn(true); when(_connection.createTenantVDCPFRule(anyString(), - anyString(), anyString(), anyString(), + anyLong(), anyString(), anyString(), anyString(), anyString(), anyString())).thenReturn(true); when(_connection.createTenantVDCAclRuleForPF(anyString(), - anyString(), anyString(), anyString(), + anyLong(), anyString(), anyString(), anyString(), anyString(), anyString())).thenReturn(true); when(_connection.associateAclPolicySet(anyString())).thenReturn(true);