napalm-automation-community / napalm-asa

napalm-asa
Apache License 2.0
17 stars 13 forks source link

Improve get interfaces #22

Closed DiogoAndre closed 6 years ago

DiogoAndre commented 6 years ago

This adds support to the additional interface types: Redundant, VLAN and Port-channel

DiogoAndre commented 6 years ago

Tests are failing because of the length of the filename used to mock one of the API calls. Over the weekend I wondered over a possible solution. I wanted something that did not change things significantly and especially that did not need 'hardcoding' values in the tests code. Well, the only thing I could think of is using an external file (like the ones we are using for multiple context and interface support) to map API calls to files.

Something like this:

# The key in the Dict would be the name computed by the test code
# and the value the actual file name with the mock API call results.

API_CALL_MOCK_FILES_MAPPING = {
 '_cli_show_interface_GigabitEthernet0_0_show_interface_Management0_0_show_interface_GigabitEthernet0_1_show_interface_Management0_0.2_show_interface_redundant1_show_interface_port-channel1_show_interface_Port-channel2' : 'cli_get_interfaces_multiple.json',
'_cli_show_running-config': '_cli_show_running-config.json'
}

Any thoughts on this @enzzzy ?