VMware {code} Community
kvp511
Enthusiast
Enthusiast
Jump to solution

API gateway help

I've been working with the vCloud API to automate our manual vdc process. So far I've figured out how to create a new org, add users, add a vdc, allocate resources, and add a network to the org.

What I'm having trouble with is figuring out how to query and change the edge gateway info. The RESTful api calls just don't seem to work the same way the others did. I'm looking to do some simple things like change the edge gateway name, get the external IP allocation and update the sub-allocated IP pools with that information. I'd also like to Configure Rate Limits. Basically any tabbed set of items within the Edge Gateway Properties I'd like to be able to work with.

Thanks

0 Kudos
1 Solution

Accepted Solutions
kvp511
Enthusiast
Enthusiast
Jump to solution

Actually after running the queries again I've just realized that my /api/admin/vdc call does not return a <Link rel="edgeGateways"...

I believe I have just figured out what the issue was. My accept header was pointing to version=1.5 and not version=5.1.

View solution in original post

0 Kudos
5 Replies
gharbaliev
VMware Employee
VMware Employee
Jump to solution

You can get the admin vDC

GET: https://10.26.58.36/api/admin/vdc/815814d3-1bf4-4bf7-8e26-568f6177ed9a

it will show link like this:

<Link rel="edgeGateways" type="application/vnd.vmware.vcloud.query.records+xml" href="https://10.26.58.36/api/admin/vdc/815814d3-1bf4-4bf7-8e26-568f6177ed9a/edgeGateways"/>

GET: https://10.26.58.36/api/admin/vdc/815814d3-1bf4-4bf7-8e26-568f6177ed9a/edgeGateways

Would show the list of gateways:

<?xml version="1.0" encoding="UTF-8"?>

<QueryResultRecords xmlns="http://www.vmware.com/vcloud/v1.5" total="2" pageSize="25" page="1" name="edgeGateway" type="application/vnd.vmware.vcloud.query.records+xml" href="https://10.26.58.36/api/admin/vdc/815814d3-1bf4-4bf7-8e26-568f6177ed9a/edgeGateways?page=1&pageSize=..." xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://10.26.58.36/api/v1.5/schema/master.xsd">

    <Link rel="alternate" type="application/vnd.vmware.vcloud.query.references+xml" href="https://10.26.58.36/api/admin/vdc/815814d3-1bf4-4bf7-8e26-568f6177ed9a/edgeGateways?page=1&pageSize=..."/>

    <Link rel="alternate" type="application/vnd.vmware.vcloud.query.idrecords+xml" href="https://10.26.58.36/api/admin/vdc/815814d3-1bf4-4bf7-8e26-568f6177ed9a/edgeGateways?page=1&pageSize=..."/>

    <EdgeGatewayRecord vdc="https://10.26.58.36/api/vdc/815814d3-1bf4-4bf7-8e26-568f6177ed9a" numberOfOrgNetworks="1" numberOfExtNetworks="1" name="gateway" isBusy="false" haStatus="UP" gatewayStatus="READY" href="https://10.26.58.36/api/admin/edgeGateway/09d35a2e-0844-437d-bcd5-f2b22f7a9dbf" isSyslogServerSettingInSync="true" taskStatus="success" taskOperation="networkConfigureEdgeGatewayServices" task="https://10.26.58.36/api/task/6fcd9292-bcda-4924-af7b-12548c0d9016" taskDetails=" "/>

    <EdgeGatewayRecord vdc="https://10.26.58.36/api/vdc/815814d3-1bf4-4bf7-8e26-568f6177ed9a" numberOfOrgNetworks="0" numberOfExtNetworks="1" name="gateway2" isBusy="false" haStatus="DISABLED" gatewayStatus="READY" href="https://10.26.58.36/api/admin/edgeGateway/aaf72958-2ec5-4106-9deb-9548b6d6b58e" isSyslogServerSettingInSync="true" taskStatus="success" taskOperation="networkEdgeGatewayCreate" task="https://10.26.58.36/api/task/83b89ac4-b3da-4670-bbc6-4440101201b7" taskDetails=" "/>

