Network
Introduction
Virtual networks are managed by VMware vSphere Distributed Virtual Switch in order to simplify and scale the network layer. If you already have access to one or many virtual networks in our environment you certainly feel more familiar with this section, if not, you are probably going to use our public networks labeled VL-1584-VSS-PUBLIC and VL-0253-EIS-VSS-CGN, which are DHCP enabled networks and have no firewall enabled due to its nature as just being temporary.
We encourage all of our customers to have a custom network segment plumbed into our environment and that can be done first by contacting U of T Network Administration Tools and then providing the allocated segment and VLAN information to the VSS Team.
This resource provides read access to all Virtual Networks permitted in our environment. If by any chance you cannot see a network and you add it to a new Virtual Machine creation request or a NIC change request, your request will not be successfully processed. If you believe you need access to a specific network, please contact us.Â
The following table shows a brief description and HTTP methods allowed to interact with virtual networks.
Resource | URI | Description | GET | POST | PUT | PATCH |
---|---|---|---|---|---|---|
Network | /network | List permitted networks and their attributes | Â | |||
Network object | /network/<moref> | Obtain network detail information. | ||||
Network VMs | /network/<moref>/vm | Virtual machines using a given network | ||||
Network permission | /network/<moref>/permission | Network object resource permission list. |
TK stores the Cloud API Token generated as a result of the following POST request to the /auth/request-token resource:
curl -X POST https://vss-api.eis.utoronto.ca/auth/request-token -u <username>
For example, extracting the token with the jq command:
TK=$(curl -X POST https://vss-api.eis.utoronto.ca/auth/request-token -u <username> | jq -r '.token')
List
In order to list allowed Networks you should make a  GET request to the endpoint /v2/network, passing your access token. As a result, you will get a reference URI /v2/network/<moref> to get detailed information about that network, human readable name and Managed Object Reference (moref). The following examples uses HTTPie and CURL to list all networks a user have access to:
http GET "https://vss-api.eis.utoronto.ca/v2/network" "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/network"
Response Body
Paging
All requests to the /network URL are paginated. The response body includes a 'meta.pages' key with everything to navigate through the results, for instance:
Key | Description |
---|---|
first_url | Contain the URLs to navigate through results. |
last_url | |
prev_url | |
next_url | |
page | Current page |
pages | Total number of pages |
per_page | Results per page. Maximum 250; Default 10. |
total | Total number of results |
Results per page can be set by including the parameter in the URL query, so we can get the desired number of elements per page, for example:
Filtering
Networks can be filtered by adding the filter argument to the query string in the following format:
Operators can be:
Operator | Description |
---|---|
eq | Equals |
ne | Not equal |
lt | Lower than |
le | Lower equal |
gt | Greater than |
ge | Greater equal |
like | Matching pattern |
in | Match value in many items separated by commas |
A resource can be filtered by as many attributes the request has, for instance /networks can be filtered by description, created_on, vms, vlan_id, subnet, name, admin, moref, label, updated_on, ports, etc. Thus, the following example will filter only by name=PUBLIC
Sorting
The resource provides also attribute sorting by adding the sort parameter in the URL query string in the following format:
The following example shows how to filter by label:
List specific Network Info
Some of the attributes will have an object value. Such is the case of items in attribute vms.
Name | Type | Description |
---|---|---|
admin | string | Network owner/administrator |
description | string | Virtual Network description. |
name | string | Virtual Network name. |
ports | integer | Number of ports in the port group. |
moref | string | Network identifier |
subnet | string | Network subnet with mask |
vlan_id | string | VLAN id or range |
vms | integer | Number of virtual machines on the network. |
The following example, requests information about a particular Network using the base resource /v2/network and appending the moref to get the URIÂ /v2/network/dvportgroup-92:
HTTP response body would look something like: