I am facing a problem while adding an “isolated” network to an existing vApp. Getting exception thrown with message “Unable to create network “mynetwork”. Invalid network parameter: Subnet mask cannot be empty.”
Below is the code,
VAppNetworkConfigurationType vAppNetworkConfigurationType = new VAppNetworkConfigurationType(); vAppNetworkConfigurationType.networkName = “myNetwork”; vAppNetworkConfigurationType.Configuration = new NetworkConfigurationType(); vAppNetworkConfigurationType.Configuration.FenceMode = “isolated”; vAppNetworkConfigurationType.Configuration.IpScope = new IpScopeType(); vAppNetworkConfigurationType.Configuration.IpScope.Gateway = “192.168.2.1″; vAppNetworkConfigurationType.Configuration.IpScope.Netmask = “255.255.255.0″; IpRangeType ipRange = new IpRangeType(); ipRange.StartAddress = “192.168.2.100″; ipRange.EndAddress = “192.168.2.199″; vAppNetworkConfigurationType.Configuration.IpScope.IpRanges = new IpRangesType(); vAppNetworkConfigurationType.Configuration.IpScope.IpRanges.IpRange = new IpRangeType[]{ipRange}; NetworkConfigSectionType networkConfigSectionType = new NetworkConfigSectionType(); networkConfigSectionType.NetworkConfig = new VAppNetworkConfigurationType[] {vAppNetworkConfigurationType}; networkConfigSectionType.Info = new Msg_Type(); Task task_net = vApp.UpdateSection(networkConfigSectionType); task_net.WaitForTask(timeout); <<< Exception is thrown in this line