跳转到内容
Ask AI

NETCONF Operations

此内容尚不支持你的语言。

NETCONF protocol defines a set of operations to modify or obtain information in datastores.

For AsterNOS, operations supported situation are as following:

OperationStatusDescription
SupportedObtains some or all configuration data from the , , and databases.
SupportedObtains some or all running configuration data and status data from the database.
SupportedAdd/Modify/Delete configuration in / datastore.
SupportedReplaces the target database with the source database. If no target database has been created, this operation creates a database and then replaces the database.
SupportedCloses a NETCONF session.

AsterNOS support to retrieve all or part of a specified configuration datastore via .

  • source: Name of the configuration datastore being queried, such as .
  • filter: This parameter identifies the portions of the device configuration datastore to retrieve. If this parameter is not present, the entire configuration is returned.

If the device can satisfy the request, the server sends an element containing a element with the results of the query.

An element is included in the if the request cannot be completed for any reason.

To retrieve the entire 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>

AsterNOS support operation to //.

The 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), the element can appear instead of the parameter. The device analyzes the source and target configurations and performs the requested changes. The target configuration is not necessarily replaced, as with the message. Instead, the target configuration is changed in accordance with the source’s data and requested operations.

If the 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).

Elements in the 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 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:

merge

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 parameter. This is the default behavior.

replace

The configuration data identified by the element containing this attribute replaces any related configuration in the configuration datastore identified by the parameter. If no such configuration data exists in the configuration datastore, it is created. Unlike a operation, which replaces the entire target configuration, only the configuration actually presents in the parameter is affected.

create

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 element is returned with an value of “data-exists”.

delete

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 element is returned with an value of “data-missing”.

remove

Not supported currently.

  • target: Name of the configuration datastore being edited, such as or .
  • 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.

If the device was able to satisfy the request, an is sent containing an element.

An response is sent if the request cannot be completed for any reason.

The examples in this section utilize a simple data model, in which multiple vlans of the element can be present, and an instance is distinguished by the element within each 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>

AsterNOS support , source can be //, target can be /.

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.

  • target: Name of the configuration datastore to use as the destination of the operation.Support /.
  • source: Name of the configuration datastore to use as the source of the operation. Support //.

If the device was able to satisfy the request, an is sent that includes an element.

An element is included within the if the request cannot be completed for any reason.

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>

AsterNOS support to obtain config and state( defined with ‘config false’ in YANG). is used to retrieve running configuration and device state information.

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 element MUST contain a “type” attribute with value ‘subtree’. User may refer to Subtree Filtering for more detailed info about subtree filter on AsterNOS.

If the device was able to satisfy the request, an is sent. The section contains the appropriate subset.

An element is included in the if the request cannot be completed for any reason.

This example shows how to get PTP instance 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.

AsterNOS support to use to request graceful termination of a NETCONF session.

When NETCONF server receives a 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 request will be ignored.

If the device was able to satisfy the request, an is sent that includes an element.

An element is included in the if the request cannot be completed for any reason.

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>