RESTCONF Device Commands

This section shows the JSON payloads generated by each RESTCONF device driver for each supported operation. The JSON is rendered with example values (VLAN 100, port Ethernet1/1) to illustrate the OpenConfig structure sent to the switch via RESTCONF PATCH requests (RFC 8040 / RFC 7951).

Each payload is shown alongside the RESTCONF resource URL it targets. The driver sends one PATCH per top-level YANG container.

RestconfOpenConfigSwitch (restconf_openconfig)

RESTCONF OpenConfig switch driver.

Manages network and port operations using OpenConfig YANG models over RESTCONF transport (RFC 8040). Callable class variables build OpenConfig model objects that the base class serialises to JSON (RFC 7951) and sends via HTTP PATCH.

ADD_NETWORK

Create a VLAN on the device

PATCH /restconf/data/openconfig-network-instance:network-instances

{
  "network-instance": [
    {
      "name": "default",
      "openconfig-vlan:vlans": {
        "vlan": [
          {
            "vlan-id": 100,
            "config": {
              "vlan-id": 100,
              "name": "aabbccdd11223344aabbccdd11223344",
              "status": "ACTIVE"
            }
          }
        ]
      }
    }
  ]
}

DELETE_NETWORK

Remove a VLAN from the device

PATCH /restconf/data/openconfig-network-instance:network-instances

{
  "network-instance": [
    {
      "name": "default",
      "openconfig-vlan:vlans": {
        "vlan": [
          {
            "vlan-id": 100,
            "config": {
              "vlan-id": 100,
              "name": "neutron-DELETED-100",
              "status": "SUSPENDED"
            }
          }
        ]
      }
    }
  ]
}

ADD_NETWORK_TO_TRUNK

Tag trunk ports with a VLAN when a network is created

PUT /restconf/data/openconfig-interfaces:interfaces

{
  "interface": [
    {
      "name": "Ethernet1/48",
      "openconfig-if-ethernet:ethernet": {
        "openconfig-vlan:switched-vlan": {
          "config": {
            "interface-mode": "TRUNK",
            "trunk-vlans": [
              100
            ]
          }
        }
      }
    }
  ]
}

REMOVE_NETWORK_FROM_TRUNK

Untag trunk ports when a network is deleted

PUT /restconf/data/openconfig-interfaces:interfaces

{
  "interface": [
    {
      "name": "Ethernet1/48",
      "openconfig-if-ethernet:ethernet": {
        "openconfig-vlan:switched-vlan": {
          "config": {
            "interface-mode": "TRUNK"
          }
        }
      }
    }
  ]
}

PLUG_PORT_TO_NETWORK

Assign an access VLAN to a port

PUT /restconf/data/openconfig-interfaces:interfaces

{
  "interface": [
    {
      "name": "Ethernet1/1",
      "openconfig-if-ethernet:ethernet": {
        "openconfig-vlan:switched-vlan": {
          "config": {
            "interface-mode": "ACCESS",
            "access-vlan": 100
          }
        }
      }
    }
  ]
}

DELETE_PORT

Remove VLAN configuration from a port

PUT /restconf/data/openconfig-interfaces:interfaces

{
  "interface": [
    {
      "name": "Ethernet1/1",
      "config": {
        "description": ""
      }
    }
  ]
}

ENABLE_PORT

Administratively enable a port

PATCH /restconf/data/openconfig-interfaces:interfaces

{
  "interface": [
    {
      "name": "Ethernet1/1",
      "config": {
        "enabled": true
      }
    }
  ]
}

DISABLE_PORT

Administratively disable a port

PATCH /restconf/data/openconfig-interfaces:interfaces

{
  "interface": [
    {
      "name": "Ethernet1/1",
      "config": {
        "enabled": false
      }
    }
  ]
}

ADD_SUBPORTS_ON_TRUNK

Add subport VLANs to a trunk port (converging with trunk_details)

PUT /restconf/data/openconfig-interfaces:interfaces

{
  "interface": [
    {
      "name": "Ethernet1/1",
      "openconfig-if-ethernet:ethernet": {
        "openconfig-vlan:switched-vlan": {
          "config": {
            "interface-mode": "TRUNK",
            "native-vlan": 100,
            "trunk-vlans": [
              200,
              201,
              202
            ]
          }
        }
      }
    }
  ]
}

DEL_SUBPORTS_ON_TRUNK

Remove subport VLANs from a trunk port (converging with trunk_details showing remaining subports)

PUT /restconf/data/openconfig-interfaces:interfaces

{
  "interface": [
    {
      "name": "Ethernet1/1",
      "openconfig-if-ethernet:ethernet": {
        "openconfig-vlan:switched-vlan": {
          "config": {
            "interface-mode": "TRUNK",
            "native-vlan": 100,
            "trunk-vlans": [
              202
            ]
          }
        }
      }
    }
  ]
}

PLUG_PORT_TO_NETWORK (trunk)

Assign a trunk port with native VLAN and subport VLANs

PUT /restconf/data/openconfig-interfaces:interfaces

{
  "interface": [
    {
      "name": "Ethernet1/1",
      "openconfig-if-ethernet:ethernet": {
        "openconfig-vlan:switched-vlan": {
          "config": {
            "interface-mode": "TRUNK",
            "native-vlan": 100,
            "trunk-vlans": [
              200,
              201,
              202
            ]
          }
        }
      }
    }
  ]
}