URL Capabilities
Overview
NetConf allows the complete OcNOS configuration to be replaced with a full Command Management Layer (CML) configuration. It also enables the backup of configurations in XML or JSON formats from all databases to a server. These functions are achieved using the Universal Resource Location (URL) capabilities identified in the following string:
"urn:ietf:params:netconf:capability:url:1.0?scheme=http,ftp,file, https, sftp"
The HTTP, HTTPS, FTP, SFTP and file schemes in the URL capabilities provide the following operations in managing the OcNOS configurations.
• copy-config
• edit-config
• delete-config
Limitations
The following operations are not supported:
• copy-config with source as URL and target as startup and running
• copy-config with source and target with a different URL.
• copy-config with source and target with the same URL (not a valid operation)
• edit-config using HTTPs and SFTP
• delete-config from HTTPs and SFTP
Prerequisites
NetConf should be configured and active.
Copy-config
Create or replace an entire configuration datastore with the contents of another complete configuration datastore. The :url capability modifies the <copy-config> operation to accept the <url> element as the value of the <source> and the <target> parameters. The file that the URL refers to contains the complete datastore, encoded in XML under the element <config> in the namespace below:
"urn:ietf:params:xml:ns:netconf:base:1.0"
Note: Yang CLI supports the URL option only in interactive mode.
From HTTP to the Candidate Configuration Store
Download the configuration from the HTTP server and copy it to the candidate configuration store.
yangcli ocnos@10.12.16.33> copy-config target=candidate
Filling container /copy-config/input/source:
Enter the number of the selected case statement:
1: case candidate:
leaf candidate
2: case running:
leaf running
3: case startup:
leaf startup
4: case url:
leaf url
5: case config:
container config
Enter choice number [1 - 5]:
yangcli ocnos@10.12.16.33:copy-config> 4
Enter string value for leaf <url>
yangcli ocnos@10.12.16.33:copy-config> http://10.12.12.91:10080/dashboard/docs/copy_config_test/zebConf.xml
RPC OK Reply 10 for session 1:
Here is the example URL with basic authentication:
http://username:password@10.12.12.91:10080/dashboard/docs/copy_config_test/zebConf.xml
From HTTPs to the Candidate Configuration Store
The https copy-config command may be used to copy the candidate or startup configuration to the server and vice-versa.
yangcli ocnos@127.1> copy-config source=candidate
Filling container /copy-config/input/target:
Enter the number of the selected case statement:
1: case candidate:
leaf candidate
2: case startup:
leaf startup
3: case url:
leaf url
Enter choice number [1 - 3]:
yangcli ocnos@127.1:copy-config> 3
Enter string value for leaf <url>
yangcli ocnos@127.1:copy-config> https://user:user123@10.14.105.129//test.xml
RPC OK Reply 2 for session 3:
yangcli ocnos@127.1>
The stored configuration can be applied at a later point from the server:
yangcli ocnos@127.1> copy-config target=candidate
Filling container /copy-config/input/target:
Enter the number of the selected case statement:
1: case candidate:
leaf candidate
2: case startup:
leaf startup
3: case url:
leaf url
Enter choice number [1 - 3]:
yangcli ocnos@127.1:copy-config> 3
Enter string value for leaf <url>
yangcli ocnos@127.1:copy-config> https://user:user123@10.14.105.129//test.xml
RPC OK Reply 3 for session 3:
yangcli ocnos@127.1>commit
From FTP to the Candidate Configuration Store
Download the configuration from FTP server and copy it to the candidate configuration store.
yangcli ocnos@10.12.16.33> copy-config target=candidate
Filling container /copy-config/input/source:
Enter the number of the selected case statement:
1: case candidate:
leaf candidate
2: case running:
leaf running
3: case startup:
leaf startup
4: case url:
leaf url
5: case config:
container config
Enter choice number [1 - 5]:
yangcli ocnos@10.12.16.33:copy-config> 4
Enter string value for leaf <url>
yangcli ocnos@10.12.16.33:copy-config> ftp://10.12.12.91/config_file/zebConf.xml
RPC OK Reply 24 for session 1:
Here is the example URL with basic authentication:
ftp://username:password@10.12.12.91/config_file/zebConf.xml
From SFTP to the Candidate Configuration Store
The sftp copy-config command may be used to copy the candidate or startup configuration to the server and vice-versa:
yangcli ocnos@127.1> copy-config source=candidate
Filling container /copy-config/input/target:
Enter the number of the selected case statement:
1: case candidate:
leaf candidate
2: case startup:
leaf startup
3: case url:
leaf url
Enter choice number [1 - 3]:
yangcli ocnos@127.1:copy-config> 3
Enter string value for leaf <url>
yangcli ocnos@127.1:copy-config> sftp://user:user123@10.14.105.129//test.xml
RPC OK Reply 2 for session 3:
yangcli ocnos@127.1>
The stored configuration can be applied at a later point from the server:
yangcli ocnos@127.1> copy-config target=candidate
Filling container /copy-config/input/target:
Enter the number of the selected case statement:
1: case candidate:
leaf candidate
2: case startup:
leaf startup
3: case url:
leaf url
Enter choice number [1 - 3]:
yangcli ocnos@127.1:copy-config> 3
Enter string value for leaf <url>
yangcli ocnos@127.1:copy-config> sftp://user:user123@10.14.105.129//test.xml
RPC OK Reply 3 for session 3:
yangcli ocnos@127.1>commit
From a Local file to the Candidate Configuration Store
Using the file scheme support, copy the configuration from the stored local file to the candidate configuration store. Here is the example to copy local file configuration into a candidate configuration store.
Note: Local files should be stored under /root/.yuma/ directory of the device.
yangcli ocnos@10.12.16.33> copy-config target=candidate
Filling container /copy-config/input/source:
Enter the number of the selected case statement:
1: case candidate:
leaf candidate
2: case running:
leaf running
3: case startup:
leaf startup
4: case url:
leaf url
5: case config:
container config
Enter choice number [1 - 5]:
yangcli ocnos@10.12.16.33:copy-config> 4
Enter string value for leaf <url>
yangcli ocnos@10.12.16.33:copy-config> file://zebConf.xml
RPC OK Reply 9 for session 1:
From the Candidate Configuration Store to HTTP
Either Running or Startup configuration can serve as the source configuration store.
Upload the configuration to the HTTP server from candidate configuration store.
yangcli root@127.1> copy-config source=candidate
Filling container /copy-config/input/target:
Enter the number of the selected case statement:
1: case candidate:
leaf candidate
2: case startup:
leaf startup
3: case url:
leaf url
Enter choice number [1 - 3]:
yangcli root@127.1:copy-config> 3
Enter string value for leaf <url>
yangcli root@127.1:copy-config> http://10.12.12.91:10080/dashboard/docs/copy_config_test/zebConf.xml
RPC OK Reply 10 for session 1:
Here is the example a URL with basic authentication.
http://username:password@10.12.12.91:10080/dashboard/docs/copy_config_test/zebConf.xml
From the Candidate Configuration Store to HTTPS
Upload configuration to HTTP server from candidate configuration store.
yangcli ocnos@127.1> copy-config source=candidate
Filling container /copy-config/input/target:
Enter the number of the selected case statement:
1: case candidate:
leaf candidate
2: case startup:
leaf startup
3: case url:
leaf url
Enter choice number [1 - 3]:
yangcli ocnos@127.1:copy-config> 3
Enter string value for leaf <url>
yangcli ocnos@127.1:copy-config> https://user:user123@10.14.105.129//test.xml
RPC OK Reply 2 for session 3:
yangcli ocnos@127.1>
From the Candidate Configuration Store to FTP
Upload configuration to FTP server from candidate configuration store.
yangcli root@127.1> copy-config source=candidate
Filling container /copy-config/input/target:
Enter the number of the selected case statement:
1: case candidate:
leaf candidate
2: case startup:
leaf startup
3: case url:
leaf url
Enter choice number [1 - 3]:
yangcli root@127.1:copy-config> 3
Enter string value for leaf <url>
yangcli root@127.1:copy-config> ftp://10.12.12.91/config_file/zebConf.xml
RPC OK Reply 39 for session 1:
Here is the example URL with basic authentication.
ftp://username:password@10.12.12.91/config_file/zebConf.xml
From the Candidate Configuration Store to SFTP
Upload configuration to SFTP server from candidate configuration store.
yangcli ocnos@127.1> copy-config source=candidate
Filling container /copy-config/input/target:
Enter the number of the selected case statement:
1: case candidate:
leaf candidate
2: case startup:
leaf startup
3: case url:
leaf url
Enter choice number [1 - 3]:
yangcli ocnos@127.1:copy-config> 3
Enter string value for leaf <url>
yangcli ocnos@127.1:copy-config> sftp://user:user123@10.14.105.129//test.xml
RPC OK Reply 2 for session 3:
yangcli ocnos@127.1>
From the Candidate Configuration Store to the Local File
Using file scheme support, create a snapshot of the configuration store as shown in the example.
Note: Local files are created under the /root/.yuma/ directory of the device. Storing files inside a directory is not supported.
yangcli root@127.1> copy-config source=candidate
Filling container /copy-config/input/target:
Enter the number of the selected case statement:
1: case candidate:
leaf candidate
2: case startup:
leaf startup
3: case url:
leaf url
Enter choice number [1 - 3]:
yangcli root@127.1:copy-config> 3
Enter string value for leaf <url>
yangcli root@127.1:copy-config> file://zebConf.xml
RPC OK Reply 10 for session 1:
Copy-config Error Messages
Following are the error messages belong to URL capability copy-config operation. Invalid authentication, path, IP address, port number (in case required) and XML file. Here is the example of invalid FTP authentication:
yangcli ocnos@10.12.16.33> copy-config target=candidate
Filling container /copy-config/input/source:
Enter the number of the selected case statement:
1: case candidate:
leaf candidate
2: case running:
leaf running
3: case startup:
leaf startup
4: case url:
leaf url
5: case config:
container config
Enter choice number [1 - 5]:
yangcli ocnos@10.12.16.33:copy-config> 4
Enter string value for leaf <url>
yangcli ocnos@10.12.16.33:copy-config> ftp://:admin@10.12.12.91/config_file/zebConf.xml
RPC Error Reply 32 for session 1:
rpc-reply {
rpc-error {
error-type rpc
error-tag operation-failed
error-severity error
error-app-tag libxml2-error
error-path /copy-config
error-message 'xml reader start failed'
error-info {
error-number 212
}
}
}
Edit-config
The <url> element can appear instead of the <config> parameter. The file that the URL refers to contains the configuration data hierarchy to be modified, encoded in XML under the element <config> in the namespace below:
"urn:ietf:params:xml:ns:netconf:base:1.0"
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<mpls xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-mpls">
<interfaces>
<interface>
<name>xe3</name>
<label-switching>
<config>
<enable/>
</config>
</label-switching>
</interface>
</interfaces>
</mpls>
</config>
Edit-config using HTTP
Provision device configuration from HTTP server using edit-config operation.
yangcli root@127.1> edit-config url=http://10.12.12.91:10080/dashboard/docs/copy_config_test/zebConf.xml
Filling container /edit-config/input/target:
RPC OK Reply 40 for session 1:
yangcli root@127.1> sget-config source=candidate /ospfv2
Filling list /ospfv2:
RPC Data Reply 41 for session 1:
rpc-reply {
data {
ospfv2 {
processes {
process 20 {
ospf-id 20
config {
ospf-id 20
shutdown
vrf-name default
}
}
}
}
}
}
Here is the example URL with basic authentication.
Edit-config using FTP
Provision device configuration from FTP server using edit-config operation.
yangcli root@127.1> edit-config url=ftp://10.12.12.91/config_file/zebConf.xml
Filling container /edit-config/input/target:
RPC OK Reply 21 for session 1:
yangcli root@127.1> sget-config source=candidate /ospfv2
Filling list /ospfv2:
RPC Data Reply 22 for session 1:
rpc-reply {
data {
ospfv2 {
processes {
process 20 {
ospf-id 20
config {
ospf-id 20
shutdown
vrf-name default
}
}
}
}
}
}
Here is the example URL with basic authentication.
ftp://username:password@10.12.12.91/config_file/zebConf.xml
Edit-config using local file
Load configuration from the local storage and perform with edit-config operation. Load configuration from the local storage and perform with edit-config operation.
Note: Local files should be stored under /root/.yuma/ directory of the device.
yangcli root@127.1> edit-config url=file://zebConf.xml
Filling container /edit-config/input/target:
RPC OK Reply 2 for session 1:
yangcli root@127.1> sget-config source=candidate /ospfv2
Filling list /ospfv2:
RPC Data Reply 3 for session 1:
rpc-reply {
data {
ospfv2 {
processes {
process 20 {
ospf-id 20
config {
ospf-id 20
shutdown
vrf-name default
}
}
}
}
}
}
Edit-config Error Messages
OcNOS throws error messages for invalid authentication, invalid path, invalid IP address, and invalid port number (in case required) and invalid XML file. Here is the example for invalid FTP authentication.
yangcli root@127.1> edit-config url=ftp://admin:@10.12.12.91/config_file/zebConf.xml
Filling container /edit-config/input/target:
RPC Error Reply 36 for session 1:
rpc-reply {
rpc-error {
error-type rpc
error-tag operation-failed
error-severity error
error-app-tag libxml2-error
error-path /edit-config
error-message 'xml reader start failed'
error-info {
error-number 212
}
}
}
Delete-config
Delete a configuration store. The <url> element can appear as the <target> parameter.
Delete configuration from HTTP server
Delete the configuration xml file in HTTP server from the given URL.
yangcli ocnos@10.12.16.33> delete-config
Filling container /delete-config/input/target:
Enter the number of the selected case statement:
1: case startup:
leaf startup
2: case url:
leaf url
Enter choice number [1 - 2]:
yangcli ocnos@10.12.16.33:delete-config> 2
Enter string value for leaf <url>
yangcli ocnos@10.12.16.33:delete-config> http://10.12.12.91:10080/dashboard/docs/copy_config_test/zebConf.xml
RPC OK Reply 4 for session 3:
Here is the example URL with basic authentication.
http://username:password@10.12.12.91:10080/dashboard/docs/copy_config_test/zebConf.xml
Delete configuration from FTP
Delete the configuration file present in FTP.
yangcli ocnos@10.12.16.33> delete-config
Filling container /delete-config/input/target:
Enter the number of the selected case statement:
1: case startup:
leaf startup
2: case url:
leaf url
Enter choice number [1 - 2]:
yangcli ocnos@10.12.16.33:delete-config> 2
Enter string value for leaf <url>
yangcli ocnos@10.12.16.33:delete-config> ftp://10.12.12.91/config_file/zebConf.xml
RPC OK Reply 1 for session 3:
Here is the example URL with basic authentication.
ftp://username:password@10.12.12.91/config_file/zebConf.xml
Delete local file
Delete the configuration XML file in the local storage of the device.
Note: Local files are under /root/.yuma/ directory of the device.
yangcli ocnos@10.12.16.33> delete-config
Filling container /delete-config/input/target:
Enter the number of the selected case statement:
1: case startup:
leaf startup
2: case url:
leaf url
Enter choice number [1 - 2]:
yangcli ocnos@10.12.16.33:delete-config> 2
Enter string value for leaf <url>
yangcli ocnos@10.12.16.33:delete-config> file://zebConf.xml
RPC OK Reply 3 for session 1:
Delete-config Error Messages
Following are the error messages related to URL capability delete-config operation. Invalid authentication, invalid path, invalid IP address, and invalid port number (in case required) and invalid XML file. Here is the example for invalid FTP authentication.
yangcli ocnos@10.12.16.33> delete-config
Filling container /delete-config/input/target:
Enter the number of the selected case statement:
1: case startup:
leaf startup
2: case url:
leaf url
Enter choice number [1 - 2]:
yangcli ocnos@10.12.16.33:delete-config> 2
Enter string value for leaf <url>
yangcli ocnos@10.12.16.33:delete-config> ftp://admin:@10.12.12.91/config_file/zebConf.xml
RPC Error Reply 9 for session 1:
rpc-reply {
rpc-error {
error-type protocol
error-tag operation-failed
error-severity error
error-app-tag general-error
error-path /nc:rpc/nc:delete-config/nc:target
error-message 'operation failed'
error-info {
bad-value ftp://admin:@10.12.12.91/config_file/zebConf.xml
error-number 274
}
}
}