# Yang model with multiple input params

**URL:** <https://dmap-community.ductus.global/t/yang-model-with-multiple-input-params/661>\
**Category:** YANG\
**Created:** [August 31, 2016, 2:38pm UTC](https://dmap-community.ductus.global/t/yang-model-with-multiple-input-params/661 "2016-08-31T14:38:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![madhirasasi](https://avatars.discourse-cdn.com/v4/letter/m/b9bd4f/32.png) [@madhirasasi](https://dmap-community.ductus.global/u/madhirasasi)\
**Post date:** [August 31, 2016, 2:38pm UTC](https://dmap-community.ductus.global/t/yang-model-with-multiple-input-params/661/1 "2016-08-31T14:38:44Z")

</div>

Hi Team,

i have some CLI format like below.

CLI# show counter  
DEVICE\_INDEX device index  
CLI# show counter 1  
CHANNEL\_INDEX channel index  
CLI# show counter 1 1  
CLI# show counter 1 1 module  
gmac-downstream  
gmac-upstream  
host-local-counter  
packet-processor-downstream  
CLI# show counter 1 1 module gmac-downstream counter  
pyld-idle-bytes  
pyld-bytes-cnt-high  
CLI# show counter 1 1 module gmac-upstream counter  
fec-corrupted-cw  
good-dbru-onu  
CLI# show counter 1 1 module host-local-counter counter  
host-local-omci-rx  
host-local-omci-tx  
CLI# show counter 1 1 module packet-processor-downstream counter  
ne-port-id-octets  
channel-selctor-octets-low  
CLI#

Complete commands looks like:  
CLI# show counter 1 1 module gmac-downstream counter pyld-idle-bytes parameter-type global  
CLI# show counter 1 1 module gmac-upstream counter fec-corrupted-cw parameter-type onu-id parameter-index  
CLI# show counter 1 1 module host-local-counter counter host-local-omci-rx  
CLI# show counter 1 1 module packet-processor-downstream counter ne-port-id-octets parameter-type port-id parameter-index  
PARAM\_INDEX Index of parameter type  
CLI#

i tried yang model which looks below but not sure how to get sub-params based on module.

list counter {  
tailf:callpoint dev;  
config false;  
tailf:cli-suppress-table;  
key “index\_counter channel\_index module”;  
leaf index\_counter {  
type uint16 {  
range “0 … 15”;  
}  
}  
leaf channel\_index {  
type uint16 {  
range “0 … 3”;  
}  
}  
leaf module {  
tailf:cli-expose-key-name;  
type enumeration {  
enum “gmac-downstream”;  
enum “gmac-upstream”;  
enum “host-local-counter”;  
enum “packet-processor-downstream”;  
}  
}  
}  
please guide me.

---

<div class="post-metadata">

**Author:** ![waitai](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/waitai/32/436_2.png) [@waitai](https://dmap-community.ductus.global/u/waitai)\
**Post date:** [September 1, 2016, 2:56am UTC](https://dmap-community.ductus.global/t/yang-model-with-multiple-input-params/661/2 "2016-09-01T02:56:23Z")

</div>

> [@madhirasasi](#):
>
> i tried yang model which looks below but not sure how to get sub-params based on module.

You can use tailf:display-when to control what leaf elements to display next based on the value of module. Following is a partial example of your command requirements:

```
leaf counter {
  type uint32;
}
leaf pyld-idle-bytes {
  type uint32;
  tailf:display-when "../module = 'gmac-downstream'";
}
leaf fec-corrupted-cw {
  type uint32;
  tailf:display-when "../module = 'gmac-upstream'";
}
leaf host-local-omci-rx {
  type uint32;
  tailf:display-when "../module = 'host-local-counter'";
}
leaf ne-port-id-octets {
  type uint32;
  tailf:display-when "../module = 'packet-processor-downstream'";
}

```

---

<div class="post-metadata">

**Author:** ![madhirasasi](https://avatars.discourse-cdn.com/v4/letter/m/b9bd4f/32.png) [@madhirasasi](https://dmap-community.ductus.global/u/madhirasasi)\
**Post date:** [September 1, 2016, 2:16pm UTC](https://dmap-community.ductus.global/t/yang-model-with-multiple-input-params/661/3 "2016-09-01T14:16:23Z")

</div>

Hi watai,  
Thanks. still i have some issue.

leaf fec-corrupted-cw {  
type uint32;  
tailf:display-when “…/module = ‘gmac-upstream’”;  
}

If “fec-corrupted-cw” is the last argument then it was fine but still i have to get  
parameter-type, onu-id, parameter-index then value for only parameter-index.  
i don’t need any value for fec-corrupted-cw, parameter-type, onu-id.

show **counter** 1 1 module gmac-upstream **counter** fec-corrupted-cw parameter-type onu-id parameter-index 5

1. so here leaf will not work and if i try with list i cannot use tailf:cli-expose-key-name.
2. If i make counter as container i cannot use key “index\_counter channel\_index”.
3. All the above commands i have to accommodate in the same container or list otherwise redefined error will thrown.
4. Need to provide two times **counter** in the command so redefined error. please correct me if my understanding is wrong.

Thanks,  
sasidhar

---

<div class="post-metadata">

**Author:** ![waitai](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/waitai/32/436_2.png) [@waitai](https://dmap-community.ductus.global/u/waitai)\
**Post date:** [September 1, 2016, 4:12pm UTC](https://dmap-community.ductus.global/t/yang-model-with-multiple-input-params/661/4 "2016-09-01T16:12:22Z")

</div>

> [@madhirasasi](#):
>
> If “fec-corrupted-cw” is the last argument then it was fine but still i have to get parameter-type, onu-id, parameter-index then value for only parameter-index.i don’t need any value for fec-corrupted-cw, parameter-type, onu-id.

By showing just the CLI command, it isn’t clear what all the data types are for each of the arguments. It makes it difficult to come up with any suggestions.

> [@madhirasasi](#):
>
> show counter 1 1 module gmac-upstream counter fec-corrupted-cw parameter-type onu-id parameter-index 5

Again, without knowing the data types of the rest of your arguments, you can also consider using the custom show output feature as described in Chapter 16.21.6 & Chapter 16.21.7 in the ConfD User Guide as necessary.
