# Actions disappear from CLI if I use "no" on the container

**URL:** <https://dmap-community.ductus.global/t/actions-disappear-from-cli-if-i-use-no-on-the-container/2977>\
**Category:** YANG\
**Created:** [March 11, 2020, 10:47pm UTC](https://dmap-community.ductus.global/t/actions-disappear-from-cli-if-i-use-no-on-the-container/2977 "2020-03-11T22:47:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![judegeorge](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@judegeorge](https://dmap-community.ductus.global/u/judegeorge)\
**Post date:** [March 11, 2020, 10:47pm UTC](https://dmap-community.ductus.global/t/actions-disappear-from-cli-if-i-use-no-on-the-container/2977/1 "2020-03-11T22:47:15Z")

</div>

I have a container in a YANG model, and in that container are some leaf nodes and also some actions.

If, from the CLI, I use "no " to clear the contents of the container, then the actions no longer appear in the CLI. They don’t show up in “?” completion, and if I try to type them anyway, they give an error. However, the leaf nodes still appear and can be set in the CLI.

How can I prevent this from happening? I want the actions to always be available. Is there any other known condition in which the actions in a YANG model will disappear from the CLI?

Thank you,  
Jude

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [March 12, 2020, 4:01pm UTC](https://dmap-community.ductus.global/t/actions-disappear-from-cli-if-i-use-no-on-the-container/2977/2 "2020-03-12T16:01:51Z")

</div>

A YANG example would help people like myself to avoid spending time on your issue only to find out that I misunderstood your setup.

---

<div class="post-metadata">

**Author:** ![judegeorge](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@judegeorge](https://dmap-community.ductus.global/u/judegeorge)\
**Post date:** [March 12, 2020, 4:20pm UTC](https://dmap-community.ductus.global/t/actions-disappear-from-cli-if-i-use-no-on-the-container/2977/3 "2020-03-12T16:20:39Z")

</div>

Conny, thank you for your response. The example is from Tail-f’s SNMP agent, and the configuration code provided in the “SNMP Tailpack”. In the YANG below, I have added the “view” and “regenerate” actions. The remainder of the container is what was originally provided by Tail-f, with the only other modifications being the removal of “tailf:hidden” from some of the leaf notes, and removal of “tailf:cli-drop-node-name” from the container. This is so that the leaf nodes are exposed and usable in the CLI.

```auto
  augment /snmp:snmp {
    container agent {

    // some other leaf nodes and containers not shown here, for brevity

      container engine-id {
        presence "sets the local engine-id";
        reference "SNMP-FRAMEWORK-MIB.snmpEngineID";
        tailf:info
          "Local SNMP engine's administratively-unique identifier";

        leaf enterprise-number {
          tailf:hidden enterprise-number;
          type uint32;
          mandatory true;
        }
        choice method {
          mandatory true;
          leaf from-ip {
            tailf:info "Construct engine-id from specified IP address";
            type inet:ip-address;
          }
          leaf from-mac-address {
            tailf:info "Construct engine-id from specified MAC address";
            type yang:mac-address;
          }
          leaf from-text {
            tailf:info "Construct engine-id from specified ASCII string";
            type string {
              length 1..27;
            }
          }
          leaf other {
            tailf:info "Construct engine-id from colon-separated hex bytes";
            type string {
              pattern "[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){0,27}";
            }
          }
        }
        tailf:action regenerate {
            description "Regenerate the agent's default engine-id";
            tailf:info "Regenerate the agent's default engine-id";
            tailf:actionpoint snmp-action;
            output {
                leaf result {
                    tailf:cli-drop-node-name;
                    type string;
                }
            }
        }
        tailf:action view {
            description "View the agent's engine-id";
            tailf:info "View the agent's engine-id";
            tailf:actionpoint snmp-action;
            output {
                leaf result {
                    tailf:cli-drop-node-name;
                    type string;
                }
            }
        }
      }
  }

```

What happens is that, if I am inside the snmp node in the CLI and say “no snmp agent engine-id”, it will clear the contents of that entire container as expected, but it will also remove the actions from being visible in the CLI.

Before:

```auto
localhost(config-snmp)# agent engine-id ?
Possible completions:
  from-ip Construct engine-id from specified IP address
  from-mac-address Construct engine-id from specified MAC address
  from-text Construct engine-id from specified ASCII string
  other Construct engine-id from colon-separated hex bytes
  regenerate Regenerate the agent's default engine-id
  view View the agent's engine-id
  <cr>               
localhost(config-snmp)#

```

After:

```auto
localhost(config-snmp)# agent engine-id ?
Possible completions:
  from-ip Construct engine-id from specified IP address
  from-mac-address Construct engine-id from specified MAC address
  from-text Construct engine-id from specified ASCII string
  other Construct engine-id from colon-separated hex bytes
  <cr>               
localhost(config-snmp)#

```

Possibly there is some bug in my callback code which is causing this, but if so, what are the conditions which can cause actions to disappear? I have not significantly modified Tail-f’s snmp-config-transform daemon which contains the existing hook callbacks for the entire SNMP container. I did add a separate daemon however, in python, which contains the action handler for the two actions (and that handler works fine). But note that I don’t even have to use the actions themselves to cause them to disappear. All I have to do is say “no snmp agent engine-id”.

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [March 13, 2020, 1:58pm UTC](https://dmap-community.ductus.global/t/actions-disappear-from-cli-if-i-use-no-on-the-container/2977/4 "2020-03-13T13:58:33Z")

</div>

As “engine-id” is a presence container you get that behaviour.  
When the “engine-id” container is set, the actions show, when not set, the actions will not show.

One option is to change the “engine-id” container into a non-presence container (remove the “presence” statement) and take away mandatory statements from the “method” choice and the hidden “enterprise-number”.

---

<div class="post-metadata">

**Author:** ![judegeorge](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@judegeorge](https://dmap-community.ductus.global/u/judegeorge)\
**Post date:** [March 13, 2020, 4:40pm UTC](https://dmap-community.ductus.global/t/actions-disappear-from-cli-if-i-use-no-on-the-container/2977/5 "2020-03-13T16:40:50Z")

</div>

Thank you very much – I will try it.  
Jude
