Environment
- Python version: 3.12
- Nautobot version: 2.x (Assumed based on UI screenshots)
- nautobot-device-onboarding version: Latest/Current
- ntc-templates version: 5.x
Expected Behavior
When running the "Sync Network Data From Network" job, the script should use the Port specified in the Job Form (e.g., 22) or default to 22 if the device record is empty. This should allow the tcp_ping connectivity check to succeed and proceed to run network commands.
Observed Behavior
The job fails immediately (duration ~1 second) with a TypeError. The logs show that task.host.port is being passed as None to the netutils.ping.tcp_ping function. Because int(None) is an invalid operation in Python, the job crashes.
File "/opt/nautobot/.../nautobot_device_onboarding/nornir_plays/command_getter.py", line 133, in netmiko_send_commands
if not tcp_ping(task.host.hostname, task.host.port if task.host.port else 22):
File "/usr/local/lib/python3.12/site-packages/netutils/ping.py", line 28, in tcp_ping
sckt.connect((ip, int(port)))
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
Steps to Reproduce
- Select a device in Nautobot that has an IP address but has the TCP Port field left blank (null) in its device record.
- Run the job "Sync Network Data From Network".
- In the Job Form, enter 22 in the Port field (note: the bug persists even though this field is filled).
- Observe that the job fails with TypeError: ... not 'NoneType'.
- Note: Adding {"port": 22} to the device's Config Context does not resolve the issue, confirming the sync_network_data_command_getter function is not correctly mapping these variables to the Nornir inventory.
NTC-5581
Environment
Expected Behavior
When running the "Sync Network Data From Network" job, the script should use the Port specified in the Job Form (e.g., 22) or default to 22 if the device record is empty. This should allow the tcp_ping connectivity check to succeed and proceed to run network commands.
Observed Behavior
The job fails immediately (duration ~1 second) with a TypeError. The logs show that task.host.port is being passed as None to the netutils.ping.tcp_ping function. Because int(None) is an invalid operation in Python, the job crashes.
Steps to Reproduce
NTC-5581