Show "context-match" doesn't work with leaf allow-range?

Hello!

We have a yang model that implements Dot1Q settings over ConfD 8.0.6,
as follows:

container dot1q {
    tailf:info "Dot1q settings";
    tailf:cli-add-mode;

    list vlan {
        tailf:info "Static VLANs";
        tailf:cli-range-list-syntax;
        key "vlan-id";

        leaf vlan-id {
            tailf:cli-allow-range;
            tailf:info "<1-4094>;;VLAN ID or a range of VLAN IDs (1-3,5,7-9)";
            type types:vid;
        }
<...>

This model with cli-allow-range attribute supports vlan ranges.

The example below shows the range of vlans that have the same configuration,
which is the desired format so far.

show dot1q
dot1q
 vlan 77,2508
  interface g-ethernet-1/1/1
  !
 !
 vlan 248
  interface g-ethernet-1/1/1
  !
  interface g-ethernet-1/1/2
  !
 !
!

But when using context-match in the show, it seems that the match only displays the first vlan of range, ignoring other vlans:

show dot1q vlan | context-match g-ethernet-1/1/1
dot1q
 vlan 77
  interface g-ethernet-1/1/1
dot1q
 vlan 248
  interface g-ethernet-1/1/1

Above it’s possible to see that vlan 2508 was ignored, showing only vlan 77 of range 77,2508.

Is there a way to fix context-match with allow-range ?

Thanks in advance!

Hi Adalberto,

I wasn’t able to find an option that shows the context-match output in the range format, and it does seem like something that should be supported.

The data is certainly there and can be shown by including a few subsequent options. e.g. for your example:

(config)# show full-configuration dot1q 
dot1q
 vlan 77,248,2508
  interface g-ethernet-1/1/1
 !
!

Reproducing your observations:

(config)# show full-configuration dot1q vlan | context-match g-ethernet-1/1/1              
dot1q
 vlan 77
  interface g-ethernet-1/1/1

The data can be displayed with additional options:

(config)# show full-configuration dot1q vlan | context-match g-ethernet-1/1/1 | tab
VLAN                    
ID    INTERFACE         
------------------------
77    g-ethernet-1/1/1  
248   g-ethernet-1/1/1  
2508  g-ethernet-1/1/1  

and

(config)# show full-configuration dot1q vlan | context-match g-ethernet-1/1/1 | display xml  
<config xmlns="http://tail-f.com/ns/config/1.0">
  <dot1q xmlns="urn:simple">
    <vlan>
      <vlan-id>77</vlan-id>
      <interface>g-ethernet-1/1/1</interface>
    </vlan>
    <vlan>
      <vlan-id>248</vlan-id>
      <interface>g-ethernet-1/1/1</interface>
    </vlan>
    <vlan>
      <vlan-id>2508</vlan-id>
      <interface>g-ethernet-1/1/1</interface>
    </vlan>
  </dot1q>
</config>

But, it would be nice to have it come out in that format, probably especially as the number of vlans and their ranges gets bigger. Of course, that probably has its own challenges as well (even though it does output nicely with a basic show).

Best,
Scott