YANG data retrieved from a server can be saved to a file using a file assignment expression.
The data encoding is determined by the file extension:
- ".xml" : Save data in XML format
- ".json": Save data in JSON format
- ".yang" : Save data in text format
- All other extensions, including none: Save data in text format
@test1.xml = sget /netconf-state/datastores
<?xml version="1.0" encoding="UTF-8"?>
<data xmlns:ya="http://yumaworks.com/ns/yumaworks-attrs"
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<netconf-state xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
<datastores>
<datastore>
<name>candidate</name>
<last-modified xmlns="http://netconfcentral.org/ns/yuma-time-filter">2018-02-01T03:04:21Z</last-modified>
</datastore>
<datastore>
<name>running</name>
<last-modified xmlns="http://netconfcentral.org/ns/yuma-time-filter">2018-02-01T03:04:21Z</last-modified>
</datastore>
</datastores>
</netconf-state>
</data>@test1.json = sget /netconf-state/datastores
{
"yuma-netconf:data": {
"ietf-netconf-monitoring:netconf-state": {
"datastores": {
"datastore": [
{
"name":"candidate",
"yuma-time-filter:last-modified":"2018-02-01T03:04:21Z"
},
{
"name":"running",
"yuma-time-filter:last-modified":"2018-02-01T03:04:21Z"
}
]
}
}
}
}@test1.txt = sget /netconf-state/datastores
{
netconf-state {
datastores {
datastore candidate {
name candidate
last-modified 2018-02-01T03:04:21Z
}
datastore running {
name running
last-modified 2018-02-01T03:04:21Z
}
}
}
}