Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Arris CER and Casa CMTS platforms. #2958

Merged
merged 2 commits into from
Sep 30, 2022

Conversation

vangesseld
Copy link
Contributor

@vangesseld vangesseld commented Sep 23, 2022

Greetings,

Looking to add support for Arris and Casa CMTS platforms. Please let me know if you have any feedback.

Test results (arris_cer):
`(venv) PS C:\Users\VangesselD\PycharmProjects\netmiko\tests> py.test -v test_netmiko_show.py --test_device arris_cer
========================================================================================================= test session starts =========================================================================================================
platform win32 -- Python 3.9.13, pytest-7.1.2, pluggy-1.0.0 -- C:\Users\VangesselD\PycharmProjects\netmiko\venv\Scripts\python.exe
cachedir: .pytest_cache
rootdir: C:\Users\VangesselD\PycharmProjects\netmiko, configfile: setup.cfg
plugins: pylama-8.3.8
collected 25 items

test_netmiko_show.py::test_failed_key SKIPPED (Not using SSH-keys) [ 4%]
test_netmiko_show.py::test_disable_paging PASSED [ 8%]
test_netmiko_show.py::test_terminal_width PASSED [ 12%]
test_netmiko_show.py::test_ssh_connect PASSED [ 16%]
test_netmiko_show.py::test_ssh_connect_cm PASSED [ 20%]
test_netmiko_show.py::test_send_command_timing PASSED [ 24%]
test_netmiko_show.py::test_send_command_timing_no_cmd_verify SKIPPED [ 28%]
test_netmiko_show.py::test_send_command PASSED [ 32%]
test_netmiko_show.py::test_send_command_no_cmd_verify SKIPPED [ 36%]
test_netmiko_show.py::test_complete_on_space_disabled SKIPPED [ 40%]
test_netmiko_show.py::test_send_command_textfsm SKIPPED (TextFSM/ntc-templates not supported on this platform) [ 44%]
test_netmiko_show.py::test_send_command_ttp SKIPPED (TTP template not existing for this platform) [ 48%]
test_netmiko_show.py::test_send_command_genie SKIPPED (Genie not supported on this platform) [ 52%]
test_netmiko_show.py::test_send_multiline_timing SKIPPED [ 56%]
test_netmiko_show.py::test_send_multiline SKIPPED [ 60%]
test_netmiko_show.py::test_send_multiline_prompt SKIPPED [ 64%]
test_netmiko_show.py::test_send_multiline_simple SKIPPED [ 68%]
test_netmiko_show.py::test_base_prompt PASSED [ 72%]
test_netmiko_show.py::test_strip_prompt PASSED [ 76%]
test_netmiko_show.py::test_strip_command PASSED [ 80%]
test_netmiko_show.py::test_normalize_linefeeds PASSED [ 84%]
test_netmiko_show.py::test_clear_buffer PASSED [ 88%]
test_netmiko_show.py::test_enable_mode PASSED [ 92%]
test_netmiko_show.py::test_disconnect PASSED [ 96%]
test_netmiko_show.py::test_disconnect_no_enable SKIPPED [100%]

======================================================================================================= short test summary info =======================================================================================================
SKIPPED [1] test_netmiko_show.py:88: Skipped
SKIPPED [1] test_netmiko_show.py:106: Skipped
SKIPPED [1] test_netmiko_show.py:128: Skipped
SKIPPED [1] test_netmiko_show.py:149: TextFSM/ntc-templates not supported on this platform
SKIPPED [1] test_netmiko_show.py:171: TTP template not existing for this platform
SKIPPED [1] test_netmiko_show.py:211: Genie not supported on this platform
SKIPPED [1] test_netmiko_show.py:231: Skipped
SKIPPED [1] test_netmiko_show.py:247: Skipped
SKIPPED [1] test_netmiko_show.py:272: Skipped
SKIPPED [1] test_netmiko_show.py:296: Skipped
SKIPPED [1] test_netmiko_show.py:401: Skipped
=================================================================================================== 13 passed, 12 skipped in 35.10s ===================================================================================================
(venv) PS C:\Users\VangesselD\PycharmProjects\netmiko\tests> py.test -v test_netmiko_config.py --test_device arris_cer
========================================================================================================= test session starts =========================================================================================================
platform win32 -- Python 3.9.13, pytest-7.1.2, pluggy-1.0.0 -- C:\Users\VangesselD\PycharmProjects\netmiko\venv\Scripts\python.exe
cachedir: .pytest_cache
rootdir: C:\Users\VangesselD\PycharmProjects\netmiko, configfile: setup.cfg
plugins: pylama-8.3.8
collected 13 items

test_netmiko_config.py::test_ssh_connect PASSED [ 7%]
test_netmiko_config.py::test_enable_mode PASSED [ 15%]
test_netmiko_config.py::test_config_mode PASSED [ 23%]
test_netmiko_config.py::test_exit_config_mode PASSED [ 30%]
test_netmiko_config.py::test_config_set PASSED [ 38%]
test_netmiko_config.py::test_config_set_generator PASSED [ 46%]
test_netmiko_config.py::test_config_set_longcommand PASSED [ 53%]
test_netmiko_config.py::test_config_from_file SKIPPED [ 69%]
test_netmiko_config.py::test_config_error_pattern SKIPPED (No error_pattern defined.) [ 76%]
test_netmiko_config.py::test_banner SKIPPED (No banner defined.) [ 84%]
test_netmiko_config.py::test_global_cmd_verify SKIPPED (No banner defined.) [ 92%]
test_netmiko_config.py::test_disconnect PASSED [100%]

======================================================================================================= short test summary info =======================================================================================================
SKIPPED [1] test_netmiko_config.py:163: Skipped
SKIPPED [1] test_netmiko_config.py:175: No error_pattern defined.
SKIPPED [1] test_netmiko_config.py:209: No banner defined.
SKIPPED [1] test_netmiko_config.py:242: No banner defined.
==================================================================================================== 9 passed, 4 skipped in 56.38s ==================================================================================================== `

