Yang model with multiple input params

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.

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'";
}

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

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.

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.