Skip to content

Commit

Permalink
[voq] refine eos fanout function to check fanout link oper status (so…
Browse files Browse the repository at this point in the history
  • Loading branch information
wenyiz2021 authored and AharonMalkin committed Jan 25, 2024
1 parent 6f92a87 commit 7081a4f
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions tests/common/devices/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,35 @@ def no_shutdown_multiple(self, interfaces):
return self.no_shutdown(intf_str)

def check_intf_link_state(self, interface_name):
"""
This function returns link oper status
e.g. cable not connected:
Ethernet1/1 is down, line protocol is notpresent (notconnect)
link is admin down(cable not present):
Ethernet1/1 is administratively down, line protocol is notpresent (disabled)
link is admin down(cable present):
Ethernet2/1 is administratively down, line protocol is down (disabled)
link is admin up&oper up:
Ethernet2/1 is up, line protocol is up (connected)
link is admin up&oper down:
Ethernet2/1 is down, line protocol is down (notconnect)
In conclusion:
connected = admin up & oper up
disabled = admin down
notconnect= admin up & oper down
"""
show_int_result = self.eos_command(
commands=['show interface %s' % interface_name])
return 'Up' in show_int_result['stdout_lines'][0]
commands=['show interface %s | json' % interface_name])
int_status = show_int_result['stdout'][0]['interfaces'][interface_name]['interfaceStatus']
return int_status == 'connected'

def links_status_down(self, ports):
show_int_result = self.eos_command(commands=['show interface status'])
for output_line in show_int_result['stdout_lines'][0]:
"""
Note:
(Pdb) output_line
u'Et33/1 str2-7804-lc6-1-Ethernet0 notconnect 1134 full 100G 100GBASE-CR4
u'Et33/1 lc-1-Ethernet0 notconnect 1134 full 100G 100GBASE-CR4
e.g.
(Pdb) output_line.split(' ')[0]
u'Et1/1'
Expand All @@ -138,7 +156,7 @@ def links_status_up(self, ports):
"""
Note:
(Pdb) output_line
u'Et33/1 str2-7804-lc6-1-Ethernet0 notconnect 1134 full 100G 100GBASE-CR4
u'Et33/1 lc-1-Ethernet0 notconnect 1134 full 100G 100GBASE-CR4
e.g.
(Pdb) output_line.split(' ')[0]
u'Et1/1'
Expand Down

0 comments on commit 7081a4f

Please sign in to comment.