scaleway / netbox-netprod-importer

Poll data from network devices in production and import it into netbox
GNU General Public License v3.0
101 stars 31 forks source link

Interconnection functionality not working #24

Open Wo0dsi3 opened 5 years ago

Wo0dsi3 commented 5 years ago

First of all, THANKS... This is a great program.

The import functionality works perfect. Brings in all the interface data.

The interconnect function won't work for me...

I have pasted the debugs logs.. Any tips would be awesome..

This particular log is an interconnect between two devices in Netbox.. DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet1/0/3', 'hostname': 'Glan-NA-GPN-AGN-DMVPN.Glanbia', 'port': 'Gi0/1/0'}: 'NetboxMapper_Interfaces_DcimInterfaces958' object has no attribute 'interface_connection'

DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet0/0/1', 'hostname': 'GLAN-NA-GPN-BCT-MPLS-METRO.Glanbia', 'port': 'Gi0/0/2'}: Device GLAN-NA-GPN-BCT-MPLS-METRO not found on Netbox DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/devices/?name=Glan-NA-GPN-AGN-Core&limit=50 HTTP/1.1" 200 1623 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/?device_id=27&limit=50&offset=50 HTTP/1.1" 200 27598 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/?device_id=27&limit=50&offset=50 HTTP/1.1" 200 27598 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/?device_id=27&limit=50&offset=100 HTTP/1.1" 200 27506 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/?device_id=27&limit=50 HTTP/1.1" 200 27759 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/?device_id=27&limit=50&offset=100 HTTP/1.1" 200 27506 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/?device_id=27&limit=50&offset=150 HTTP/1.1" 200 11649 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/?device_id=27&limit=50&offset=150 HTTP/1.1" 200 11649 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/devices/?name=GPN-AGN-OFFICE-2802i-AP1&limit=50 HTTP/1.1" 200 52 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet1/0/48', 'hostname': 'GPN-AGN-OFFICE-2802i-AP1', 'port': '0'}: Device GPN-AGN-OFFICE-2802i-AP1 not found on Netbox DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/954/?limit=50 HTTP/1.1" 200 550 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/?device_id=27&limit=50&offset=50 HTTP/1.1" 200 27598 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/devices/?name=GPN-AGN-OFFICE-2802i-AP4&limit=50 HTTP/1.1" 200 52 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet3/0/48', 'hostname': 'GPN-AGN-OFFICE-2802i-AP4', 'port': '0'}: Device GPN-AGN-OFFICE-2802i-AP4 not found on Netbox DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/1089/?limit=50 HTTP/1.1" 200 547 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet0/0/1', 'hostname': 'Glan-NA-GPN-AGN-Core.Glanbia', 'port': 'Gi3/0/2'}: 'NetboxMapper_Interfaces_DcimInterfaces1089' object has no attribute 'interface_connection' DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/974/?limit=50 HTTP/1.1" 200 531 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/956/?limit=50 HTTP/1.1" 200 535 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet1/0/1', 'hostname': 'Glan-NA-GPN-AGN-MPLS_METRO.Glanbia', 'port': 'Gi0/1/0'}: 'NetboxMapper_Interfaces_DcimInterfaces956' object has no attribute 'interface_connection' DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/devices/?name=GPN-AGN-OFFICE-2802i-AP2&limit=50 HTTP/1.1" 200 52 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet2/0/48', 'hostname': 'GPN-AGN-OFFICE-2802i-AP2', 'port': '0'}: Device GPN-AGN-OFFICE-2802i-AP2 not found on Netbox DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/960/?limit=50 HTTP/1.1" 200 534 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/?device_id=27&limit=50&offset=100 HTTP/1.1" 200 27506 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/devices/?name=GPN-AGN-OFFICE-2802i-AP3&limit=50 HTTP/1.1" 200 52 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet1/0/47', 'hostname': 'GPN-AGN-OFFICE-2802i-AP3', 'port': '0'}: Device GPN-AGN-OFFICE-2802i-AP3 not found on Netbox DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/1048/?limit=50 HTTP/1.1" 200 539 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet0/1/1', 'hostname': 'Glan-NA-GPN-AGN-Core.Glanbia', 'port': 'Gi2/0/3'}: 'NetboxMapper_Interfaces_DcimInterfaces1048' object has no attribute 'interface_connection' DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/1048/?limit=50 HTTP/1.1" 200 539 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/960/?limit=50 HTTP/1.1" 200 534 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet2/0/3', 'hostname': 'Glan-NA-GPN-AGN-DMVPN.Glanbia', 'port': 'Gi0/1/1'}: 'NetboxMapper_Interfaces_DcimInterfaces960' object has no attribute 'interface_connection' DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/?device_id=27&limit=50&offset=150 HTTP/1.1" 200 11649 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/958/?limit=50 HTTP/1.1" 200 572 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/996/?limit=50 HTTP/1.1" 200 546 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet0/1/0', 'hostname': 'Glan-NA-GPN-AGN-Core.Glanbia', 'port': 'Gi1/0/3'}: 'NetboxMapper_Interfaces_DcimInterfaces996' object has no attribute 'interface_connection' DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/1026/?limit=50 HTTP/1.1" 200 533 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/952/?limit=50 HTTP/1.1" 200 539 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet2/0/1', 'hostname': 'Glan-NA-GPN-AGN-DMVPN.Glanbia', 'port': 'Gi0/0/0'}: 'NetboxMapper_Interfaces_DcimInterfaces952' object has no attribute 'interface_connection' DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/956/?limit=50 HTTP/1.1" 200 535 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/974/?limit=50 HTTP/1.1" 200 531 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet0/1/0', 'hostname': 'Glan-NA-GPN-AGN-Core.Glanbia', 'port': 'Gi1/0/1'}: 'NetboxMapper_Interfaces_DcimInterfaces974' object has no attribute 'interface_connection' DEBUG:netmiko:write_channel: b'\n' DEBUG:netmiko:Pattern is: # DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/952/?limit=50 HTTP/1.1" 200 539 DEBUG:netmiko:_read_channel_expect read_data: Glan-NA-GPN-AGN-MPLS_METRO# DEBUG:netmiko:Pattern found: # Glan-NA-GPN-AGN-MPLS_METRO# DEBUG:netmiko:exit_config_mode: DEBUG:netmiko:write_channel: b'exit\n' 33%|ââââââââââââââââââââââââââ | 1/3 [00:13<00:27, 13.59s/it]DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/1026/?limit=50 HTTP/1.1" 200 533 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet0/0/0', 'hostname': 'Glan-NA-GPN-AGN-Core.Glanbia', 'port': 'Gi2/0/1'}: 'NetboxMapper_Interfaces_DcimInterfaces1026' object has no attribute 'interface_connection' DEBUG:netmiko:write_channel: b'\n' DEBUG:netmiko:Pattern is: # DEBUG:paramiko.transport:EOF in transport thread DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/1089/?limit=50 HTTP/1.1" 200 547 DEBUG:netmiko:_read_channel_expect read_data: Glan-NA-GPN-AGN-DMVPN# DEBUG:netmiko:Pattern found: # Glan-NA-GPN-AGN-DMVPN# DEBUG:netmiko:exit_config_mode: DEBUG:netmiko:write_channel: b'exit\n' 67%|ââââââââââââââââââââââââââââââââââââââââââââââââââââ | 2/3 [00:13<00:09, 9.56s/it]DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/954/?limit=50 HTTP/1.1" 200 550 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet3/0/2', 'hostname': 'Glan-NA-GPN-AGN-DMVPN.Glanbia', 'port': 'Gi0/0/1'}: 'NetboxMapper_Interfaces_DcimInterfaces954' object has no attribute 'interface_connection' DEBUG:paramiko.transport:EOF in transport thread DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/996/?limit=50 HTTP/1.1" 200 546 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/958/?limit=50 HTTP/1.1" 200 572 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet1/0/3', 'hostname': 'Glan-NA-GPN-AGN-DMVPN.Glanbia', 'port': 'Gi0/1/0'}: 'NetboxMapper_Interfaces_DcimInterfaces958' object has no attribute 'interface_connection' DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/devices/?name=54bf.6442.4a21&limit=50 HTTP/1.1" 200 52 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet2/0/37', 'hostname': '54bf.6442.4a21', 'port': '54bf.6442.4a21'}: Device 54bf.6442.4a21 not found on Netbox DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/devices/?name=f8ca.b819.1dc3&limit=50 HTTP/1.1" 200 52 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet1/0/19', 'hostname': 'f8ca.b819.1dc3', 'port': 'f8ca.b819.1dc3'}: Device f8ca.b819.1dc3 not found on Netbox DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/devices/?name=1065.3099.43f5&limit=50 HTTP/1.1" 200 52 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet2/0/17', 'hostname': '1065.3099.43f5', 'port': '1065.3099.43f5'}: Device 1065.3099.43f5 not found on Netbox DEBUG:netmiko:write_channel: b'\n' DEBUG:netmiko:Pattern is: # DEBUG:netmiko:_read_channel_expect read_data:

DEBUG:netmiko:_read_channel_expect read_data: Glan-NA-GPN-AGN-Core# DEBUG:netmiko:Pattern found: # Glan-NA-GPN-AGN-Core# DEBUG:netmiko:exit_config_mode: DEBUG:netmiko:write_channel: b'exit\n' 100%|ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ| 3/3 [00:14<00:00, 6.92s/it] 0 interconnection(s) applied ERROR:netbox_importer:Error pushing 19 interconnection(s)

aruhier commented 5 years ago

Hi, Could you try the master branch instead of the last release and tell me if it solves your issue?

Wo0dsi3 commented 5 years ago

Hi Anthony,

I tried that but no joy... This seems to be the error I get..

DEBUG:netmiko:read_channel: DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/1840/?limit=50 HTTP/1.1" 200 967 DEBUG:urllib3.connectionpool:http://194.72.105.68:8000 "GET /api/dcim/interfaces/1897/?limit=50 HTTP/1.1" 200 953 DEBUG:netbox_importer:Error with interco {'local_port': 'GigabitEthernet0', 'hostname': 'Glan-EU-Agri-AFD-CORE.Glanbia', 'port': 'Gi1/0/48'}: 'NetboxMapper_Interfaces_DcimInterfaces1897' object has no attribute 'interface_connection'

Any ideas ? Cheers, Donnchadh.

omyno commented 5 years ago

Can confirm this issue with master (fb81720) in combination with netbox-7c7d4996d4-n792m (v2.6.0).

aruhier commented 5 years ago

Sorry, are you sure you're using the master branch? Because it used to set an interface connection using the interface_connection, but it's using the dcim/interface-connections object for a while now. If I grep the use of interface_connection in the entire codebase, the only thing I find is in a documentation:

$ git grep interface_connection
netbox_netprod_importer/push.py:        :returns interface_connection: wanted interface connection
aruhier commented 5 years ago

You can try to update netbox-netprod-importer through pip, I released new versions since. Also, can you print me the output of netbox-netprod-importer --version please?