dainok / netdoc

Automatic Network Documentation plugin for NetBox
GNU General Public License v3.0
89 stars 14 forks source link

Add Allied Telesis platform #122

Closed dainok closed 6 months ago

dainok commented 7 months ago

@tatumi0726 I moved your code to this PR so I can edit it easily. Currently devices, interfaces, vlans, switchports, lldp neighbors are ingested. Please test and confirm:

Mind that you are required to use: https://github.com/dainok/ntc-templates/tree/add_allied_telesis

I'm closing the other PR.

dainok commented 7 months ago

About VRF I think the best choice is to get from the following commands:

tatumi0726 commented 7 months ago

Yes, sir.

We will collect logs tomorrow using an idle L3 switch on the actual equipment and submit them to you.

"show ip vrf detail" "show ip vrf interface"

2024年2月15日(木) 22:42 Andrea Dainese @.***>:

About VRF I think the best choice is to get from the following commands:

  • "show ip vrf detail"
  • "show ip vrf interface" Can you provide the output from your lab?

— Reply to this email directly, view it on GitHub https://github.com/dainok/netdoc/pull/122#issuecomment-1946121455, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM4WL5ERN5RQOY5FGSQZMHTYTYGE3AVCNFSM6AAAAABDG5NEHOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBWGEZDCNBVGU . You are receiving this because you were mentioned.Message ID: @.***>

dainok commented 7 months ago

Hello @tatumi0726 everything should work fine, except VRFs. Please test on your environment and let me know how it works.

tatumi0726 commented 7 months ago

Hello, @dainok!

I imported the template you modified and tried Discover and got an error. (show system)

I thought that removing the code that is not used in the ingestor would improve the situation, but what do you think?

Error message:

An exception occurred: AttributeError: 'NoneType' object has no attribute 'lower'

Traceback (most recent call last):. File "/opt/netbox/netbox/extras/scripts.py", line 504, in _run_script script.output = script.run(data=data, commit=commit) File "/opt/netbox/netbox/scripts/netdoc_scripts.py", line 357, in run log_ingest(log) File "/opt/netbox/src/netdoc/netdoc/utils.py", line 403, in log_ingest module.ingest(log) File "/opt/netbox/src/netdoc/netdoc/ingestors/netmiko_allied_telesis_show_system.py", line 29, in ingest if "chassis" in part_description.lower():. AttributeError: 'NoneType' object has no attribute 'lower'

Code we considered unnecessary: netmiko_allied_telesis_show_system.py

    if "chassis" in part_description.lower():.
        # Chassis model and Serial Number
         part_serial_number = item.get("sn")
         part_number = item.get("pid")
         break

The reason why we judged it unnecessary is that you have deleted the definitions of "sn" and "pid" in the template that you have maintained.

I would like to know your thoughts on this. Thank you in advance.

tatumi0726 commented 7 months ago

Hi, @dainok!

I also got an error with "show interface switchport".

After investigating, it seems that when the log output is "Default Vlan : None", "NATIVE_VLAN" is parsed as "None", and when it is processed by Ingestor, it is not int type, so it is an error.

If "NATIVE_VLAN" is "None" during ingestor processing, should we replace it with "Null"?

Thank you in advance.

Error message:

An exception occurred: ValueError: invalid literal for int() with base 10: 'None'

Traceback (most recent call last):. File "/opt/netbox/netbox/extras/scripts.py", line 504, in _run_script script.output = script.run(data=data, commit=commit) File "/opt/netbox/netbox/scripts/netdoc_scripts.py", line 357, in run log_ingest(log) File "/opt/netbox/src/netdoc/netdoc/utils.py", line 403, in log_ingest module.ingest(log) File "/opt/netbox/src/netdoc/netdoc/ingestors/netmiko_allied_telesis_show_interface_switchport.py", line 19, in ingest native_vlan = int(item.get("native_vlan")) if item.get("native_vlan") else None ValueError: invalid literal for int() with base 10: 'None'

Sample Raw Output:

Interface name : port1.0.3 Switchport mode : trunk Ingress filter : enable Acceptable frame types : vlan-tagged only Default Vlan : None Configured Vlans : 795 Dynamic Vlans :


Parsed Output:

{'interface': 'port1.0.3', 'mode': 'trunk', 'native_vlan': 'None', 'trunking_vlans': ['795']},


tatumi0726 commented 7 months ago

Hello, @dainok

I checked the "show interaface" logs on a VRF enabled switch and I can confirm that VRF information can be retrieved.

I will send you a sample log. I am sorry to say this is my personal opinion, but I have the impression that VRF related information can be obtained from this log. Can you get all the necessary information you have in mind from this log?

If so, I will have to review Ingestor....

