-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[config-engine] minigraph.py refactoring #448
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 3 commits
efb7e95
424d931
cbc5ec3
b5bd1b0
2f80407
4a08e55
160b535
06c3346
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 |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| {% for member in alias_map %} | ||
| configure ports {{member['sonic']}} lldp portidsubtype local {{member['origin']}} | ||
| {% for member in minigraph_ports.keys() %} | ||
| configure ports {{member}} lldp portidsubtype local {{minigraph_ports[member]['alias']}} | ||
| {% endfor %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| {% for member in minigraph_ports.keys() %} | ||
| "{{member}}": "{{minigraph_ports[member]['alias']}}" | ||
| {% endfor %} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,58 +43,61 @@ iface eth0 inet dhcp | |
| {% endif %} | ||
| # | ||
| {% endblock mgmt_interface %} | ||
|
|
||
| {% block front_panel_interfaces %} | ||
| # The switch front panel interfaces | ||
| {% for port in minigraph_ports.keys()|sort %} | ||
| auto {{ port }} | ||
| allow-hotplug {{ port }} | ||
| {% endfor %} | ||
|
|
||
| {% for interface in minigraph_interfaces %} | ||
| auto {{ interface['alias'] }} | ||
| allow-hotplug {{ interface['alias'] }} | ||
| iface {{ interface['alias'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static | ||
| iface {{ interface['attachto'] }} {{ 'inet' if interface['addr'] | ipv4 else 'inet6' }} static | ||
| address {{ interface['addr'] }} | ||
| netmask {{ interface['mask'] }} | ||
| # | ||
| {% endfor %} | ||
| {% for vlan_interface in minigraph_vlan_interfaces|unique_name %} | ||
| {% for interface in vlan_interface['members'] %} | ||
| auto {{ interface }} | ||
| allow-hotplug {{ interface }} | ||
| iface {{ interface }} inet manual | ||
| pre-up ifconfig {{ interface }} up | ||
| post-up brctl addif {{ vlan_interface['name'] }} {{ interface }} | ||
| post-down ifconfig {{ interface }} down | ||
| # | ||
| {% for vlan in minigraph_vlans.keys()|sort %} | ||
| {% for member in minigraph_vlans[vlan]['members'] %} | ||
| iface {{ member }} inet manual | ||
| pre-up ifconfig {{ member }} up | ||
| post-up brctl addif {{ vlan }} {{ member }} | ||
| post-down ifconfig {{ member }} down | ||
| {% endfor %} | ||
| {% endfor %} | ||
| # Add || true to suppress the error when docker-teamd starts after docker-swss | ||
| {% for pc_interface in minigraph_portchannel_interfaces|unique_name %} | ||
| {% for interface in pc_interface['members'] %} | ||
| {% if pc_interface['name'] not in pc_set %} | ||
| auto {{ interface }} | ||
| allow-hotplug {{ interface }} | ||
| iface {{ interface }} inet manual | ||
| pre-up teamdctl {{ pc_interface['name'] }} port add {{ interface }} || true | ||
| post-down ifconfig {{ interface }} down | ||
| # | ||
| {% endif %} | ||
| # "|| true" is added to suppress the error when docker-teamd starts after docker-swss | ||
| {% for pc in minigraph_portchannels.keys()|sort %} | ||
| {% for member in minigraph_portchannels[pc]['members'] %} | ||
| iface {{ member }} inet manual | ||
| pre-up teamdctl {{ pc }} port add {{ member }} || true | ||
| post-down ifconfig {{ member }} down | ||
| {% endfor %} | ||
| {% endfor %} | ||
| {% endblock front_panel_interfaces %} | ||
| {% block vlan_interfaces %} | ||
|
|
||
| # Vlan interfaces | ||
| {% for vlan in minigraph_vlans.keys()|sort %} | ||
| auto {{ vlan }} | ||
| {% endfor %} | ||
|
|
||
|
||
| {% for vlan_interface in minigraph_vlan_interfaces %} | ||
| auto {{ vlan_interface['name'] }} | ||
| iface {{ vlan_interface['name'] }} {{ 'inet' if vlan_interface['addr'] | ipv4 else 'inet6' }} static | ||
| iface {{ vlan_interface['attachto'] }} {{ 'inet' if vlan_interface['addr'] | ipv4 else 'inet6' }} static | ||
| bridge_ports none | ||
| address {{ vlan_interface['addr'] }} | ||
| netmask {{ vlan_interface['mask'] }} | ||
| # | ||
| {% endfor %} | ||
| {% endblock vlan_interfaces %} | ||
| {% block pc_interfaces %} | ||
|
|
||
| # Portchannel settings | ||
| {% for pc in minigraph_portchannels.keys()|sort %} | ||
| auto {{ pc }} | ||
| allow-hotplug {{ pc }} | ||
| {% endfor %} | ||
|
||
|
|
||
| {% for pc_interface in minigraph_portchannel_interfaces %} | ||
| auto {{ pc_interface['name'] }} | ||
| allow-hotplug {{ pc_interface['name'] }} | ||
| iface {{ pc_interface['name'] }} {{ 'inet' if pc_interface['addr'] | ipv4 else 'inet6' }} static | ||
| iface {{ pc_interface['attachto'] }} {{ 'inet' if pc_interface['addr'] | ipv4 else 'inet6' }} static | ||
| address {{ pc_interface['addr'] }} | ||
| netmask {{ pc_interface['mask'] }} | ||
| # | ||
| {% endfor %} | ||
| {% endblock pc_interfaces %} | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
could you also remove the unique_name filter in sonic-cfggen? #WontFix
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.
I feel it's OK to keep it?
In reply to: 108321887 [](ancestors = 108321887)