bug cs-14510:NetScaler SDX does not work when public network is setup to be in untagged network

status cs-14510: resolved fixed

This fix ensures VPX's provisioned on the SDX by CloudStack will be made part of both
tagged and untagged public networks
This commit is contained in:
Murali reddy 2012-05-01 12:20:12 +05:30
parent 1ac0ac956b
commit c961fb11a6
1 changed files with 24 additions and 1 deletions

View File

@ -189,7 +189,13 @@ public class NetscalerResource implements ServerResource {
_publicIPGateway = (String) params.get("publicipgateway");
_publicIPNetmask = (String) params.get("publicipnetmask");
_publicIPVlan = (String) params.get("publicipvlan");
addGuestVlanAndSubnet(Long.parseLong(_publicIPVlan), _publicIP, _publicIPNetmask, false);
if ("untagged".equalsIgnoreCase(_publicIPVlan)) {
// if public network is un-tagged just add subnet IP
addSubnetIP(_publicIP, _publicIPNetmask);
} else {
// if public network is tagged then add vlan and bind subnet IP to the vlan
addGuestVlanAndSubnet(Long.parseLong(_publicIPVlan), _publicIP, _publicIPNetmask, false);
}
}
return true;
@ -898,6 +904,23 @@ public class NetscalerResource implements ServerResource {
}
}
private void addSubnetIP(String snip, String netmask) throws ExecutionException {
try {
nsip selfIp = new nsip();
selfIp.set_ipaddress(snip);
selfIp.set_netmask(netmask);
selfIp.set_type("SNIP");
apiCallResult = nsip.add(_netscalerService, selfIp);
if (apiCallResult.errorcode != 0) {
throw new ExecutionException("Failed to add SNIP object on the Netscaler device due to "+ apiCallResult.message);
}
} catch (nitro_exception e) {
throw new ExecutionException("Failed to add SNIP object on the Netscaler device due to " + e.getMessage());
} catch (Exception e) {
throw new ExecutionException("Failed to add SNIP object on the Netscaler device due to " + e.getMessage());
}
}
private void addGuestVlanAndSubnet(long vlanTag, String vlanSelfIp, String vlanNetmask, boolean guestVlan) throws ExecutionException {
try {
// add vlan object for guest VLAN