Implement show command for a config

Hi all,

I have a config command “access-list 1 ip 10.1.1.0/24 20.1.1.0/24 permit”

i need to implement show command for the same ie “show access-list”

is there a way to do the same ?
as access-list node in yang file is “config true”

how to get show command for the same node ?

Regards
Gopi krishna P

What should be the output of the show command? Same output as for

show running-config access-list ?

Hi mnovak …
out put would be similar to running-config with little tweaks as well we get data from internal variables not from cdb database … where as show running config comes from cdb …
it helps us in

  1. presenting it better
  2. through this we make sure internal database and cdb database matches .

please let me know any good tutorial that helps us in presenting our show clis in a better way … there is no proper guide for the same … and it looks heavy to implement show commands. …
below are few requirements:

  1. “show access-list dependency” should show output as below

access-list node has acl_id as key

and dependency is a child with config false.

acl: 1 attached to:
class-map c1
interface datapath 1/1
policy p1
acl:2 attached to:
class-map c2

i tried cli-suppress-table but it is still taking the default table format… not sure why
access-list node is a config and
i augmented access-list and added a dependency list node and tried to suppress-table

   augment "/acl:access-list" {
list dependency {
            tailf:info "acl dependencies";
            config false;

            tailf:callpoint show-access-list;

            tailf:cli-suppress-mode;

            tailf:cli-suppress-table;
            tailf:cli-show-template-enter "";

            tailf:cli-show-template-legend
                '\n'
                +' attached to :\n\n';

            tailf:cli-show-template
                ' Type :$(Type). comedy is happening\n'
              + ' name : $(name) \n'
            {
                tailf:cli-auto-legend;
            }
            tailf:cli-show-template-footer "\n\n";
            uses attached_to;
     }
}

this is not printing custom but it is printing default table format.

Ok, if I understand correctly, it is operational data you want to show *(with data provider)

I do not know the data model, but as Greg suggests, you can use tailf:cli-show-template annotations, where you can freely format. You can also use it for sublists.

e.g. (from one of router like application):

list ospf-db-br-tl {
    key process-id;
    config false;
    tailf:cli-suppress-table;
    tailf:cli-suppress-mode;
    tailf:cli-show-template "OSPF Router with ID ($(router-id)) Process ID ($(process-id))\n\n" +
    "$(ospf-db-brief|show)";
    leaf process-id {
        type router-comn:ospf-process-id-uint32;
    }
    leaf router-id {
        type inet:ipv4-address;
    }
    list ospf-db-brief {
        key area-id;
        tailf:cli-suppress-table;
        tailf:cli-suppress-mode;
        tailf:cli-show-template "Area $(area-id);\n$(ospf-lsa-brief|show)\n";
        leaf area-id {
            type router-comn:ospf-area-type-ipv4;
        }
        uses router-comn:snmpDummyLeaf;
        list ospf-lsa-brief {
            key "lsid adv-router-id lsa-type";
            tailf:cli-suppress-table;
            tailf:cli-suppress-mode;
            tailf:cli-show-template-legend
                "Link type     Link ID         ADV router      Age (secs) Sequence   Checksum\n" +
                "---------     -------         ----------      ---------- --------   --------\n";
            tailf:cli-show-template "$(lsa-type==router?$(1  - router|ljust:13):$(lsa-type==network?$(2  - network|ljust:13):$(lsa-type==summary?$(3  - summary|ljust:13):$(lsa-type==asbr?$(4  - ASBR|ljust:13):$(lsa-type==multicast?$(6  - multicast|ljust:13):$(lsa-type==nssa?$(7  - NSSA|ljust:13):$(lsa-type==area-opq?$(10 - area opq|ljust:13)))))))) $(lsid|ljust:15) $(adv-router-id|ljust:15) $(age|ljust:10) 0x$(sequence|hex:8) 0x$(checksum|hex:8)\n";
            leaf lsid {
                type inet:ipv4-address;
            }
            leaf adv-router-id {
                type inet:ipv4-address;
            }
            leaf lsa-type {
                type lsa-type-types;
            }
            leaf age {
                type int32;
            }
            leaf sequence {
                type int32;
            }
            leaf checksum {
                type int32;
            }
        }
    }
}

The "$(ospf-db-brief|show)" - displays values in sub-list formatted according to sublist’s template (which in turn can have also sublists).