Chapter 10. Networks

The networks collection provides information about the logical networks in a Red Hat Enterprise Virtualization environment. An API user accesses this information through the rel="networks" link obtained from the entry point URI (see Chapter 4, Entry Point).
The following table shows specific elements contained in a network resource representation.

Note

The icons used in the properties column of this table are described in Table 7.1, “Element property icons”

Table 10.1. Network elements

Element Type Description Properties
data_center id= GUID A reference to the data center of which this cluster is a member. See Chapter 8, Data Centers.
vlan id= integer A VLAN tag.
stp Boolean: true or false true if Spanning Tree Protocol is enabled on this network.
status One of operational or non_operational The status of the network. These states are listed in network_states under capabilities (See Section 6.1.21, “Resource Status States”).

Example 10.1. An XML representation of a network resource

<network id="00000000-0000-0000-0000-000000000009"
  href="/api/networks/00000000-0000-0000-0000-000000000009">
    <name>rhevm</name>
    <description>Management Network</description>
    <data_center id="01a45ff0-915a-11e0-8b87-5254004ac988"
      href="/api/datacenters/01a45ff0-915a-11e0-8b87-5254004ac988"/>
    <stp>false</stp>
    <status>
        <state>operational</status>
    </status>
    <display>false</display>
</network>

Creation of a new data center requires the name and datacenter elements. See Section 7.2.4, “ Creating a Resource in a Collection ” for more information.

Example 10.2. Creating a network resource

POST /api/networks HTTP/1.1
Accept: application/xml
Content-type: application/xml

<network>
    <name>network 1</name>
    <data_center id="01a45ff0-915a-11e0-8b87-5254004ac988"/>
</network>

The name, description, ip, vlan, stp and display elements are updatable post-creation. See Section 7.3.2, “ Updating a Resource ” for more information.

Example 10.3. Updating a network resource

PUT /api/networks/e6575a87-377c-4f67-9c1b-7b94eff76b17 HTTP/1.1
Accept: application/xml
Content-type: application/xml

<network>
    <description>Network 1</description>
</network>

Removal of a network requires a DELETE request.

Example 10.4. Removing a network

DELETE /api/networks/e6575a87-377c-4f67-9c1b-7b94eff76b17 HTTP/1.1

HTTP/1.1 204 No Content

Important

The API as documented in this section is experimental and subject to change. It is not covered by the backwards compatibility statement in Section 6, “Backwards Compatibility Statement”.