2020DEFAULT_BUILD_ARGS = '-DCMAKE_BUILD_TYPE=Release -DFORCE_DEBUG_INFO=True -DENABLE_UHD=False -DENABLE_DPDK=True -DENABLE_ZEROMQ=False -DMARCH="x86-64-v4"'
2121DEFAULT_DPDK_VERSION = "23.11.1_avx512"
2222
23+
2324# pylint: disable=too-many-instance-attributes
2425@dataclass
2526class _TestDefinition :
26- """
27- """
27+ """ """
2828
29- campaign_filename : str = ""
3029 id : str = ""
30+ campaign_filename : str = ""
31+ test_name : str = ""
3132 description : str = ""
3233
34+
3335# pylint: disable=too-many-instance-attributes
3436@dataclass
3537class _ArgsDefinition :
36- """
37- """
38+ """ """
3839
3940 testlist : bool = False
4041 token : str = ""
@@ -46,20 +47,25 @@ class _ArgsDefinition:
4647 build_args : str = DEFAULT_BUILD_ARGS
4748 dpdk_version : str = DEFAULT_DPDK_VERSION
4849
50+
4951def get_viavi_tests ():
50- viavi_test_declaration = (pathlib .Path (__file__ ).parent / '..' / 'tests' / 'e2e' / 'tests' / 'viavi' / 'test_declaration.yml' ).resolve ()
51- with open (viavi_test_declaration , 'r' ) as file :
52+ viavi_test_declaration = (
53+ pathlib .Path (__file__ ).parent / ".." / "tests" / "e2e" / "tests" / "viavi" / "test_declaration.yml"
54+ ).resolve ()
55+ with open (viavi_test_declaration , "r" , encoding = "utf-8" ) as file :
5256 data = yaml .safe_load (file )
5357
54- test_list : List [_TestDefinition ] = []
55- for test in data [' tests' ]:
58+ test_list : List [_TestDefinition ] = []
59+ for test in data [" tests" ]:
5660 test_definition = _TestDefinition ()
57- test_definition .campaign_filename = test ['campaign_filename' ]
58- test_definition .id = test ['id' ]
59- test_definition .description = test .get ('description' , '' )
61+ test_definition .id = test ["id" ]
62+ test_definition .campaign_filename = test ["campaign_filename" ]
63+ test_definition .test_name = test ["test_name" ]
64+ test_definition .description = test .get ("description" , "" )
6065 test_list .append (test_definition )
6166 return test_list
6267
68+
6369def validate_args (args ) -> _ArgsDefinition :
6470 args_definition = _ArgsDefinition ()
6571 args_definition .testlist = args .testlist
@@ -87,6 +93,7 @@ def validate_args(args) -> _ArgsDefinition:
8793 exit (1 )
8894 return args_definition
8995
96+
9097def show_test_list ():
9198 test_list = get_viavi_tests ()
9299 print ("Available tests:" )
@@ -114,7 +121,7 @@ def run_test(args_definition: _ArgsDefinition, test_definition: _TestDefinition)
114121 TESTBED = "viavi"
115122 MARKERS = "viavi_manual"
116123
117- PYARGS = f'--viavi-manual-campaign-filename "{ test_definition .campaign_filename } " --viavi-manual-test-name "{ test_definition .id } " --viavi-manual-test-timeout { timeout } --retina-pod-timeout 900'
124+ PYARGS = f'--viavi-manual-campaign-filename "{ test_definition .campaign_filename } " --viavi-manual-test-name "{ test_definition .test_name } " --viavi-manual-test-timeout { timeout } --retina-pod-timeout 900'
118125 if args_definition .gnb_extra :
119126 PYARGS += f' --viavi-manual-extra-gnb-arguments "{ args_definition .gnb_extra } "'
120127
@@ -153,6 +160,8 @@ def run_test(args_definition: _ArgsDefinition, test_definition: _TestDefinition)
153160 pipeline_url = pipeline .web_url
154161
155162 print (f"Pipeline created: { pipeline_url } " )
163+
164+
156165def main ():
157166 """
158167 Entrypoint runner.
@@ -173,7 +182,7 @@ def main():
173182
174183 parser .add_argument (
175184 "--testid" ,
176- help = ' [REQUIRED] Testid in the campaign.' ,
185+ help = " [REQUIRED] Testid in the campaign." ,
177186 )
178187
179188 parser .add_argument (
@@ -194,9 +203,7 @@ def main():
194203 default = DEFAULT_DPDK_VERSION ,
195204 )
196205
197- parser .add_argument (
198- "--timeout" , help = "Timeout in seconds for the test"
199- )
206+ parser .add_argument ("--timeout" , help = "Timeout in seconds for the test" )
200207
201208 args_definition = validate_args (parser .parse_args ())
202209 if args_definition .testlist :
@@ -211,5 +218,6 @@ def main():
211218 print (f"Testid { args_definition .testid } not found." )
212219 exit (1 )
213220
221+
214222if __name__ == "__main__" :
215223 main ()
0 commit comments