sonic-mgmt icon indicating copy to clipboard operation
sonic-mgmt copied to clipboard

Add loopback action test cases

Open nhe-NV opened this issue 2 years ago • 29 comments

Description of PR

Summary: Add test cases for loopback action Fixes # (issue)

Type of change

  • [ ] Bug fix
  • [ ] Testbed and Framework(new/improvement)
  • [x] Test case(new/improvement)

Back port request

  • [ ] 201911
  • [ ] 202012

Approach

What is the motivation for this PR?

Add new test cases for loopback action

How did you do it?

Add 3 testcases for the loopback action feature: test_loopback_action_basic test_loopback_action_port_flap test_loopback_action_reload

How did you verify/test it?

Run all the new test cases, and tests pass

Any platform specific information?

No

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

any

Documentation

https://github.com/sonic-net/SONiC/blob/master/doc/ip-interface/loopback-action/rif_loopback_action_testplan.md https://github.com/sonic-net/SONiC/blob/master/doc/ip-interface/loopback-action/ip-interface-loopback-action-design.md

nhe-NV avatar Jun 24 '22 14:06 nhe-NV

This pull request introduces 1 alert when merging 0cd7e83b19ebafea906e0219022403e58733cf5e into 23c0aeea82dd9c31014b13b7d0993c805ce94731 - view on LGTM.com

new alerts:

  • 1 for Unused import

lgtm-com[bot] avatar Jul 02 '22 09:07 lgtm-com[bot]

This pull request introduces 1 alert when merging cf7f747d4353f348e460436f2c8871e42f6cc2b6 into 6da07f8477cb8b7b27db3ea027273f85ea9da2c6 - view on LGTM.com

new alerts:

  • 1 for Unused import

lgtm-com[bot] avatar Jul 04 '22 02:07 lgtm-com[bot]

@nhe-NV could you please handle LGTM new alerts and build failures?

liat-grozovik avatar Jul 07 '22 06:07 liat-grozovik

This pull request introduces 1 alert when merging b5ebcf29c911ee533218102d45b9bd0b45fb812d into ee04112b43da01fbc5c5bc352cdacf76bd030b61 - view on LGTM.com

new alerts:

  • 1 for Unused import

lgtm-com[bot] avatar Jul 09 '22 15:07 lgtm-com[bot]

This pull request introduces 1 alert when merging 192c2e93744e596409747f94365e89d5f31a8d0e into 7ae74e4a857e141fd3b5d14b9f53b65e8800b170 - view on LGTM.com

new alerts:

  • 1 for Unused import

lgtm-com[bot] avatar Jul 14 '22 02:07 lgtm-com[bot]

This pull request introduces 1 alert when merging 192c2e9 into 7ae74e4 - view on LGTM.com

new alerts:

  • 1 for Unused import

Hi, I have added "# lgtm[py/unused-import]" for the fixture which is used in the conftest.py, but is detected as "Unused import" , but it still pop up this alerts.

nhe-NV avatar Jul 18 '22 01:07 nhe-NV

This pull request introduces 1 alert when merging a1246958b307a0237a9263f99243b4982663203c into b1866a1ba00b2b338356e5999c09c549cb7c64a3 - view on LGTM.com

new alerts:

  • 1 for Unused import

lgtm-com[bot] avatar Jul 21 '22 04:07 lgtm-com[bot]

@roysr-nv could you please help to review following the changes requested?

liat-grozovik avatar Aug 08 '22 12:08 liat-grozovik

/azp run Azure.sonic-mgmt

liat-grozovik avatar Aug 10 '22 16:08 liat-grozovik

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Aug 10 '22 16:08 azure-pipelines[bot]

/easycla

liat-grozovik avatar Aug 10 '22 16:08 liat-grozovik

@roysr-nv please review

liat-grozovik avatar Aug 10 '22 16:08 liat-grozovik

This pull request introduces 1 alert when merging 006b8d6339f3cadd8f1b8cfc5e96b0e7697e1497 into 1d50696888c2c88a4c6367c55250aea013709a79 - view on LGTM.com

new alerts:

  • 1 for Unused import

lgtm-com[bot] avatar Aug 22 '22 05:08 lgtm-com[bot]

This pull request introduces 1 alert when merging e5230654406aec7d55606c8b41838491feb6267c into 976bb1584b53b826dbe37944eab2367bace1758c - view on LGTM.com

new alerts:

  • 1 for Unused import

lgtm-com[bot] avatar Aug 31 '22 14:08 lgtm-com[bot]

This pull request introduces 1 alert when merging a505ea320d7e0db39208bd23e57004f63a41f7fc into b762d3094fd5900536a9f89201e269e67a3490e5 - view on LGTM.com

