Hi guys.
I can't create Routed Org Network by PowerCLI.
PowerCLI version is 6.5.0.234 and vCD for SP version is 8.20.0.2.
I'm connected to vCD server and all objects are exists: Org "Test", OrgVDC "Test-VDC" and EdgeGW "Test-EdgeGW".
But last one (EdgeGW) isn't using in script and it's strange because in process of creation routed org network in GUI we are choosing existing Edge Gateway... (see pic).
I suppose that script is out of date...
PowerCLI C:\> $OrgName = "Test"
PowerCLI C:\> $Org = Get-Org -Name $OrgName
PowerCLI C:\> $OrgVDCName = "$OrgName-VDC"
PowerCLI C:\> $OrgVDC = Get-OrgVdc -Name $OrgVDCName
PowerCLI C:\> $edgeGateway = Search-Cloud -QueryType EdgeGateway -Name $orgName | Get-CIView | where {$_.name -like "$orgName*"}
PowerCLI C:\> $ExNetnetwork = New-Object VMware.VimAutomation.Cloud.Views.OrgVdcNetwork
PowerCLI C:\> $ExNetnetwork.EdgeGateway = $edgeGateway.Id
PowerCLI C:\> $ExNetnetwork.isShared = $false
PowerCLI C:\> $ExNetnetwork.Configuration = New-Object VMware.VimAutomation.Cloud.Views.NetworkConfiguration
PowerCLI C:\> $ExNetnetwork.Name = "$OrgName-Org-Net01"
PowerCLI C:\> $ExNetnetwork.Configuration.IpScopes = New-Object VMware.VimAutomation.Cloud.Views.IpScopes
PowerCLI C:\> $ExNetnetwork.Configuration.FenceMode = "natRouted"
PowerCLI C:\> $IpScope = New-Object VMware.VimAutomation.Cloud.Views.IpScope
PowerCLI C:\> $IpScope.Gateway = "192.168.100.1"
PowerCLI C:\> $IpScope.Netmask = "255.255.255.0"
PowerCLI C:\> $IpScope.Dns1 = "8.8.8.8"
PowerCLI C:\> $IpScope.IpRanges = New-Object VMware.VimAutomation.Cloud.Views.IpRanges
PowerCLI C:\> $IpScope.IpRanges.IpRange = New-Object VMware.VimAutomation.Cloud.Views.IpRange
PowerCLI C:\> $IpScope.IpRanges.IpRange[0].StartAddress = "192.168.100.2"
PowerCLI C:\> $IpScope.IpRanges.IpRange[0].EndAddress = "192.168.100.50"
PowerCLI C:\> $ExNetnetwork.Configuration.IpScopes.IpScope += $IpScope
PowerCLI C:\> $orgVdc.ExtensionData.CreateNetwork($ExNetnetwork)
Exception calling "CreateNetwork" with "1" argument(s): "The server returned 'Server Error' with the status code 500 - InternalServerError."
At line:1 char:1
+ $orgVdc.ExtensionData.CreateNetwork($ExNetnetwork)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : CloudException
What's wrong? Can anybody give me working example of creating Routed Org Network by PowerCLI?