ConfD User Community

Create (action)xml request for below yang model

Hi,
I have the below yang file.

container comp {
        list A {
            key name;
            max-elements 64;
            leaf name {
                type string{
                    length "1..256";
                }
                mandatory true;
                tailf:info "Name of service";
            }
            leaf Num {
                type uint16;
                mandatory true;
                tailf:info "Route no";
            }
		}
		list B-Service {
            when "/comp/A";
            key x-list;
            leaf x-list {
                type leafref {
                    path "/comp/A/name";
                }
            }
            tailf:action start {
                tailf:exec "/home/eart/enable.sh" {
                    tailf:args "-p $(path)";
                }
                output {
                    leaf response {
                        type string;
                    }
                }		
		tailf:action getbindings {
                     tailf:actionpoint  ShowInfo;
                output {
                    leaf response {
                        type string;
                    }
                }
            }
		}
	}

I would like to create xml request to call action, use with netconf-console
I was trying with below request.

<?xml version="1.0" encoding="UTF-8"?>
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <capabilities>
    <capability>urn:ietf:params:netconf:base:1.0</capability>
  </capabilities>
</hello>
]]>]]>
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <action xmlns="http://tail-f.com/ns/netconf/actions/1.0">

    <data>
        <comp xmlns="http://">
                <B-Service>
                        <start/>
               </B-Service>
        </comp>
     </data>
   </action>
</rpc>
]]>]]>
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
  <close-session/>
</rpc>

But unable to get result.
Thanks for your support.

Regards,
Jagdish

There are several problems with what you have:

  • the YANG module is not valid: you have tailf:action getbindings inside tailf:action start, you cannot have an action as a descendant element of an action.
  • the action start is a child element of of the list B-Service, so when you want to invoke the action, you need to identify a list entry, e.g. like this:
<action xmlns="http://tail-f.com/ns/netconf/actions/1.0">
  <data>
    <comp xmlns="http://">
      <B-Service>
        <x-list>component</x-list>
        <start/>
      </B-Service>
    </comp>
  </data>
</action>

Thanks for your reply,

  1. tailf:action getbindings and tailf:action start are both different action, that is a typo error.
  2. Thanks for your solution

Thanks.