VMware Cloud Community
abergman89
Contributor
Contributor
Jump to solution

Get IP on VM on Deploy

We're using IP Pools for IP assignment, but we want to track the assignments, what org is using what IP etc, to integrate with external systems.

Is there any good way to do that? I was thinking about a blocking task in Orchestrator, but that seems overkill? I hoped the IP would be included in the message sent over MQ when a VM is deployed, but that doesnt seem to be tha case.

Any good ideas?

Reply
0 Kudos
1 Solution

Accepted Solutions
aneverov
VMware Employee
VMware Employee
Jump to solution

Actually I think it's not supported for the VM level. But it seems like you can actually get it anyway even without "OVF mode" (might work in VCD 1.5).

https://aneverov-ln/api/vApp/vm-5e3df7bc-871f-46df-ad0b-c1cd5f588515/networkConnectionSection:

<NetworkConnectionSection xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://aneverov-ln/api/vApp/vm-5e3df7bc-871f-46df-ad0b-c1cd5f588515/networkConnectionSection/" ovf:required="false" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1.5 http://10.20.63.114/api/v1.5/schema/master.xsd">
    <ovf:Info>Specifies the available VM network connections</ovf:Info>
    <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
    <NetworkConnection network="extra" needsCustomization="true">
        <NetworkConnectionIndex>0</NetworkConnectionIndex>
        <IpAddress>192.168.6.100</IpAddress>
        <IsConnected>true</IsConnected>
        <MACAddress>00:50:56:01:01:fe</MACAddress>
        <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
    </NetworkConnection>
    <Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://aneverov-ln/api/vApp/vm-5e3df7bc-871f-46df-ad0b-c1cd5f588515/networkConnectionSection/"/>
</NetworkConnectionSection>

/Andrii

/* Please remember to mark answer as 'helpful' or 'correct' such that other users know it can be used and people focusing on ‘unanswered’ questions can skip it. */

View solution in original post

Reply
0 Kudos
5 Replies
JayhawkEric
Expert
Expert
Jump to solution

You can do a DB query for sure but you might be able to query VCD via the System Org. Not sure if there's an API to directly do it.  You might have to get all vApps and their IP's and then sort them.

Does it matter what you use to get them (direct to DB, PoerCLI, VCO, API, etc..)?

Eric

VCP5-DV twitter - @ericblee6 blog - http://vEric.me
abergman89
Contributor
Contributor
Jump to solution

I've been thinking about querying the DB, but that seems like a last resort, I want to use the APIs as much as possible.

I checked the vCloud Programming guide and it looks like I can query the API using a packaged query like API-URL/vms/query or the entity resolver (Page 237 in http://www.vmware.com/pdf/vcd_15_api_guide.pdf).

Since i get the VM id in the MQ message, i can pick up the additional data using the API as i parse the message, i hope.

Reply
0 Kudos
aneverov
VMware Employee
VMware Employee
Jump to solution

Hi,

In VCD 5.1 we added something called "OVF Mode" which basically provides more detailed information. You can get that via REST APi by adding /ovf to the URL.

https://aneverov-ln/api/vApp/vapp-d9f3b556-f91c-49db-8bb2-35e1186016e9/ovf:

...

<ovf:Item>
                    <rasd:Address>00:50:56:01:01:fe</rasd:Address>
                    <rasd:AddressOnParent>0</rasd:AddressOnParent>
                    <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
                    <rasd:Connection vcloud:ipAddress="192.168.6.100" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">extra</rasd:Connection>
                    <rasd:Description>PCNet32 ethernet adapter on "extra"</rasd:Description>
                    <rasd:ElementName>Network adapter 0</rasd:ElementName>
                    <rasd:InstanceID>1</rasd:InstanceID>
                    <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
                    <rasd:ResourceType>10</rasd:ResourceType>
                    <vmw:Config vmw:value="true" vmw:key="connectable.allowGuestControl" ovf:required="false"/>
                    <vmw:Config vmw:value="true" vmw:key="wakeOnLanEnabled" ovf:required="false"/>
                </ovf:Item>

Hope that helps.

/Andrii

/* Please remember to mark answer as 'helpful' or 'correct' such that other users know it can be used and people focusing on ‘unanswered’ questions can skip it. */
abergman89
Contributor
Contributor
Jump to solution

Sweet!

You are calling the URL of a vApp as i understand it, can I do the same using a VM instead?

I'm using the MQ messages for a VM deployed and not a vApp deployed,

Reply
0 Kudos
aneverov
VMware Employee
VMware Employee
Jump to solution

Actually I think it's not supported for the VM level. But it seems like you can actually get it anyway even without "OVF mode" (might work in VCD 1.5).

https://aneverov-ln/api/vApp/vm-5e3df7bc-871f-46df-ad0b-c1cd5f588515/networkConnectionSection:

<NetworkConnectionSection xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://aneverov-ln/api/vApp/vm-5e3df7bc-871f-46df-ad0b-c1cd5f588515/networkConnectionSection/" ovf:required="false" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1.5 http://10.20.63.114/api/v1.5/schema/master.xsd">
    <ovf:Info>Specifies the available VM network connections</ovf:Info>
    <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
    <NetworkConnection network="extra" needsCustomization="true">
        <NetworkConnectionIndex>0</NetworkConnectionIndex>
        <IpAddress>192.168.6.100</IpAddress>
        <IsConnected>true</IsConnected>
        <MACAddress>00:50:56:01:01:fe</MACAddress>
        <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
    </NetworkConnection>
    <Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://aneverov-ln/api/vApp/vm-5e3df7bc-871f-46df-ad0b-c1cd5f588515/networkConnectionSection/"/>
</NetworkConnectionSection>

/Andrii

/* Please remember to mark answer as 'helpful' or 'correct' such that other users know it can be used and people focusing on ‘unanswered’ questions can skip it. */
Reply
0 Kudos