-
Notifications
You must be signed in to change notification settings - Fork 1.8k
CISCO: Enhance sonic-config-engine to support L1 & L3 configurations #7368
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 all commits
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,39 @@ | |
| 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): | ||
| data['DEVICE_METADATA']['localhost']['hostname'] = 'sonic' | ||
| data['DEVICE_METADATA']['localhost']['type'] = 'LeafRouter' | ||
| 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['DEVICE_METADATA']['localhost']['hostname'] = 'sonic' | ||
| data['DEVICE_METADATA']['localhost']['type'] = 'LeafRouter' | ||
| data['DEVICE_METADATA']['localhost']['bgp_asn'] = '65100' | ||
| 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 +128,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, | ||
| 'l3': generate_l3_config | ||
|
Collaborator
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 explain what is l1, l3 config and why we need them?
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. L1 configuration generates only the default port admin_status and mtu values. This is minimally required configuration for any system interfaces to come up. L2 configuration generates Vlan interface configuration. For instance the api generate_l2_config is generating Vlan1000 data port configuration. A "routed" system may not need a L2 configuration def generate_l2_config(data): L3 generates "routed" configuration like, which are minimally required for configuring the system as a L3 device.
|
||
| } | ||
|
|
||
| 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.
can you remove those hardcoded 'type', 'bgp_asn' and 'LOOPBACK_INTERFACE'?
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.
Please review https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-config-engine/config_samples.py
The new methods for L1 & L3 are just extensions to the existing methods and has the minimum set of parameters required for L1 & L3 System bringup.
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.
Tracked thru #7637