Configuring ICX Using the RESTCONF Management Interface
HTTPS OPTIONS Request curl -i -k -X "OPTIONS" https://<MGMT-IP>/restconf/data/lldp -H 'Accept: application/yang-data+json' -u <username>:<password> HTTP/1.1 204 No Content Server: nginx/1.14.0 Date: Tue, 06 Jan 1970 10:10:35 GMT Connection: keep-alive Allow: OPTIONS,HEAD,GET,POST,PUT,PATCH,DELETE Allowed methods on this URL Accept-Patch: application/yang-patch
HTTPS HEAD Request $ curl -i -k -I https://<MGMT-IP>/restconf/data/lldp -u <username>:<password> HTTP/1.1 200 OK Server: nginx/1.14.0 Date: Tue, 06 Jan 1970 10:38:08 GMT Content-Type: application/json Transfer-Encoding: chunked Connection: keep-alive Cache-Control: no-cache Pragma: no-cacheTo create a new entry using the PUT method and an input file, use the following PUT request.
HTTPS PUT Request (Create or Replace Configuration)
curl -vX PUT -d @input.json --header "Content-Type: application/yang-data+json" https://<MGMT-IP>/restconf/data/network-instances/network-instance/default-vrf/vlans/vlan=200 --insecure -u
<username>:<password>
Where input.json is:
{
"vlan": [
{
"vlan-id": "200",
"config": {
"vlan-id":"200",
"name":"VLAN 200"
}
}
]
}
$ curl -i -k -X "PUT" https://<MGMT-IP>/restconf/data/network-instances/network-instance/default-vrf/vlans/vlan=200 -H 'Content-Type: application/yang-data+json' -H 'Accept:
application/yang-data+json' -u <username>:<password> -d @"input.json"
HTTP/1.1 201 Created
Server: nginx/1.14.0
Date: Tue, 06 Jan 1970 10:34:10 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Location: http://localhost/restconf/data/network-instances/network-instance/default-vrf/vlans/vlan=200
Cache-Control: no-cache
Pragma: no-cache
Last-Modified: Tue, 06 Jan 1970 10:34:10 GMT
ETag: 258
To create a new entry using the PATCH method and an input file, use the following PATCH request.
HTTPS PATCH Request (Merge Resource Configuration)
curl -vX PATCH https://<MGMT-IP>/restconf/data/network-instances/network-instance/default-vrf/vlans -d @input.json --header "Content-Type:
application/yang-data+json" --insecure -u <username>:<password>
Where, input.json is
{
"vlans" : {
"vlan": [
{
"vlan-id": "100",
"config": {
"vlan-id":"100",
"name":"VLAN 100"
}
}
]
}
}
$ curl -i -k -X "PATCH" https://<MGMT-IP>/restconf/data/network-instances/network-instance/default-vrf/vlans -H 'Content-Type: application/
yang-data+json' -H 'Accept: application/yang-data+json' -u <username>:<password> -d @"vlan_patch.json"
HTTP/1.1 204 No Content
Server: nginx/1.14.0
Date: Tue, 06 Jan 1970 10:31:09 GMT
Connection: keep-alive
Cache-Control: no-cache
Pragma: no-cache
Last-Modified: Tue, 06 Jan 1970 10:31:09 GMT
ETag: 253
To create a new entry using the POST method and an input file, use the following POST request.
HTTPS POST Request (Create resource)
curl -vX POST https://<MGMT-IP>/restconf/data/network-instances/network-instance/default-vrf/protocols/protocol/STATIC,icx-static/static-routes -d @input.json --
header "Content-Type: application/yang-data+json" --insecure -u <username>:<password>
Where, input.json is
{
"static": [
{
"prefix": "55.55.55.55/32",
"config": {
"prefix": "55.55.55.55/32"
}
}
]
}
$curl -i -k -X "POST" https://<MGMT-IP>/restconf/data/network-instances/network-instance/default-vrf/protocols/protocol/STATIC,icx-static/static-routes -H
'Content-Type: application/yang-data+json' -H 'Accept: application/yang-data+json' -u <username>:<password> -d @"static_route_v0.json"
HTTP/1.1 201 Created
Server: nginx/1.14.0
Date: Tue, 06 Jan 1970 10:25:12 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Location: http://localhost/restconf/data/network-instances/network-instance/default-vrf/protocols/protocol/STATIC,icx-static/static-routes/static=55.55.55.55%2F32
Cache-Control: no-cache
Pragma: no-cache
Last-Modified: Tue, 06 Jan 1970 10:25:12 GMT
ETag: 250
To delete an existing configuration, use the following Delete request:
HTTPS Delete Request curl -vX DELETE https://<MGMT-IP>/restconf/data/network-instances/network-instance/default-vrf/vlans/vlan=100 --insecure -u <username>:<password>
- https://<MGMT-IP>/restconf/data/lldp/config?with-defaults=report-all
- https://<MGMT-IP>/restconf/data/network-instances/network-instance/default-vrf/protocols/protocol/STATIC,icx-static/static-routes
- https://<MGMT-IP>/restconf/data/network-instances/network-instance/default-vrf/protocols/protocol/STATIC,icx-static?depth=3
- https://<MGMT-IP>/restconf/data/openconfig-interfaces:interfaces/interface=ethernet%201%2F1%2F1
- https://<MGMT-IP>/restconf/data?fields=ietf-yang-library:modules-state/module(name;revision)
- https://<MGMT-IP>/restconf/yang/icx-openconfig-aaa-aug/2019-09-04