-
Notifications
You must be signed in to change notification settings - Fork 745
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Change TextFSM Windows failure to a runtime failure (instead of an import failure) #803
Conversation
Testing on Linux with ntc-templates installed, but no TextFSM installed:
|
Follow-up action: PyEZ library needs to eliminate the following (once ntc-templates releases this fix to pypi) In setup.py: https://github.com/Juniper/py-junos-eznc/blob/master/setup.py#L11-L15
|
Also the Juniper import no longer fails (on import):
|
templates/index
Outdated
@@ -146,7 +146,7 @@ cisco_asa_show_version.textfsm, .*, cisco_asa, sh[[ow]] ver[[sion]] | |||
cisco_asa_show_route.textfsm, .*, cisco_asa, sh[[ow]] ro[[ute]] | |||
cisco_asa_show_xlate.textfsm, .*, cisco_asa, sh[[ow]] x[[late]] | |||
cisco_asa_show_name.textfsm, .*, cisco_asa, sh[[ow]] nam[[e]] | |||
cisco_asa_show_arp.textfsm, .*, cisco_(asa|ftd), sh[[ow]] arp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just ran tox on master and it passed the tests, as well as the last build on here shows as passing. Removing this will cause it to not work for FTD devices. The test case is currently covered in ASA, as we do not require testing both platforms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries at all...will restore the index to its original state
FYI, here is the test failure for FTD (using py.test -vv
)
tests/test_testcases_exists.py::test_verify_parsed_and_reference_data_exists[tests/vyatta_vyos/show_interfaces] PASSED [ 99%]
tests/test_testcases_exists.py::test_verify_parsed_and_reference_data_exists[tests/watchguard_firebox/show_arp] PASSED [100%]
============================================ FAILURES =============================================
_____________ test_verify_parsed_and_reference_data_exists[tests/cisco_ftd/show_arp] ______________
mock_directory = 'tests/cisco_ftd/show_arp'
@pytest.mark.parametrize("mock_directory", extract_index_data())
def test_verify_parsed_and_reference_data_exists(mock_directory):
"""Verify that at least one test exists for all entries in the index file."""
cases = f"{mock_directory}/*.raw"
test_list = glob.glob(cases)
> assert len(test_list) != 0, f"Could not find tests for {mock_directory}.textfsm"
E AssertionError: Could not find tests for tests/cisco_ftd/show_arp.textfsm
E assert 0 != 0
E + where 0 = len([])
tests/test_testcases_exists.py:41: AssertionError
================================= 1 failed, 972 passed in 23.26s ==================================
Also adding @vnitinv here. FYI, @vnitinv we are a battling each other a bit on these changes. In other words, PyEZ is breaking NAPALM and Nornir on Windows which is causing me to frequently pin to downrev PyEZ. You are now pinning to both downrev ntc-templates and downrev textfsm 0.4.1 in PyEZ. I am hoping we can come up with an interim solution where we can cease the pinning to down rev versions of each others libraries (until TextFSM fixes the underlying issue with this PR here google/textfsm#82) Note TextFSM 0.4.1 is fundamentally broken as it not packaged correctly (which causes a lot of negative side-effects). And the terminal.py library has not had a release since 2013 (and it really only works because it overwrites the namespace of TextFSM 0.4.1 due to it not being a package). Consequently, I don't view using TextFSM 0.4.1 + terminal.py as a recommended solution to this problem. This fix proposed here would mean TextFSM on Windows would only break if you actually use TextFSM on Windows (via PyEZ). It would also lead the end-user to the fix that they need. TextFSM would cease to fail when it was imported. Netmiko/NAPALM/Nornir all have a separate fix where TextFSM on Windows works properly for them. Basically, I vendored part of TextFSM (in Netmiko) a few years back because of this issue. Let me know if that is a reasonable fix from your perspective or not. Regards, Kirk |
Sure @ktbyer. Can you point me to the fix in nornir/napalm. we can follow the same approach. @rahkumar651991, we might need to work on this. |
@vnitinv I basically versioned part of TextFSM library here such that when https://github.com/ktbyers/netmiko/tree/develop/netmiko/_textfsm I will actually remove this if/when Google accepts that referenced PR (and pushes a new release to pypi). And this in my Netmiko version of clitable.py https://github.com/ktbyers/netmiko/blob/develop/netmiko/_textfsm/_clitable.py#L35 try:
# TextFSM >= 1.0 (new package structure)
from textfsm import copyable_regex_object
except ImportError:
# TextFSM <= 0.4.1
import copyable_regex_object
import textfsm
from netmiko._textfsm import _texttable as texttable Note, the |
@ktbyers are we good to merge this here? |
Yes, should be good to go. |
Also I was getting an unrelated test failure related to there being no tests for
show arp
on the cisco_ftd.It looks like these tests were never included with the original PR (and I don't have an FTD) so I just removed the
cisco_ftd
from theshow arp
in the index .It basically was saying
cisco_ftd
is the same ascisco_asa
forshow arp
, but then provided no data in the original PR. The other option is to just copy thecisco_asa
show arp tests over for the FTD (unless someone can get the FTD test data).Just let me know if you want me to switch over to that (copying the
show arp
ASA data) or I can just straight remove thatindex
change. Not sure why tests are working on CI-CD system, but failed for me locally due to the FTD issue.