VMware Cloud Community
marcolenzo
Contributor
Contributor
Jump to solution

Firewall Service Usage through API

Hi,

looking at the appendix of the API_v_1_5_Reference I noticed that only 10 ComputingResources are listed. There is no reference to the Firewall Service.

However, when I generate a report through the GUI I am able to get Count of Networks, NAT Service, DHCP Service, Firewall Service, External Network Transfer/Receive etc...

Is there any way to get that information through the API?

Thanks beforehand,

Marco

Reply
0 Kudos
1 Solution

Accepted Solutions
amrainders
Enthusiast
Enthusiast
Jump to solution

Hi Marco,

You have two options :-

  • You can find out the ids of the following computing resource from database directly. You need to look at CB_SERVER_PROPERTY table invCenter chargeback database. Once the computing resource ids are generated for a particular vCenter Chargeback installation they are fixed and will not change.
    1. Count of Networks-->SERVER_PROPERTY_NAME="Count Of Networks",PROPERTY_CATEGORY="vcloud"-->column SERVER_PROPERTY_VALUE will give you id
    2. NAT Service-->SERVER_PROPERTY_NAME="NAT Service",PROPERTY_CATEGORY="vcloud"-->column SERVER_PROPERTY_VALUE will give you id
    3. DHCP Service-->SERVER_PROPERTY_NAME="FIREWALL Service",PROPERTY_CATEGORY="vcloud"-->column SERVER_PROPERTY_VALUE will give you id
    4. Firewall Service-->SERVER_PROPERTY_NAME="DHCP Service",PROPERTY_CATEGORY="vcloud"-->column SERVER_PROPERTY_VALUE will give you id
    5. External Network Transfer-->SERVER_PROPERTY_NAME="External Network Transfer",PROPERTY_CATEGORY="vcloud"-->column SERVER_PROPERTY_VALUE will give you id
    6. External Network Receive-->SERVER_PROPERTY_NAME="External Network Receive",PROPERTY_CATEGORY="vcloud"-->column SERVER_PROPERTY_VALUE will give you id

  • Another option is to find out the computing resource ids using APIs (but as it is only one time effort, I think first approach should be better)

Call "Search, POST <Base_URL>/search" API, the input xml for calling this API will look like

<Request>
    <SearchQueries>
        <SearchQuery id="serverProperty">
            <Criteria type="AND">
                <Filter name="propertyCategory" type="EQUAL" value="vcloud" />
            </Criteria>
            <SortBy>
                <Params>
                    <Param index="1" order="ASC">serverPropertyName</Param>
                </Params>
            </SortBy>
            <Pagination>
                <FirstResultCount>0</FirstResultCount>
                <MaxResultCount>100</MaxResultCount>
            </Pagination>
        </SearchQuery>
    </SearchQueries>
</Request>
The response will return you all the properties having category as "vcloud", out of these properties you can filter out the properties relevant to you based on name (e.g. "Count of Networks") and get the computing resource id from the value.
I hope this helps.
-Amrainder

View solution in original post

Reply
0 Kudos
2 Replies
amrainders
Enthusiast
Enthusiast
Jump to solution

Hi Marco,

You have two options :-

  • You can find out the ids of the following computing resource from database directly. You need to look at CB_SERVER_PROPERTY table invCenter chargeback database. Once the computing resource ids are generated for a particular vCenter Chargeback installation they are fixed and will not change.
    1. Count of Networks-->SERVER_PROPERTY_NAME="Count Of Networks",PROPERTY_CATEGORY="vcloud"-->column SERVER_PROPERTY_VALUE will give you id
    2. NAT Service-->SERVER_PROPERTY_NAME="NAT Service",PROPERTY_CATEGORY="vcloud"-->column SERVER_PROPERTY_VALUE will give you id
    3. DHCP Service-->SERVER_PROPERTY_NAME="FIREWALL Service",PROPERTY_CATEGORY="vcloud"-->column SERVER_PROPERTY_VALUE will give you id
    4. Firewall Service-->SERVER_PROPERTY_NAME="DHCP Service",PROPERTY_CATEGORY="vcloud"-->column SERVER_PROPERTY_VALUE will give you id
    5. External Network Transfer-->SERVER_PROPERTY_NAME="External Network Transfer",PROPERTY_CATEGORY="vcloud"-->column SERVER_PROPERTY_VALUE will give you id
    6. External Network Receive-->SERVER_PROPERTY_NAME="External Network Receive",PROPERTY_CATEGORY="vcloud"-->column SERVER_PROPERTY_VALUE will give you id

  • Another option is to find out the computing resource ids using APIs (but as it is only one time effort, I think first approach should be better)

Call "Search, POST <Base_URL>/search" API, the input xml for calling this API will look like

<Request>
    <SearchQueries>
        <SearchQuery id="serverProperty">
            <Criteria type="AND">
                <Filter name="propertyCategory" type="EQUAL" value="vcloud" />
            </Criteria>
            <SortBy>
                <Params>
                    <Param index="1" order="ASC">serverPropertyName</Param>
                </Params>
            </SortBy>
            <Pagination>
                <FirstResultCount>0</FirstResultCount>
                <MaxResultCount>100</MaxResultCount>
            </Pagination>
        </SearchQuery>
    </SearchQueries>
</Request>
The response will return you all the properties having category as "vcloud", out of these properties you can filter out the properties relevant to you based on name (e.g. "Count of Networks") and get the computing resource id from the value.
I hope this helps.
-Amrainder
Reply
0 Kudos
marcolenzo
Contributor
Contributor
Jump to solution

Hi,

I tried the second approach and it worked like a charm Smiley Happy

I believe the serverProperty searchQueryID is not listed in the API reference though.

Regards,

Marco

Reply
0 Kudos