Thank you in advance.

2024年2月17日(土) 15:24 0726 tatumiz @.***>:

Hi, @dainok!

I also got an error with "show interface switchport".

After investigating, it seems that when the log output is "Default Vlan : None", "NATIVE_VLAN" is parsed as "None", and when it is processed by Ingestor, it is not int type, so it is an error.

If "NATIVE_VLAN" is "None" during ingestor processing, should we replace it with "Null"?

Thank you in advance.

Error message:

An exception occurred: ValueError: invalid literal for int() with base 10: 'None'

Traceback (most recent call last):. File "/opt/netbox/netbox/extras/scripts.py", line 504, in _run_script script.output = script.run(data=data, commit=commit) File "/opt/netbox/netbox/scripts/netdoc_scripts.py", line 357, in run log_ingest(log) File "/opt/netbox/src/netdoc/netdoc/utils.py", line 403, in log_ingest module.ingest(log) File "/opt/netbox/src/netdoc/netdoc/ingestors/netmiko_allied_telesis_show_interface_switchport.py", line 19, in ingest native_vlan = int(item.get("native_vlan")) if item.get("native_vlan") else None ValueError: invalid literal for int() with base 10: 'None'

Sample Raw Output:

Interface name : port1.0.3 Switchport mode : trunk Ingress filter : enable Acceptable frame types : vlan-tagged only Default Vlan : None Configured Vlans : 795 Dynamic Vlans :


Parsed Output:

{'interface': 'port1.0.3', 'mode': 'trunk', 'native_vlan': 'None', 'trunking_vlans': ['795']},


HOSTNAME#show interface Interface port1.1.1 Scope: both Link is UP, administrative state is UP Thrash-limiting Status Not Detected, Action learn-disable, Timeout 1(s) Hardware is Ethernet, address is 0000.cd37.0fcf Description: To XXXXXXXXXXXX index 5101 metric 1 mru 1500 current duplex full, current speed 10000, current polarity mdi configured duplex auto, configured speed auto, configured polarity auto <UP,BROADCAST,RUNNING,MULTICAST> SNMP link-status traps: Sending (suppressed after 20 traps in 60 sec) Link-status trap delay: 0 sec input packets 9455362865, bytes 11289114945786, dropped 0, multicast packets 3410881 output packets 17173058785, bytes 12752872494347, multicast packets 513043665, broadcast packets 830156481 input average rate : 30 seconds 1.05 Mbps, 5 minutes 590.97 Kbps output average rate: 30 seconds 1.64 Mbps, 5 minutes 919.28 Kbps input peak rate 806.73 Mbps at 2023/01/12 23:32:30 output peak rate 806.80 Mbps at 2023/01/12 23:32:30 Time since last state change: 0 days 01:14:20

