Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ansible/ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ callback_whitelist = profile_tasks
# current IP information.
fact_caching = jsonfile
fact_caching_connection = ~/.ansible/cache
fact_caching_timeout = 1200
fact_caching_timeout = 86400


# retry files
Expand Down
96 changes: 96 additions & 0 deletions ansible/group_vars/sonic/sku-sensors-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2279,3 +2279,99 @@ sensors_checks:
temp: []

psu_skips: {}

Arista-7260CX3-Q64:
alarms:
fan:
- pmbus-i2c-3-58/fan1/fan1_alarm
- pmbus-i2c-4-58/fan1/fan1_alarm
- pmbus-i2c-3-58/fan1/fan1_fault
- pmbus-i2c-4-58/fan1/fan1_fault
- la_cpld-i2c-85-60/fan1/fan1_fault
- la_cpld-i2c-85-60/fan2/fan2_fault
- la_cpld-i2c-85-60/fan3/fan3_fault
- la_cpld-i2c-85-60/fan4/fan4_fault
power:
- pmbus-i2c-3-58/iin/curr1_max_alarm
- pmbus-i2c-3-58/iout1/curr2_max_alarm
- pmbus-i2c-3-58/iout1/curr2_crit_alarm
- pmbus-i2c-3-58/iout2/curr3_crit_alarm
- pmbus-i2c-3-58/vin/in1_alarm
- pmbus-i2c-3-58/vout1/in2_lcrit_alarm
- pmbus-i2c-3-58/vout1/in2_crit_alarm
- pmbus-i2c-4-58/iin/curr1_max_alarm
- pmbus-i2c-4-58/iout1/curr2_max_alarm
- pmbus-i2c-4-58/iout1/curr2_crit_alarm
- pmbus-i2c-4-58/iout2/curr3_crit_alarm
- pmbus-i2c-4-58/vin/in1_alarm
- pmbus-i2c-4-58/vout1/in2_lcrit_alarm
- pmbus-i2c-4-58/vout1/in2_crit_alarm
temp:
- coretemp-isa-0000/Physical id 0/temp1_crit_alarm
- coretemp-isa-0000/Core 0/temp2_crit_alarm
- coretemp-isa-0000/Core 1/temp3_crit_alarm
- lm73-i2c-88-48/Front panel temp sensor/temp1_min_alarm
- lm73-i2c-88-48/Front panel temp sensor/temp1_max_alarm
- max6658-i2c-1-4c/Asic temp sensor/temp1_min_alarm
- max6658-i2c-1-4c/Asic temp sensor/temp1_max_alarm
- max6658-i2c-1-4c/Asic temp sensor/temp1_crit_alarm
- max6658-i2c-73-4c/Back panel temp sensor 1/temp1_min_alarm
- max6658-i2c-73-4c/Back panel temp sensor 1/temp1_max_alarm
- max6658-i2c-73-4c/Back panel temp sensor 1/temp1_crit_alarm
- max6658-i2c-73-4c/Back panel temp sensor 2/temp2_min_alarm
- max6658-i2c-73-4c/Back panel temp sensor 2/temp2_max_alarm
- max6658-i2c-73-4c/Back panel temp sensor 2/temp2_crit_alarm
- max6658-i2c-73-4c/Back panel temp sensor 2/temp2_fault
- pmbus-i2c-3-58/Power supply 1 exhaust temp sensor/temp3_alarm
- pmbus-i2c-3-58/Power supply 1 inlet temp sensor/temp2_alarm
- pmbus-i2c-3-58/Power supply 1 hotspot sensor/temp1_alarm
- pmbus-i2c-4-58/Power supply 2 exhaust temp sensor/temp3_alarm
- pmbus-i2c-4-58/Power supply 2 inlet temp sensor/temp2_alarm
- pmbus-i2c-4-58/Power supply 2 hotspot sensor/temp1_alarm

