@@ -742,47 +742,6 @@ def setup_dut_ports(
742
742
return config , port_config_list , snappi_ports
743
743
744
744
745
- @pytest .fixture (scope = "function" )
746
- def get_multidut_snappi_ports (duthosts , conn_graph_facts , fanout_graph_facts ): # noqa: F811
747
- """
748
- Populate tgen ports and connected DUT ports info of T0 testbed and returns as a list
749
- Args:
750
- duthost (pytest fixture): duthost fixture
751
- conn_graph_facts (pytest fixture): connection graph
752
- fanout_graph_facts (pytest fixture): fanout graph
753
- Return:
754
- return tuple of duts and tgen ports
755
- """
756
- def _get_multidut_snappi_ports (line_card_choice , line_card_info ):
757
- host_names = line_card_info ['hostname' ]
758
- asic_info = line_card_info ['asic' ]
759
- asic_port_map = {
760
- "asic0" : ['Ethernet%d' % i for i in range (0 , 72 , 4 )],
761
- "asic1" : ['Ethernet%d' % i for i in range (72 , 144 , 4 )],
762
- None : ['Ethernet%d' % i for i in range (0 , 144 , 4 )],
763
- }
764
- ports = []
765
- for index , host in enumerate (duthosts ):
766
- snappi_fanout_list = SnappiFanoutManager (fanout_graph_facts )
767
- for i in range (len (snappi_fanout_list .fanout_list )):
768
- try :
769
- snappi_fanout_list .get_fanout_device_details (i )
770
- except Exception :
771
- pass
772
- snappi_ports = snappi_fanout_list .get_ports (peer_device = host .hostname )
773
- for port in snappi_ports :
774
- port ['location' ] = get_snappi_port_location (port )
775
- for hostname in host_names :
776
- for asic in asic_info :
777
- if port ["peer_port" ] in asic_port_map [asic ] and hostname in port ['peer_device' ]:
778
- port ['asic_value' ] = asic
779
- port ['asic_type' ] = host .facts ["asic_type" ]
780
- port ['duthost' ] = host
781
- ports .append (port )
782
- return ports
783
- return _get_multidut_snappi_ports
784
-
785
-
786
745
def get_tgen_peer_ports (snappi_ports , hostname ):
787
746
ports = [(port ['location' ], port ['peer_port' ]) for port in snappi_ports if port ['peer_device' ] == hostname ]
788
747
return ports
@@ -939,85 +898,6 @@ def __intf_config_multidut(config, port_config_list, duthost, snappi_ports, setu
939
898
return True
940
899
941
900
942
- def get_multidut_tgen_peer_port_set (line_card_choice , ports , config_set , number_of_tgen_peer_ports = 2 ):
943
- """
944
- Configures interfaces of the DUT
945
- Args:
946
- line_card_choice (obj): Line card type defined by the variable file
947
- ports (list): list of Snappi port configuration information
948
- config_set: Comprises of linecard configuration type and asic values
949
- number_of_tgen_peer_ports: number of ports needed for the test
950
- Returns:
951
- The ports for the respective line card choice from the testbed file
952
- """
953
- linecards = {}
954
- try :
955
- from itertools import product
956
- from itertools import izip_longest as zip_longest
957
- except ImportError :
958
- from itertools import zip_longest
959
-
960
- for port in ports :
961
- if port ['peer_device' ] in linecards :
962
- if port ['asic_value' ] not in linecards [port ['peer_device' ]]:
963
- linecards [port ['peer_device' ]][port ['asic_value' ]] = []
964
- else :
965
- linecards [port ['peer_device' ]] = {}
966
- linecards [port ['peer_device' ]][port ['asic_value' ]] = []
967
- linecards [port ['peer_device' ]][port ['asic_value' ]].append (port )
968
-
969
- if len (ports ) < number_of_tgen_peer_ports or not linecards :
970
- raise Exception ("Not Enough ports " )
971
- peer_ports = []
972
- if line_card_choice in ['chassis_single_line_card_single_asic' , 'non_chassis_single_line_card' ]:
973
- # same asic ports required
974
- for line_card , asics in linecards .items ():
975
- for asic , asic_info in asics .items ():
976
- if config_set [line_card_choice ]['asic' ][0 ] == asic :
977
- if len (asic_info ) >= number_of_tgen_peer_ports :
978
- peer_ports = list (random .sample (asic_info , number_of_tgen_peer_ports ))
979
- return peer_ports
980
- else :
981
- raise Exception (
982
- 'Error: Not enough ports for line card "%s" and asic "%s"' % (line_card_choice , asic ))
983
- elif line_card_choice in ['chassis_single_line_card_multi_asic' ]:
984
- # need 2 asic minimum one port from each asic
985
- for line_card , asics in linecards .items ():
986
- if len (asics .keys ()) >= 2 :
987
- peer_ports = list (zip_longest (* asics .values ()))
988
- peer_ports = [item for sublist in peer_ports for item in sublist ]
989
- peer_ports = list (filter (None , peer_ports ))
990
- return peer_ports [:number_of_tgen_peer_ports ]
991
- else :
992
- raise Exception ('Error: Invalid line_card_choice or Not enough ports' )
993
-
994
- elif line_card_choice in ['chassis_multi_line_card_single_asic' , 'non_chassis_multi_line_card' ]:
995
- # DIfferent line card and minimum one port from same same asic number
996
- if len (linecards .keys ()) >= 2 :
997
- common_asic_across_line_cards = set (linecards [next (iter (linecards ))].keys ())
998
- for d in linecards .values ():
999
- common_asic_across_line_cards .intersection_update (set (d .keys ()))
1000
- for asic in common_asic_across_line_cards :
1001
- peer_ports = [linecards [line_card ][asic ] for line_card in linecards .keys ()]
1002
- peer_ports = list (zip (* peer_ports ))
1003
- peer_ports = [item for sublist in peer_ports for item in sublist ]
1004
- return peer_ports [:number_of_tgen_peer_ports ]
1005
- else :
1006
- raise Exception ('Error: Not enough line_card_choice' )
1007
-
1008
- elif line_card_choice in ['chassis_multi_line_card_multi_asic' ]:
1009
- # Different line card and minimum one port from different asic number
1010
- if len (linecards .keys ()) >= 2 :
1011
- host_asic = list (product (config_set [line_card_choice ]['hostname' ], config_set [line_card_choice ]['asic' ]))
1012
- peer_ports = list (zip_longest (* [linecards [host ][asic ]
1013
- for host , asic in host_asic if asic in linecards [host ]]))
1014
- peer_ports = [item for sublist in peer_ports for item in sublist ]
1015
- peer_ports = list (filter (None , peer_ports ))
1016
- return peer_ports [:number_of_tgen_peer_ports ]
1017
- else :
1018
- raise Exception ('Error: Not enough line_card_choice' )
1019
-
1020
-
1021
901
def create_ip_list (value , count , mask = 32 , incr = 0 ):
1022
902
'''
1023
903
Create a list of ips based on the count provided
0 commit comments