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?
Hi,
the function also works in my vCD 9.1 Test-Lab.
Might you please update your local Copy of the Module from Master Branch. I Have added some Verbose output and more Error handling.
Verbose call:
$params = @{ 'Name' = '<String>';
'OrgVdcName'=<String>'';
'OrgName'='<String>';
'EdgeName'='<String>';
'SubnetMask' = '255.255.255.0';
'Gateway' = '192.168.66.1';
'IPRangeStart' = '192.168.66.100';
'IPRangeEnd' = '192.168.66.200'
}
New-MyOrgNetwork @params -Verbose
PowerCLI C:\> $params = @{ 'Name' = 'Test-Org-Net02';
>> 'OrgVdcName'= 'Test-VDC';
>> 'OrgName'='Test';
>> 'EdgeName'='Test-EdgeGW';
>> 'SubnetMask' = '255.255.255.0';
>> 'Gateway' = '192.168.66.1';
>> 'IPRangeStart' = '192.168.66.100';
>> 'IPRangeEnd' = '192.168.66.200'
>> }
PowerCLI C:\> New-MyOrgNetwork @params -Verbose
DETAILED: Get Org vDC
DETAILED: 12/4/2018 23:14:12 Get-Org Started execution
DETAILED: 12/4/2018 23:14:18 Get-OrgVdc Started execution
DETAILED: 12/4/2018 23:14:22 Get-OrgVdc Finished execution
DETAILED: 12/4/2018 23:14:22 Get-Org Finished execution
DETAILED: 12/4/2018 23:14:22 Get-CIView Started execution
DETAILED: 12/4/2018 23:14:22 Get-CIView Finished execution
DETAILED: Get EdgeGateway
DETAILED: 12/4/2018 23:14:22 Search-Cloud Started execution
DETAILED: 12/4/2018 23:14:22 Get-CIView Started execution
DETAILED: 12/4/2018 23:14:25 Get-CIView Finished execution
DETAILED: 12/4/2018 23:14:25 Search-Cloud Finished execution
DETAILED: Define Org Network
DETAILED: Create Org Network
Exclusion in calling "CreateNetwork" with "1" arguments: "[ 470257c4-6517-4212-8885-273abdcfb2a3 ] class java.lang.NullPointerException"
C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Modules\New-MyOrgNetwork\New-MyOrgNetwork.psm1:131 sign:9
+ $CreateOrgNetwork = $orgVdcView.CreateNetwork($OrgNetwork)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : CloudException
DETAILED: Wait for Org Network to become Ready
Get-OrgVdcNetwork : Cannot check the argument for the "Id" parameter. The argument is empty or NULL. Specify a non-null argument that does not have a NULL value, and then retry the command.
C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Modules\New-MyOrgNetwork\New-MyOrgNetwork.psm1:135 sign:39
+ while(!(Get-OrgVdcNetwork -Id $CreateOrgNetwork.Id -ErrorActi ...
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-OrgVdcNetwork], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.Cloud.Commands.Cmdlets.GetOrgVdcNetwork
Get-OrgVdcNetwork : Cannot check the argument for the "Id" parameter. The argument is empty or NULL. Specify a non-null argument that does not have a NULL value, and then retry the command.
C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Modules\New-MyOrgNetwork\New-MyOrgNetwork.psm1:144 sign:31
+ Get-OrgVdcNetwork -Id $CreateOrgNetwork.Id | Select-Object Na ...
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-OrgVdcNetwork], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.Cloud.Commands.Cmdlets.GetOrgVdcNetwork
PowerCLI C:\>
Markus,
I have Edge Gateway in Advanced Mode.
And also connected as System Admin (not Org Admin)?
If so, I only see the option to compare a manually created Org Network with the parameters in the function.
Markus, i always work as System Admin at vCD.
I have opinion that some cmdlets work strange for me...
For example, search-cloud don't search orgnetworks...
As you see - empty output.
In the same time search-cloud search edgegateways successfully...
PowerCLI C:\> $OrgNetwork = Search-Cloud -QueryType OrgNetwork -Name "Test-Org-Net01"
PowerCLI C:\> $OrgNetwork
PowerCLI C:\>
PowerCLI C:\> $OrgNetwork = Search-Cloud -QueryType OrgNetwork
PowerCLI C:\>
PowerCLI C:\> $EdgeGW = Search-Cloud -QueryType EdgeGateway -Name "Test-EdgeGW"
PowerCLI C:\> $EdgeGW
Name : Test-EdgeGW
Vdc : urn:vcloud:vdc:b4698235-fa1b-46be-8a10-3c59c90efb42
NumberOfExtNetworks : 1
NumberOfOrgNetworks : 1
IsBusy : False
GatewayStatus : READY
HaStatus : DISABLED
AdvancedNetworkingEnabled : True
Href :
Id : urn:vcloud:gateway:f05cf503-10d1-4cb1-87ea-6c6e669495f0
Type :
AnyAttr : {task, isSyslogServerSettingInSync, taskOperation, taskStatus...}
Link :
Metadata :
PropertyList : {[Name, Test-EdgeGW], [Vdc, urn:vcloud:vdc:b4698235-fa1b-46be-8a10-3c59c90efb42],
[NumberOfExtNetworks, 1], [NumberOfOrgNetworks, 1]...}
ps: Btw, do you know how to change language of messages in powershell to Eng? Now i have Rus and translate error messages to English manually
I think the Query Type "AdminOrgNetwork" should work for you.