Skip to content

Commit

Permalink
Merge pull request #321 from metal-stack/sonic_202211_sag
Browse files Browse the repository at this point in the history
Implement new SAG configuration for SONIC 202211
  • Loading branch information
mreiger authored Sep 26, 2024
2 parents b64184b + 4b974f5 commit 65d4ae1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 41 deletions.
4 changes: 1 addition & 3 deletions partition/roles/sonic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ It depends on the `switch_facts` module from `ansible-common`, so make sure modu
| sonic_vlans.untagged_ports | | Array of untagged ports to bind to this VLAN. |
| sonic_vlans.tagged_ports | | Array of tagged ports to bind to this VLAN. |
| sonic_vlans.vrf | | The VRF to bind the VLANs SVI to. |
| sonic_vlans.sag | | Whether to enable Static Anycast Gateway for this VLAN. Defaults to false in SONIC. |
| sonic_vteps | | VTEPs to configure. If defined FRR will automatically advertise all VNIs. |
| sonic_vteps.comment | | Description for the VTEP. |
| sonic_vteps.vlan | | The local VLAN interface. |
Expand Down Expand Up @@ -82,9 +83,6 @@ It depends on the `switch_facts` module from `ansible-common`, so make sure modu
| sonic_portchannels.members | | The list of the interfaces taking part in the portchannel. |
| sonic_sag | | Configuration for SAG (Static Anycast Gateway) |
| sonic_sag.mac | | The virtual MAC used for the SAG address |
| sonic_sag.vlans | | A list of VLANs that use SAG |
| sonic_sag.vlans.id | | The VLAN ID of this VLAN |
| sonic_sag.vlans.ip | | The SAG IP of this VLAN |
| sonic_ssh_sourceranges | | The source ranges from which the switch should be reachable over SSH on its prod (non-management) addresses |
| sonic_extended_cacl.ipv4 | | Iptables ipv4 rules that should be added as extended Control Plane ACLs (Edgecore Sonic specific feature) |
| sonic_extended_cacl.ipv6 | | Iptables ipv6 rules that should be added as extended Control Plane ACLs (Edgecore Sonic specific feature) |
30 changes: 8 additions & 22 deletions partition/roles/sonic/templates/metal.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ PORTCHANNEL:
{% for po in sonic_portchannels %}
PortChannel{{ po.number }}:
admin_status: "up"
{% if po.fallback is defined %}
fallback: "{{ po.fallback|bool }}"
{% if po.fallback is defined and po.fallback %}
fallback: "true"
{% endif %}
fast_rate: "false"
lacp_key: "auto"
Expand All @@ -140,21 +140,11 @@ PORTCHANNEL_MEMBER:
{% endfor %}
{% endfor %}
{% endif %}
{% if sonic_sag is defined and sonic_sag|length > 0 %}
{% if sonic_sag.vlans is defined and sonic_sag.vlans|length > 0 %}
{% if sonic_sag.mac is defined %}

SAG:
{% for vlan in sonic_sag.vlans %}
"Vlan{{ vlan.id }}|IPv4":
gwip:
- "{{ vlan.ip }}"
{% endfor %}
{% endif %}

SAG_GLOBAL:
IP:
IPv4: "enable"
gwmac: "{{ sonic_sag.mac }}"
GLOBAL:
gateway_mac: "{{ sonic_sag.mac }}"
{% endif %}
{% if sonic_vlans is defined and sonic_vlans|length > 0 %}

Expand All @@ -171,13 +161,9 @@ VLAN_INTERFACE:
{% for vlan in sonic_vlans %}
{% if vlan.vrf is defined %}
Vlan{{ vlan.id }}:
{% if sonic_sag is defined and sonic_sag.vlans is defined %}
{% for sag_vlan in sonic_sag.vlans %}
{% if vlan.id == sag_vlan.id %}
"grat_arp_force_override": "enabled"
{% endif %}
{% endfor %}
{% endif %}
{% if vlan.sag is defined and vlan.sag %}
static_anycast_gateway: "true"
{% endif %}
vrf_name: "{{ vlan.vrf }}"
{% else %}
Vlan{{ vlan.id }}: {}
Expand Down
4 changes: 1 addition & 3 deletions partition/roles/sonic/test/data/l2_leaf/input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ sonic_vlans:
- PortChannel01
- id: 1001
vrf: Vrf46
sag: "true"
tagged_ports:
- PortChannel01
untagged_ports:
Expand Down Expand Up @@ -201,9 +202,6 @@ sonic_portchannels:

sonic_sag:
mac: 00:11:22:33:44:66
vlans:
- id: 1001
ip: 10.3.2.1/27

sonic_frr_l2vpn_evpn: true
sonic_frr_route_map:
Expand Down
19 changes: 6 additions & 13 deletions partition/roles/sonic/test/data/l2_leaf/metal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,31 +200,30 @@ PORTCHANNEL:
mtu: "9216"
PortChannel11:
admin_status: "up"
fallback: "True"
fallback: "true"
fast_rate: "false"
lacp_key: "auto"
min_links: "1"
mix_speed: "false"
mtu: "9000"
PortChannel12:
admin_status: "up"
fallback: "True"
fallback: "true"
fast_rate: "false"
lacp_key: "auto"
min_links: "1"
mix_speed: "false"
mtu: "9000"
PortChannel21:
admin_status: "up"
fallback: "True"
fallback: "true"
fast_rate: "false"
lacp_key: "auto"
min_links: "1"
mix_speed: "false"
mtu: "9000"
PortChannel22:
admin_status: "up"
fallback: "False"
fast_rate: "false"
lacp_key: "auto"
min_links: "1"
Expand All @@ -248,14 +247,8 @@ PORTCHANNEL_MEMBER:
PortChannel23|Ethernet2: {}

SAG:
"Vlan1001|IPv4":
gwip:
- "10.3.2.1/27"

SAG_GLOBAL:
IP:
IPv4: "enable"
gwmac: "00:11:22:33:44:66"
GLOBAL:
gateway_mac: "00:11:22:33:44:66"

VLAN:
Vlan1000:
Expand All @@ -267,7 +260,7 @@ VLAN_INTERFACE:
Vlan1000: {}
Vlan1000|192.168.255.1/24: {}
Vlan1001:
"grat_arp_force_override": "enabled"
static_anycast_gateway: "true"
vrf_name: "Vrf46"

VLAN_MEMBER:
Expand Down

0 comments on commit 65d4ae1

Please sign in to comment.