-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add verification IPv4 address on LLDP conf Jinja2 Template #5699
Conversation
Signed-off-by: Petro Bratash <[email protected]>
@akokhan, please review |
@shlomibitton can you please review as well? |
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.
Thank you for the contrinbution
Can you please
- Describe more what is the problem is? The way to reproduce the issue and so on. Currently it is not clear from the PR description
- Add tests for your change,
|
can you add test in sonic-cfggen to validate the template results. |
LGTM |
Signed-off-by: Petro Bratash <[email protected]>
@lguohan @pavel-shirshov I think this commit will fix the test(change the order of the interfaces): ad2001f Could you say, how to run this tests? |
Hi @bratashX I'd suggest you revert the last commit. It breaks other tests. Usually we have ipv6 as second address on the interface in the minigraph. How to run the tests:
|
This reverts commit ad2001f.
dockers/docker-lldp/lldpd.conf.j2
Outdated
{% if MGMT_INTERFACE %} | ||
{% for interface in MGMT_INTERFACE.keys()|list %} | ||
{% if interface[1]|ipv4 %} |
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.
ipv4 [](start = 19, length = 4)
Could you add a test case similar to https://github.com/Azure/sonic-buildimage/blob/781188f54941a2eb9e4a23a96f05986ec51ff106/src/sonic-config-engine/tests/test_j2files.py#L69? So it will capture regression like this.
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.
The test was added, please review
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.
Thanks for adding test! I think another useful test case is 1 ipv4 + 1 ipv6 mgmt addresses, which are common to in normal use case.
In reply to: 515413789 [](ancestors = 515413789)
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 think the test must verify 2 cases:
- IPv4 mgmt interface exists
- IPv4 mgmt interface doesn't exist
But now I add 3 cases, when:
- IPv4 mgmt interface only exists
- IPv6 mgmt interface only exists
- IPv4 + IPv6 mgmt interface exists
Please review
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.
As comment
@pavel-shirshov Previously I have never been run SONiC test. Could you please say what environment needs use before test running? Maybe is some docker for testing or some README file? |
retest vsimage please |
Signed-off-by: Petro Bratash <[email protected]>
Signed-off-by: Petro Bratash <[email protected]>
052b382
to
0e81cc3
Compare
Unblock, the test could be further improved.
@bratashX
Also you need to install sonic-py-common and swsssdk for that
|
Signed-off-by: Petro Bratash <[email protected]>
Signed-off-by: Petro Bratash <[email protected]>
retest mellanox please |
retest vsimage please |
…5699) Fix #5812 LLDP conf Jinja2 Template does not verify IPv4 address and can use IPv6 version. This issue does not effect control LLDP daemon. Issue can be reproduced via `test_snmp_lldp` test. LLDP conf Jinja2 Template selects first item from the list of mgmt interfaces. TESTBED_1 LLDP conf ``` configure ports eth0 lldp portidsubtype local eth0 configure system ip management pattern FC00:3::32 configure system hostname dut-1 ``` TESTBED_2 LLDP conf ``` configure ports eth0 lldp portidsubtype local eth0 configure system ip management pattern 10.22.24.61 configure system hostname dut-2 ``` TESTBED_1 MGMT_INTERFACE ``` $ redis-cli -n 4 keys "*" | grep MGMT_INTERFACE MGMT_INTERFACE|eth0|10.22.24.53/23 MGMT_INTERFACE|eth0|FC00:3::32/64 ``` TESTBED_2 MGMT_INTERFACE ``` $ redis-cli -n 4 keys "*" | grep MGMT_INTERFACE MGMT_INTERFACE|eth0|FC00:3::32/64 MGMT_INTERFACE|eth0|10.22.24.61/23 ``` Signed-off-by: Petro Bratash <[email protected]>
…onic-net#5699) Fix sonic-net#5812 LLDP conf Jinja2 Template does not verify IPv4 address and can use IPv6 version. This issue does not effect control LLDP daemon. Issue can be reproduced via `test_snmp_lldp` test. LLDP conf Jinja2 Template selects first item from the list of mgmt interfaces. TESTBED_1 LLDP conf ``` # cat /etc/lldpd.conf configure ports eth0 lldp portidsubtype local eth0 configure system ip management pattern FC00:3::32 configure system hostname dut-1 ``` TESTBED_2 LLDP conf ``` # cat /etc/lldpd.conf configure ports eth0 lldp portidsubtype local eth0 configure system ip management pattern 10.22.24.61 configure system hostname dut-2 ``` TESTBED_1 MGMT_INTERFACE ``` $ redis-cli -n 4 keys "*" | grep MGMT_INTERFACE MGMT_INTERFACE|eth0|10.22.24.53/23 MGMT_INTERFACE|eth0|FC00:3::32/64 ``` TESTBED_2 MGMT_INTERFACE ``` $ redis-cli -n 4 keys "*" | grep MGMT_INTERFACE MGMT_INTERFACE|eth0|FC00:3::32/64 MGMT_INTERFACE|eth0|10.22.24.61/23 ``` Signed-off-by: Petro Bratash <[email protected]>
Signed-off-by: Petro Bratash [email protected]
- Why I did it
LLDP conf Jinja2 Template does not verify IPv4 address and can use IPv6 version. This issue does not effect control LLDP daemon. Issue can be reproduced via
test_snmp_lldp
test. LLDP conf Jinja2 Template selects first item from the list of mgmt interfaces.TESTBED_1 LLDP conf
TESTBED_2 LLDP conf
TESTBED_1 MGMT_INTERFACE
TESTBED_2 MGMT_INTERFACE
- How I did it
Skip IP address if it includes ":" characters
- How to verify it
docker exec lldp cat /etc/lldpd.conf
- Which release branch to backport (provide reason below if selected)
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)