Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page describe how to execute <get> and <edit-config> operations about "target-output-power" XML node via Netconf. There are totally three ways to config power.


Table of Contents

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.
  • Running ONOS instance that is able to configure power through two ways.

Assume that we have started an OpenConfig Cassini Emulator which runs a Netconf server in docker as follows:

Code Block
languagetext
linenumberstrue
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:

Code Block
languagepowershell
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 Execute Operations

2.1 ONOS startup and node discovery

This section is the environment for section 2.3 and 2.4.

Firstly, an ONOS instance is started via command "bazel run onos-local -- clean". Secondly, the docker container connects to ONOS via command "onos-netcfg localhost device.json". The content of device.json is:

Code Block
{
  "devices" : {
    "netconf:127.0.0.1:11002" : {
      "basic" : {
        "name":"cassini2",
        "driver":"cassini-ocnos"
      },
      "netconf" : {
        "ip" : "127.0.0.1",
        "port" : "11002",
        "username" : "root",
        "password" : "root",

If you want to get the whole components, the content of XML_FILE_NAME file is:

Code Block
languagexml
linenumberstrue
<?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>

If you want to get only the "<optical-channel>" of "<component>", the content is:

Code Block
languagexml
linenumberstrue
<get>
  <filter>
    <components xmlns="http://openconfig.net/yang/platform">
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device" />"idle-timeout" : "0"
      </component>}
    </components>}
  </filter>
</get>

The output is :

}
}

Then, we use "onos localhost" to log into ONOS CLI environment and see if the docker container is detected.

Code Block
Welcome to Open Network Operating System (ONOS)!
Code Block
languagexml
linenumberstrue
collapsetrue
<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:c9220366-76bd-43ba-ad3c-13e1b7014e21">
  <data>
    <components xmlns="http://openconfig.net/yang/platform">
      <component> ____  _  ______  ____
    / __   <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>\/ |/ / __ \/ __/
   / /_/ /    / /_/ /\ <frequency>0</frequency>\
       \____/_/|_/\____/___/

Documentation: wiki.onosproject.org
Tutorials:     <target-output-power>-10.0</target-output-power>
            <line-port>oe1</line-port>
          </config>
        </optical-channel>
      </component>
tutorials.onosproject.org
Mailing lists: lists.onosproject.org

Come help out! Find out how at: contribute.onosproject.org

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'logout' to exit ONOS session.

onf@root > devices           <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
                <config>
            <frequency>0</frequency>
            <target-output-power>0.0</target-output-power>
            <line-port>oe1</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194700000</frequency>
            <target-output-power>-10.0</target-output-power>
   11:54:09
id=netconf:127.0.0.1:11002, available=true, local-status=connected 4m53s ago, role=MASTER, type=TERMINAL_DEVICE, mfr=EDGECORE, hw=Cassini, sw=OcNOS, serial=, chassis=1, driver=cassini-ocnos, ipaddress=127.0.0.1, locType=none, name=cassini2, port=11002, protocol=NETCONF

2.2 Config Power by using ONOS CLI Command "power-config"

An ONOS command is provided to configure the power of line-side ports.

In ONOS CLI environment, the description for command "power-config" is listed:

Code Block
onf@root > help power-config         <line-port>oe2</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
                <config>
            <frequency>0</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe2</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>0</frequency>11:56:39
DESCRIPTION
        onos:power-config

    <target-output-power>-10.0</Get/Edit the target-output-power>
power for specific optical-channel

SYNTAX
         <line-port>oe3</line-port>
          </config>onos:power-config [options] operation connection point [value]

ARGUMENTS
        </optical-channel>operation
      </component>
      <component>
    Netconf Operation including get, <opticaledit-channel xmlns="http://openconfig.net/yang/terminal-device">config, etc.
          <config>
      (required)
        connection <frequency>0</frequency>point
            <target-output-power>-10.0</target-output-power>
    {DeviceID}/{PortNumber}
                <line-port>oe3</line-port>(required)
        value
   </config>
         </optical-channel>
    target-output-power  </component>
value. Unit: dBm

OPTIONS
        <component>--help
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
        Display this help  <config>message
            <frequency>194700000</frequency>
            <target-output-power>-10.0</target-output-power>-j, --json
            <line-port>oe4</line-port>
      Output JSON


This command also supports auto-completion function for each parameter.

Currently, only get and edit-config operations are supported:

Code Block
onf@root >  </config>
power-config           </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194750000</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe4</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194700000</frequency>
     11:56:43
get       <target-output-power>-10.0</target-output-power>
      lock      <line-port>oe5</line-port>
      unlock    </config>
      get-config  </optical-channel>
    copy-config  </component>
   edit-config   <component>
  kill-session    close-session  <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
 delete-config

2.2.1 Perform <get> Operation

Through power-config command, you can get the power value of any line-side port of any optical device, for example,

Code Block
onf@root > power-config get netconf:127.0.0.1:11002/216          <config>
            <frequency>194750000</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe5</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194700000</frequency>
   11:56:43
The target-output-power value in port 216 on device netconf:127.0.0.1:11002 is -2.0.


