-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a "raw" parser concept, also add sync device platform support for…
… hp_comware (#250) * add first attempt at comware * add raw parser and force to fake json payload * fix new raw parser type * fix comware yaml file * add raw parser and add new sync devices platform hp_comware * add raw parser docs
- Loading branch information
Showing
10 changed files
with
231 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Added raw parser choice to skip jpath extraction. | ||
Added initial hp_comware support for sync_devices job. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
sync_devices: | ||
hostname: | ||
commands: | ||
- command: "display current | include sysname" | ||
parser: "raw" | ||
jpath: "raw" | ||
post_processor: "{{ obj.lstrip().split(' ')[1] }}" | ||
serial: | ||
commands: | ||
- command: "display device manuinfo" | ||
parser: "textfsm" | ||
jpath: "[?slot_type==`Slot`].device_serial_number" | ||
device_type: | ||
commands: | ||
- command: "display device manuinfo" | ||
parser: "textfsm" | ||
jpath: "[?slot_type==`Slot`].device_name" | ||
mgmt_interface: | ||
commands: | ||
- command: "display ip interface" | ||
parser: "textfsm" | ||
jpath: "[*].{interface: interface, ip_addr: ip_address[0]}" | ||
post_processor: "{% for i in obj %}{% if i['ip_addr'] %}{% if original_host in i['ip_addr'] %}{{ i['interface'] }}{% endif %}{% endif %}{% endfor %}" | ||
mask_length: | ||
commands: | ||
- command: "display ip interface" | ||
parser: "textfsm" | ||
jpath: "[*].ip_address[?contains(@, `{{ obj }}`)][]" | ||
post_processor: "{{ obj[0].split('/')[1] }}" | ||
iterable_type: "int" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 7 additions & 5 deletions
12
nautobot_device_onboarding/tests/mock/cisco_wlc/sync_devices/expected_result_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{"device_type": "AIR-CT5520-K9", | ||
"hostname": "ABCWC-01", | ||
"mask_length": 28, | ||
"mgmt_interface": "management", | ||
"serial": "FCH2145V28L"} | ||
{ | ||
"device_type": "AIR-CT5520-K9", | ||
"hostname": "ABCWC-01", | ||
"mask_length": 28, | ||
"mgmt_interface": "management", | ||
"serial": "FCH2145V28L" | ||
} |
147 changes: 147 additions & 0 deletions
147
nautobot_device_onboarding/tests/mock/hp_comware/command_getter_result_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
{ | ||
"display current | include sysname": { | ||
"raw": " sysname 133-SW-Core" | ||
}, | ||
"display device manuinfo": [ | ||
{ | ||
"chassis_id": "", | ||
"slot_type": "Slot", | ||
"slot_id": "1", | ||
"device_name": "5510 24G 4SFP+ HI JH145A", | ||
"device_serial_number": "CN73H0Y0H9", | ||
"manufacturing_date": "2017-03-14", | ||
"vendor_name": "HPE", | ||
"mac_address": "40B9-3CA0-4B2D" | ||
}, | ||
{ | ||
"chassis_id": "", | ||
"slot_type": "Subslot", | ||
"slot_id": "1", | ||
"device_name": "HP 5130/5510 10GbE SFP+ 2p Module JH157A", | ||
"device_serial_number": "CN83H1B0DN", | ||
"manufacturing_date": "2018-04-06", | ||
"vendor_name": "HPE", | ||
"mac_address": "" | ||
}, | ||
{ | ||
"chassis_id": "", | ||
"slot_type": "Fan", | ||
"slot_id": "1", | ||
"device_name": "", | ||
"device_serial_number": "", | ||
"manufacturing_date": "", | ||
"vendor_name": "", | ||
"mac_address": "" | ||
}, | ||
{ | ||
"chassis_id": "", | ||
"slot_type": "Fan", | ||
"slot_id": "2", | ||
"device_name": "", | ||
"device_serial_number": "", | ||
"manufacturing_date": "", | ||
"vendor_name": "", | ||
"mac_address": "" | ||
}, | ||
{ | ||
"chassis_id": "", | ||
"slot_type": "Power", | ||
"slot_id": "1", | ||
"device_name": "HPE X361 150W AC Power Supply JD362B", | ||
"device_serial_number": "CN70JW52NY", | ||
"manufacturing_date": "2017-10-23", | ||
"vendor_name": "HPE", | ||
"mac_address": "" | ||
} | ||
], | ||
"display ip interface": [ | ||
{ | ||
"interface": "GigabitEthernet1/0/4", | ||
"line_status": "UP", | ||
"protocol_status": "UP", | ||
"route_map": "", | ||
"ip_address": [ | ||
"10.51.100.1/29" | ||
], | ||
"mtu": "1500" | ||
}, | ||
{ | ||
"interface": "M-GigabitEthernet0/0/0", | ||
"line_status": "DOWN", | ||
"protocol_status": "DOWN", | ||
"route_map": "", | ||
"ip_address": [], | ||
"mtu": "" | ||
}, | ||
{ | ||
"interface": "Vlan-interface16", | ||
"line_status": "UP", | ||
"protocol_status": "UP", | ||
"route_map": "", | ||
"ip_address": [ | ||
"10.133.16.1/22" | ||
], | ||
"mtu": "1500" | ||
}, | ||
{ | ||
"interface": "Vlan-interface20", | ||
"line_status": "UP", | ||
"protocol_status": "UP", | ||
"route_map": "", | ||
"ip_address": [ | ||
"10.133.20.1/23" | ||
], | ||
"mtu": "1500" | ||
}, | ||
{ | ||
"interface": "Vlan-interface32", | ||
"line_status": "UP", | ||
"protocol_status": "UP", | ||
"route_map": "", | ||
"ip_address": [ | ||
"10.133.32.1/24" | ||
], | ||
"mtu": "1500" | ||
}, | ||
{ | ||
"interface": "Vlan-interface64", | ||
"line_status": "UP", | ||
"protocol_status": "UP", | ||
"route_map": "", | ||
"ip_address": [ | ||
"10.133.64.1/23" | ||
], | ||
"mtu": "1500" | ||
}, | ||
{ | ||
"interface": "Vlan-interface68", | ||
"line_status": "UP", | ||
"protocol_status": "UP", | ||
"route_map": "", | ||
"ip_address": [ | ||
"10.133.68.1/23" | ||
], | ||
"mtu": "1500" | ||
}, | ||
{ | ||
"interface": "Vlan-interface100", | ||
"line_status": "UP", | ||
"protocol_status": "UP", | ||
"route_map": "", | ||
"ip_address": [ | ||
"198.51.100.1/24" | ||
], | ||
"mtu": "1500" | ||
}, | ||
{ | ||
"interface": "Vlan-interface102", | ||
"line_status": "UP", | ||
"protocol_status": "UP", | ||
"route_map": "", | ||
"ip_address": [ | ||
"10.133.102.1/24" | ||
], | ||
"mtu": "1500" | ||
} | ||
] | ||
} |
7 changes: 7 additions & 0 deletions
7
nautobot_device_onboarding/tests/mock/hp_comware/sync_devices/expected_result_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"device_type": "5510 24G 4SFP+ HI JH145A", | ||
"hostname": "133-SW-Core", | ||
"mask_length": 24, | ||
"mgmt_interface": "Vlan-interface100", | ||
"serial": "CN73H0Y0H9" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters