Quantcast
Channel: VMware Communities : Popular Discussions - vCloud Director PowerCLI
Viewing all articles
Browse latest Browse all 13334

Organization vDC Edge Gateway

$
0
0

Been trying to figure out how to create a edge gateway in a vDC with powershell and have gotten nowhere, perhaps someone else can give a hand?

 

So i've tried to check an excisting edge gateway to see what's required when creating one, but that hasn't really helped. So here's what i've been trying to do sofar:

 

$example = search-cloud -QueryType EdgeGateway | where {$_.name -like "*test*"} | Get-CIView

 

Status          : 1

Configuration   : VMware.VimAutomation.Cloud.Views.GatewayConfiguration

Name            : test

Description     : test edgegw

Tasks           :

Id              : urn:vcloud:gateway:2e062275-a6db-46b4-83ec-170a24b4fe8d

OperationKey    :

Client          : VMware.VimAutomation.Cloud.Views.CloudClient

Href            : https://example.url/api/admin/edgeGateway/2e062275-a6db-46b4-83ec-170a24b4fe8d

Type            : application/vnd.vmware.admin.edgeGateway+xml

Link            : {, , , ...}

AnyAttr         : {xsi:schemaLocation}

VCloudExtension :

 

 

Now, i've tried the following:

$externalnetwork = Get-ExternalNetwork | Get-CIView | ?{$_.name -eq $vCDExtNetName}
$myExtNetwork = new-object vmware.vimautomation.cloud.views.Gateway
$myExtNetwork.Name = $vCDEdgeGWName
$myExtNetwork.Description = $vCDEdgeGWDesc
$myEdgeGateway.GatewayConfiguration  = new-object VMware.VimAutomation.Cloud.Views.GatewayConfiguration
$myEdgeGateway.GatewayConfiguration.GatewayBackingConfig = "compact"
$myEdgeGateway.GatewayConfiguration.GatewayInterfaces  = new-object VMware.VimAutomation.Cloud.Views.reference
$myEdgeGateway.GatewayConfiguration.GatewayInterfaces.GatewayInterface  = new-object VMware.VimAutomation.Cloud.Views.reference
$myEdgeGateway.GatewayConfiguration.GatewayInterfaces.GatewayInterface.Name  = "uplink1"
$myEdgeGateway.GatewayConfiguration.GatewayInterfaces.GatewayInterface.DisplayName  = "uplink1"
$myEdgeGateway.GatewayConfiguration.GatewayInterfaces.GatewayInterface.Network  = $externalnetwork.href
$myEdgeGateway.GatewayConfiguration.GatewayInterfaces.GatewayInterface.InterfaceType = "uplink"
$myEdgeGateway.GatewayConfiguration.IpScopes  = new-object VMware.VimAutomation.Cloud.Views.IpScopes
$myEdgeGateway.GatewayConfiguration.IpScopes.IpScope  = new-object VMware.VimAutomation.Cloud.Views.IpScope
$myEdgeGateway.GatewayConfiguration.IpScopes.ipscope[0].Gateway = $vCDExtNetGw
$myEdgeGateway.GatewayConfiguration.IpScopes.ipscope[0].Netmask = $vCDExtNetSubNetmask
$myEdgeGateway.GatewayConfiguration.IpScopes.ipscope[0].IsInherited = "False"
$myEdgeGateway.GatewayConfiguration.IpScopes.ipscope[0].ipranges = new-object vmware.vimautomation.cloud.views.ipranges
$myEdgeGateway.GatewayConfiguration.Ipscopes.ipscope[0].ipranges.iprange = new-object vmware.vimautomation.cloud.views.iprange
$myEdgeGateway.GatewayConfiguration.IpScopes.ipscope[0].IpRanges.IpRange[0].startaddress = $vCDEdgeWanIPStart
$myEdgeGateway.GatewayConfiguration.IpScopes.ipscope[0].IpRanges.IpRange[0].endaddress = $vCDEdgeWanIPEnd
$myEdgeGateway.GatewayConfiguration.IpScopes.ipscope[0].AllocatedIpAddresses = new-object vmware.vimautomation.cloud.views.AllocatedIpAddresses
$myEdgeGateway.GatewayConfiguration.IpScopes.ipscope[0].AllocatedIpAddresses.IpAddress[0] = $vCDEdgeWanIP

 

 

 

Now this gives a lot of errors, but the first:

 

Property 'GatewayConfiguration' cannot be found on this object; make sure it exists and is settable.

At D:\DC-DEV\Powershell\test.ps1:96 char:17

+     $myEdgeGateway. <<<< GatewayConfiguration  = new-object VMware.VimAutomation.Cloud.Views.GatewayConfiguration

    + CategoryInfo          : InvalidOperation: (GatewayConfiguration:String) [], RuntimeException

    + FullyQualifiedErrorId : PropertyNotFound

 

 

Property 'GatewayBackingConfig' cannot be found on this object; make sure it exists and is settable.

At D:\DC-DEV\Powershell\test.ps1:97 char:38

+     $myEdgeGateway.GatewayConfiguration. <<<< GatewayBackingConfig = "compact"

    + CategoryInfo          : InvalidOperation: (GatewayBackingConfig:String) [], RuntimeException

    + FullyQualifiedErrorId : PropertyNotFound

 

 

Property 'GatewayInterfaces' cannot be found on this object; make sure it exists and is settable.

At D:\DC-DEV\Powershell\test.ps1:100 char:38

+     $myEdgeGateway.GatewayConfiguration. <<<< GatewayInterfaces  = new-object VMware.VimAutomation.Cloud.Views.reference

    + CategoryInfo          : InvalidOperation: (GatewayInterfaces:String) [], RuntimeException

    + FullyQualifiedErrorId : PropertyNotFound

 

Clearly there's a lot things wrong with this, like that GatewayConfiguration doesn't excist and so on. I've also tried "Configuration" with the same error, as stated here: VMware vCloud Director 5.5 Documentation Center

 

I'm just lost on how should i figure out what to use in this method to get things working? The API documentation gives a hint but doesn't seem to apply 1:1 or then i'm reading it wrong.


Viewing all articles
Browse latest Browse all 13334

Trending Articles