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

Tests for bgpcfgd templates #4841

Merged
merged 8 commits into from
Jun 25, 2020

Conversation

pavel-shirshov
Copy link
Contributor

@pavel-shirshov pavel-shirshov commented Jun 24, 2020

- Why I did it

  1. Implemented tests for bgpd templates. Tests are checking for correct rendering of the templates and also they check that every ipv6 neighbor has 'set ipv6 prefer-global' configuration
  2. Extract modules from bgpcfgd. This was done to write the test, but this work is not completed. I'm going to complete this work in the next PR.

- How I did it
I used pytest framework to write the tests.

- How to verify it

$ cd src/sonic-bgpcfgd
$ python setup.py test

It should give you following output:

running pytest
running egg_info
writing requirements to sonic_bgpcfgd.egg-info/requires.txt
writing sonic_bgpcfgd.egg-info/PKG-INFO
writing top-level names to sonic_bgpcfgd.egg-info/top_level.txt
writing dependency_links to sonic_bgpcfgd.egg-info/dependency_links.txt
reading manifest file 'sonic_bgpcfgd.egg-info/SOURCES.txt'
writing manifest file 'sonic_bgpcfgd.egg-info/SOURCES.txt'
running build_ext
============================= test session starts ==============================
platform linux2 -- Python 2.7.12, pytest-4.6.9, py-1.8.1, pluggy-0.13.1 -- /usr/bin/python
cachedir: .pytest_cache
rootdir: /home/ps/work/sonic-buildimage/src/sonic-bgpcfgd, inifile: setup.cfg
plugins: flaky-3.6.1
collecting ... collected 10 items

tests/test_ipv6_nexthop_global.py::test_v6_next_hop_global PASSED        [ 10%]
tests/test_templates.py::test_general_policies PASSED                    [ 20%]
tests/test_templates.py::test_general_pg PASSED                          [ 30%]
tests/test_templates.py::test_general_instance PASSED                    [ 40%]
tests/test_templates.py::test_dynamic_policies PASSED                    [ 50%]
tests/test_templates.py::test_dynamic_pg PASSED                          [ 60%]
tests/test_templates.py::test_dynamic_instance PASSED                    [ 70%]
tests/test_templates.py::test_monitors_policies PASSED                   [ 80%]
tests/test_templates.py::test_monitors_pg PASSED                         [ 90%]
tests/test_templates.py::test_monitors_instance PASSED                   [100%]

========================== 10 passed in 0.27 seconds ===========================

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@pavel-shirshov pavel-shirshov self-assigned this Jun 24, 2020
@lgtm-com
Copy link

lgtm-com bot commented Jun 24, 2020

This pull request fixes 1 alert when merging ba6d16e into 563a0fd - view on LGTM.com

fixed alerts:

  • 1 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Jun 24, 2020

This pull request fixes 3 alerts when merging 699ce90 into 5cacc20 - view on LGTM.com

fixed alerts:

  • 2 for Unreachable code
  • 1 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Jun 24, 2020

This pull request fixes 3 alerts when merging 2013ab0 into 63d2efb - view on LGTM.com

fixed alerts:

  • 2 for Unreachable code
  • 1 for Unused import

return str(getattr(prefix, attr))

@staticmethod
def pfx_filter(value):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be fixed to add /32 if it is ip address?

@pavel-shirshov pavel-shirshov merged commit d592e9b into sonic-net:master Jun 25, 2020
@pavel-shirshov pavel-shirshov deleted the pavelsh/bgpcfgd_tests branch June 25, 2020 21:54
abdosi pushed a commit that referenced this pull request Jul 5, 2020
* Tests for bgpcfgd templates
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.

3 participants