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

[Mellanox] Add SONiC as fanout switch #13062

Merged
merged 1 commit into from
Jun 6, 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
4 changes: 2 additions & 2 deletions ansible/roles/fanout/tasks/fanout_sonic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
when: dry_run is defined
when: "'20220531' in fanout_sonic_version['build_version'] or 'internal' in fanout_sonic_version['build_version']"

- name: deploy SONiC fanout with image version 202305
- name: deploy SONiC fanout with image version 202311
block:
- name: deploy SONiC fanout not incremental and not dry_run
include_tasks:
sonic/fanout_sonic_202305.yml
sonic/fanout_sonic_202311.yml
when: dry_run is not defined and incremental is not defined
when: "'2023' in fanout_sonic_version['build_version']"
109 changes: 109 additions & 0 deletions ansible/roles/fanout/tasks/sonic/fanout_sonic_202311.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
- name: collect fanout port config
port_config_gen:
hwsku: "{{ device_info[inventory_hostname]['HwSku'] }}"
hwsku_type: "{{ device_info[inventory_hostname]['HwSkuType'] | default('predefined') }}"
device_conn: "{{ device_conn[inventory_hostname] }}"
become: yes

- name: Ensure TPID enabled in SAI
lineinfile:
path: /usr/share/sonic/device/{{ fanout_platform }}/{{ fanout_hwsku }}/sai.profile
line: 'SAI_USER_DEFINED_TPID=1'
state: present
become: yes
when: "'mellanox' in fanout_sonic_version.asic_type"

- name: Disable software control module function in SAI
lineinfile:
path: /usr/share/sonic/device/{{ fanout_platform }}/{{ fanout_hwsku }}/sai.profile
line: 'SAI_INDEPENDENT_MODULE_MODE=1'
state: absent
become: yes
when: "'mellanox' in fanout_sonic_version.asic_type"

- name: build fanout startup config
template:
src: "sonic_deploy_202311.j2"
dest: "/tmp/base_config.json"

- name: generate config_db.json
shell: sonic-cfggen -H -j /tmp/base_config.json --print-data > /etc/sonic/config_db.json
become: yes

- name: disable all copp rules
copy:
content: "{}"
dest: "/usr/share/sonic/templates/copp_cfg.j2"
become: yes
when: "'mellanox' not in fanout_sonic_version.asic_type"

- name: Overwrite copp rules for Mellanox FanoutLeaf
copy:
src: "copp_cfg_mlnx.j2"
dest: "/usr/share/sonic/templates/copp_cfg.j2"
become: yes
when: "'mellanox' in fanout_sonic_version.asic_type"

- name: Disable feature teamd and remove teamd container (avoid swss crash after config reload)
block:
- name: Check if teamd container exists
shell: "docker ps -a -q -f name=teamd"
register: teamd_container

- name: disable feature teamd and remove container
block:
- name: disable feature teamd
shell: config feature state teamd disabled
become: true
- name: ensure teamd container is stopped
docker_container:
name: teamd
state: stopped
become: true
ignore_errors: yes
- name: remove teamd container
docker_container:
name: teamd
state: absent
become: true
when: teamd_container.stdout != ""

- name: SONiC update config db
shell: config reload -y -f
become: true

- name: wait for SONiC update config db finish
pause:
seconds: 180

- name: Shutdown arp_update process in swss (avoid fanout broadcasting it's MAC address)
shell: docker exec -i swss supervisorctl stop arp_update
become: yes

- name: Setup broadcom based fanouts
block:
- name: reinit fp entries
shell: "bcmcmd 'fp detach' && bcmcmd 'fp init'"
become: yes
when: "'broadcom' in fanout_sonic_version.asic_type"

- block:
- name: Remove ipv6 parameter
lineinfile:
path: /etc/sysctl.conf
line: 'net.ipv6.conf.all.disable_ipv6 = 0'
state: absent
become: yes

- name: Update IPv6 parameter
lineinfile:
path: /etc/sysctl.conf
line: 'net.ipv6.conf.all.disable_ipv6 = 1'
state: present
become: yes

- name: Apply parameter to disable IPv6 function
shell: "sysctl -p"
become: yes

when: "'mellanox' in fanout_sonic_version.asic_type"
Loading
Loading