CLOUDSTACK-2475: Failed to create PF rules with Cisco VNMC as the port pool object name is exceeding the max limit Ip and port pool object names in VNMC were created by appending guest vlan, public ip and id of corresponding rule for better readability. This resulted in the name exceeding max. length allowed. Shortened the name by removing public ip part from it.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f484f4af Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f484f4af Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f484f4af Branch: refs/heads/ui-vpc-redesign Commit: f484f4af09ce9e9532e17fb231c48d7a7e7c9e81 Parents: 1518e7e Author: Koushik Das <[email protected]> Authored: Wed May 15 09:12:48 2013 +0530 Committer: Koushik Das <[email protected]> Committed: Wed May 15 09:12:48 2013 +0530 ---------------------------------------------------------------------- .../network/cisco/CiscoVnmcConnectionImpl.java | 12 ++++++------ .../cloud/network/resource/CiscoVnmcResource.java | 12 +++++++----- 2 files changed, 13 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f484f4af/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 c7380ab..0e57cae 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 @@ -795,7 +795,7 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { } private String getNameForPFPortPool(String tenantName, String identifier) { - return "PFPort-" + tenantName + "-" + identifier; + return "PortPool-" + tenantName + "-" + identifier; } private String getDnForPFPortPool(String tenantName, String identifier) { @@ -803,7 +803,7 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { } private String getNameForPFIpPool(String tenantName, String identifier) { - return "PFIp-" + tenantName + "-" + identifier; + return "IpPool-" + tenantName + "-" + identifier; } private String getDnForPFIpPool(String tenantName, String identifier) { @@ -1010,8 +1010,8 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { xml = replaceXmlValue(xml, "natruledn", getDnForPFRule(tenantName, identifier, policyIdentifier)); xml = replaceXmlValue(xml, "natrulename", getNameForPFRule(tenantName, identifier)); xml = replaceXmlValue(xml, "descr", "PF rule for Tenant VDC " + tenantName); - xml = replaceXmlValue(xml, "ippoolname", getNameForPFIpPool(tenantName, policyIdentifier + "-" + identifier)); - xml = replaceXmlValue(xml, "portpoolname", getNameForPFPortPool(tenantName, policyIdentifier + "-" + identifier)); + xml = replaceXmlValue(xml, "ippoolname", getNameForPFIpPool(tenantName, identifier)); + xml = replaceXmlValue(xml, "portpoolname", getNameForPFPortPool(tenantName, identifier)); xml = replaceXmlValue(xml, "ip", publicIp); xml = replaceXmlValue(xml, "startport", startPort); xml = replaceXmlValue(xml, "endport", endPort); @@ -1088,7 +1088,7 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { } private String getNameForDNatIpPool(String tenantName, String identifier) { - return "DNATIp-" + tenantName + "-" + identifier; + return "IpPool-" + tenantName + "-" + identifier; } private String getDnForDNatIpPool(String tenantName, String identifier) { @@ -1135,7 +1135,7 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection { xml = replaceXmlValue(xml, "natruledn", getDnForDNatRule(tenantName, identifier, policyIdentifier)); xml = replaceXmlValue(xml, "natrulename", getNameForDNatRule(tenantName, identifier)); xml = replaceXmlValue(xml, "descr", "DNAT rule for Tenant VDC " + tenantName); - xml = replaceXmlValue(xml, "ippoolname", getNameForDNatIpPool(tenantName, policyIdentifier + "-" + identifier)); + xml = replaceXmlValue(xml, "ippoolname", getNameForDNatIpPool(tenantName, identifier)); xml = replaceXmlValue(xml, "ip", publicIp); List<String> rules = listChildren(getDnForDNatPolicy(tenantName, policyIdentifier)); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f484f4af/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 9c81b2e..176fdc4 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 @@ -364,7 +364,8 @@ public class CiscoVnmcResource implements ServerResource { } else { String[] externalIpRange = getIpRangeFromCidr(rule.getSourceCidrList().get(0)); if (rule.getTrafficType() == TrafficType.Ingress) { - if (!rule.getProtocol().equalsIgnoreCase("icmp")) { + if (!rule.getProtocol().equalsIgnoreCase("icmp") + && rule.getSrcPortRange() != null) { if (!_connection.createTenantVDCIngressAclRule(tenant, Long.toString(rule.getId()), policyIdentifier, rule.getProtocol().toUpperCase(), externalIpRange[0], externalIpRange[1], @@ -379,7 +380,8 @@ public class CiscoVnmcResource implements ServerResource { } } } else { - if (rule.getProtocol().equalsIgnoreCase("tcp") || rule.getProtocol().equalsIgnoreCase("udp")) { + if ((rule.getProtocol().equalsIgnoreCase("tcp") || rule.getProtocol().equalsIgnoreCase("udp")) + && rule.getSrcPortRange() != null) { if (!_connection.createTenantVDCEgressAclRule(tenant, Long.toString(rule.getId()), policyIdentifier, rule.getProtocol().toUpperCase(), @@ -477,7 +479,7 @@ public class CiscoVnmcResource implements ServerResource { throw new Exception("Failed to delete ACL ingress rule for DNAT in VNMC for guest network with vlan " + vlanId); } } else { - if (!_connection.createTenantVDCDNatIpPool(tenant, policyIdentifier + "-" + rule.getId(), rule.getDstIp())) { + if (!_connection.createTenantVDCDNatIpPool(tenant, Long.toString(rule.getId()), rule.getDstIp())) { throw new Exception("Failed to create DNAT ip pool in VNMC for guest network with vlan " + vlanId); } @@ -572,10 +574,10 @@ public class CiscoVnmcResource implements ServerResource { throw new Exception("Failed to delete ACL ingress rule for PF in VNMC for guest network with vlan " + vlanId); } } else { - if (!_connection.createTenantVDCPFIpPool(tenant, policyIdentifier + "-" + rule.getId(), rule.getDstIp())) { + if (!_connection.createTenantVDCPFIpPool(tenant, Long.toString(rule.getId()), rule.getDstIp())) { throw new Exception("Failed to create PF ip pool in VNMC for guest network with vlan " + vlanId); } - if (!_connection.createTenantVDCPFPortPool(tenant, policyIdentifier + "-" + rule.getId(), + if (!_connection.createTenantVDCPFPortPool(tenant, Long.toString(rule.getId()), Integer.toString(rule.getDstPortRange()[0]), Integer.toString(rule.getDstPortRange()[1]))) { throw new Exception("Failed to create PF port pool in VNMC for guest network with vlan " + vlanId); }