</QueryResultRecords>

Get the href of some of them:

GET: https://10.26.58.36/api/admin/edgeGateway/09d35a2e-0844-437d-bcd5-f2b22f7a9dbf

<?xml version="1.0" encoding="UTF-8"?>

<EdgeGateway xmlns="http://www.vmware.com/vcloud/v1.5" status="1" name="gateway" id="urn:vcloud:gateway:09d35a2e-0844-437d-bcd5-f2b22f7a9dbf" type="application/vnd.vmware.admin.edgeGateway+xml" href="https://10.26.58.36/api/admin/edgeGateway/09d35a2e-0844-437d-bcd5-f2b22f7a9dbf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://10.26.58.36/api/v1.5/schema/master.xsd">

    <Link rel="edit" type="application/vnd.vmware.admin.edgeGateway+xml" href="https://10.26.58.36/api/admin/edgeGateway/09d35a2e-0844-437d-bcd5-f2b22f7a9dbf"/>

    <Link rel="remove" href="https://10.26.58.36/api/admin/edgeGateway/09d35a2e-0844-437d-bcd5-f2b22f7a9dbf"/>

    <Link rel="up" type="application/vnd.vmware.admin.vdc+xml" href="https://10.26.58.36/api/admin/vdc/815814d3-1bf4-4bf7-8e26-568f6177ed9a"/>

    <Link rel="edgeGateway:redeploy" href="https://10.26.58.36/api/admin/edgeGateway/09d35a2e-0844-437d-bcd5-f2b22f7a9dbf/action/redeploy"/>

    <Link rel="edgeGateway:configureServices" type="application/vnd.vmware.admin.edgeGatewayServiceConfiguration+xml" href="https://10.26.58.36/api/admin/edgeGateway/09d35a2e-0844-437d-bcd5-f2b22f7a9dbf/action/configureServi..."/>

    <Link rel="edgeGateway:reapplyServices" href="https://10.26.58.36/api/admin/edgeGateway/09d35a2e-0844-437d-bcd5-f2b22f7a9dbf/action/reapplyService..."/>

    <Link rel="edgeGateway:syncSyslogSettings" href="https://10.26.58.36/api/admin/edgeGateway/09d35a2e-0844-437d-bcd5-f2b22f7a9dbf/action/syncSyslogServ..."/>

    <Link rel="edgeGateway:upgrade" href="https://10.26.58.36/api/admin/edgeGateway/09d35a2e-0844-437d-bcd5-f2b22f7a9dbf/action/upgradeConfig"/>

    <Description/>

    <Configuration>

        <GatewayBackingConfig>compact</GatewayBackingConfig>

        <GatewayInterfaces>

            <GatewayInterface>

                <Name>natRoutedNetwork</Name>

                <DisplayName>natRoutedNetwork</DisplayName>

                <Network type="application/vnd.vmware.admin.network+xml" name="natRoutedNetwork" href="https://10.26.58.36/api/admin/network/4cbbefc1-875e-4ce6-abde-90ebd0e29539"/>

                <InterfaceType>internal</InterfaceType>

                <SubnetParticipation>

                    <Gateway>221.192.0.1</Gateway>

                    <Netmask>255.255.255.0</Netmask>

                    <IpAddress>221.192.0.1</IpAddress>

                </SubnetParticipation>

                <ApplyRateLimit>false</ApplyRateLimit>

                <UseForDefaultRoute>false</UseForDefaultRoute>

            </GatewayInterface>

            <GatewayInterface>

                <Name>ext</Name>

                <DisplayName>ext</DisplayName>

                <Network type="application/vnd.vmware.admin.network+xml" name="ext" href="https://10.26.58.36/api/admin/network/0366322f-e7d9-48eb-8c5b-a4bf3b6d827d"/>

                <InterfaceType>uplink</InterfaceType>

                <SubnetParticipation>

                    <Gateway>10.26.63.253</Gateway>

                    <Netmask>255.255.240.0</Netmask>

                    <IpAddress>10.26.53.151</IpAddress>

                </SubnetParticipation>

                <ApplyRateLimit>false</ApplyRateLimit>

                <InRateLimit>100.0</InRateLimit>

                <OutRateLimit>100.0</OutRateLimit>

                <UseForDefaultRoute>true</UseForDefaultRoute>

            </GatewayInterface>

        </GatewayInterfaces>

        <EdgeGatewayServiceConfiguration>

            <GatewayDhcpService>

                <IsEnabled>true</IsEnabled>

            </GatewayDhcpService>

            <FirewallService>

                <IsEnabled>true</IsEnabled>

                <DefaultAction>allow</DefaultAction>

                <LogDefaultAction>false</LogDefaultAction>

                <FirewallRule>

                    <Id>1</Id>

                    <IsEnabled>true</IsEnabled>

                    <MatchOnTranslate>false</MatchOnTranslate>

                    <Description>test</Description>

                    <Policy>allow</Policy>

                    <Protocols>

                        <Tcp>true</Tcp>

                    </Protocols>

                    <Port>-1</Port>

                    <DestinationPortRange>Any</DestinationPortRange>

                    <DestinationIp>220.192.0.11</DestinationIp>

                    <SourcePort>-1</SourcePort>

                    <SourcePortRange>Any</SourcePortRange>

                    <SourceIp>220.192.0.102</SourceIp>

                    <EnableLogging>false</EnableLogging>

                </FirewallRule>

            </FirewallService>

            <GatewayIpsecVpnService>

                <IsEnabled>true</IsEnabled>

            </GatewayIpsecVpnService>

            <StaticRoutingService>

                <IsEnabled>true</IsEnabled>

            </StaticRoutingService>

        </EdgeGatewayServiceConfiguration>

        <HaEnabled>true</HaEnabled>

        <UseDefaultRouteForDnsRelay>false</UseDefaultRouteForDnsRelay>

    </Configuration>

