Hi,
I'm trying to create an OrgVDC Network for my newly created OrgVDCs via PowerCLI. Unfortunately I'm getting an erorr stating:
I am referencing: http://www.vmware.com/support/developer/PowerCLI/PowerCLI51/html/New-OrgNetwork.html
Command I am using is:
New-OrgNetwork -Direct -Name 'MyOrgDirectNetwork' -Org 'MyOrganization' -ExternalNetwork 'MyExternalNetwork' -Description "None"
Please tell me this is not a another bug and I'm doing something wrong. I really do not want to go creating 20 OrgVDC networks manually.
Thanks!
Here's a quick example of crearting an Isolated OrgVdc network:
$orgVdcNet = New-Object 'VMware.VimAutomation.Cloud.Views.OrgVdcNetwork'
$orgVdcNet.Name = 'TmpOrgVdcNet'
$orgVdcNet.Configuration = New-Object 'VMware.VimAutomation.Cloud.Views.NetworkConfiguration'
$orgVdcNet.Configuration.IpScopes = New-Object 'VMware.VimAutomation.Cloud.Views.IpScopes'
$ipscope = New-Object "VMware.VimAutomation.Cloud.Views.IpScope"
$ipscope.Gateway = '192.168.0.1'
$ipscope.Netmask = '255.255.255.0'
$orgVdcNet.Configuration.IpScopes.IpScope += $ipscope
$orgVdcNet.Configuration.FenceMode = 'isolated'
$orgVdcView = Get-OrgVdc Org1Vdc1 | Get-CIView
$result = $orgVdcView.CreateNetwork($orgVdcNet)
Get-OrgNetwork $result.Name
Name Gateway Org ExternalNetwork NetworkType
---- ------- --- --------------- -----------
TmpOrgVdcNet 192.168.0.1 Organization1 Isolated
I know that it's a hassle building the configuration of the OrgVdcNetwork by hand, but still you can prepare a function that'll work for your needs.
Hope that this example will give you an idea what to do.
If you reference the newest R2 docs (http://www.vmware.com/support/developer/PowerCLI/PowerCLI51R2/html/index.html) it says:
"You can run this cmdlet only against vCloud Director 1.5.x environments."
Cheers,
Jake Robinson
Solutions Architect
Bluelock, LLC
Thread moved to vCloud Director PowerCLI
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
So there is no way to automate the creation of new OrgVDC Networks? Why automate the creation of Orgs, OrgVDCs then have to go manually create OrgVDC Networks?
Thanks!
It's still possible to create OrgVdc Network, using the PowerCLI cloud views.
Thanks Pavel, could you provide me with an example or point me in the right direction, to an online reference or something....
Here's a quick example of crearting an Isolated OrgVdc network:
$orgVdcNet = New-Object 'VMware.VimAutomation.Cloud.Views.OrgVdcNetwork'
$orgVdcNet.Name = 'TmpOrgVdcNet'
$orgVdcNet.Configuration = New-Object 'VMware.VimAutomation.Cloud.Views.NetworkConfiguration'
$orgVdcNet.Configuration.IpScopes = New-Object 'VMware.VimAutomation.Cloud.Views.IpScopes'
$ipscope = New-Object "VMware.VimAutomation.Cloud.Views.IpScope"
$ipscope.Gateway = '192.168.0.1'
$ipscope.Netmask = '255.255.255.0'
$orgVdcNet.Configuration.IpScopes.IpScope += $ipscope
$orgVdcNet.Configuration.FenceMode = 'isolated'
$orgVdcView = Get-OrgVdc Org1Vdc1 | Get-CIView
$result = $orgVdcView.CreateNetwork($orgVdcNet)
Get-OrgNetwork $result.Name
Name Gateway Org ExternalNetwork NetworkType
---- ------- --- --------------- -----------
TmpOrgVdcNet 192.168.0.1 Organization1 Isolated
I know that it's a hassle building the configuration of the OrgVdcNetwork by hand, but still you can prepare a function that'll work for your needs.
Hope that this example will give you an idea what to do.
Awesome thanks Pavel Dimitrov I'll test it out this weekend!
Thanks Pavel your script worked for an Isolated OrgVdc network.
I am trying to create an OrgVDC bridged network but can't seem to get it working, I always get errors on creation. Do you have a sample for scripting a bridged network with cloud views?
Thanks!
Did you ever figure this out? I am trying to create a natRouted network as well and having an issue.
Nope never got a response. Ended up manually creating them.
Just for kicks, here is a working script for creating a natRouted OrgNetwork:
$orgName = "1001"
$orgNetName = "1001-Test"
$org = Get-OrgVdc $orgName | Get-CIView
$edgeGateway = Search-Cloud -QueryType EdgeGateway | Get-CIView | where {$_.name -like "$orgName*"}
$mynetwork = new-object vmware.vimautomation.cloud.views.orgvdcnetwork
$mynetwork.name = $orgNetName
$mynetwork.edgegateway = $edgeGateway.id
$mynetwork.configuration = new-object vmware.vimautomation.cloud.views.networkconfiguration
$mynetwork.configuration.fencemode = "natRouted"
$mynetwork.configuration.ipscopes = new-object vmware.vimautomation.cloud.views.ipscopes
$scope = new-object vmware.vimautomation.cloud.views.ipscope
$scope.gateway = "192.168.2.1"
$scope.netmask = "255.255.255.0"
$scope.dns1 = "192.168.2.1"
$scope.ipranges = new-object vmware.vimautomation.cloud.views.ipranges
$scope.ipranges.iprange = new-object vmware.vimautomation.cloud.views.iprange
$scope.ipranges.iprange[0].startaddress = "192.168.2.100"
$scope.ipranges.iprange[0].endaddress = "192.168.2.200"
$mynetwork.configuration.ipscopes.ipscope += $scope
$result = $org.CreateNetwork($mynetwork)
Some portions of this are dependent on naming conventions for EdgeGateways but it will at least give you what you would need to modify it.