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

Use running configuration for sonic ports #324

Merged
merged 4 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 11 additions & 2 deletions partition/roles/sonic/templates/metal.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,22 @@ PORT:
{% endif %}
{% if sonic_ports_dict[name] is defined %}
{% set port = sonic_ports_dict[name] %}
admin_status: up
admin_status: {{ port.admin_status|default('up') }}
speed: "{{ port.speed|default(sonic_ports_default_speed) }}"
mtu: "{{ port.mtu|default(sonic_ports_default_mtu) }}"
fec: "{{ port.fec|default(sonic_ports_default_fec)|string|lower }}"
fec: {{ port.fec|default(sonic_ports_default_fec)|string|lower }}
{% else %}
admin_status: up
{% if running_cfg.speed is defined %}
speed: "{{ running_cfg.speed }}"
{% endif %}
{% if running_cfg.mtu is defined %}
mtu: "{{ running_cfg.mtu }}"
{% endif %}
{% if running_cfg.fec is defined %}
fec: {{ running_cfg.fec }}
{% endif %}
{% endif %}
{% endfor %}
{% if sonic_portchannels %}

Expand Down
9 changes: 6 additions & 3 deletions partition/roles/sonic/test/data/exit/metal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,30 @@ PORT:
admin_status: up
speed: "10000"
mtu: "1500"
fec: "none"
fec: none
Ethernet1:
alias: Eth1/2(Port1)
autoneg: "off"
index: "1"
lanes: "2"
parent_port: Ethernet0
admin_status: up
speed: "10000"
Ethernet2:
alias: Eth1/3(Port1)
autoneg: "off"
index: "1"
lanes: "3"
parent_port: Ethernet0
admin_status: up
speed: "10000"
Ethernet3:
alias: Eth1/4(Port1)
autoneg: "off"
index: "1"
lanes: "4"
parent_port: Ethernet0
admin_status: up
speed: "10000"
Ethernet112:
alias: Eth29(Port29)
Expand All @@ -92,7 +95,7 @@ PORT:
admin_status: up
speed: "100000"
mtu: "9216"
fec: "none"
fec: none
Ethernet116:
alias: Eth30(Port30)
autoneg: "off"
Expand All @@ -102,7 +105,7 @@ PORT:
admin_status: up
speed: "100000"
mtu: "9216"
fec: "none"
fec: none

VLAN:
Vlan4000:
Expand Down
4 changes: 3 additions & 1 deletion partition/roles/sonic/test/data/l2_leaf/input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ sonic_running_cfg_ports:
index: "1"
lanes: "4"
parent_port: Ethernet0
speed: "25000"
speed: "10000"
fec: rs
mtu: "9100"
Ethernet4:
alias: Eth2/1(Port2)
index: "2"
Expand Down
25 changes: 15 additions & 10 deletions partition/roles/sonic/test/data/l2_leaf/metal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ PORT:
admin_status: up
speed: "25000"
mtu: "9000"
fec: "none"
fec: none
Ethernet1:
alias: Eth1/2(Port1)
autoneg: "off"
Expand All @@ -97,7 +97,7 @@ PORT:
admin_status: up
speed: "25000"
mtu: "9000"
fec: "none"
fec: none
Ethernet2:
alias: Eth1/3(Port1)
autoneg: "off"
Expand All @@ -107,14 +107,17 @@ PORT:
admin_status: up
speed: "25000"
mtu: "9000"
fec: "none"
fec: none
Ethernet3:
alias: Eth1/4(Port1)
autoneg: "off"
index: "1"
lanes: "4"
parent_port: Ethernet0
speed: "25000"
admin_status: up
speed: "10000"
mtu: "9100"
fec: rs
Ethernet4:
alias: Eth2/1(Port2)
autoneg: "off"
Expand All @@ -124,7 +127,7 @@ PORT:
admin_status: up
speed: "25000"
mtu: "9000"
fec: "none"
fec: none
Ethernet5:
alias: Eth2/2(Port2)
autoneg: "off"
Expand All @@ -134,20 +137,22 @@ PORT:
admin_status: up
speed: "25000"
mtu: "9000"
fec: "none"
fec: none
Ethernet6:
alias: Eth2/3(Port2)
autoneg: "off"
index: "2"
lanes: "3"
parent_port: Ethernet4
admin_status: up
speed: "25000"
Ethernet7:
alias: Eth2/4(Port2)
autoneg: "off"
index: "2"
lanes: "4"
parent_port: Ethernet4
admin_status: up
speed: "25000"
Ethernet112:
alias: Eth29(Port29)
Expand All @@ -158,7 +163,7 @@ PORT:
admin_status: up
speed: "100000"
mtu: "9216"
fec: "none"
fec: none
Ethernet116:
alias: Eth30(Port30)
autoneg: "off"
Expand All @@ -168,7 +173,7 @@ PORT:
admin_status: up
speed: "100000"
mtu: "9216"
fec: "none"
fec: none
Ethernet120:
alias: Eth31(Port31)
autoneg: "off"
Expand All @@ -178,7 +183,7 @@ PORT:
admin_status: up
speed: "100000"
mtu: "9216"
fec: "none"
fec: none
Ethernet124:
alias: Eth32(Port32)
autoneg: "off"
Expand All @@ -188,7 +193,7 @@ PORT:
admin_status: up
speed: "100000"
mtu: "9216"
fec: "none"
fec: none