</EdgeGateway>

Than for the simple things use the "edit" link for the gateway body above. It should be just the same as the other objects in the API. Please ping if you have any difficulties!

0 Kudos
kvp511
Enthusiast
Enthusiast
Jump to solution

Ok so I was doing it correctly but here is the issue. When I run the GET I don't get the edgeGatways I have to use one of the alternate links.

<Link rel="alternate" type="application/vnd.vmware.vcloud.query.references+xml" href="https://10.26.58.36/api/admin/vdc/815814d3-1bf4-4bf7-8e26-568f6177ed9a/edgeGateways?page=1&pageSize=..."/>

After running this I do get a resulting href:

/api/admin/edgeGateway/561b5631-b986-4dd8-bb5e-1ba1f22f6194

But the result appears to be null:

<?xml version="1.0" encoding="UTF-8"?>

<EdgeGateway xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://74.129.240.69/api/v1.5/schema/master.xsd">

</EdgeGateway>


All other elements I've worked with I do not have this issue. What am I missing here?

0 Kudos
kvp511
Enthusiast
Enthusiast
Jump to solution

Actually after running the queries again I've just realized that my /api/admin/vdc call does not return a <Link rel="edgeGateways"...

I believe I have just figured out what the issue was. My accept header was pointing to version=1.5 and not version=5.1.

0 Kudos
gharbaliev
VMware Employee
VMware Employee
Jump to solution

So fixing the accept header have fix the issue, right?

0 Kudos
kvp511
Enthusiast
Enthusiast
Jump to solution

Yes I have confirmed that I do get the entire gateway element now. Thanks for your help!

0 Kudos