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

[dhcp_relay] Add show/clear/counter cli for dhcp_relay #2719

Merged
merged 4 commits into from
Mar 9, 2023

Conversation

yaqiangz
Copy link
Contributor

@yaqiangz yaqiangz commented Mar 7, 2023

What I did

Add support for dhcp_relay show cli, consistent with sonic-net/sonic-buildimage#13614

How I did it

Add support for dhcp_relay show cli

How to verify it

  1. UT
============================= test session starts ==============================
platform linux -- Python 3.7.3, pytest-3.10.1, py-1.7.0, pluggy-0.8.0
rootdir: /__w/1/s, inifile: pytest.ini
plugins: pyfakefs-5.1.0, cov-2.6.0
collected 975 items

tests/config_dhcp_relay_test.py ....................                     [ 10%]
tests/show_dhcp_relay_test.py .....                                      [ 82%]

----------- coverage: platform linux, python 3.7.3-final-0 -----------
Name                                          Stmts   Miss  Cover
-----------------------------------------------------------------
config/dhcp_relay.py                            102      8    92%
show/dhcp_relay.py                              121     24    80%
utilities_common/dhcp_relay_util.py              13      3    77%
-----------------------------------------------------------------
TOTAL                                         23489   9757    58%
Coverage HTML written to dir htmlcov
Coverage XML written to file coverage.xml

  1. build wheel and install in device
admin@testbed:~$ show dhcp_relay ipv4 helper
+-------------+----------------------+
|   Interface |   DHCP Relay Address |
+=============+======================+
|    Vlan1000 |            192.0.0.1 |
|             |            192.0.0.2 |
|             |            192.0.0.3 |
|             |            192.0.0.4 |
|             |            192.0.0.5 |
|             |            192.0.0.6 |
|             |            192.0.0.7 |
|             |            192.0.0.8 |
|             |            192.0.0.9 |
|             |           192.0.0.10 |
|             |           192.0.0.11 |
|             |           192.0.0.12 |
|             |           192.0.0.13 |
|             |           192.0.0.14 |
|             |           192.0.0.15 |
|             |           192.0.0.16 |
|             |           192.0.0.17 |
|             |           192.0.0.18 |
|             |           192.0.0.19 |
|             |           192.0.0.20 |
|             |           192.0.0.21 |
|             |           192.0.0.22 |
|             |           192.0.0.23 |
|             |           192.0.0.24 |
|             |           192.0.0.25 |
|             |           192.0.0.26 |
|             |           192.0.0.27 |
|             |           192.0.0.28 |
|             |           192.0.0.29 |
|             |           192.0.0.30 |
|             |           192.0.0.31 |
|             |           192.0.0.32 |
|             |           192.0.0.33 |
|             |           192.0.0.34 |
|             |           192.0.0.35 |
|             |           192.0.0.36 |
|             |           192.0.0.37 |
|             |           192.0.0.38 |
|             |           192.0.0.39 |
|             |           192.0.0.40 |
|             |           192.0.0.41 |
|             |           192.0.0.42 |
|             |           192.0.0.43 |
|             |           192.0.0.44 |
|             |           192.0.0.45 |
|             |           192.0.0.46 |
|             |           192.0.0.47 |
|             |           192.0.0.48 |
+-------------+----------------------+

admin@testbed:~$ show dhcp_relay ipv6 destination
+-------------+----------------------+
|   Interface |   DHCP Relay Address |
+=============+======================+
|    Vlan1000 |         fc02:2000::1 |
|             |         fc02:2000::2 |
|             |         fc02:2000::3 |
|             |         fc02:2000::4 |
+-------------+----------------------+

admin@testbed:~$ show dhcp_relay ipv6 counter
  Message Type    Vlan1000
--------------  ----------
       Unknown           0
       Solicit           0
     Advertise           0
       Request           0
       Confirm           6
         Renew           0
        Rebind           0
         Reply           0
       Release           0
       Decline           0
 Relay-Forward           0
   Relay-Reply           0

admin@testbed:~$ show dhcprelay_helper ipv6
--------  ------------
Vlan1000  fc02:2000::1
          fc02:2000::2
          fc02:2000::3
          fc02:2000::4
--------  ------------

admin@testbed:~$ show dhcp6relay_counters counts
  Message Type    Vlan1000
--------------  ----------
       Unknown           0
       Solicit           0
     Advertise           0
       Request           0
       Confirm           6
         Renew           0
        Rebind           0
         Reply           0
       Release           0
       Decline           0
 Relay-Forward           0
   Relay-Reply           0

admin@testbed:~$ sudo sonic-clear dhcp_relay ipv6 counters
Cleared DHCPv6 Relay Counters

admin@testbed:~$ show dhcp_relay ipv6 counter
  Message Type    Vlan1000
--------------  ----------
       Unknown           0
       Solicit           0
     Advertise           0
       Request           0
       Confirm           0
         Renew           0
        Rebind           0
         Reply           0
       Release           0
       Decline           0
 Relay-Forward           0
   Relay-Reply           0

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

@yaqiangz yaqiangz force-pushed the 202012_show_dhcp_relay branch from 04fb57b to 590f1e7 Compare March 7, 2023 12:00
@yaqiangz yaqiangz force-pushed the 202012_show_dhcp_relay branch from 590f1e7 to b1ac46d Compare March 7, 2023 12:03
@yaqiangz yaqiangz force-pushed the 202012_show_dhcp_relay branch from e318ed6 to f76b5f1 Compare March 7, 2023 12:07
@yaqiangz yaqiangz changed the title [test] Just want to build [dhcp_relay] Add show/clear/counter cli for dhcp_relay Mar 8, 2023
@yaqiangz yaqiangz marked this pull request as ready for review March 8, 2023 07:35
@yaqiangz yaqiangz requested a review from kellyyeh March 8, 2023 07:36
@yaqiangz
Copy link
Contributor Author

yaqiangz commented Mar 8, 2023

@kellyyeh Could you help to review this PR?

@yaqiangz yaqiangz merged commit f0a9f4f into sonic-net:202012 Mar 9, 2023
qiluo-msft pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Mar 21, 2023
This PR includes the following commits
```
5b0f0fc [202012][dhcp_relay] Fix dhcp_relay restart error while add/del vlan (sonic-net/sonic-utilities#2688)
48fd842 [show][muxcable] increase timeout for displaying HW_STATUS (sonic-net/sonic-utilities#2712)
f0a9f4f [dhcp_relay] Add show/clear/counter cli for dhcp_relay (sonic-net/sonic-utilities#2719)
8627944 Revert "[202012] Update load minigraph to load backend acl" (sonic-net/sonic-utilities#2736)
93c7d43 [warm-reboot] Use kexec_file_load instead of kexec_load when available (sonic-net/sonic-utilities#2608)
cc78747 [warm/fast-reboot] Backup logs from tmpfs to disk during fast/warm shutdown (sonic-net/sonic-utilities#2714)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants