tdorssers / confparser

Parse Cisco-like configuration files into a JSON-formattable structure using YAML-defined dissectors
MIT License
34 stars 13 forks source link

IOS-XR, global static-routes #6

Closed hani010 closed 1 year ago

hani010 commented 1 year ago

i want to parse global and vrf static-routes in ios-xr config. With the parser (iosxr.yaml) its only possible to parse static-routes in vrfs. It is possible to parse both static-routes ?

Example for ios-xr config:

router static address-family ipv4 unicast : here begins the global static routes 10.2.1.128/26 172.24.63.44 10.2.4.0/24 172.24.63.44 ! vrf abcdef : here begins the vrf static routes address-family ipv4 unicast 10.1.192.0/24 172.28.49.140 10.1.194.128/26 172.28.49.140 10.1.195.0/25 172.28.49.140 10.1.196.0/25 172.28.49.140

Regards

tdorssers commented 1 year ago

You can modify the iosxr.yaml file like this:

- match: router static
  name: static
  child:
    - match: address-family (\S+)
      parent: af
      child:
        match: '([^! ]+)(?: vrf (?P<vrf>\S+))?(?: (?=[A-Tn])(?P<interface>\S+))?(?: (?=(?:\S*[\.:])+)(?P<nexthop>\S+))?(?: (?P<distance>\d+))?(?: description (?P<description>\S+))?'
    - match: vrf (\S+)
      parent: vrf
      child:
        match: address-family (\S+)
        parent: af
        child:
          match: '([^! ]+)(?: vrf (?P<vrf>\S+))?(?: (?=[A-Tn])(?P<interface>\S+))?(?: (?=(?:\S*[\.:])+)(?P<nexthop>\S+))?(?: (?P<distance>\d+))?(?: description (?P<description>\S+))?'
tdorssers commented 1 year ago

4f6a8b4 includes this