compares:
fan: []
power:
- - pmbus-i2c-3-58/iin/curr1_input
- pmbus-i2c-3-58/iin/curr1_max
- - pmbus-i2c-3-58/iout1/curr2_input
- pmbus-i2c-3-58/iout1/curr2_max
- - pmbus-i2c-4-58/iin/curr1_input
- pmbus-i2c-4-58/iin/curr1_max
- - pmbus-i2c-4-58/iout1/curr2_input
- pmbus-i2c-4-58/iout1/curr2_max
temp:
- - coretemp-isa-0000/Physical id 0/temp1_input
- coretemp-isa-0000/Physical id 0/temp1_max
- - coretemp-isa-0000/Core 0/temp2_input
- coretemp-isa-0000/Core 0/temp2_max
- - coretemp-isa-0000/Core 1/temp3_input
- coretemp-isa-0000/Core 1/temp3_max
- - lm73-i2c-88-48/Front panel temp sensor/temp1_input
- lm73-i2c-88-48/Front panel temp sensor/temp1_max
- - max6658-i2c-1-4c/Asic temp sensor/temp1_input
- max6658-i2c-1-4c/Asic temp sensor/temp1_max
- - max6658-i2c-73-4c/Back panel temp sensor 1/temp1_input
- max6658-i2c-73-4c/Back panel temp sensor 1/temp1_max
- - max6658-i2c-73-4c/Back panel temp sensor 2/temp2_input
- max6658-i2c-73-4c/Back panel temp sensor 2/temp2_max

non_zero:
fan:
- pmbus-i2c-3-58/fan1/fan1_input
- pmbus-i2c-4-58/fan1/fan1_input
- la_cpld-i2c-85-60/fan1/fan1_input
- la_cpld-i2c-85-60/fan2/fan2_input
- la_cpld-i2c-85-60/fan3/fan3_input
- la_cpld-i2c-85-60/fan4/fan4_input
power:
- pmbus-i2c-4-58/pin/power1_input
- pmbus-i2c-4-58/pout1/power2_input
- pmbus-i2c-4-58/pout2/power3_input
- pmbus-i2c-3-58/pin/power1_input
- pmbus-i2c-3-58/pout1/power2_input
- pmbus-i2c-3-58/pout2/power3_input
temp:
- pch_haswell-virtual-0/temp1/temp1_input

psu_skips: {}
8 changes: 6 additions & 2 deletions ansible/library/extract_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@
from datetime import datetime
from ansible.module_utils.basic import *

from pprint import pprint


def extract_lines(directory, filename, target_string):
path = os.path.join(directory, filename)
Expand All @@ -100,6 +98,7 @@ def extract_lines(directory, filename, target_string):

return result


def extract_number(s):
"""Extracts number from string, if not number found returns 0"""
ns = re.findall(r'\d+', s)
Expand All @@ -112,6 +111,10 @@ def extract_number(s):
def convert_date(s):
dt = None
re_result = re.findall(r'^\S{3}\s{1,2}\d{1,2} \d{2}:\d{2}:\d{2}\.?\d*', s)
# Workaround for pytest-ansible
loc = locale.getlocale()
locale.setlocale(locale.LC_ALL, (None, None))

if len(re_result) > 0:
str_date = re_result[0]
try:
Expand All @@ -122,6 +125,7 @@ def convert_date(s):
re_result = re.findall(r'^\d{4}-\d{2}-\d{2}\.\d{2}:\d{2}:\d{2}\.\d{6}', s)
str_date = re_result[0]
dt = datetime.strptime(str_date, '%Y-%m-%d.%X.%f')
locale.setlocale(locale.LC_ALL, loc)

return dt

Expand Down
3 changes: 3 additions & 0 deletions ansible/roles/eos/handlers/common_handlers/update_state.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
- name: Reboot the VM
command: /sbin/shutdown -r now "Ansible updates triggered"
async: 300
poll: 0
ignore_errors: true

- name: Wait for VM to shutdown
wait_for:
Expand Down
19 changes: 17 additions & 2 deletions ansible/roles/test/files/acstests/everflow_policer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,16 @@ def checkMirroredFlow(self):
"""
@summary: Send traffic & check how many mirrored packets are received
@return: count: number of mirrored packets received

Note:
Mellanox crafts the GRE packets with extra information:
That is: 22 bytes extra information after the GRE header
"""
payload = self.base_pkt
if self.asic_type in ["mellanox"]:
import binascii
payload = binascii.unhexlify("0"*44) + str(payload) # Add the padding

exp_pkt = testutils.simple_gre_packet(
eth_src = self.router_mac,
ip_src = self.session_src_ip,
Expand All @@ -109,15 +118,21 @@ def checkMirroredFlow(self):
ip_id = 0,
#ip_flags = 0x10, # need to upgrade ptf version to support it
ip_ttl = self.session_ttl,
inner_frame = self.base_pkt)
inner_frame = payload)

exp_pkt['GRE'].proto = 0x88be
if self.asic_type in ["mellanox"]:
exp_pkt['GRE'].proto = 0x8949 # Mellanox specific
else:
exp_pkt['GRE'].proto = 0x88be

masked_exp_pkt = Mask(exp_pkt)
masked_exp_pkt.set_do_not_care_scapy(scapy.Ether, "dst")
masked_exp_pkt.set_do_not_care_scapy(scapy.IP, "flags")
masked_exp_pkt.set_do_not_care_scapy(scapy.IP, "chksum")

