Skip to content

Commit

Permalink
Merge branch 'master' into reclaim-buffer-master-github
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenxs authored Nov 1, 2021
2 parents 3959906 + 4f52b35 commit 8852a69
Show file tree
Hide file tree
Showing 247 changed files with 8,775 additions and 2,907 deletions.
87 changes: 51 additions & 36 deletions ansible/TestbedProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,47 +492,62 @@ def makeLab(data, devices, testbed, outfile):
except AttributeError:
print("\t\t" + host + " asics_host_ipv6 not found")

try: #get voq_inband_ip
voq_inband_ip = dev.get("voq_inband_ip")
if voq_inband_ip is not None:
entry += "\tvoq_inband_ip=" + str( voq_inband_ip )
except AttributeError:
print("\t\t" + host + " voq_inband_ip not found")

try: #get voq_inband_ipv6
voq_inband_ipv6 = dev.get("voq_inband_ipv6")
if voq_inband_ipv6 is not None:
entry += "\tvoq_inband_ipv6=" + str( voq_inband_ipv6 )
except AttributeError:
print("\t\t" + host + " voq_inband_ipv6 not found")

try: #get voq_inband_intf
voq_inband_intf = dev.get("voq_inband_intf")
if voq_inband_intf is not None:
entry += "\tvoq_inband_intf=" + str( voq_inband_intf )
except AttributeError:
print("\t\t" + host + " voq_inband_intf not found")

try: #get voq_inband_type
voq_inband_type = dev.get("voq_inband_type")
if voq_inband_type is not None:
entry += "\tvoq_inband_type=" + str( voq_inband_type )
except AttributeError:
print("\t\t" + host + " voq_inband_type not found")

try: #get switch_type
switch_type = dev.get("switch_type")
if switch_type is not None:
entry += "\tswitch_type=" + str( switch_type )
except AttributeError:
print("\t\t" + host + " switch_type not found")
entry += "\tswitch_type=" + str( switch_type )
if switch_type == 'voq' and card_type != 'supervisor':
if num_asics is None:
num_asics = 1

# All fields are a list. For single asic the list is of size 1.
switchids = dev.get("switchids") # switchids, single asic example "[4]", 3 asic example "[4,6,8]"
voq_inband_ip = dev.get("voq_inband_ip") # voq_inband_ip
voq_inband_ipv6 = dev.get("voq_inband_ipv6") # voq_inband_ipv6
voq_inband_intf = dev.get("voq_inband_intf") # voq_inband_intf
voq_inband_type = dev.get("voq_inband_type") # voq_inband_type
max_cores = dev.get("max_cores") # max cores
lo4096_ip = dev.get("loopback4096_ip") # loopback4096_ip
lo4096_ipv6 = dev.get("loopback4096_ipv6") # loopback4096_ipv6
num_cores_per_asic = dev.get("num_cores_per_asic", 1) # number of cores per asic - to be used in calculating the switchids, assuming to be the same for all linecards

# Add fields
if switchids is None:
switchids = [start_switchid + (asic_id * num_cores_per_asic) for asic_id in range(num_asics)]
entry += "\tswitchids=" + str(switchids)

if voq_inband_ip is None:
voq_inband_ip = ["1.1.1.{}/32".format(start_switchid + asic_id) for asic_id in range(num_asics)]
entry += "\tvoq_inband_ip=" + str(voq_inband_ip)

if voq_inband_ipv6 is None:
voq_inband_ip = ["1111::1:{}/128".format(start_switchid + asic_id) for asic_id in range(num_asics)]
entry += "\tvoq_inband_ipv6=" + str(voq_inband_ip)

if voq_inband_intf is None:
voq_inband_intf = ["Ethernet-IB{}".format(asic_id) for asic_id in range(num_asics)]
entry += "\tvoq_inband_intf=" + str(voq_inband_intf)

if voq_inband_type is None:
voq_inband_type = "port"
entry += "\tvoq_inband_type=" + voq_inband_type

if max_cores is None:
max_cores = 48
entry += "\tmax_cores=" + str(max_cores)

if lo4096_ip is None:
lo4096_ip = ["8.0.0.{}/32".format(start_switchid + asic_id) for asic_id in range(num_asics)]
entry += "\tloopback4096_ip=" + lo4096_ip

if lo4096_ipv6 is None:
lo4096_ipv6 = ["2603:10e2:400::{}/128".format(start_switchid + asic_id) for asic_id in range(num_asics)]
entry += "\tloopback4096_ipv6=" + lo4096_ipv6

start_switchid += (num_asics * num_cores_per_asic)

try: #get max_cores
max_cores = dev.get("max_cores")
if max_cores is not None:
entry += "\tmax_cores=" + str( max_cores )
except AttributeError:
print("\t\t" + host + " max_cores not found")
print("\t\t" + host + " switch_type not found")

try: #get os
os = dev.get("os")
Expand Down
42 changes: 35 additions & 7 deletions ansible/config_sonic_basedon_testbed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
hwsku: "{{ hwsku }}"
card_type: "{{ card_type | default('fixed') }}"
hostname: "{{ inventory_hostname | default('') }}"
start_switchid: "{{ start_switchid | default(0) }}"
switchids: "{{ switchids | default([]) }}"
when: deploy is defined and deploy|bool == true