PORTCHANNEL:
PortChannel01:
Expand Down
13 changes: 7 additions & 6 deletions partition/roles/sonic/test/data/mgmtleaf/metal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ PORT:
admin_status: up
speed: "1000"
mtu: "9000"
fec: "none"
fec: none
Ethernet1:
alias: Eth1/2(Port1)
autoneg: "off"
Expand All @@ -75,7 +75,7 @@ PORT:
admin_status: up
speed: "1000"
mtu: "9000"
fec: "none"
fec: none
Ethernet2:
alias: Eth1/3(Port1)
autoneg: "off"
Expand All @@ -85,7 +85,7 @@ PORT:
admin_status: up
speed: "1000"
mtu: "9000"
fec: "none"
fec: none
Ethernet3:
alias: Eth1/4(Port1)
autoneg: "off"
Expand All @@ -95,13 +95,14 @@ PORT:
admin_status: up
speed: "1000"
mtu: "9000"
fec: "none"
fec: none
Ethernet4:
alias: Eth2(Port2)
autoneg: "off"
index: "2"
lanes: "5,6,7,8"
parent_port: Ethernet4
admin_status: up
speed: "100000"
Ethernet120:
alias: Eth31(Port31)
Expand All @@ -112,7 +113,7 @@ PORT:
admin_status: up
speed: "100000"
mtu: "9216"
fec: "rs"
fec: rs
Ethernet124:
alias: Eth32(Port32)
autoneg: "off"
Expand All @@ -122,7 +123,7 @@ PORT:
admin_status: up
speed: "100000"
mtu: "9000"
fec: "none"
fec: none

VLAN:
Vlan1:
Expand Down
3 changes: 2 additions & 1 deletion partition/roles/sonic/test/data/sonic-vs/metal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ PORT:
admin_status: up
speed: "40000"
mtu: "9000"
fec: "none"
fec: none
Ethernet4:
alias: fortyGigE0/4
autoneg: "off"
index: "1"
lanes: "29,30,31,32"
admin_status: up
speed: "40000"

VLAN:
Expand Down
4 changes: 2 additions & 2 deletions partition/roles/sonic/test/data/spine/metal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ PORT:
admin_status: up
speed: "100000"
mtu: "9216"
fec: "none"
fec: none
Ethernet124:
alias: Eth32(Port32)
autoneg: "off"
Expand All @@ -66,7 +66,7 @@ PORT:
admin_status: up
speed: "100000"
mtu: "9216"
fec: "none"
fec: none

LLDP:
Global:
Expand Down
Loading