Match multiple lines in multiple columns textfsm

67 views Asked by At

I am trying to match multiple lines which are present in multiple columns. The text I want to match looks like the following:

vPC domain id                     : 10  
Peer status                       : peer adjacency formed ok      
vPC keep-alive status             : peer is alive                 
Configuration consistency status  : success 
Per-vlan consistency status       : success                       
Type-2 consistency status         : success 
vPC role                          : primary, operational secondary
Number of vPCs configured         : 11  
Peer Gateway                      : Enabled
Dual-active excluded VLANs        : -
Graceful Consistency Check        : Enabled
Auto-recovery status              : Enabled, timer is off.(timeout = 240s)
Delay-restore status              : Timer is off.(timeout = 45s)
Delay-restore SVI status          : Timer is off.(timeout = 10s)
Operational Layer3 Peer-router    : Disabled

vPC Peer-link status
---------------------------------------------------------------------
id    Port   Status Active vlans    
--    ----   ------ -------------------------------------------------
1     Po2    up     1-2,59,111,500,2000,2002,2051,2121                                   

vPC status
----------------------------------------------------------------------------
Id    Port          Status Consistency Reason                Active vlans
--    ------------  ------ ----------- ------                ---------------
5     Po5           up     success     success               2002,2121,  
                                                             1000                 
                                                                                         
6     Po6           up     success     success               2002,2121                   
                                                                                         
7     Po7           down*  Not         Consistency Check Not -                           
                           Applicable   Performed                                        
9     Po9           up     success     success               2,2002                      
                                                                                         
10    Po10          up     success     success               2,2002                      
                                                                                         
11    Po11          up     success     success               2000                                          
                                                                                         
19    Po19          down*  failed      vpc port channel      -                           
                                       mis-config due to vpc                             
                                        links in the 2                                   
                                       switches connected to                             
                                        different partners    

Please note that the multiline texts are present in the consistency, reason and active VLAN columns. I have managed to match the multiple active VLAN fields. But unable to do so for consistency and reason column. I am using the current code in textfsm:

Value Filldown id (\d+)
Value port (\S*)
Value List status (\S*) 
Value List consistency (\w*)
Value List reason ([A-Za-z]+(?:\s+[A-Za-z]+)*)
Value List active_vlans ([\d,\-\.]*)

Start
  ^\s*Id\s*Port\s*Status\s*Consistency\s*Reason\s*Active\s*vlans -> Begin

Begin
  ^${id}\s+${port}\s+${status}\s+${consistency}\s+${reason}\s+${active_vlans}
  ^\s+${active_vlans} -> Record

Please help if there is any way we can match the mentioned data. Thanks in advance.

0

There are 0 answers