-
Notifications
You must be signed in to change notification settings - Fork 740
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SONiC as fanout switch - infra code (#13062)
1. Update password of SONiC fanout switch 2. Add fanout deploy jinja file 3. Add 2311 fanout deploy operations Change-Id: I4ac20c0deab05b3c6b3bc6693ae88c5415ec41cd
- Loading branch information
1 parent
e873287
commit 51a3754
Showing
3 changed files
with
561 additions
and
2 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
109 changes: 109 additions & 0 deletions
109
ansible/roles/fanout/tasks/sonic/fanout_sonic_202311.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,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" |
Oops, something went wrong.