forked from sonic-net/sonic-mgmt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add fanout support for 202405 and 202411 (sonic-net#16412)
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
1 parent
2c0942d
commit b8dc1b4
Showing
3 changed files
with
620 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
156 changes: 156 additions & 0 deletions
156
ansible/roles/fanout/tasks/sonic/fanout_sonic_202405.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
Oops, something went wrong.