Test results (casa_cmts):
`(venv) PS C:\Users\VangesselD\PycharmProjects\netmiko\tests> py.test -v test_netmiko_show.py --test_device casa_cmts
========================================================================================================= test session starts =========================================================================================================
platform win32 -- Python 3.9.13, pytest-7.1.2, pluggy-1.0.0 -- C:\Users\VangesselD\PycharmProjects\netmiko\venv\Scripts\python.exe
cachedir: .pytest_cache
rootdir: C:\Users\VangesselD\PycharmProjects\netmiko, configfile: setup.cfg
plugins: pylama-8.3.8
collected 25 items

test_netmiko_show.py::test_failed_key SKIPPED (Not using SSH-keys) [ 4%]
test_netmiko_show.py::test_disable_paging PASSED [ 8%]
test_netmiko_show.py::test_terminal_width PASSED [ 12%]
test_netmiko_show.py::test_ssh_connect PASSED [ 16%]
test_netmiko_show.py::test_ssh_connect_cm PASSED [ 20%]
test_netmiko_show.py::test_send_command_timing PASSED [ 24%]
test_netmiko_show.py::test_send_command_timing_no_cmd_verify SKIPPED [ 28%]
test_netmiko_show.py::test_send_command PASSED [ 32%]
test_netmiko_show.py::test_send_command_no_cmd_verify SKIPPED [ 36%]
test_netmiko_show.py::test_complete_on_space_disabled SKIPPED [ 40%]
test_netmiko_show.py::test_send_command_textfsm SKIPPED (TextFSM/ntc-templates not supported on this platform) [ 44%]
test_netmiko_show.py::test_send_command_ttp SKIPPED (TTP template not existing for this platform) [ 48%]
test_netmiko_show.py::test_send_command_genie SKIPPED (Genie not supported on this platform) [ 52%]
test_netmiko_show.py::test_send_multiline_timing SKIPPED [ 56%]
test_netmiko_show.py::test_send_multiline SKIPPED [ 60%]
test_netmiko_show.py::test_send_multiline_prompt SKIPPED [ 64%]
test_netmiko_show.py::test_send_multiline_simple SKIPPED [ 68%]
test_netmiko_show.py::test_base_prompt PASSED [ 72%]
test_netmiko_show.py::test_strip_prompt PASSED [ 76%]
test_netmiko_show.py::test_strip_command PASSED [ 80%]
test_netmiko_show.py::test_normalize_linefeeds PASSED [ 84%]
test_netmiko_show.py::test_clear_buffer PASSED [ 88%]
test_netmiko_show.py::test_enable_mode PASSED [ 92%]
test_netmiko_show.py::test_disconnect PASSED [ 96%]
test_netmiko_show.py::test_disconnect_no_enable SKIPPED [100%]

======================================================================================================= short test summary info =======================================================================================================
SKIPPED [1] test_netmiko_show.py:88: Skipped
SKIPPED [1] test_netmiko_show.py:106: Skipped
SKIPPED [1] test_netmiko_show.py:128: Skipped
SKIPPED [1] test_netmiko_show.py:149: TextFSM/ntc-templates not supported on this platform
SKIPPED [1] test_netmiko_show.py:171: TTP template not existing for this platform
SKIPPED [1] test_netmiko_show.py:211: Genie not supported on this platform
SKIPPED [1] test_netmiko_show.py:231: Skipped
SKIPPED [1] test_netmiko_show.py:247: Skipped
SKIPPED [1] test_netmiko_show.py:272: Skipped
SKIPPED [1] test_netmiko_show.py:296: Skipped
SKIPPED [1] test_netmiko_show.py:401: Skipped
=================================================================================================== 13 passed, 12 skipped in 46.15s ===================================================================================================
(venv) PS C:\Users\VangesselD\PycharmProjects\netmiko\tests> py.test -v test_netmiko_config.py --test_device casa_cmts
========================================================================================================= test session starts =========================================================================================================
platform win32 -- Python 3.9.13, pytest-7.1.2, pluggy-1.0.0 -- C:\Users\VangesselD\PycharmProjects\netmiko\venv\Scripts\python.exe
cachedir: .pytest_cache
rootdir: C:\Users\VangesselD\PycharmProjects\netmiko, configfile: setup.cfg
plugins: pylama-8.3.8
collected 13 items

test_netmiko_config.py::test_ssh_connect PASSED [ 7%]
test_netmiko_config.py::test_enable_mode PASSED [ 15%]
test_netmiko_config.py::test_config_mode PASSED [ 23%]
test_netmiko_config.py::test_exit_config_mode PASSED [ 30%]
test_netmiko_config.py::test_config_set PASSED [ 38%]
test_netmiko_config.py::test_config_set_generator PASSED [ 46%]
test_netmiko_config.py::test_config_set_longcommand PASSED [ 53%]
test_netmiko_config.py::test_config_hostname PASSED [ 61%]
test_netmiko_config.py::test_config_from_file SKIPPED [ 69%]
test_netmiko_config.py::test_config_error_pattern SKIPPED (No error_pattern defined.) [ 76%]
test_netmiko_config.py::test_banner SKIPPED (No banner defined.) [ 84%]
test_netmiko_config.py::test_global_cmd_verify SKIPPED (No banner defined.) [ 92%]
test_netmiko_config.py::test_disconnect PASSED [100%]

======================================================================================================= short test summary info =======================================================================================================
SKIPPED [1] test_netmiko_config.py:163: Skipped
SKIPPED [1] test_netmiko_config.py:175: No error_pattern defined.
SKIPPED [1] test_netmiko_config.py:209: No banner defined.
SKIPPED [1] test_netmiko_config.py:242: No banner defined.
==================================================================================================== 9 passed, 4 skipped in 59.90s ==================================================================================================== `

