From c961fb11a687327c0479b9413ca7f234fcdba072 Mon Sep 17 00:00:00 2001 From: Murali reddy Date: Tue, 1 May 2012 12:20:12 +0530 Subject: [PATCH] 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 --- .../network/resource/NetscalerResource.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/core/src/com/cloud/network/resource/NetscalerResource.java b/core/src/com/cloud/network/resource/NetscalerResource.java index 5ba1a962ef0..160c90ec1e7 100644 --- a/core/src/com/cloud/network/resource/NetscalerResource.java +++ b/core/src/com/cloud/network/resource/NetscalerResource.java @@ -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