cidrblock / netcopa

Network Configuration Parser
GNU General Public License v3.0
135 stars 31 forks source link

Issue running netcopa with my own configs #14

Open owensj8 opened 5 years ago

owensj8 commented 5 years ago

I am having trouble running the parser with my own configs. The sample ones run just fine but when I add a fairly generic xe config it doesn't like it. Am I missing something simple?

'''* Loading configurations cisco_xe-OFFICE_IDF1 [ok]
Copy host_vars entry to temp directory cisco_xe-OFFICE_IDF1 [ok]
Retrieving OS cisco_xe-OFFICE_IDF1 [ok]
Loading OS removers cisco_xe-OFFICE_IDF1: cisco_xe [ok]
Loading OS parsers cisco_xe-OFFICE_IDF1: cisco_xe [ok]
Run pre-parse removers cisco_xe-OFFICE_IDF1 [ok]
Running parsers and comparing template output to actual cisco_xe-OFFICE_IDF1: cisco_xe/aaa accounting [ok]
cisco_xe-OFFICE_IDF1: cisco_xe/aaa authentication [ok]
cisco_xe-OFFICE_IDF1: cisco_xe/aaa authorization [ok]
cisco_xe-OFFICE_IDF1: cisco_xe/aaa groups [ok]
cisco_xe-OFFICE_IDF1: cisco_xe/aaa [ok]
cisco_xe-OFFICE_IDF1: cisco_xe/access-list extended [ok]
cisco_xe-OFFICE_IDF1: cisco_xe/access-list standard [ok]
cisco_xe-OFFICE_IDF1: cisco_xe/alias [ok]
cisco_xe-OFFICE_IDF1: cisco_xe/banner [ok]
cisco_xe-OFFICE_IDF1: cisco_xe/boot [ok]
cisco_xe-OFFICE_IDF1: cisco_xe/class-map [ok]
cisco_xe-OFFICE_IDF1: cisco_xe/clock [ok]
cisco_xe-OFFICE_IDF1: cisco_xe/control-plane [ok]
cisco_xe-OFFICE_IDF1: cisco_xe/enable secret [ok]
cisco_xe-OFFICE_IDF1: cisco_xe/hostname [ok]
cisco_xe-OFFICE_IDF1: cisco_xe/interface [fail] Failed to extract jinja output from configuration.
' ' '######## EXTRACTIONS' {'class_maps': {'non-client-nrt-class': {'match_type': 'match-any', 'name': 'non-client-nrt-class'}}, 'hostname': 'OFFICE_IDF1.1', 'interfaces': {'GigabitEthernet0/0': {'ip': {'address': {'negate': True}}, 'name': 'GigabitEthernet0/0', 'negotiation': {'negate': False, 'type': 'auto'}, 'vrf': 'Mgmt-vrf'}, 'GigabitEthernet1/0/1': {'name': 'GigabitEthernet1/0/1', 'switchport': {'access': {'vlan': 201}, 'mode': ['access']}}, 'GigabitEthernet1/0/10': {'name': 'GigabitEthernet1/0/10', 'switchport': {'access': {'vlan': 201}, 'mode': ['access']}}, 'GigabitEthernet1/0/11': {'name': 'GigabitEthernet1/0/11', 'switchport': {'access': {'vlan': 201}, 'mode': ['access']}}, 'GigabitEthernet1/0/12': {'name': 'GigabitEthernet1/0/12', 'switchport': {'access': {'vlan': 201}, 'mode': ['access']}}, '''

mchlrv commented 5 years ago

I'm having similar issues too on the interfaces and other parts. I've tried to narrow it down to only the BGP config and it outputs the following (output limited). The error is: [fail] Jinja result does not match actual (router bgp) But when I try to do the interfaces the error is: [fail] Jinja result does not match actual (interfaces)

Loading configurations config-bgp [ok]
Copy host_vars entry to temp directory config-bgp [ok]
Retrieving OS config-bgp [ok]
Loading OS removers config-bgp: cisco_xe [ok]
Loading OS parsers config-bgp: cisco_xe [ok]
Run pre-parse removers config-bgp [ok]
***** Running parsers and comparing template output to actual config-bgp: cisco_xe/access-list standard [ok]
config-bgp: cisco_xe/access-list extended [ok]
config-bgp: cisco_xe/interface [ok]
config-bgp: cisco_xe/hostname [ok]
config-bgp: cisco_xe/tacacs-server [ok]
config-bgp: cisco_xe/router ospf [ok]
config-bgp: cisco_xe/router bgp [fail] Jinja result does not match actual (router bgp).
'######## EXTRACTIONS' {'router': {'bgp': {65512: {'address_families': {'ipv4': {'ip_version': 'ipv4',

mchlrv commented 5 years ago

My issue seems to be related to multiple "address-family ipv4 vrf" sections in my BGP config. Not sure how to fix this yet.

[edit] Narrowed it down to " !" after "exit-address-family". If is remove the space in front of the "!" it works. [/edit]

mchlrv commented 5 years ago

Today I found that the order of the input config matters.

For example the following works for XE

interface Port-channel1 description test switchport trunk native vlan 2 switchport trunk allowed vlan 2,3 switchport mode trunk

However the config below doesn't

interface Port-channel1 description test switchport trunk allowed vlan 2,3 switchport mode trunk switchport trunk native vlan 2