Function: Add a Private Isolated Network in a vCloud vApp

by Simon Sparks · 5 September 2025

To use this function add it to the class library file named OrchestratorService.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: OrchestratorService.ts

Description: Orchestrator Function to create a Private Isolated Network in a vCloud vApp.

Function: VclVAppNetworkCreate

public VclVAppNetworkCreate(objVclNetworkConfigSection: VclNetworkConfigSection, strNetworkName: string, strNetworkDescription: string, strIpAddressRangeStart: string, strIpAddressRangeEnd: string, strIpAddressGateway: string, strIpSubnetMask: string, strIpAddressDnsServerPrimary: string, strIpAddressDnsServerSecondary: string, strIpAddressSyslogServerPrimary: string, strIpAddressSyslogServerSecondary: string, strIpAddressDnsSuffix: string): void {
    let objVclIpRange: VclIpRange = new VclIpRange();
    objVclIpRange.startAddress = strIpAddressRangeStart;
    objVclIpRange.endAddress = strIpAddressRangeEnd;

    let objVclIpRanges: VclIpRanges = new VclIpRanges();
    objVclIpRanges.ipRange.add(objVclIpRange);

    let objVclIpScope: VclIpScope = new VclIpScope();
    objVclIpScope.gateway = strIpAddressGateway;
    objVclIpScope.netmask = strIpSubnetMask;
    objVclIpScope.ipRanges = objVclIpRanges;
    objVclIpScope.dns1 = strIpAddressDnsServerPrimary;
    objVclIpScope.dns2 = strIpAddressDnsServerSecondary;
    objVclIpScope.dnsSuffix = strIpAddressDnsSuffix;
    objVclIpScope.allocatedIpAddresses = null;
    objVclIpScope.subAllocations = null;
    objVclIpScope.isEnabled = true;
    objVclIpScope.isInherited = false;

    let objVclIpScopes: VclIpScopes = new VclIpScopes();
    objVclIpScopes.ipScope.add(objVclIpScope);

    let objVclSyslogServerSettings: VclSyslogServerSettings = new VclSyslogServerSettings();
    objVclSyslogServerSettings.syslogServerIp1 = strIpAddressSyslogServerPrimary;
    objVclSyslogServerSettings.syslogServerIp2 = strIpAddressSyslogServerSecondary;

    let objVclNetworkConfigurationPRIVATE: VclNetworkConfiguration = new VclNetworkConfiguration();
    objVclNetworkConfigurationPRIVATE.syslogServerSettings = objVclSyslogServerSettings;
    objVclNetworkConfigurationPRIVATE.ipScope = objVclIpScope;
    objVclNetworkConfigurationPRIVATE.ipScopes = objVclIpScopes;
    objVclNetworkConfigurationPRIVATE.fenceMode = "isolated";
    objVclNetworkConfigurationPRIVATE.features = null;
    objVclNetworkConfigurationPRIVATE.routerInfo = null;
    objVclNetworkConfigurationPRIVATE.backwardCompatibilityMode = false;
    objVclNetworkConfigurationPRIVATE.retainNetInfoAcrossDeployments = false;
    objVclNetworkConfigurationPRIVATE.parentNetwork = null;

    let objVclVAppNetworkConfigurationPRIVATE: VclVAppNetworkConfiguration = new VclVAppNetworkConfiguration();
    objVclVAppNetworkConfigurationPRIVATE.configuration = objVclNetworkConfigurationPRIVATE;
    objVclVAppNetworkConfigurationPRIVATE.description = strNetworkDescription;
    objVclVAppNetworkConfigurationPRIVATE.networkName = strNetworkName;
    objVclVAppNetworkConfigurationPRIVATE.isDeployed = true;

    objVclNetworkConfigSection.networkConfig.add(objVclVAppNetworkConfigurationPRIVATE);
}


Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like