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

[action] [PR:16683] Fix l2/test_l2_configure.py for dualtor. #17352

Open
wants to merge 1 commit into
base: 202411
Choose a base branch
from

Conversation

mssonicbld
Copy link
Collaborator

Description of PR

Summary:
Fixes #394

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • New Test case
  • Skipped for non-supported platforms
  • Test case improvement

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405
  • 202411

Approach

What is the motivation for this PR?

l2/test_l2_configure.py fails on dualtor and leaves the testbed in bad state.

E tests.common.errors.RunAnsibleModuleFail: run module minigraph_facts failed, Ansible Results =>
E failed = True
E msg = Error reading file '/etc/sonic/minigraph.xml': failed to load external entity "/etc/sonic/minigraph.xml"
E Traceback (most recent call last):
E File "/tmp/ansible_minigraph_facts_payload_shhocew6/ansible_minigraph_facts_payload.zip/ansible/modules/minigraph_facts.py", line 924, in main
E File "/tmp/ansible_minigraph_facts_payload_shhocew6/ansible_minigraph_facts_payload.zip/ansible/modules/minigraph_facts.py", line 653, in parse_xml
E File "/tmp/ansible_minigraph_facts_payload_shhocew6/ansible_minigraph_facts_payload.zip/ansible/modules/minigraph_facts.py", line 608, in reconcile_mini_graph_locations
E File "src/lxml/etree.pyx", line 3538, in lxml.etree.parse
E File "src/lxml/parser.pxi", line 1876, in lxml.etree._parseDocument
E File "src/lxml/parser.pxi", line 1902, in lxml.etree._parseDocumentFromURL
E File "src/lxml/parser.pxi", line 1805, in lxml.etree._parseDocFromFile
E File "src/lxml/parser.pxi", line 1177, in lxml.etree._BaseParser._parseDocFromFile
E File "src/lxml/parser.pxi", line 615, in lxml.etree._ParserContext._handleParseResultDoc
E File "src/lxml/parser.pxi", line 725, in lxml.etree._handleParseResult
E File "src/lxml/parser.pxi", line 652, in lxml.etree._raiseParseError
E OSError: Error reading file '/etc/sonic/minigraph.xml': failed to load external entity "/etc/sonic/minigraph.xml"
E
E invocation = {'module_args': {'host': 'gd437', 'filename': None, 'namespace': None}}
E _ansible_no_log = None
E changed = False
E stdout =
E stderr =

The test removes minigraph but since the test doesn't take into account dualtor so it fails. The restoration of minigraph.xml is a part of test body (rather than in fixture teardown), hence the minigraph is never restored and the testbed goes into a bad state leading to every subsequent test failing.

How did you do it?

The proposed fix is to take into account the dualtor behaviour and take mux out of the list of critical services while the test loads the DUT with bare minimum L2 config. Also the part to restore minigraph.xml has been moved to a fixture teardown so that it's fate is not tied to the the test passing.

How did you verify/test it?

Tested on Arista-7260CX3 platform with dualtor-120 and dualtor-aa-56 topology.

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

What is the motivation for this PR?
l2/test_l2_configure.py fails on dualtor and leaves the testbed in bad state.

E           tests.common.errors.RunAnsibleModuleFail: run module minigraph_facts failed, Ansible Results =>
E           failed = True
E           msg = Error reading file '/etc/sonic/minigraph.xml': failed to load external entity "/etc/sonic/minigraph.xml"
E           Traceback (most recent call last):
E             File "/tmp/ansible_minigraph_facts_payload_shhocew6/ansible_minigraph_facts_payload.zip/ansible/modules/minigraph_facts.py", line 924, in main
E             File "/tmp/ansible_minigraph_facts_payload_shhocew6/ansible_minigraph_facts_payload.zip/ansible/modules/minigraph_facts.py", line 653, in parse_xml
E             File "/tmp/ansible_minigraph_facts_payload_shhocew6/ansible_minigraph_facts_payload.zip/ansible/modules/minigraph_facts.py", line 608, in reconcile_mini_graph_locations
E             File "src/lxml/etree.pyx", line 3538, in lxml.etree.parse
E             File "src/lxml/parser.pxi", line 1876, in lxml.etree._parseDocument
E             File "src/lxml/parser.pxi", line 1902, in lxml.etree._parseDocumentFromURL
E             File "src/lxml/parser.pxi", line 1805, in lxml.etree._parseDocFromFile
E             File "src/lxml/parser.pxi", line 1177, in lxml.etree._BaseParser._parseDocFromFile
E             File "src/lxml/parser.pxi", line 615, in lxml.etree._ParserContext._handleParseResultDoc
E             File "src/lxml/parser.pxi", line 725, in lxml.etree._handleParseResult
E             File "src/lxml/parser.pxi", line 652, in lxml.etree._raiseParseError
E           OSError: Error reading file '/etc/sonic/minigraph.xml': failed to load external entity "/etc/sonic/minigraph.xml"
E
E           invocation = {'module_args': {'host': 'gd437', 'filename': None, 'namespace': None}}
E           _ansible_no_log = None
E           changed = False
E           stdout =
E           stderr =
The test removes minigraph but since the test doesn't take into account dualtor so it fails. The restoration of minigraph.xml is a part of test body (rather than in fixture teardown), hence the minigraph is never restored and the testbed goes into a bad state leading to every subsequent test failing.

How did you do it?
The proposed fix is to take into account the dualtor behaviour and take mux out of the list of critical services while the test loads the DUT with bare minimum L2 config. Also the part to restore minigraph.xml has been moved to a fixture teardown so that it's fate is not tied to the the test passing.

How did you verify/test it?
Tested on Arista-7260CX3 platform with dualtor-120 and dualtor-aa-56 topology.
@mssonicbld
Copy link
Collaborator Author

/azp run

@mssonicbld
Copy link
Collaborator Author

Original PR: #16683

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants