Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 21 Current »


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 network labeled VL-1584-VSS-PUBLIC, which is a DHCP enabled network and has 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.

On this page:

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.

ResourceURIDescriptionGETPOSTPUTPATCH
Network/networkList permitted networks and their attributes(tick) 


Network object/network/<moref>Obtain network detail information.(tick)


Network VMs/network/<moref>/vmVirtual machines using a given network(tick)


Network permission/network/<moref>/permissionNetwork object resource permission list.(tick)


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
{
    "_links": {
        "self": "https://vss-api.eis.utoronto.ca/v2/network?short=1"
    },
    "data": [
        {
            "label": "Quarantine N/A Quarantine no access DVPG",
            "moref": "dvportgroup-11137",
            "name": "Quarantine",
            "vim_type": "vim.dvs.DistributedVirtualPortgroup",
            "vlan_id": "0"
        },
        {
            "label": "VL-1584-VSS-PUBLIC 142.1.216.0/23 VSS Public network",
            "moref": "dvportgroup-11052",
            "name": "VL-1584-VSS-PUBLIC",
            "vim_type": "vim.dvs.DistributedVirtualPortgroup",
            "vlan_id": "1584"
        }
    ],
    "meta": {
        "count": 6,
        "pages": {
            "first_url": "https://vss-api.eis.utoronto.ca/v2/network?per_page=100&page=1&expand=1",
            "last_url": "https://vss-api.eis.utoronto.ca/v2/network?per_page=100&page=1&expand=1",
            "next_url": null,
            "page": 1,
            "pages": 1,
            "per_page": 100,
            "prev_url": null,
            "total": 6
        },
        "time": "0.00960s",
        "user": "jm"
    }
}

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:

KeyDescription
first_urlContain the URLs to navigate through results.
last_url
prev_url
next_url
pageCurrent page
pagesTotal number of pages
per_pageResults per page. Maximum 250; Default 10.
totalTotal 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:

http GET "https://vss-api.eis.utoronto.ca/v2/network?per_page=1" "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/network?per_page=1"

Filtering

Networks can be filtered by adding the filter argument to the query string in the following format:

filter=<field_name>,<operator>,<value>

Operators can be:

OperatorDescription
eqEquals
neNot equal
ltLower than
leLower equal
gtGreater than
geGreater equal
likeMatching pattern
inMatch 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

http GET "https://vss-api.eis.utoronto.ca/v2/network?per_page=10&expand=1&filter=name,like,%PUBLIC%" "Authorization: Bearer $TK"

Sorting

The resource provides also attribute sorting by adding the sort parameter in the URL query string in the following format:

sort=<field_name>,<asc|desc>

The following example shows how to filter by label:

http GET "https://vss-api.eis.utoronto.ca/v2/network?per_page=10&expand=1&filter=name,like,%VL%&sort=label,desc" "Authorization: Bearer $TK"

curl -X GET -H "Authorization: Bearer $TK" "https://vss-api.eis.utoronto.ca/v2/network?per_page=10&expand=1&filter=name,like,%VL%&sort=label,desc" 

List specific Network Info

Some of the attributes will have an object value. Such is the case of items in attribute vms.

NameTypeDescription
adminstringNetwork owner/administrator
descriptionstringVirtual Network description.
namestringVirtual Network name.
portsintegerNumber of ports in the port group. 
morefstringNetwork identifier
subnetstringNetwork subnet with mask
vlan_idstringVLAN id or range
vmsintegerNumber 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 GET https://vss-api.eis.utoronto.ca/v2/network/dvportgroup-11052 "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X GET https://vss-api.eis.utoronto.ca/v2/network/dvportgroup-11052

HTTP response body would look something like:

Response Body
{
    "_links": {
        "network": "https://vss-api.eis.utoronto.ca/v2/network",
        "self": "https://vss-api.eis.utoronto.ca/v2/network/dvportgroup-11052"
    },
    "data": {
        "admin": "Jose Manuel Lopez Lujan:123-456-7890:dns-adm@eis.utoronto.ca",
        "created_on": "2019-07-09 Tue 21:15:56 EDT",
        "description": "VSS Public network",
        "label": "VL-1584-VSS-PUBLIC 142.1.216.0/23 VSS Public network",
        "moref": "dvportgroup-11052",
        "name": "VL-1584-VSS-PUBLIC",
        "ports": 67,
        "subnet": "142.1.216.0/23",
        "updated_on": "2019-07-11 Thu 09:02:08 EDT",
        "vim_type": "vim.dvs.DistributedVirtualPortgroup",
        "vlan_id": "1584",
        "vms": 59
    },
    "meta": {
        "count": 12,
        "time": "0.00866s",
        "user": "jm"
    }
}
  • No labels