# Create (action)xml request for below yang model

**URL:** <https://dmap-community.ductus.global/t/create-action-xml-request-for-below-yang-model/3507>\
**Category:** NETCONF\
**Created:** [February 12, 2021, 2:45pm UTC](https://dmap-community.ductus.global/t/create-action-xml-request-for-below-yang-model/3507 "2021-02-12T14:45:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jagdish.singh](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@jagdish.singh](https://dmap-community.ductus.global/u/jagdish.singh)\
**Post date:** [February 12, 2021, 2:45pm UTC](https://dmap-community.ductus.global/t/create-action-xml-request-for-below-yang-model/3507/1 "2021-02-12T14:45:38Z")

</div>

Hi,  
I have the below yang file.

```auto
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.

```auto
<?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

---

<div class="post-metadata">

**Author:** ![mvf](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mvf/32/182_2.png) [@mvf](https://dmap-community.ductus.global/u/mvf)\
**Post date:** [February 17, 2021, 5:06pm UTC](https://dmap-community.ductus.global/t/create-action-xml-request-for-below-yang-model/3507/2 "2021-02-17T17:06:30Z")

</div>

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:

```auto
<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>

```

---

<div class="post-metadata">

**Author:** ![jagdish.singh](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@jagdish.singh](https://dmap-community.ductus.global/u/jagdish.singh)\
**Post date:** [February 19, 2021, 5:57am UTC](https://dmap-community.ductus.global/t/create-action-xml-request-for-below-yang-model/3507/3 "2021-02-19T05:57:31Z")

</div>

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.