Interface vlan1 Scope: both Link is UP, administrative state is UP Hardware is VLAN, address is 0000.cd37.0fcf IPv4 address 192.168.1.1/24 broadcast 192.168.1.255 index 301 metric 1 mtu 1500 arp ageing timeout 300 <UP,BROADCAST,RUNNING,MULTICAST> VRF Binding: Associated with VRF01 SNMP link-status traps: Disabled Router Advertisement is disabled Router Advertisement default routes are accepted Router Advertisement prefix info is accepted input packets 30729674, bytes 2331109561, dropped 206, multicast packets 1014964 output packets 117039344, bytes 5218779216, multicast packets 0, broadcast packets 0 Time since last state change: 134 days 01:22:08 Interface vlan2 Scope: both Link is UP, administrative state is UP Hardware is VLAN, address is 0000.cd37.0fcf index 302 metric 1 mtu 1500 arp ageing timeout 300 <UP,BROADCAST,RUNNING,MULTICAST> VRF Binding: Not bound SNMP link-status traps: Disabled Router Advertisement is disabled Router Advertisement default routes are accepted Router Advertisement prefix info is accepted input packets 0, bytes 0, dropped 0, multicast packets 0 output packets 0, bytes 0, multicast packets 0, broadcast packets 0 Time since last state change: 134 days 01:22:08 Interface vlan3 Scope: both Link is UP, administrative state is UP Hardware is VLAN, address is 0000.cd37.0fcf IPv4 address 192.168.3.1/24 broadcast 192.168.3.255 index 303 metric 1 mtu 1500 arp ageing timeout 300 <UP,BROADCAST,RUNNING,MULTICAST> VRF Binding: Associated with VRF01 SNMP link-status traps: Disabled Router Advertisement is disabled Router Advertisement default routes are accepted Router Advertisement prefix info is accepted input packets 35361512, bytes 2570082989, dropped 0, multicast packets 360213 output packets 24669070, bytes 1441930633, multicast packets 0, broadcast packets 0 Time since last state change: 134 days 01:22:08 Interface lo Scope: both Link is UP, administrative state is UP Hardware is Loopback index 1 metric 1 <UP,LOOPBACK,RUNNING> VRF Binding: Not bound SNMP link-status traps: Disabled Router Advertisement is disabled Router Advertisement default routes are accepted Router Advertisement prefix info is accepted Time since last state change: 134 days 01:59:44 Interface lo1 Scope: both Link is UP, administrative state is UP Hardware is Loopback index 5 metric 1 <UP,RUNNING,NOARP> VRF Binding: Associated with VRF01 SNMP link-status traps: Disabled Router Advertisement is disabled Router Advertisement default routes are accepted Router Advertisement prefix info is accepted Time since last state change: 134 days 01:59:44 Interface lo2 Scope: both Link is UP, administrative state is UP Hardware is Loopback index 6 metric 1 <UP,RUNNING,NOARP> VRF Binding: Associated with VRF02 SNMP link-status traps: Disabled Router Advertisement is disabled Router Advertisement default routes are accepted Router Advertisement prefix info is accepted Time since last state change: 134 days 01:59:44 Interface lo3 Scope: both Link is UP, administrative state is UP Hardware is Loopback index 7 metric 1 <UP,RUNNING,NOARP> VRF Binding: Associated with VRF03 SNMP link-status traps: Disabled Router Advertisement is disabled Router Advertisement default routes are accepted Router Advertisement prefix info is accepted Time since last state change: 134 days 01:59:44 Interface lo4 Scope: both Link is UP, administrative state is UP Hardware is Loopback index 8 metric 1 <UP,RUNNING,NOARP> VRF Binding: Associated with VRF04 SNMP link-status traps: Disabled Router Advertisement is disabled Router Advertisement default routes are accepted Router Advertisement prefix info is accepted Time since last state change: 134 days 01:59:44

dainok commented 7 months ago

Hi @tatumi0726 thank you for your tests. Regarding failed parsing, I need you send me the JSON logs so I can fix templates. I expected, that's why I not published new templates yet. Regarding VRF, thank you very much, I'll update templates. That makes things easier.

tatumi0726 commented 7 months ago

Hello, @dainok

Thank you for your confirmation! I will send you the log file and json file you requested.

show system show interface switchport

Thank you very much.

2024年2月17日(土) 18:28 Andrea Dainese @.***>:

Hi @tatumi0726 https://github.com/tatumi0726 thank you for your tests. Regarding failed parsing, I need you send me the JSON logs so I can fix templates. I expected, that's why I not published new templates yet. Regarding VRF, thank you very much, I'll update templates. That makes things easier.

— Reply to this email directly, view it on GitHub https://github.com/dainok/netdoc/pull/122#issuecomment-1949914376, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM4WL5DAIGQUGCRMFBREJP3YUBZ3BAVCNFSM6AAAAABDG5NEHOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBZHEYTIMZXGY . You are receiving this because you were mentioned.Message ID: @.***>

System Status Sat Feb 17 09:55:23 2024

Board ID Bay Board Name Rev Serial number

Base 467 AT-SH210-24GT B-0 G22TG606R

RAM: Total: 122660 kB Free: 40928 kB Flash: 63.0MB Used: 44.0MB Available: 19.0MB

Environment Status : Normal Uptime : 102 days 18:24:05 Bootloader version : 2.0.25

Current software : SH210-5.4.7-0.1.rel Software version : 5.4.7-0.1 Build date : Thu Mar 23 21:27:28 UTC 2017

Current boot config: flash:/default.cfg (file exists)

System Name 13F-SH210-test System Contact

System Location

dainok commented 7 months ago

@tatumi0726 last update add VRFs. Please, send me logs as json files so I can import them in my lab. If you don't want to publish there, send me via email.

tatumi0726 commented 7 months ago

Hello, @dainok !

I understand your request. Sorry, I have left my office...I will submit it here tomorrow!

tatumi0726 commented 7 months ago

Hello, @dainok

Sorry for the delay. I have retrieved the json file using the template you maintained, and will submit it to you.

Thank you for your cooperation.

show-interface.zip

dainok commented 7 months ago

Hi @tatumi0726 to download log files, you need to:

Andrea

tatumi0726 commented 7 months ago

Hello, @dainok

I did not know how to collect the logs you specified...

I tested against a single L2 switch and got an error with the following command, so I collected the json file.

After this, we will check on the stacked L3 switches.

Thank you in advance.

295_show_system.zip

dainok commented 6 months ago

NTC templates PR: https://github.com/networktocode/ntc-templates/pull/1632