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 c7380ab11d8..0e57cae6ddc 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 rules = listChildren(getDnForDNatPolicy(tenantName, policyIdentifier)); 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 9c81b2e28a1..176fdc45062 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); }