-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Support L1 & L3 Config generation in SONiC #7637
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
Changes from 2 commits
6ed124f
d9e98f0
37e8dc2
7e80cbe
30c591c
d27bbde
975daf5
8932089
8bb7f1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,34 @@ | |
| else: | ||
| UNICODE_TYPE = unicode | ||
|
|
||
|
|
||
| # The new enhancements to this file provides capabilities to generate l1 & l3 | ||
| # configuration in addition the existing l2, t1 and empty configurations | ||
| # So the following capabilities exits now: | ||
| # 't1': generate_t1_sample_config, | ||
| # 'l2': generate_l2_config, | ||
| # 'empty': generate_empty_config, | ||
| # 'l1': generate_l1_config, | ||
| # 'l3': generate_l3_config | ||
|
|
||
| def generate_l1_config(data): | ||
| for port in natsorted(data['PORT']): | ||
| data['PORT'][port]['admin_status'] = 'up' | ||
| data['PORT'][port]['mtu'] = '9100' | ||
| return data; | ||
|
|
||
| def generate_l3_config(data): | ||
| data['LOOPBACK_INTERFACE'] = {"Loopback0": {}, | ||
| "Loopback0|10.1.0.1/32": {}} | ||
| data['BGP_NEIGHBOR'] = {} | ||
| data['DEVICE_NEIGHBOR'] = {} | ||
| data['INTERFACE'] = {} | ||
| for port in natsorted(data['PORT']): | ||
| data['PORT'][port]['admin_status'] = 'up' | ||
| data['PORT'][port]['mtu'] = '9100' | ||
| data['INTERFACE']['{}'.format(port)] = {} | ||
| return data; | ||
|
|
||
| def generate_t1_sample_config(data): | ||
| data['DEVICE_METADATA']['localhost']['hostname'] = 'sonic' | ||
| data['DEVICE_METADATA']['localhost']['type'] = 'LeafRouter' | ||
|
|
@@ -95,7 +123,9 @@ def generate_l2_config(data): | |
| _sample_generators = { | ||
| 't1': generate_t1_sample_config, | ||
| 'l2': generate_l2_config, | ||
| 'empty': generate_empty_config | ||
| 'empty': generate_empty_config, | ||
| 'l1': generate_l1_config, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please add a unit test for this? You can refer as done for #7215
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the comments. Added UT. Please review.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @prsunny do you have any more comments or else would be able to approve this PR ? |
||
| 'l3': generate_l3_config | ||
| } | ||
|
|
||
| def get_available_config(): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment looks more like PR description. I think this should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it will require the comment update again once someone add an additional template..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Fixed the comments and uploaded the new change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests for both L1 & L3 passed as belows.
test_l1_ports_template (tests.test_j2files.TestJ2Files) ... ok
test_l3_ports_template (tests.test_j2files.TestJ2Files) ... ok
New failures are seen in unrleated area.