Skip to content

Commit

Permalink
add fanout support for 202405 and 202411 (sonic-net#16412)
Browse files Browse the repository at this point in the history
What is the motivation for this PR?
Support 202405 and 202411 image.

How did you do it?
replace soft link with hard copy. and modified it to suit 202405 requirement.

How did you verify/test it?
Tested it locally.
  • Loading branch information
sdszhang authored and mssonicbld committed Jan 13, 2025
1 parent 2c0942d commit b8dc1b4
Show file tree
Hide file tree
Showing 3 changed files with 620 additions and 3 deletions.
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 @@ -65,9 +65,9 @@
when: dry_run is not defined and incremental is not defined
when: "'2023' in fanout_sonic_version['build_version']"

- name: deploy SONiC fanout with image version 202405
- name: deploy SONiC fanout with image version 202405 or 202411
block:
- name: deploy SONiC fanout not incremental and not dry_run
- name: deploy SONiC fanout not incremental and not dry_run with 2024 images
include_tasks:
sonic/fanout_sonic_202405.yml
when: dry_run is not defined and incremental is not defined
Expand Down
1 change: 0 additions & 1 deletion ansible/roles/fanout/tasks/sonic/fanout_sonic_202405.yml

This file was deleted.

156 changes: 156 additions & 0 deletions ansible/roles/fanout/tasks/sonic/fanout_sonic_202405.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
- name: Copy port_config.ini to fanout switch
block:
- 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] }}"

- name: Copy port_config.ini to fanout switch
copy:
src: "{{ device_info[inventory_hostname]['PortConfigIni'] }}"
dest: "/usr/share/sonic/device/{{ fanout_platform }}/{{ fanout_hwsku }}/port_config.ini"
become: yes
when: device_info[inventory_hostname]['PortConfigIni'] is defined

- name: Copy sonic_sku_create.py to fanout switch
copy:
src: "roles/fanout/library/sonic_sku_create.py"
dest: "/tmp/sonic_sku_create.py"
mode: "+x"
become: yes
when: device_info[inventory_hostname]['HwSkuType'] == "dynamic"

- 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
block:
- 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

- name: Check whether pmon_daemon_control.json exist
stat:
path: /usr/share/sonic/device/{{ fanout_platform }}/{{ fanout_hwsku }}/pmon_daemon_control.json
register: pmon_daemon_control_json

- name: Skip transceiver cmis manager
lineinfile:
path: /usr/share/sonic/device/{{ fanout_platform }}/{{ fanout_hwsku }}/pmon_daemon_control.json
regexp: '"skip_xcvrd_cmis_mgr": false'
line: ' "skip_xcvrd_cmis_mgr": true'
when: pmon_daemon_control_json.stat.exists

- name: Remove media setting file
file:
path: /usr/share/sonic/device/{{ fanout_platform }}/{{ fanout_hwsku }}/media_settings.json
state: absent

- name: Remove optical setting file
file:
path: /usr/share/sonic/device/{{ fanout_platform }}/{{ fanout_hwsku }}/optics_si_settings.json
state: absent
become: yes
when: "'mellanox' in fanout_sonic_version.asic_type"

- name: build fanout startup config
template:
src: "sonic_deploy_202405.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

0 comments on commit b8dc1b4

Please sign in to comment.