This page describe how to execute <get> and <edit-config> operations about "target-output-power" XML node.
1. Environment Requirement
- Docker container that runs a Netconf server. Follow the instructions posted How to build and run ODTN Emulators?
- netconf-console tool that is a simulation tool for Netconf client.
- "target-output-power" node defined in "openconfig-terminal-device.yang" as the operation target node.
Assume that we have started an OpenConfig Cassini Emulator which runs a Netconf server in docker as follows:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 20c0298eb652 onosproject/oc-cassini:0.21 "sh /root/script/pus…" 2 hours ago Up 2 hours 22/tcp, 8080/tcp, 0.0.0.0:11002->830/tcp odtn-emulator_openconfig_cassini_1_1
So we use the command listed below to send RPC request to the container:
netconf-console --host=127.0.0.1 --port=11003 -u admin -p admin --rpc={XML_FILE_NAME}
The root node of "openconfig-platform.yang" is "<components>" and its sublist "<component>" contains "<name>" node as its identity. Besides "openconfig-terminal-device.yang" adds node "<optical-channel>" into "<component>" node. "<target-power-config>" is defined as a child node of "<optical-channel>".
2. Perform Operations
2.1 Perform <get> Operation:
If you want to get the whole components, the content of get-components is:
<?xml version="1.0"?>
<get xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<filter xmlns:oc-platform="http://openconfig.net/yang/platform">
<oc-platform:components/>
</filter>
</get>
You can take a look at the output of get components here: out-get-components.xml
If you want to get only the "<optical-channel>" of "<component>", the content is:
<?xml version="1.0"?>
<get xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<filter>
<components xmlns="http://openconfig.net/yang/platform">
<component>
<optical-channel xmlns="http://openconfig.net/yang/terminal-device" />
</component>
</components>
</filter>
</get>
The output is :
If you want to get the "<config>" nodes only where the frequency is 194750000 and the line-port is oe1:
<?xml version="1.0"?>
<get xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<filter>
<components xmlns="http://openconfig.net/yang/platform">
<component>
<optical-channel xmlns="http://openconfig.net/yang/terminal-device">
<config>
<line-port>oe1</line-port>
<frequency>194750000</frequency>
</config>
</optical-channel>
</component>
</components>
</filter>
</get>
</get>
The output is:
<nc:rpc-reply xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:703f18cc-512f-411c-8b8d-f07a87b4797f">
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<components xmlns="http://openconfig.net/yang/platform">
<component>
<name>oe1/2</name>
<optical-channel xmlns="http://openconfig.net/yang/terminal-device">
<config>
<frequency>194750000</frequency>
<target-output-power>-5.1</target-output-power>
<line-port>oe1</line-port>
</config>
</optical-channel>
</component>
</components>
</data>
</nc:rpc-reply>
2.2 Perform <edit-config> operation
If you want to change the target-output-power value as 0dBm instead of the default -5.1 dBm where "<name>" ID is "oe1/2":
<?xml version="1.0"?>
<edit-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<target><running/></target>
<config>
<components xmlns="http://openconfig.net/yang/platform">
<component>
<name>oe1/2</name>
<optical-channel xmlns="http://openconfig.net/yang/terminal-device">
<config>
<target-output-power>0</target-output-power>
</config>
</optical-channel>
</component>
</components>
</config>
</edit-config>
The output is:
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:3b4de76f-74f0-4f06-808d-64320a6c47ed"> <ok/> </rpc-reply>
Then we request the "<config>" nodes again to check this operation, where the frequency is 194750000 and the line-port is oe1. The output is changed:
<nc:rpc-reply xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:ca069e53-020a-4201-a9d3-53f4e5534bec">
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<components xmlns="http://openconfig.net/yang/platform">
<component>
<name>oe1/2</name>
<optical-channel xmlns="http://openconfig.net/yang/terminal-device">
<config>
<frequency>194750000</frequency>
<target-output-power>0.0</target-output-power>
<line-port>oe1</line-port>
</config>
</optical-channel>
</component>
</components>
</data>
</nc:rpc-reply>