Hide display of data

Hi,

I have yang model as below,
container A {
config false;
callpoint a1;
leaf 1 {
}
leaf 2 {
}
leaf 3{
}
container B {
callpont b1;
leaf 5;
leaf 6;
leaf 7;
}
container C {
callpoint c1;
leaf 5;
leaf 6;
leaf 7;
}
}

If I give show A,

It displays all the datum under A. But I need only leaf 1,2,3. How to hide container b and container c?

Any idea?
Please suggest…

Thanks in advance.,
Banumoorthy M

1 Like

You can use the tailf:hidden statement to hide any part of your data model. Refer to Chapter 3.9, Hidden Data, for more information of this feature.

An alternative is to customize the auto-rendered show output as was suggested in your other post titled: Key value handling between datahandler and yang model.

Hi Wai,

For the above mentioned yang model,
If I give show A,
It should display 1,2,3
And if I give show A B,
it should display 5,6,7
And if I give show A C
it should display 5,6,7 respective to container C

Thanks in advance,
Banumoorthy M

You can use the show templates feature as described in Chapter 16.27.2, Show templates, of the ConfD 6.0 User Guide to customize the output of the show command to implement your use case.

If you modify your YANG model as follows:

module ABC {
  namespace "http://example.com/ns/ABC";
  prefix abc;

  import tailf-common {
  prefix tailf;
}

  container A {
    config false;
    tailf:cli-show-template
      "$(/A/l1?$(l1|ljust:1)  )"
      +"$(/A/l2?$(l2|ljust:1)  )"
      +"$(/A/l3?$(l3|ljust:1))\n";
    leaf l1 {
      type int32;
    }
    leaf l2 {
      type int32;
    }
    leaf l3{
      type int32;
    }

    container B {
      tailf:cli-show-template
        "$(/A/B/l4?$(l4|ljust:1)  )"
        +"$(/A/B/l5?$(l5|ljust:1)  )"
        +"$(/A/B/l6?$(l6|ljust:1))\n";
      leaf l4 {
        type int32;
      }
      leaf l5 {
        type int32;
      }
      leaf l6 {
        type int32;
      }
    }

    container C {
      tailf:cli-show-template
        "$(/A/C/l7?$(l7|ljust:1)  )"
        +"$(/A/C/l8?$(l8|ljust:1)  )"
        +"$(/A/C/l9?$(l9|ljust:1))\n";
      leaf l7 {
        type int32;
      }
      leaf l8 {
         type int32;
      }
      leaf l9 {
        type int32;
      }
    }
  }
}

When you run confd with the above YANG model and with the operational data initialized, the cli output will now look as follows:

admin connected from 127.0.0.1 using console on WAITAI-M-K092
admin@WAITAI-M-K092> show A
1  2  3
[ok][2016-01-04 15:36:53]
admin@WAITAI-M-K092> show A B
5  6  7
[ok][2016-01-04 15:37:00]
admin@WAITAI-M-K092> show A C
5  6  7
[ok][2016-01-04 15:37:02]
admin@WAITAI-M-K092>

I want to add yang model something like,

the leaf should not show in CLI, but in show runnning-config

I tried,

    leaf myname {
        tailf:cli-show-config;
        view:pathmap "rtmindex";
        config false;
       type uint32;
        }

but not working

It works for me when I tried the following YANG snippet:

container mycontainer {
  config false;
  leaf myname {
    tailf:cli-show-config;
    type uint32;
  }
}

which resulted in the following CLI behavior:

localhost# show running-config | include mycontainer
mycontainer myname 30

It’s worth mentioning that mycontainer won’t show up as a possible selection when you do “show running-config ?” as it isn’t configuration data, but it will show up as a line item in the output of “show running-config”.