sonic-buildimage/dockers/docker-dhcp-relay/cli/clear/plugins/clear_dhcp6relay_counter.py
shlomibitton 546340bf7b
[dhcp_relay] Fix import for dhcp_counters on clear_dhcp6relay_counter.py (#8991)
#### Why I did it

**Import issue will cause:**
root@sonic:/# sudo sonic-clear arp
failed to import plugin clear.plugins.dhcprelay: No module named 'show_dhcp_relay'

#### How I did it

Fix the import.

#### How to verify it

run sudo sonic-clear arp
2021-10-19 03:10:36 -07:00

32 lines
759 B
Python

import sys
import click
from show.plugins.dhcprelay import DHCPv6_Counter
import utilities_common.cli as clicommon
# sonic-clear dhcp6relay_counters
@click.group(cls=clicommon.AliasedGroup)
def dhcp6relay_clear():
pass
@dhcp6relay_clear.command('dhcp6relay_counters')
@click.option('-i', '--interface', required=False)
def dhcp6relay_clear_counters(interface):
""" Clear dhcp6relay message counts """
counter = DHCPv6_Counter()
counter_intf = counter.get_interface()
if interface:
counter.clear_table(interface)
else:
for intf in counter_intf:
counter.clear_table(intf)
def register(cli):
cli.add_command(dhcp6relay_clear_counters)
if __name__ == '__main__':
dhcp6relay_clear_counters()