new alerts:

  • 1 for Unused import

lgtm-com[bot] avatar Sep 07 '22 12:09 lgtm-com[bot]

/azp run

liat-grozovik avatar Sep 20 '22 07:09 liat-grozovik

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Sep 20 '22 07:09 azure-pipelines[bot]

/azpw run

nhe-NV avatar Oct 09 '22 03:10 nhe-NV

/AzurePipelines run

mssonicbld avatar Oct 09 '22 03:10 mssonicbld

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Oct 09 '22 03:10 azure-pipelines[bot]

/azpw run

nhe-NV avatar Oct 12 '22 06:10 nhe-NV

/AzurePipelines run

mssonicbld avatar Oct 12 '22 06:10 mssonicbld

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Oct 12 '22 06:10 azure-pipelines[bot]

The pre-commit check detected issues in the files touched by this pull request. The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

Detailed pre-commit check results: trim trailing whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing tests/common/devices/sonic.py

fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
autopep8.................................................................Failed
- hook id: autopep8
- files were modified by this hook
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/common/devices/sonic.py:219:121: E501 line too long (133 > 120 characters)
tests/common/devices/sonic.py:223:121: E501 line too long (132 > 120 characters)
tests/common/devices/sonic.py:247:9: E722 do not use bare 'except'
tests/common/devices/sonic.py:256:121: E501 line too long (129 > 120 characters)
tests/common/devices/sonic.py:385:54: W605 invalid escape sequence '{'
tests/common/devices/sonic.py:385:56: W605 invalid escape sequence '{'
tests/common/devices/sonic.py:385:72: W605 invalid escape sequence '}'
tests/common/devices/sonic.py:385:74: W605 invalid escape sequence '}'
tests/common/devices/sonic.py:390:9: E722 do not use bare 'except'
tests/common/devices/sonic.py:423:80: W605 invalid escape sequence '{'
tests/common/devices/sonic.py:423:82: W605 invalid escape sequence '{'
tests/common/devices/sonic.py:423:90: W605 invalid escape sequence '}'
tests/common/devices/sonic.py:423:92: W605 invalid escape sequence '}'
tests/common/devices/sonic.py:582:27: E712 comparison to False should be 'if cond is False:' or 'if not cond:'
tests/common/devices/sonic.py:588:22: E712 comparison to False should be 'if cond is False:' or 'if not cond:'
tests/common/devices/sonic.py:596:13: E741 ambiguous variable name 'l'
tests/common/devices/sonic.py:597:47: W605 invalid escape sequence 's'
tests/common/devices/sonic.py:649:46: W605 invalid escape sequence 's'
tests/common/devices/sonic.py:698:121: E501 line too long (157 > 120 characters)
tests/common/devices/sonic.py:703:121: E501 line too long (131 > 120 characters)
tests/common/devices/sonic.py:729:121: E501 line too long (145 > 120 characters)
tests/common/devices/sonic.py:843:9: E722 do not use bare 'except'
tests/common/devices/sonic.py:1028:121: E501 line too long (144 > 120 characters)
tests/common/devices/sonic.py:1040:121: E501 line too long (253 > 120 characters)
tests/common/devices/sonic.py:1063:121: E501 line too long (251 > 120 characters)
tests/common/devices/sonic.py:1079:121: E501 line too long (253 > 120 characters)
tests/common/devices/sonic.py:1096:121: E501 line too long (251 > 120 characters)
tests/common/devices/sonic.py:1131:58: F821 undefined name 'unicode'
tests/common/devices/sonic.py:1133:58: F821 undefined name 'unicode'
tests/common/devices/sonic.py:1135:58: F821 undefined name 'unicode'
tests/common/devices/sonic.py:1138:17: E741 ambiguous variable name 'l'
tests/common/devices/sonic.py:1141:69: F821 undefined name 'unicode'
tests/common/devices/sonic.py:1141:91: F821 undefined name 'unicode'
tests/common/devices/sonic.py:1150:29: W605 invalid escape sequence 's'
tests/common/devices/sonic.py:1150:35: W605 invalid escape sequence 's'
tests/common/devices/sonic.py:1150:39: W605 invalid escape sequence 'S'
tests/common/devices/sonic.py:1150:43: W605 invalid escape sequence 's'
tests/common/devices/sonic.py:1150:51: W605 invalid escape sequence 's'
tests/common/devices/sonic.py:1150:55: W605 invalid escape sequence 'S'
tests/common/devices/sonic.py:1150:59: W605 invalid escape sequence 's'
tests/common/devices/sonic.py:1150:67: W605 invalid escape sequence 's'
tests/common/devices/sonic.py:1150:71: W605 invalid escape sequence 'S'
tests/common/devices/sonic.py:1150:75: W605 invalid escape sequence 's'
tests/common/devices/sonic.py:1281:121: E501 line too long (121 > 120 characters)
tests/common/devices/sonic.py:1407:121: E501 line too long (135 > 120 characters)
tests/common/devices/sonic.py:1408:121: E501 line too long (135 > 120 characters)
tests/common/devices/sonic.py:1409:121: E501 line too long (135 > 120 characters)
tests/common/devices/sonic.py:1410:121: E501 line too long (135 > 120 characters)
tests/common/devices/sonic.py:1411:121: E501 line too long (135 > 120 characters)
tests/common/devices/sonic.py:1433:121: E501 line too long (972 > 120 characters)
tests/common/devices/sonic.py:1821:67: W605 invalid escape sequence '*'
tests/common/devices/sonic.py:1983:25: E127 continuation line over-indented for visual indent
tests/common/devices/sonic.py:1984:21: E124 closing bracket does not match visual indentation
tests/iface_loopback_action/conftest.py:4:121: E501 line too long (151 > 120 characters)
tests/iface_loopback_action/conftest.py:6:1: F401 'tests.common.fixtures.duthost_utils.backup_and_restore_config_db_package' imported but unused
tests/iface_loopback_action/conftest.py:183:76: F811 redefinition of unused 'backup_and_restore_config_db_package' from line 6
tests/iface_loopback_action/iface_loopback_action_helper.py:23:121: E501 line too long (123 > 120 characters)
tests/common/fixtures/duthost_utils.py:203:121: E501 line too long (138 > 120 characters)
tests/common/fixtures/duthost_utils.py:205:121: E501 line too long (138 > 120 characters)
tests/common/fixtures/duthost_utils.py:242:121: E501 line too long (181 > 120 characters)
tests/common/fixtures/duthost_utils.py:378:14: F821 undefined name 'xrange'
tests/common/fixtures/duthost_utils.py:409:22: E712 comparison to True should be 'if cond is True:' or 'if cond:'
tests/common/fixtures/duthost_utils.py:430:60: E712 comparison to True should be 'if cond is True:' or 'if cond:'

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

azure-pipelines[bot] avatar Oct 12 '22 06:10 azure-pipelines[bot]

The pre-commit check detected issues in the files touched by this pull request. The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

Detailed pre-commit check results: $(results)

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt docker container.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

azure-pipelines[bot] avatar Oct 14 '22 05:10 azure-pipelines[bot]

This pull request fixes 3 alerts when merging 00ae02e369df2d64061b23084dd194808a24893c into 5bf8ec8af23901118ea01a318d484b0d3921fd50 - view on LGTM.com

fixed alerts:

  • 3 for Except block handles 'BaseException'

lgtm-com[bot] avatar Oct 14 '22 06:10 lgtm-com[bot]

The pre-commit check detected issues in the files touched by this pull request. The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

Detailed pre-commit check results: trim trailing whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing tests/common/devices/sonic.py

fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/common/devices/sonic.py:251:9: E722 do not use bare 'except'
tests/common/devices/sonic.py:389:54: W605 invalid escape sequence '{'
tests/common/devices/sonic.py:389:56: W605 invalid escape sequence '{'
tests/common/devices/sonic.py:389:72: W605 invalid escape sequence '}'
tests/common/devices/sonic.py:389:74: W605 invalid escape sequence '}'
...
[truncated extra lines, please run pre-commit locally to view full check results]

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt docker container.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

azure-pipelines[bot] avatar Oct 28 '22 10:10 azure-pipelines[bot]

The pre-commit check detected issues in the files touched by this pull request. The detected issues may be old or new. For new issues, please try to fix them.

For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!

Detailed pre-commit check results: trim trailing whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing tests/common/devices/sonic.py

fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/common/devices/sonic.py:251:9: E722 do not use bare 'except'
tests/common/devices/sonic.py:389:54: W605 invalid escape sequence '{'
tests/common/devices/sonic.py:389:56: W605 invalid escape sequence '{'
tests/common/devices/sonic.py:389:72: W605 invalid escape sequence '}'
tests/common/devices/sonic.py:389:74: W605 invalid escape sequence '}'
...
[truncated extra lines, please run pre-commit locally to view full check results]

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt docker container.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

azure-pipelines[bot] avatar Nov 08 '22 01:11 azure-pipelines[bot]

waiting for build success. @wangxin @roysr-nv @liorghub can you please approve this PR if the review is ok? We need merge this PR to get the feature into 202211 release. Thanks.

zhangyanzhao avatar Nov 11 '22 19:11 zhangyanzhao