2.2.2 Perform <edit-config> Operation

Through power-config command, you can modify the power value of any line-side port of any optical device, for example,

Code Block
onf@root > power-config edit-config netconf:127.0.0.1:11002/216 -4.0               <target-output-power>-10.0</target-output-power>
            <line-port>oe6</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194750000</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe6</line-port>
          </config>
        </optical-channel>
      </component>
  12:04:11
onf@root > power-config  <component>
get netconf:127.0.0.1:11002/216        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194700000</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe7</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194750000</frequency>
            <target-output-power>-10.0</12:06:01
The target-output-power>
power value in port 216 on device netconf:127.0.0.1:11002 is -4.0.

2.3 Config Power on a single device by using Netconf tool like netconf-console

So we use the command listed below to send RPC request to the container:

Code Block
languagepowershell
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.3.1 Perform <get> Operation

If you want to get the whole components, the content of get-components is:

Code Block
languagexml
linenumberstrue
<?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 of get-components-op-channel is:

Code Block
languagexml
linenumberstrue
<?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 out-get-components-op-channel:

Code Block
languagexml
linenumberstrue
collapsetrue
<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:c9220366-76bd-43ba-ad3c-13e1b7014e21">
  <data>
    <components xmlns="http://openconfig.net/yang/platform">
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>0</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe1</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>0</frequency>
            <target-output-power>0.0</target-output-power>
            <line-port>oe1</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194700000</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe2</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>0</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe2</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>0</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe3</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>0</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe3</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194700000</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe4</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194750000</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe4</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194700000</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe5</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194750000</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe5</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194700000</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe6</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
   <line-port>oe7</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194700000<   <frequency>194750000</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe8<port>oe6</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194750000<<frequency>194700000</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe8</line-port>
          </config>
        </optical-channel>
       </component><line-port>oe7</line-port>
    </components>
  </data>
</rpc-reply>

If you want to get the "<config>" nodes only where the frequency is 0 and the line-port is oe1:

Code Block
languagexml
linenumberstrue
<?xml version="1.0"?>
<get>
  <filter>
    <components xmlns="http://openconfig.net/yang/platform">      </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <line-port>oe1</line-port><frequency>194750000</frequency>
            <target-output-power>-10.0</target-output-power>
            <frequency>0</frequency><line-port>oe7</line-port>
          </config>
        </optical-channel>
      </component>
      </components><component>
  </filter>
</get>

The output is:

Code Block
languagexml
linenumberstrue
<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:190d45b0-29e8-44a7-8b6a-71f87c35f740">
  <data>
    <components xmlns="http://openconfig.net/yang/platform">      <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194700000</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe8</line-port>
          </config>
        </optical-channel>
      </component>
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>194750000</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe8</line-port>
          <config></config>
            <frequency>0</frequency></optical-channel>
      </component>
      <target-output-power>-10.0</target-output-power>
            <line-port>oe1</line-port>
          </config>
        </optical-channel>
      </component></components>
  </data>
</rpc-reply>

If you want to get the "<config>" nodes only where the frequency is 194750000 and the line-port is oe1, the content of get-config-nodes is:

Code Block
languagexml
linenumberstrue
<?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>
            <frequency>0</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe1</line-port>
            <frequency>194750000</frequency>
          </config>
        </optical-channel>
      </component>
    </components>
  </filter>
</data>get>
</rpc-reply>

Perform <edit-config> operation

get>

The output is is out-get-config-nodesIf you want to change the target-output-power value as 0dBm instead of the default -10.0 dBm where "<name>" ID is "oe1/2":

Code Block
languagexml
linenumberstrue
<?xml version="1.0"?>
<edit-config>
  <target><running/></target>
  <config><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>0<power>-5.1</target-output-power>
          </config>
        </optical-channel><line-port>oe1</line-port>
      </component>
    </components>config>
  </config>
</edit-config>

The output is:

Code Block
languagexml
linenumberstrue
<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 0 and the line-port is oe1. The output is changed:

      </optical-channel>
      </component>
    </components>
  </data>
</nc:rpc-reply>

2.3.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", the content of file is set-target-output-power :

Code Block
languagexml
linenumberstrue
<?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">
Code Block
languagexml
linenumberstrue
<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:190d45b0-29e8-44a7-8b6a-71f87c35f740">
  <data>
    <components xmlns="http://openconfig.net/yang/platform">
      <component>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>0</frequency>
            <target-output-power>-10.0</target-output-power>
            <line-port>oe1</line-port>
          </config>
      <component>
  </optical-channel>
      </component>
      <component><name>oe1/2</name>
        <optical-channel xmlns="http://openconfig.net/yang/terminal-device">
          <config>
            <frequency>0</frequency>
            <target-output-power>0.0<power>0</target-output-power>
          </config>
  <line-port>oe1</line-port>      </optical-channel>
      </component>
    </config>components>
        </optical-channel>
      </component>
    </components>
  </data>
</rpc-reply></config>
</edit-config>


The output is:

Code Block
languagexml
linenumberstrue
<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 using  get-config-nodes:

As you the following output illustrates, the target-output-power is changed from -5.1 to 0.