if self.asic_type in ["mellanox"]:
masked_exp_pkt.set_do_not_care(304, 176) # Mask the Mellanox specific inner header

self.dataplane.flush()

count = 0
Expand Down
61 changes: 49 additions & 12 deletions ansible/roles/test/files/ptftests/advanced-reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,16 +319,16 @@ def get_portchannel_info(self):
for member in content[key]['members']:
for vm_key in self.vm_dut_map.keys():
if member in self.vm_dut_map[vm_key]['dut_ports']:
self.vm_dut_map[vm_key]['dut_portchannel'] = key
self.vm_dut_map[vm_key]['dut_portchannel'] = str(key)
self.vm_dut_map[vm_key]['neigh_portchannel'] = 'Port-Channel1'
break

def get_neigh_port_info(self):
content = self.read_json('neigh_port_info')
for key in content.keys():
if content[key]['name'] in self.vm_dut_map.keys():
self.vm_dut_map[content[key]['name']]['dut_ports'].append(key)
self.vm_dut_map[content[key]['name']]['neigh_ports'].append(content[key]['port'])
self.vm_dut_map[content[key]['name']]['dut_ports'].append(str(key))
self.vm_dut_map[content[key]['name']]['neigh_ports'].append(str(content[key]['port']))
self.vm_dut_map[content[key]['name']]['ptf_ports'].append(self.port_indices[key])

def build_peer_mapping(self):
Expand All @@ -355,6 +355,30 @@ def populate_fail_info(self, fails):
self.fails[key] = set()
self.fails[key] |= fails[key]

def get_preboot_info(self):
'''
Prepares the msg string to log when a preboot_oper is defined.
preboot_oper can be represented in the following ways
eg. 'preboot_oper' - a single VM will be selected and preboot_oper will be applied to it
'neigh_bgp_down:2' - 2 VMs will be selected and preboot_oper will be applied to the selected 2 VMs
'neigh_lag_member_down:3:1' - this case is used for lag member down operation only. This indicates that
3 VMs will be selected and 1 of the lag members in the porchannel will be brought down
'''
msg = ''
if self.preboot_oper:
msg = 'Preboot oper: %s ' % self.preboot_oper
if ':' in self.preboot_oper:
oper_list = self.preboot_oper.split(':')
msg = 'Preboot oper: %s ' % oper_list[0] # extract the preboot oper_type
if len(oper_list) > 2:
# extract the number of VMs and the number of LAG members. preboot_oper will be of the form oper:no of VMS:no of lag members
msg += 'Number of sad path VMs: %s Lag member down in a portchannel: %s' % (oper_list[-2], oper_list[-1])
else:
# extract the number of VMs. preboot_oper will be of the form oper:no of VMS
msg += 'Number of sad path VMs: %s' % oper_list[-1]

return msg

def setUp(self):
self.fails['dut'] = set()
self.port_indices = self.read_port_indices()
Expand Down Expand Up @@ -427,13 +451,7 @@ def setUp(self):
self.generate_arp_ping_packet()

if self.reboot_type == 'warm-reboot':
# get the number of members down for sad path
if self.preboot_oper:
if ':' in self.preboot_oper:
oper_type, cnt = self.preboot_oper.split(':')
else:
oper_type, cnt = self.preboot_oper, 1
self.log("Preboot Oper: %s Number down: %s" % (oper_type, cnt))
self.log(self.get_preboot_info())

# Pre-generate list of packets to be sent in send_in_background method.
generate_start = datetime.datetime.now()
Expand Down Expand Up @@ -777,15 +795,19 @@ def wait_for_ssh_threads():
if self.reboot_type == 'fast-reboot' and no_cp_replies < 0.95 * self.nr_vl_pkts:
self.fails['dut'].add("Dataplane didn't route to all servers, when control-plane was down: %d vs %d" % (no_cp_replies, self.nr_vl_pkts))

if self.reboot_type == 'warm-reboot' and self.preboot_oper is not None:
if self.pre_handle is not None:
if self.reboot_type == 'warm-reboot':
if self.preboot_oper is not None and self.pre_handle is not None:
self.log("Postboot checks:")
log_info, fails = self.pre_handle.verify(pre_check=False)
self.populate_fail_info(fails)
for log in log_info:
self.log(log)
self.log(" ")

else:
# verify there are no interface flaps after warm boot
self.neigh_lag_status_check()

except Exception as e:
self.fails['dut'].add(e)
finally:
Expand Down Expand Up @@ -864,6 +886,21 @@ def wait_for_ssh_threads():

self.assertTrue(is_good, errors)

def neigh_lag_status_check(self):
"""
Ensure there are no interface flaps after warm-boot
"""
for neigh in self.ssh_targets:
self.neigh_handle = Arista(neigh, None, self.test_params)
self.neigh_handle.connect()
fails, flap_cnt = self.neigh_handle.verify_neigh_lag_no_flap()
self.neigh_handle.disconnect()
self.fails[neigh] |= fails
if not flap_cnt:
self.log("No LAG flaps seen on %s after warm boot" % neigh)
else:
self.fails[neigh].add("LAG flapped %s times on %s after warm boot" % (flap_cnt, neigh))

def extract_no_cpu_replies(self, arr):
"""
This function tries to extract number of replies from dataplane, when control plane is non working
Expand Down
35 changes: 30 additions & 5 deletions ansible/roles/test/files/ptftests/arista.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ def run(self):
sample["po_changetime"] = json.loads(portchannel_output, strict=False)['interfaces']['Port-Channel1']['lastStatusChangeTimestamp']

if not run_once:
# clear Portchannel counters
self.do_cmd("clear counters Port-Channel 1")

self.ipv4_gr_enabled, self.ipv6_gr_enabled, self.gr_timeout = self.parse_bgp_neighbor_once(bgp_neig_output)
if self.gr_timeout is not None:
log_first_line = "session_begins_%f" % cur_time
Expand Down Expand Up @@ -393,18 +396,23 @@ def verify_bgp_neigh_state(self, dut=None, state="Active"):
self.fails.add('Verify BGP %s neighbor: Object missing in output' % ver)
return self.fails, bgp_state

def change_neigh_lag_state(self, lag, is_up=True):
def change_neigh_lag_state(self, intf, is_up=True):
state = ['shut', 'no shut']
self.do_cmd('configure')
is_match = re.match('(Port-Channel|Ethernet)\d+', lag)
is_match = re.match('(Port-Channel|Ethernet)\d+', intf)
if is_match:
output = self.do_cmd('interface %s' % lag)
output = self.do_cmd('interface %s' % intf)
if 'Invalid' not in output:
self.do_cmd(state[is_up])
self.do_cmd('exit')
self.do_cmd('exit')
self.do_cmd('exit')

def change_neigh_intfs_state(self, intfs, is_up=True):
for intf in intfs:
self.change_neigh_lag_state(intf, is_up=is_up)

def verify_neigh_lag_state(self, lag, state="connected", pre_check=True):
states = state.split(',')
lag_state = False
msg_prefix = ['Postboot', 'Preboot']
is_match = re.match('(Port-Channel|Ethernet)\d+', lag)
Expand All @@ -415,14 +423,31 @@ def verify_neigh_lag_state(self, lag, state="connected", pre_check=True):
obj = json.loads(data)

if 'interfaces' in obj and lag in obj['interfaces']:
lag_state = (obj['interfaces'][lag]['interfaceStatus'] == state)
lag_state = (obj['interfaces'][lag]['interfaceStatus'] in states)
else:
self.fails.add('%s: Verify LAG %s: Object missing in output' % (msg_prefix[pre_check], lag))
return self.fails, lag_state

self.fails.add('%s: Invalid interface name' % msg_prefix[pre_check])
return self.fails, lag_state

def verify_neigh_lag_no_flap(self):
flap_cnt = sys.maxint
output = self.do_cmd('show interfaces Po1 | json')
if 'Invalid' not in output:
data = '\n'.join(output.split('\r\n')[1:-1])
obj = json.loads(data)

if 'interfaces' in obj and 'Port-Channel1' in obj['interfaces']:
intf_cnt_info = obj['interfaces']['Port-Channel1']['interfaceCounters']
flap_cnt = intf_cnt_info['linkStatusChanges']
else:
self.fails.add('Object missing in output for Port-Channel1')
return self.fails, flap_cnt

self.fails.add('Invalid interface name - Po1')
return self.fails, flap_cnt

def check_gr_peer_status(self, output):
# [0] True 'ipv4_gr_enabled', [1] doesn't matter 'ipv6_enabled', [2] should be >= 120
if not self.ipv4_gr_enabled:
Expand Down
1 change: 0 additions & 1 deletion ansible/roles/test/files/ptftests/fib.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
]

EXCLUDE_IPV6_PREFIXES = [
'::/0', # Currently no IPv6 default route
'::/128', # Unspecified RFC 4291
'::1/128', # Loopback RFC 4291
'ff00::/8' # Multicast RFC 4291
Expand Down
Loading