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

op mode: T4519: Show DUID instead of IAID_DUID #3462

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion op-mode-definitions/dhcp.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
<properties>
<help>Show DHCPv6 server leases sorted by the specified key</help>
<completionHelp>
<list>end iaid_duid ip last_communication pool remaining state type</list>
<list>end duid ip last_communication pool remaining state type</list>
</completionHelp>
</properties>
<command>${vyos_op_scripts_dir}/dhcp.py show_server_leases --family inet6 --sort $6</command>
Expand Down
8 changes: 4 additions & 4 deletions src/op_mode/dhcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
config = ConfigTreeQuery()
lease_valid_states = ['all', 'active', 'free', 'expired', 'released', 'abandoned', 'reset', 'backup']
sort_valid_inet = ['end', 'mac', 'hostname', 'ip', 'pool', 'remaining', 'start', 'state']
sort_valid_inet6 = ['end', 'iaid_duid', 'ip', 'last_communication', 'pool', 'remaining', 'state', 'type']
sort_valid_inet6 = ['end', 'duid', 'ip', 'last_communication', 'pool', 'remaining', 'state', 'type']

ArgFamily = typing.Literal['inet', 'inet6']
ArgState = typing.Literal['all', 'active', 'free', 'expired', 'released', 'abandoned', 'reset', 'backup']
Expand Down Expand Up @@ -105,7 +105,7 @@ def _get_raw_server_leases(family='inet', pool=None, sorted=None, state=[], orig

if family == 'inet6':
data_lease['last_communication'] = lease.last_communication.timestamp()
data_lease['iaid_duid'] = _format_hex_string(lease.host_identifier_string)
data_lease['duid'] = _format_hex_string(lease.duid)
lease_types_long = {'na': 'non-temporary', 'ta': 'temporary', 'pd': 'prefix delegation'}
data_lease['type'] = lease_types_long[lease.type]

Expand Down Expand Up @@ -175,11 +175,11 @@ def _get_formatted_server_leases(raw_data, family='inet'):
remain = lease.get('remaining')
lease_type = lease.get('type')
pool = lease.get('pool')
host_identifier = lease.get('iaid_duid')
host_identifier = lease.get('duid')
data_entries.append([ipaddr, state, start, end, remain, lease_type, pool, host_identifier])

headers = ['IPv6 address', 'State', 'Last communication', 'Lease expiration', 'Remaining', 'Type', 'Pool',
'IAID_DUID']
'DUID']

output = tabulate(data_entries, headers, numalign='left')
return output
Expand Down
Loading