Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 dockers/docker-dhcp-relay/isc-dhcp-relay.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SERVERS="{{ dhcp_servers | join(' ') }}"

INTERFACES="{{ minigraph_vlan_interfaces[0]['name'] }}"
INTERFACES="{{ minigraph_vlan_interfaces[0]['attachto'] }}"

# '-a' option provides option 82 circuit id information
OPTIONS="-a"
Expand Down
2 changes: 1 addition & 1 deletion dockers/docker-dhcp-relay/start.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

VLAN_IFACE_NAME=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_vlan_interfaces[0]['name']"`
VLAN_IFACE_NAME=`sonic-cfggen -m /etc/sonic/minigraph.xml -v "minigraph_vlan_interfaces[0]['attachto']"`

# Wait for the VLAN to come up (i.e., 'ip link show' returns 0)
until ip link show $VLAN_IFACE_NAME > /dev/null 2>&1; do
Expand Down
7 changes: 6 additions & 1 deletion dockers/docker-fpm-gobgp/zebra.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ enable password zebra
{% block interfaces %}
! Enable link-detect (default disabled)
{% for interface in minigraph_interfaces %}
interface {{ interface['alias'] }}
interface {{ interface['attachto'] }}
link-detect
!
{% endfor %}
{% for interface in minigraph_portchannels.keys() %}
interface {{ interface }}
link-detect
!
{% endfor %}
Expand Down
6 changes: 3 additions & 3 deletions dockers/docker-fpm/zebra.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ enable password zebra
{% block interfaces %}
! Enable link-detect (default disabled)
{% for interface in minigraph_interfaces %}
interface {{ interface['alias'] }}
interface {{ interface['attachto'] }}
link-detect
!
{% endfor %}
{% for interface in minigraph_portchannel_interfaces %}
interface {{ interface['name'] }}
{% for interface in minigraph_portchannels.keys() %}
interface {{ interface }}
link-detect
!
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions dockers/docker-lldp-sv2/lldpd.conf.j2
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 %}
5 changes: 5 additions & 0 deletions dockers/docker-snmp-sv2/alias_map.j2
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 %}
}
2 changes: 1 addition & 1 deletion dockers/docker-snmp-sv2/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mkdir -p /etc/snmp

sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 >/etc/snmp/snmpd.conf

sonic-cfggen -m /etc/sonic/minigraph.xml -s >/etc/snmp/alias_map.json
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/alias_map.j2 >/etc/snmp/alias_map.json

mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status
Expand Down
65 changes: 34 additions & 31 deletions files/image_config/interfaces/interfaces.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Copy link
Copy Markdown
Contributor

@stcheng stcheng Mar 28, 2017

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

Copy link
Copy Markdown
Contributor Author

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)

{% 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 %}

Copy link
Copy Markdown
Contributor

@stcheng stcheng Mar 28, 2017

Choose a reason for hiding this comment

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

i don't know if it will work or not to list all the vlan interfaces aside and the ip addresses aside. if doing in this way, move the 'bridge_ports none' to here so that even if we have multiple IPs, we don't have multiple 'bridge_ports none' lines. #Resolved

Copy link
Copy Markdown
Contributor

@stcheng stcheng Mar 29, 2017

Choose a reason for hiding this comment

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

it turns out to be that bridge_ports should follow iface line. thanks @taoyl-ms . let's stick auto stanza with iface stanza together for better readability. #Resolved

{% 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 %}
Copy link
Copy Markdown
Contributor

@stcheng stcheng Mar 28, 2017

Choose a reason for hiding this comment

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

i don't know if it is good to separate the iface stanza with the auto stanzas. #Resolved


{% 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 %}
Loading