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

Clear counter when dhcp6relay init #51

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

yaqiangz
Copy link
Contributor

@yaqiangz yaqiangz commented Dec 10, 2024

Fix issue sonic-net/sonic-buildimage#15047

Why I did it

When dhcp6relay startup, it would clear and reset the counter in DHCP_RELAY table, and it would cause that counter data of deleted Vlan wouldn't be clear.

How I did it

Clear all counter when dhcp6relay init

How I verify it

  1. UT
  2. Install new dhcp6relay in testbed
    2.1. Add Vlan2000,
    2.2. Send dhcpv6 packets to Vlan2000, confirm that counter has been updated
    2.3 reload config without Vlan2000, confirm that counter data of Vlan2000 has been deleted
admin@bjw-can-2700-3:~$ sonic-db-cli STATE_DB hgetall "DHCPv6_COUNTER_TABLE|Vlan1000"
{'Unknown': '0', 'Solicit': '1', 'Advertise': '0', 'Request': '0', 'Confirm': '0', 'Renew': '0', 'Rebind': '0', 'Reply': '0', 'Release': '0', 'Decline': '0', 'Reconfigure': '0', 'Information-Request': '0', 'Relay-Forward': '4', 'Relay-Reply': '0', 'Malformed': '0'}
admin@bjw-can-2700-3:~$ sonic-db-cli STATE_DB hgetall "DHCPv6_COUNTER_TABLE|Vlan2000"
{'Unknown': '0', 'Solicit': '3', 'Advertise': '0', 'Request': '0', 'Confirm': '0', 'Renew': '0', 'Rebind': '0', 'Reply': '0', 'Release': '0', 'Decline': '0', 'Reconfigure': '0', 'Information-Request': '0', 'Relay-Forward': '3', 'Relay-Reply': '0', 'Malformed': '0'}
admin@bjw-can-2700-3:~$ sudo config reload -y
Acquired lock on /etc/sonic/reload.lock
Disabling container monitoring ...
Stopping SONiC target ...
Running command: /usr/local/bin/sonic-cfggen -j /etc/sonic/init_cfg.json -j /etc/sonic/config_db.json --write-to-db
Running command: /usr/local/bin/db_migrator.py -o migrate
Running command: /usr/local/bin/sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t /usr/share/sonic/templates/sonic-environment.j2,/etc/sonic/sonic-environment
Restarting SONiC target ...
Enabling container monitoring ...
Reloading Monit configuration ...
Reinitializing monit daemon
Released lock on /etc/sonic/reload.lock
admin@bjw-can-2700-3:~$ sonic-db-cli STATE_DB hgetall "DHCPv6_COUNTER_TABLE|Vlan1000"
{'Unknown': '0', 'Solicit': '0', 'Advertise': '0', 'Request': '0', 'Confirm': '0', 'Renew': '0', 'Rebind': '0', 'Reply': '0', 'Release': '0', 'Decline': '0', 'Reconfigure': '0', 'Information-Request': '0', 'Relay-Forward': '0', 'Relay-Reply': '0', 'Malformed': '0'}
admin@bjw-can-2700-3:~$ sonic-db-cli STATE_DB hgetall "DHCPv6_COUNTER_TABLE|Vlan2000"
{}
admin@bjw-can-2700-3:~$ 

@yaqiangz
Copy link
Contributor Author

Hi @yxieca could you please help to review this PR?

@yaqiangz yaqiangz force-pushed the master_clear_counter branch from 9368652 to a82d4b6 Compare December 12, 2024 12:52
@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yaqiangz yaqiangz merged commit 2a2fb68 into sonic-net:master Dec 13, 2024
8 checks passed
@yaqiangz
Copy link
Contributor Author

Hi @bingwang-ms could you please help to approve the backport request?

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.

4 participants