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

Add LST resource module #447

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Conversation

stalabi1
Copy link
Collaborator

@stalabi1 stalabi1 commented Sep 11, 2024

SUMMARY

I added a new resource module for link state tracking, LST.
Please see model PR.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

sonic_lst

OUTPUT

Updated regression results:
regression-2024-12-19-09-04-09.html.pdf

regression-2024-10-14-14-18-15.html.pdf
diff_output.log
merge_check_mode.log
delete_check_mode.log
delete_upstream_group_check_mode.txt
facts_gathering.log

Checklist:
  • I have performed a self-review of my own code to ensure there are no formatting, linting, or security issues
  • I have verified that new and existing unit tests pass locally with my changes
  • I have not allowed coverage numbers to degenerate
  • I have maintained at least 90% code coverage
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have maintained backward compatibility or have provided any relevant "breaking_changes" descriptions in a "fragment" file in the "changelogs/fragments" directory of this repository.
  • I have provided a summary for this PR in valid "fragment" file format in the "changelogs/fragments" directory of this repository branch. Reference : Ansible Change Log Document

@stalabi1 stalabi1 added the new_resource_module This pull request adds a new resource module label Sep 11, 2024
@stalabi1 stalabi1 added this to the v3.0.0 milestone Sep 11, 2024
@stalabi1 stalabi1 modified the milestones: v3.0.0, v3.1.0 Nov 13, 2024
@awhaley-dell awhaley-dell self-requested a review December 3, 2024 00:22
Copy link
Collaborator

@awhaley-dell awhaley-dell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module looks good on first pass. The only notes I have are style based regarding docstring triple quotes being on their own line separated from the function description by a newline.

plugins/module_utils/network/sonic/config/lst/lst.py Outdated Show resolved Hide resolved
plugins/module_utils/network/sonic/argspec/lst/lst.py Outdated Show resolved Hide resolved
Comment on lines 111 to 118
if all_evpn_es_downstream:
group_dict['all_evpn_es_downstream'] = all_evpn_es_downstream
else:
group_dict['all_evpn_es_downstream'] = False
if all_mclags_downstream:
group_dict['all_mclags_downstream'] = all_mclags_downstream
else:
group_dict['all_mclags_downstream'] = False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dict.get can be used to populate default values.

Suggested change
if all_evpn_es_downstream:
group_dict['all_evpn_es_downstream'] = all_evpn_es_downstream
else:
group_dict['all_evpn_es_downstream'] = False
if all_mclags_downstream:
group_dict['all_mclags_downstream'] = all_mclags_downstream
else:
group_dict['all_mclags_downstream'] = False
group_dict['all_evpn_es_downstream'] = config.get('all-evpn-es-downstream', False)
group_dict['all_mclags_downstream'] = config.get('all-mclags-downstream', False)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed.

commands.extend(update_states(have, 'deleted'))
have = {}

if not have and want:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please handle scenario when 'have' is subset of 'want'. (nothing to delete, but new config is to be added)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed.

There are several modules that don't account for this case so those modules will need to be fixed.

type: list
elements: dict
suboptions:
id:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this option specifies the name of the interface, could it be changed to 'name' ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed.

Copy link
Collaborator

@kerry-meyer kerry-meyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change set, the accompanying set of tests, and the test results look good. I am posting only a few minor requests for changes.

plugins/modules/sonic_lst.py Outdated Show resolved Hide resolved
plugins/modules/sonic_lst.py Outdated Show resolved Hide resolved
plugins/modules/sonic_lst.py Outdated Show resolved Hide resolved
plugins/module_utils/network/sonic/argspec/lst/lst.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@kerry-meyer kerry-meyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making the requested changes.

All proposed changes, test cases, and corresponding test results look good after the latest commit.

Approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new_resource_module This pull request adds a new resource module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants