Skip to content

Commit

Permalink
Add SONiC as fanout switch - infra code (#13062)
Browse files Browse the repository at this point in the history
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
echuawu authored and mssonicbld committed Jun 6, 2024
1 parent e873287 commit 51a3754
Show file tree
Hide file tree
Showing 3 changed files with 561 additions and 2 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 @@ -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: "'20230531' 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

0 comments on commit 51a3754

Please sign in to comment.