Thank you!

@ktbyers
Copy link
Owner

ktbyers commented Sep 23, 2022

Would you be able to add the show and config test output into the PR for each of the two platforms.

@ktbyers
Copy link
Owner

ktbyers commented Sep 23, 2022

Testing process is here:

https://github.com/ktbyers/netmiko/blob/develop/TESTING.md

@vangesseld
Copy link
Contributor Author

Hi @ktbyers,

I discovered and corrected an issue with exiting config mode on the Casa platform, but that is now corrected and all tests are passing. I updated the PR with the test outputs. Please let me know if you have any further feedback.

Thank you!

@ktbyers
Copy link
Owner

ktbyers commented Sep 30, 2022

I am going to go ahead and merge this.

The only thing I didn't like which I might change is the SSH autodetect. It looks overly broad i.e. that we could get false positives.

    "arris_cer": {
        "cmd": "show version",
        "search_patterns": [r"CER"],
        "priority": 99,
        "dispatch": "_autodetect_std",
    },
    "casa_cmts": {
        "cmd": "show version",
        "search_patterns": [r"Casa"],
        "priority": 99,
        "dispatch": "_autodetect_std",
    },

Can we qualify these a bit more (in the case of CER add something that references Arris to the string and in the case of Casa add something to make it CMTS specific?

@ktbyers ktbyers merged commit 1685b3d into ktbyers:develop Sep 30, 2022
ktbyers pushed a commit that referenced this pull request May 5, 2023
* Added support for Arris CER and Casa CMTS platforms.

* Corrected issue with reliably exiting config mode on Casa.

Co-authored-by: Chuck van Gessel <douglas.vangessel@sparklight.biz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants