URL Capabilities
OcNOS supports: url capability. The URL capability is identified by the following capability string:
"urn:ietf:params:netconf:capability:url:1.0?scheme=http,ftp,file"
OcNOS supports HTTP, FTP, and file schemes under this capability for these operations.
• copy-config
• edit-config
• delete-config
Limitations
• Operation copy-config operation with source as URL and target as startup is not supported.
• Operation copy-config with source and target with different URL is not supported.
• Operation copy-config with source as URL and target as running is not supported.
• Operation copy-config with source and target with same URL is not a valid operation.
<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"
Copy URL configuration to candidate configuration store
As mentioned above, HTTP, FTP and file schemes are supported in URL capability.
Note: Yangcli supports URL option only in interactive mode.
HTTP to Candidate configuration store
Download configuration from HTTP server and copy it to 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
FTP to Candidate configuration store
Download configuration from FTP server and copy it to 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
Local file to Candidate configuration store
Using file scheme support, user shall copy the configuration from stored local file to 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:
Copy candidate configuration store to URL
Herein, Candidate configuration store is chosen to show the procedural steps.
Note: Source configuration store can also be chosen either Running or Startup.
Candidate configuration store to HTTP
Upload configuration to 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 URL with basic authentication.
http://username:password@10.12.12.91:10080/dashboard/docs/copy_config_test/zebConf.xml
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
Candidate configuration store to local file
Using file scheme support, user shall create a snapshot of configuration store. Here is the example to copy URL configuration store into a local file.
Note: Local files are created under /root/.yuma/ directory of the device; support to store 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 present in 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
}
}
}