Skip to content

Commit

Permalink
add dx010 config
Browse files Browse the repository at this point in the history
Signed-off-by: richardyu-ms <[email protected]>
  • Loading branch information
richardyu-ms committed Jun 19, 2022
1 parent fbe3c4f commit 385152f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 13 deletions.
23 changes: 10 additions & 13 deletions test/sai_test/config/port_configer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def t0_port_config_helper(test_obj, is_recreate_bridge=True, is_create_hostIf=Tr
default_trap_group = attr['default_trap_group']

port_list = configer.get_port_list()
configer.turn_on_port_admin_state(port_list)
configer.turn_up_and_check_ports(port_list)
default_1q_bridge_id = configer.get_default_1q_bridge()
bridge_port_list = configer.get_bridge_port_list(default_1q_bridge_id)
Expand All @@ -70,8 +71,6 @@ def t0_port_config_helper(test_obj, is_recreate_bridge=True, is_create_hostIf=Tr
test_obj.host_intf_table_id = host_intf_table_id
test_obj.hostif_list = hostif_list

configer.turn_on_port_admin_state(port_list)

test_obj.dev_port_list = dev_port_list
test_obj.portConfigs = portConfigs
test_obj.default_trap_group = default_trap_group
Expand Down Expand Up @@ -357,7 +356,7 @@ def turn_on_port_admin_state(self, port_list):
print("Set port...")
for i, port in enumerate(port_list):
sai_thrift_set_port_attribute(
self.client, port_oid=port, mtu=PORT_MTU, admin_state=True)
self.client, port_oid=port, mtu=PORT_MTU, admin_state=True, fec_mode=SAI_PORT_FEC_MODE_RS)

def turn_up_and_check_ports(self, port_list):
'''
Expand All @@ -370,23 +369,21 @@ def turn_up_and_check_ports(self, port_list):

# For brcm devices, need to init and setup the ports at once after start the switch.
retries = 10
for port_id in port_list:
try:
sai_thrift_set_port_attribute(
self.client, port_oid=port_id, admin_state=True)
except BaseException as e:
print("Cannot setup port admin state, error {}".format(e))

for num_of_tries in range(retries):
all_ports_are_up = True
time.sleep(1)
for port_id in port_list:
port_attr = sai_thrift_get_port_attribute(
self.client, port_id, oper_status=True)
port_attr = sai_thrift_get_port_attribute(self.client, port_id, oper_status=True)
if port_attr['oper_status'] != SAI_PORT_OPER_STATUS_UP:
all_ports_are_up = False
time.sleep(1)
print("port is down: {}".format(port_attr['oper_status']))
print("port {} is down, status: {}. Reset Admin State.".format(port_id, port_attr['oper_status']))
sai_thrift_set_port_attribute(
self.client,
port_oid=port_id,
mtu=PORT_MTU,
admin_state=True,
fec_mode=SAI_PORT_FEC_MODE_RS)
if all_ports_are_up:
print("Retry {} times turn up port.".format(num_of_tries))
break
Expand Down
33 changes: 33 additions & 0 deletions test/sai_test/resources/dx010-port_config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# name lanes alias speed index
Ethernet0 65,66,67,68 etp1 100000 1
Ethernet4 69,70,71,72 etp2 100000 2
Ethernet8 73,74,75,76 etp3 100000 3
Ethernet12 77,78,79,80 etp4 100000 4
Ethernet16 33,34,35,36 etp5 100000 5
Ethernet20 37,38,39,40 etp6 100000 6
Ethernet24 41,42,43,44 etp7 100000 7
Ethernet28 45,46,47,48 etp8 100000 8
Ethernet32 49,50,51,52 etp9 100000 9
Ethernet36 53,54,55,56 etp10 100000 10
Ethernet40 57,58,59,60 etp11 100000 11
Ethernet44 61,62,63,64 etp12 100000 12
Ethernet48 81,82,83,84 etp13 100000 13
Ethernet52 85,86,87,88 etp14 100000 14
Ethernet56 89,90,91,92 etp15 100000 15
Ethernet60 93,94,95,96 etp16 100000 16
Ethernet64 97,98,99,100 etp17 100000 17
Ethernet68 101,102,103,104 etp18 100000 18
Ethernet72 105,106,107,108 etp19 100000 19
Ethernet76 109,110,111,112 etp20 100000 20
Ethernet80 1,2,3,4 etp21 100000 21
Ethernet84 5,6,7,8 etp22 100000 22
Ethernet88 9,10,11,12 etp23 100000 23
Ethernet92 13,14,15,16 etp24 100000 24
Ethernet96 17,18,19,20 etp25 100000 25
Ethernet100 21,22,23,24 etp26 100000 26
Ethernet104 25,26,27,28 etp27 100000 27
Ethernet108 29,30,31,32 etp28 100000 28
Ethernet112 113,114,115,116 etp29 100000 29
Ethernet116 117,118,119,120 etp30 100000 30
Ethernet120 121,122,123,124 etp31 100000 31
Ethernet124 125,126,127,128 etp32 100000 32

0 comments on commit 385152f

Please sign in to comment.