NETCONF Operations
27 min
netconf protocol defines a set of operations to modify or obtain information in datastores for asternos, operations supported situation are as following operation status description \<get config> supported obtains some or all configuration data from the \<running/>, \<candidate/>, \<operational/> and \<startup/> databases \<get> supported obtains some or all running configuration data and status data from the \<running/> database \<edit config> supported add/modify/delete configuration in \<running/>/\<candidate/> datastore \<copy config> supported replaces the target database with the source database if no target database has been created, this operation creates a database and then replaces the database \<close session> supported closes a netconf session \<font color="#1d50a2">\<get config\>\</font> \<font color="#1d50a2">description\</font> asternos support to retrieve all or part of a specified configuration datastore via \<get config> \<font color="#1d50a2">parameters\</font> source name of the configuration datastore being queried, such as \<running/> filter this parameter identifies the portions of the device configuration datastore to retrieve if this parameter is not present, the entire configuration is returned note the asternos only support filter type as subtree, the \<filter> element must contain a "type" attribute and set it to “subtree” otherwise, an “unsupported filter type” error is returned for more detail about subtree filter, user may refer to subtree filtering docid\ ex4vlsf zhlm9xhbfm ll \<font color="#1d50a2">positive response\</font> if the device can satisfy the request, the server sends an \<rpc reply> element containing a \<data> element with the results of the query \<font color="#1d50a2">negative response\</font> an \<rpc error> element is included in the \<rpc error> if the request cannot be completed for any reason \<font color="#1d50a2">example\</font> to retrieve the entire \<vlans> subtree \<filter type="subtree"> \<top> \<vlans xmlns="http //asterfusion com/ns/yang/asternos vlan"/> \</top> \</filter> reply \<data xmlns="urn\ ietf\ params\ xml\ ns\ netconf\ base 1 0"> \<top> \<vlans xmlns="http //asterfusion com/ns/yang/asternos vlan"> \<vlan> \<vlanid>100\</vlanid> \<mac limit>10000\</mac limit> \<description>this is a test1\</description> \<unknown unicast action>flood\</unknown unicast action> \<unknown multicast action>drop\</unknown multicast action> \</vlan> \<vlan> \<vlanid>200\</vlanid> \<mac limit>20000\</mac limit> \<description>this is a test2\</description> \<unknown unicast action>flood\</unknown unicast action> \<unknown multicast action>drop\</unknown multicast action> \</vlan> \<vlan> \<vlanid>4000\</vlanid> \<mac limit>20000\</mac limit> \<description>test\</description> \<unknown unicast action>flood\</unknown unicast action> \<unknown multicast action>drop\</unknown multicast action> \</vlan> \</vlans> \</top> \</data> \<font color="#1d50a2">\<edit config\>\</font> \<font color="#1d50a2">description\</font> asternos support \<edit config> operation to \<running/>/\<startup>/\<candidate/> the \<edit config> operation loads all or part of a specified configuration to the specified target configuration datastore this operation allows the new configuration to be expressed in xml format data if the target configuration datastore does not exist, it will be created if a netconf peer supports the \ url capability ( section 8 8 https //datatracker ietf org/doc/html/rfc6241#section 8 8 ), the \<url> element can appear instead of the \<config> parameter the device analyzes the source and target configurations and performs the requested changes the target configuration is not necessarily replaced, as with the \<copy config> message instead, the target configuration is changed in accordance with the source's data and requested operations if the \<edit config> operation contains multiple sub operations that apply to the same conceptual node in the underlying data model, then the result of the operation is undefined (i e , outside the scope of the netconf protocol) \<font color="#1d50a2">o\</font> elements in the \<config> subtree may contain an "operation" attribute the attribute identifies the point in the configuration to perform the operation and may appear on multiple elements throughout the \<config> subtree if the "operation" attribute is not specified, the configuration is merged into the configuration datastore the "operation" attribute has one of the following values \<font color="#1d50a2">merge\</font> the configuration data identified by the element containing this attribute is merged with the configuration at the corresponding level in the configuration datastore identified by the \<target> parameter this is the default behavior \<font color="#1d50a2">replace\</font> the configuration data identified by the element containing this attribute replaces any related configuration in the configuration datastore identified by the \<target> parameter if no such configuration data exists in the configuration datastore, it is created unlike a \<copy config> operation, which replaces the entire target configuration, only the configuration actually presents in the \<config> parameter is affected note asternos currently don't support to replace whole list nodes if user specified operation as 'replace' in a list node, an rpc error is returned by server or unexpected action done by server \<font color="#1d50a2">create\</font> the configuration data identified by the element containing this attribute is added to the configuration if and only if the configuration data does not already exist in the configuration datastore if the configuration data exists, an \<rpc error> element is returned with an \<error tag> value of "data exists" \<font color="#1d50a2">delete\</font> the configuration data identified by the element containing this attribute is deleted from the configuration if and only if the configuration data currently exists in the configuration datastore if the configuration data does not exist, an \<rpc error> element is returned with an \<error tag> value of "data missing" \<font color="#1d50a2">remove\</font> not supported currently \<font color="#1d50a2">parameters\</font> target name of the configuration datastore being edited, such as \<running/> or \<candidate/> config a hierarchy of configuration data as defined by one of the device's data models the contents must be placed in an appropriate namespace, to allow the device to detect the appropriate data model, and the contents must follow the constraints of that data model, as defined by its capability definition capabilities are discussed in capabilities docid 64zqplgk4mnhlvsnh5vl5 \<font color="#1d50a2">positive response\</font> if the device was able to satisfy the request, an \<rpc reply> is sent containing an \<ok> element \<font color="#1d50a2">negative response\</font> an \<rpc error> response is sent if the request cannot be completed for any reason \<font color="#1d50a2">example\</font> the \<edit config> examples in this section utilize a simple data model, in which multiple vlans of the \<vlan> element can be present, and an instance is distinguished by the \<vlanid> element within each \<vlan> element set the description to “test netconf” on a vlan "100" in the running configuration \<config> \<top> \<vlans xmlns="http //asterfusion com/ns/yang/asternos vlan"> \<vlan operation="merge"> \<vlanid>100\</vlanid> \<description>test netconf\</description> \</vlan> \</vlans> \</top> \</config> create a new vlan with vlanid=200 \<config> \<top> \<vlans xmlns="http //asterfusion com/ns/yang/asternos vlan"> \<vlan operation="create"> \<vlanid>200\</vlanid> \</vlan> \</vlans> \</top> \</config> delete vlan 100 \<config> \<top> \<vlans xmlns="http //asterfusion com/ns/yang/asternos vlan"> \<vlan operation="delete"> \<vlanid>100\</vlanid> \</vlan> \</vlans> \</top> \<config> replace vlan 100 \<config> \<top> \<vlans xmlns="http //asterfusion com/ns/yang/asternos vlan"> \<vlan operation="replace"> \<vlanid>100\</vlanid> \<description>this is a replaced vlan 100\</description> \</vlan> \</vlans> \</top> \<config> \<font color="#1d50a2">\<copy config\>\</font> \<font color="#1d50a2">description\</font> asternos support \<copy config>, source can be \<running/>/\<startup/>/\<uri/>, target can be \<startup/>/\<uri/> \<copy config> can create or replace an entire configuration datastore with the contents of another complete configuration datastore if the target datastore exists, it is overwritten otherwise, a new one is created, if allowed note user can't use same datastore as source and target in a \<copy config> rpc currently, asternos don't support to use \<uri> as source and datastore as target in a \<copy config> rpc there are some limitations about \<copy config>, for more info about \<copy config>, please refer to document netconf examples \<font color="#1d50a2">parameters\</font> target name of the configuration datastore to use as the destination of the \<copy config> operation support \<startup/>/\<uri/> source name of the configuration datastore to use as the source of the \<copy config> operation support \<running/>/\<startup/>/\<uri/> \<font color="#1d50a2">positive response\</font> if the device was able to satisfy the request, an \<rpc reply> is sent that includes an \<ok> element \<font color="#1d50a2">negative response\</font> an \<rpc error> element is included within the \<rpc reply> if the request cannot be completed for any reason \<font color="#1d50a2">example\</font> request \<rpc message id="101" xmlns="urn\ ietf\ params\ xml\ ns\ netconf\ base 1 0"> \<copy config> \<target> \<startup/> \</target> \<source> \<running/> \</source> \</copy config> \</rpc> reply \<rpc reply message id="101" xmlns="urn\ ietf\ params\ xml\ ns\ netconf\ base 1 0"> \<ok/> \</rpc reply> \<font color="#1d50a2">\<get\>\</font> \<font color="#1d50a2">description\</font> asternos support \<get> to obtain config and state( defined with ‘config false’ in yang) \<get> is used to retrieve running configuration and device state information \<font color="#1d50a2">parameters\</font> filter this parameter specifies the portion of the system configuration and state data to retrieve if this parameter is not present, all the device configuration and state information is returned the \<filter> element must contain a "type" attribute with value ‘subtree’ user may refer to subtree filtering docid\ ex4vlsf zhlm9xhbfm ll for more detailed info about subtree filter on asternos \<font color="#1d50a2">positive response\</font> if the device was able to satisfy the request, an \<rpc reply> is sent the \<data> section contains the appropriate subset \<font color="#1d50a2">negative response\</font> an \<rpc reply> element is included in the \<rpc reply> if the request cannot be completed for any reason \<font color="#1d50a2">example\</font> this example shows how to get ptp instance \<current ds> under a specified ptp instance \<filter type="subtree"> \<top xmlns="http //www asterfusion com/asternos schema/1 0/config"> \<ptp> \<instances> \<instance> \<instance number>0\</instance number> \<current ds/> \</instance> \</instances> \</ptp> \</top> \</filter> reply \<data xmlns="urn\ ietf\ params\ xml\ ns\ netconf\ base 1 0"> \<top xmlns="http //www asterfusion com/asternos schema/1 0/config"> \<ptp> \<instances> \<instance> \<instance number>0\</instance number> \<current ds> \<offset from master>0\</offset from master> \<mean path delay>0\</mean path delay> \<servo state>unlocked\</servo state> \</current ds> \</instance> \</instances> \</ptp> \</top> \</data> for more subtree info, user may refer to subtree filtering docid\ ex4vlsf zhlm9xhbfm ll \<font color="#1d50a2">\<close session\>\</font> \<font color="#1d50a2">description\</font> asternos support to use \<close session> to request graceful termination of a netconf session when netconf server receives a \<close session> request, it will gracefully close the session the server will release any locks and resources associated with the session and gracefully close any associated connections any netconf requests received after a \<close session> request will be ignored \<font color="#1d50a2">positive response\</font> if the device was able to satisfy the request, an \<rpc reply> is sent that includes an \<ok> element \<font color="#1d50a2">negative respons\</font> \<font color="#1d50a2">e\</font> an \<rpc reply> element is included in the \<rpc reply> if the request cannot be completed for any reason \<font color="#1d50a2">example\</font> request \<rpc message id="101" xmlns="urn\ ietf\ params\ xml\ ns\ netconf\ base 1 0"> \<close session/> \</rpc> reply \<rpc reply message id="101" xmlns="urn\ ietf\ params\ xml\ ns\ netconf\ base 1 0"> \<ok/> \</rpc reply>
