Skip to content

Commit

Permalink
Merge pull request #199 from nautobot/bug_fix_serial_number_schema
Browse files Browse the repository at this point in the history
Fix error if Serial # is only numbers.
  • Loading branch information
scetron authored Aug 1, 2024
2 parents ef755f6 + 0afb3d0 commit 86b3d69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions nautobot_device_onboarding/command_mappers/cisco_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ sync_devices:
parser: "textfsm"
jpath: "[*].serial[]"
post_processor: "{{ obj | unique | first }}"
iterable_type: "str"
device_type:
commands:
- command: "show version"
Expand Down Expand Up @@ -46,6 +47,7 @@ sync_network_data:
parser: "textfsm"
jpath: "[*].serial[]"
post_processor: "{{ obj | unique | first }}"
iterable_type: "str"
interfaces:
root_key: true
commands:
Expand Down
6 changes: 3 additions & 3 deletions nautobot_device_onboarding/nornir_plays/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def sync_devices_schema(json_schema=True):
"required": ["hostname", "serial", "device_type", "mgmt_interface", "platform", "network_driver"],
"properties": {
"hostname": {"type": "string", "description": "Hostname of the network device"},
"serial": {"type": "string", "description": "Serial number of the network device"},
"serial": {"type": ["string", "integer"], "description": "Serial number of the network device"},
"device_type": {"type": ["string", "integer"], "description": "Type of the network device"},
"mgmt_interface": {"type": "string", "description": "Management interface of the network device"},
"mask_length": {
Expand Down Expand Up @@ -127,7 +127,7 @@ def sync_network_data_schema(json_schema=True):
"required": ["serial", "hostname", "device_type", "mgmt_interface", "mask_length"],
"properties": {
"serial": {
"type": "string",
"type": ["string", "integer"],
"description": "Serial number of the network device",
"minItems": 1,
},
Expand All @@ -145,7 +145,7 @@ def sync_network_data_schema(json_schema=True):
"required": ["serial", "interfaces"],
"properties": {
"serial": {
"type": "string",
"type": ["string", "integer"],
"description": "Serial number of the network device",
"minItems": 1,
},
Expand Down

0 comments on commit 86b3d69

Please sign in to comment.