- name: find interface name mapping and individual interface speed if defined with local data
Expand All @@ -92,7 +92,8 @@
num_asic: "{{ num_asics }}"
card_type: "{{ card_type | default('fixed') }}"
hostname: "{{ inventory_hostname | default('') }}"
start_switchid: "{{ start_switchid | default(0) }}"
switchids: "{{ switchids | default([]) }}"
slotid: "{{ slot_num | default(None) }}"
delegate_to: localhost
when: deploy is not defined or deploy|bool == false

Expand All @@ -101,20 +102,44 @@
num_fabric_asic: "{{ num_fabric_asics | default(0) }}"
asics_host_basepfx: "{{ asics_host_ip | default(None) }}"
asics_host_basepfx6: "{{ asics_host_ipv6 | default(None) }}"
delegate_to: localhost

- name: set all VoQ system ports information
set_fact:
all_sysports: "{{ all_sysports | default( [] ) + hostvars[item]['sysports'] }}"
when: hostvars[item]['sysports'] is defined
loop: "{{ ansible_play_batch }}"

- name: set all VoQ information for iBGP
- name: set all v4 Inband Ip information for iBGP chassis voq
set_fact:
all_inbands: "{{ all_inbands | default( [] ) + [ hostvars[item]['voq_inband_ip'] ] }}"
all_hostnames: "{{ all_hostnames | default( [] ) + [ item ] }}"
all_inbands: "{{ all_inbands | default( {} ) | combine( { item : hostvars[item]['voq_inband_ip']}) }}"
when: hostvars[item]['voq_inband_ip'] is defined
loop: "{{ ansible_play_batch }}"

- name: set all v6 Inband Ip information for iBGP chassis voq
set_fact:
all_inbands_ipv6: "{{ all_inbands_ipv6 | default( {} ) | combine( { item : hostvars[item]['voq_inband_ipv6']}) }}"
when: hostvars[item]['voq_inband_ipv6'] is defined
loop: "{{ ansible_play_batch }}"

- name: set all Loopback4096 information for iBGP chassis
set_fact:
all_loopback4096: "{{ all_loopback4096 | default( {} ) | combine( { item : hostvars[item]['loopback4096_ip']}) }}"
when: hostvars[item]['loopback4096_ip'] is defined
loop: "{{ ansible_play_batch }}"

- name: set all Loopback4096 ipv6 information for iBGP chassis
set_fact:
all_loopback4096_ipv6: "{{ all_loopback4096_ipv6 | default( {} ) | combine( { item : hostvars[item]['loopback4096_ipv6']}) }}"
when: hostvars[item]['loopback4096_ipv6'] is defined
loop: "{{ ansible_play_batch }}"

- name: set all slot information for chassis
set_fact:
all_slots: "{{ all_slots | default( {} ) | combine( { item : hostvars[item]['slot_num']}) }}"
when: hostvars[item]['slot_num'] is defined
loop: "{{ ansible_play_batch }}"

- name: find all enabled host_interfaces
set_fact:
host_if_indexes: "{{ vm_topo_config['host_interfaces_by_dut'][dut_index|int] | difference(vm_topo_config['disabled_host_interfaces_by_dut'][dut_index|int]) }}"
Expand All @@ -139,7 +164,7 @@
port_alias: "{{ port_alias }}"
vlan_intfs: "{{ vlan_intfs }}"
delegate_to: localhost
when: "'dualtor' in topo"
when: "'dualtor' in topo or 'cable' in topo"

- name: set default vm file path
set_fact:
Expand All @@ -153,7 +178,7 @@
- name: gather testbed VM informations
testbed_vm_info: base_vm={{ testbed_facts['vm_base'] }} topo={{ testbed_facts['topo'] }} vm_file={{ vm_file }}
delegate_to: localhost
when: "VM_topo | bool"
when: "(VM_topo | bool) and ('cable' not in topo)"

- name: find all vlan configurations for T0 topology
vlan_config:
Expand All @@ -179,18 +204,21 @@
set_fact:
interface_to_vms: "{{ interface_to_vms|default([]) + [ {'name': item.key, 'ports': item.value['interface_indexes'][dut_index|int] }] }}"
with_dict: "{{ vm_topo_config['vm'] }}"
when: "'cable' not in topo"

- name: find all interface indexes connecting to VM
set_fact:
ifindex_to_vms: "{{ ifindex_to_vms|default([]) }} + {{ item.value['interface_indexes'][dut_index|int] }}"
with_dict: "{{ vm_topo_config['vm'] }}"
when: "'cable' not in topo"

- name: find all interface names
set_fact:
intf_names: "{{ intf_names | default({}) | combine({item.0.name: intf_names[item.0.name]|default([]) + [ port_alias[item.1]] }) }}"
with_subelements:
- "{{ interface_to_vms }}"
- "ports"
when: "'cable' not in topo"

# create map of VM to asic interface names
- name: find all interface asic names
Expand Down
2 changes: 1 addition & 1 deletion ansible/group_vars/all/mux_simulator_http_port_map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mux_simulator_http_port:

# On server1
dualtor-testbed-1: 8080
dualtor-testbed-1: 8082
dualtor-testbed-2: 8082

# On server2
dualtor-testbed-3: 8080
Expand Down
Loading

0 comments on commit 8852a69

Please sign in to comment.