CSIEnvironments
Enthusiast
Enthusiast

Issue with New-OrgNetwork in vCloud 5.1

Jump to solution

Hi,

I'm trying to create an OrgVDC Network for my newly created OrgVDCs via PowerCLI. Unfortunately I'm getting an erorr stating:

New-OrgNetwork : 3/21/2013 2:03:45 PM    New-OrgNetwork        The requested operation is not supported on vCloud Director versions greater than
1.5.

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!

0 Kudos
1 Solution

Accepted Solutions
Pavel_Dimitrov
Enthusiast
Enthusiast

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.

View solution in original post

0 Kudos
11 Replies
jake_robinson_b
Hot Shot
Hot Shot

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

Jake Robinson VCP, vExpert - geekafterfive.com - Twitter: @jakerobinson
LucD
Leadership
Leadership

Thread moved to vCloud Director PowerCLI


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
CSIEnvironments
Enthusiast
Enthusiast

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!

0 Kudos
Pavel_Dimitrov
Enthusiast
Enthusiast

It's still possible to create OrgVdc Network, using the PowerCLI cloud views.

CSIEnvironments
Enthusiast
Enthusiast

Thanks Pavel, could you provide me with an example or point me in the right direction, to an online reference or something....

0 Kudos
Pavel_Dimitrov
Enthusiast
Enthusiast

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.

View solution in original post

0 Kudos
CSIEnvironments
Enthusiast
Enthusiast

Awesome thanks Pavel Dimitrov Smiley Happy I'll test it out this weekend!

0 Kudos
CSIEnvironments
Enthusiast
Enthusiast

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!

0 Kudos
jamesbowling
VMware Employee
VMware Employee

Did you ever figure this out?  I am trying to create a natRouted network as well and having an issue.

James B. | Blog: http://www.vSential.com | Twitter: @vSential --- If you found this helpful then please awards helpful or correct points accordingly. Thanks!
0 Kudos
CSIEnvironments
Enthusiast
Enthusiast

Nope never got a response. Ended up manually creating them.

0 Kudos
jamesbowling
VMware Employee
VMware Employee

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.

James B. | Blog: http://www.vSential.com | Twitter: @vSential --- If you found this helpful then please awards helpful or correct points accordingly. Thanks!
0 Kudos