VMware vCloud

 View Only
Expand all | Collapse all

Getting IP assignment of an External Network

  • 1.  Getting IP assignment of an External Network

    Posted Apr 23, 2013 09:03 AM

    Hi,

    as said above, I want wo query the IP assignment of organisation for a given external network.

    As a goal I want to know, which number of external IPs (of a certain external network) is assigned to each organisation.

    Is it possible to do this via REST API?

    Thanks in advance!



  • 2.  RE: Getting IP assignment of an External Network

    Posted Apr 23, 2013 09:16 AM

    Use https://whatever.whatever/api/admin/extension/orgNetworks/query to build a list of org networks. For each AdminOrgNetworkRecord returned this gives you the 'OrgName' and the 'linkNetworkName' (external network).

    For each AdminOrgNetworkRecord returned, issue a GET against the 'href' (of the form https://whatever.whatever/api/network/04f98e5b-90bb-493c-9e0d-7e9e154f0f7e). In the returned XML, look for

    AllowedExternalIpAddresses->IpAddress

    Does that give you what you want?

    Andy



  • 3.  RE: Getting IP assignment of an External Network

    Posted Apr 23, 2013 01:02 PM

    Hi,

    thanks for your reply.

    I used the https://whatever.whatever/api/admin/extension/orgNetworks/query and received the list you told. After that I used the href URL via GET, but the followed XML did not included any "AllowedExternalIpAddresses" or something like that (https:///bla.bla/api/network/47add117-877f-46a9-ae9c-59f2ce93bdf4).

    The only item which nearly converges with that point is "type="application/vnd.vmware.vcloud.allocatedNetworkAddress+xml" at the final xml.

    I'm working with the vCloud .NET SDK. Maybe it is easier with the SDK.



  • 4.  RE: Getting IP assignment of an External Network

    Posted Apr 23, 2013 01:27 PM

    Hmmm... not sure I can be of much further use.

    I'm coding directly against the API, not using an SDK. I also tend to use the Firefox RESTClient plugin to experiment.

    You should be getting back an '<OrgNetwork ...>' XML record when you issue the GET request against the 'href' ??

    Given the name, 'AllowedExternalIpAddresses', I guess it's possible that nothing is listed unless you've configured a NAT rule using one of your IP assignments.

    Sorry.

    Andy



  • 5.  RE: Getting IP assignment of an External Network

    Posted Apr 23, 2013 02:11 PM

    I'm getting an "OrgVdcNetwork" object.

    For testing purposes, I'm using the RESTClient browser plugin, too.

    Just to get it clearly: I take the "href URL" from the "AdminOrgNetworkRecord" object. After that, I issue an GET request against the URL. As a result I get an "OrgVdcNetwork" object (also of Orgs, which definitely have at least two ext assigned IPs).

    Thanks anyway :smileyhappy:



  • 6.  RE: Getting IP assignment of an External Network
    Best Answer

    Broadcom Employee
    Posted Apr 23, 2013 02:29 PM

    This was something I recently had looked into after a colleague had asked about it.

    The eaiest way IMHO is to use the vCloud API Query Service (http://blogs.vmware.com/vsphere/2012/04/quickly-finding-objects-using-the-vcloud-api-query-service.html)

    Here's a screenshot of an External Network called "Ext-Network-1" for a VCD 5.1 deployment

    Step 1 - Perform a GET on the following URL: https://[VCD-IP]/api/query?type=externalNetwork

    Step 2 - This should return a list of NetworkRecords which will be your available external networks, here's a screenshot using FF RestClient

    Step 3 - Once you have identified the "name" property of your External Network, you will need to do a GET on it's HREF

    Step 4 - From here, you can clearly see the current IP Range as well as the allocated IP Addresses

    If you want more details on the allocated IP Addresses, you'll see in the "Link" there is /allocatedAddresses that you can perform a GET on that URL which will give you further details

    Hopefully this helps you get what you're looking



  • 7.  RE: Getting IP assignment of an External Network

    Posted Apr 23, 2013 02:33 PM

    Ah. I'm still using the vCloud Director 1.5 API. I think that's probably where the difference comes from.

    Andy



  • 8.  RE: Getting IP assignment of an External Network

    Broadcom Employee
    Posted Apr 23, 2013 02:44 PM

    I don't have a 1.5 enviroment ... but the External Network query should be the same. In VCD 5.1



  • 9.  RE: Getting IP assignment of an External Network

    Posted Apr 23, 2013 08:22 PM

    Thanks a lot lamw, that was the answer which solved my "issue".

    I will look more attentively through the query service so I dont have to ask such questions anymore :smileyhappy:



  • 10.  RE: Getting IP assignment of an External Network

    Broadcom Employee
    Posted Apr 23, 2013 11:39 PM

    Great to hear! The vCloud Query Service API is very powerful!



  • 11.  RE: Getting IP assignment of an External Network

    Posted Dec 03, 2018 05:19 AM

    I'm trying to to do the exact same thing the OP has attempted (obviously years ago).

    I'm able to authenticate with the API and send the GET for " https://my.vcd.cells/api/query?type=externalNetwork ", but for some reason I seem to be only getting a subset of the External Networks in my environment.

    Any ideas what I'm doing wrong?

    It's worth noting that until half an hour I had never even authenticated with the vCD API, let alone obtained any useful information using it.

    I'm running vCD 9.1 and using version 30 of the API.


    I have 39 external networks in vCD. My XML output for the GET only lists 25 networks.