Working with Entities
Each entity in VMware Aria Operations for Networks has an associated entity ID that is unique and an entity type. You can fetch an entity using the entity ID from the URL corresponding its entity type. You can get the list of all entity IDs using a paginated list request.
You can determine the entity ID using a generic search based on the properties of the entity. For more information, see the Performing Search topic.
List All Entities for an Entity Type
Listing all entities of an entity type requires issuing a GET request on the URL corresponding to the entity type. The response contains a paginated list of entities with time corresponding to the version of the entity that has been retrieved. Response contains the cursor that can be used as a query parameter to fetch next page of results. You can add the
size
query parameter to request to set the number of entities that server should send in response. It can be set to a maximum of 10000.Prerequisite
- Obtain the URL corresponding to the entity type in the search result.
Procedure
- Issue a GET request using the URL. For example, use this GET request to list all VMs in VMware Aria Operations for Networks.Request GET https://operations-for-networks.example.com/api/ni/entities/vms/ Response { "results": [ { "entity_id": "10000:1:875335999", "entity_type": "VirtualMachine", "time": 1508745899 }, { "entity_id": "10000:1:1206990361", "entity_type": "VirtualMachine", "time": 1508745899 }, ... ], "cursor": "MTA=", "total_count": 78, "start_time": 1508972172, "end_time": 1508972172 }
- Response contains a paginated list with the cursor to be passed in the next request as a parameter to retrieve the next set of VMs.
Retrieve an Entity
Prerequisite
- Obtain the entity ID of the entity by using a search or list command
- Obtain the URL corresponding to the entity type in the search result. For more information, see Table 3: EntityType to URI.
Procedure
Run a GET request using the entity ID and the URL. This example uses entity_id 1000:1:123121 and entity_type is VirtualMachine.
Request GET https://operations-for-networks.example.com/api/ni/entities/vms/1000:1:123121 Response { "entity_id": "10000:1:1207046967", "name": "pashan-69-1", "entity_type": "VirtualMachine", "ip_addresses": [ { "ip_address": "192.168.24.40", "netmask": "255.255.255.0", "network_address": "192.168.24.0/24" } ], "default_gateway": "192.168.24.10", "vnics": [ { "entity_id": "10000:18:928014219", "entity_type": "Vnic" } ], "security_groups": [ { "entity_id": "10000:82:1509031646", "entity_type": "NSXSecurityGroup" } ], "source_firewall_rules": [ { "rules": [ { "entity_id": "10000:87:1310503280", "entity_type": "NSXFirewallRule" }, { "entity_id": "10000:87:1310503311", "entity_type": "NSXFirewallRule" } ], "firewall": { "entity_id": "10000:39:306795770", "entity_type": "NSXDistributedFirewall" }, "rule_set_type": "NSX_STANDARD" } ], "destination_firewall_rules": [ { "rules": [ { "entity_id": "10000:87:1310621266", "entity_type": "NSXFirewallRule" }, { "entity_id": "10000:87:1310503280", "entity_type": "NSXFirewallRule" } ], "firewall": { "entity_id": "10000:39:306795770", "entity_type": "NSXDistributedFirewall" }, "rule_set_type": "NSX_STANDARD" } ], "ip_sets": [ { "entity_id": "10000:84:1256619295", "entity_type": "NSXIPSet" } ], "cluster": { "entity_id": "10000:66:850307201", "entity_type": "Cluster" }, "resource_pool": { "entity_id": "10000:79:1730744919", "entity_type": "ResourcePool" }, "security_tags": [ { "entity_id": "10000:99:1129991034", "entity_type": "SecurityTag" } ], "layer2_networks": [ { "entity_id": "10000:11:604852557", "entity_type": "VxlanLayer2Network" } ], "host": { "entity_id": "10000:4:2142603919", "entity_type": "Host" }, "vlans": [], "vendor_id": "vm-174", "vcenter_manager": { "entity_id": "10000:8:2048038675", "entity_type": "VCenterManager" }, "folders": [ { "entity_id": "10000:81:1937753507", "entity_type": "Folder" } ], "datastores": [ { "entity_id": "10000:80:2099650948", "entity_type": "Datastore" } ], "datacenter": { "entity_id": "10000:105:246393763", "entity_type": "VCDatacenter" }, "nsx_manager": { "entity_id": "10000:7:935317189", "entity_type": "NSXVManager" }, "applied_to_source_rules": [ { "rules": [ { "entity_id": "10000:87:1310503280", "entity_type": "NSXFirewallRule" }, { "entity_id": "10000:87:1310622351", "entity_type": "NSXFirewallRule" } ], "firewall": { "entity_id": "10000:39:306795770", "entity_type": "NSXDistributedFirewall" }, "rule_set_type": "NSX_STANDARD" } ], "applied_to_destination_rules": [ { "rules": [ { "entity_id": "10000:87:1310621266", "entity_type": "NSXFirewallRule" }, { "entity_id": "10000:87:1310503280", "entity_type": "NSXFirewallRule" } ], "firewall": { "entity_id": "10000:39:306795770", "entity_type": "NSXDistributedFirewall" }, "rule_set_type": "NSX_STANDARD" } ], "source_inversion_rules": [], "destination_inversion_rules": [] }
Retrieve an Entity at Specified Time
VMware Aria Operations for Networks stores different versions of an entity and creates an image of the entity with a new timestamp when the data changes. A previous version of an entity can be retrieved by passing the time as query parameter in the retrieve entity request. Ensure to provide the time in epoch seconds.
https://operations-for-networks.example.com/api/ni/entities/vms/10000:1:875335999?time=1508745500
Bulk fetch of entities
Bulk fetch of entities can be fetched using a bulk fetch API. The maximum batch size of bulk fetch is 1000 entities.
POST https://operations-for-networks.example.com/api/ni/entities/fetch Request Body { "entity_ids": [ { "entity_id": "10000:4:132029350", "entity_type": "Host", "time": 1523605300 }, { "entity_id": "10000:4:132027614", "entity_type": "Host", "time": 1523605419 } ] } Response Body { "results": [ { "entity_id": "10000:4:132029350", "entity_type": "Host", "entity": { "entity_id": "10000:4:132029350", "name": "10.197.52.176", "entity_type": "Host", "vmknics": [ { "entity_id": "10000:17:771614149", "entity_type": "Vmknic" } ], "vcenter_manager": { "entity_id": "10000:8:824493708", "entity_type": "VCenterManager" }, "vm_count": 4, "datastores": [ { "entity_id": "10000:80:1910974952", "entity_type": "Datastore" }, { "entity_id": "10000:80:1910975665", "entity_type": "Datastore" }, { "entity_id": "10000:80:1910975696", "entity_type": "Datastore" }, { "entity_id": "10000:80:889229135", "entity_type": "Datastore" }, { "entity_id": "10000:80:1910974983", "entity_type": "Datastore" } ], "service_tag": "", "vendor_id": "host-127", "maintenance_mode": "NOTINMAINTENANCEMODE", "connection_state": "CONNECTED" }, "time": 1523605300 }, { "entity_id": "10000:4:132027614", "entity_type": "Host", "entity": { "entity_id": "10000:4:132027614", "name": "10.197.52.178", "entity_type": "Host", "vmknics": [ { "entity_id": "10000:17:1090151026", "entity_type": "Vmknic" } ], "vcenter_manager": { "entity_id": "10000:8:824493708", "entity_type": "VCenterManager" }, "vm_count": 3, "datastores": [ { "entity_id": "10000:80:1910974952", "entity_type": "Datastore" }, { "entity_id": "10000:80:889230871", "entity_type": "Datastore" }, { "entity_id": "10000:80:1910975665", "entity_type": "Datastore" }, { "entity_id": "10000:80:1910975696", "entity_type": "Datastore" }, { "entity_id": "10000:80:1910974983", "entity_type": "Datastore" } ], "service_tag": "", "vendor_id": "host-141", "maintenance_mode": "NOTINMAINTENANCEMODE", "connection_state": "CONNECTED" }, "time": 1523605419 } ] }
EntityType | URI |
---|---|
VirtualMachine | /entities/vms |
EC2Instance | /entities/vms |
Host | /entities/hosts |
Vnic | /entities/vnics |
Vmknic | /entities/vmknics |
VxlanLayer2Network | /entities/layer2-networks |
VlanLayer2Network | /entities/layer2-networks |
Cluster | /entities/clusters |
SecurityTag | /entities/security-tags |
ResourcePool | /entities/resouce-pools |
NSXIPSet | /entities/ipsets |
EC2IPSet | /entities/ipsets |
NSXSecurityGroup | /entities/security-groups |
EC2SecurityGroup | /entities/security-groups |
Flow | /entities/flows |
ProblemEvent | /entities/problems |
NSXFirewallRule | /entities/firewall-rules |
EC2SGFirewallRule | /entities/firewall-rules |
NSXRedirectRules | /entities/firewall-rules |
VCenterManager | /entities/vcenter-managers |
NSXVManager | /entities/nsxv-managers |
NSXService | /entities/services |
EC2Service | /entities/services |
NSXDistributedFirewall | /entities/firewalls |
EC2Firewall | /entities/firewalls |
NSXServiceGroup | /entities/service-groups |
DistributedVirtualSwitch | /entities/distributed-virtual-switches |
DistributedVirtualPortgroup | /entities/distributed-virtual-portgroups |
VCDatacenter | /entities/vc-datacenters |
Datastore | /entities/datastores |
Folder | /entities/folders |
PolicyManagerSegment | /entities/layer2-networks |