Network Routes

These commands manage network routes.

Table 8-11 Manage Network Routes

Request Append to Path /api/network/v{1|2} Description

POST

/routes

Create a new network route

GET

/routes/route

Get the specified network route properties

GET

/routes

List all network route objects

DELETE

/routes/route

Destroy the specified route object

GET

/routing

Get net routing properties

PUT

/routing

Modify net routing properties

Table 8-12 Manage Network Route Properties

Property Description

type

Type of route such as “system” or “static” (immutable)

family

Address family (either IPv4 or IPv6)

destination

Route destination address

gateway

Gateway address

interface

Network datalink interface

The href path to each route uses the route IDs set in the CLI, but these values can change as routes are modified. The API supports selecting single routes using unique properties within the route. The syntax is routes/name=value compared to routes/route-###.

List Routes

Lists all of the network routes created on Oracle ZFS Storage Appliance.

Example Request:

GET /api/network/v1/routes HTTP/1.1
Authorization: Basic Tm8gcGVla2luZyE=
Host: zfs-storage.example.com:215
Accept: application/json

Example Result:

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 192

{
    "routes": [{
        "destination": "ipaddr-0",
        "family": "IPv4",
        "gateway": "ipaddr-1",
        "href": "/api/network/v1/routing/route-000",
        "interface": "ixgbe0",
        "mask": 0,
        "route": "route-000",
        "type": "static"
    }, {
        "destination": "ipaddr-2",
        "family": "IPv4",
        "gateway": "ipaddr-3",
        "href": "/api/network/v1/routes/route-001",
        "interface": "ixgbe0",
        "mask": 24,
        "route": "route-001",
        "type": "system"
    }]
}

Get Route

Gets the properties for a single route.

Example Request:

GET /api/network/v1/routes/destination=ipaddr-1 HTTP/1.1
Authorization: Basic Tm8gcGVla2luZyE=
Host: zfs-storage.example.com:215
Accept: application/json

Example Result:

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 192

{
    "route": {
        "destination": "ipaddr-1",
        "family": "IPv4",
        "gateway": "ipaddr-2",
        "href": "/api/network/v1/routes/route-001",
        "interface": "ixgbe0",
        "mask": 24,
        "route": "route-001",
        "type": "system"
    }
}

Add Route

Creates a new network route. The route href values can change if other routes are added to the system. No route information is returned on a create since the returned properties would be identical to the input properties. A successful create returns HTTP status 204 (Created).

Example Request to Create a Static Route:

POST /api/network/v1/routes HTTP/1.1
Authorization: Basic Tm8gcGVla2luZyE=
Host: zfs-storage.example.com:215
Content-Type: application/json
Content-Length: 164

{
    "family": "IPv4",
    "destination": "ipaddr-0",
    "mask": "0",
    "gateway": "ipaddr-1",
    "interface": "ixgbe0"
}

Example Result:

HTTP/1.1 201 Created

Delete Route

Deletes an existing network route.

Example Request:

DELETE /api/network/v1/routes/route-001 HTTP/1.1
Authorization: Basic Tm8gcGVla2luZyE=
Host: zfs-storage.example.com:215

Example Result:

HTTP/1.1 204 No Content