@@ -140,6 +140,8 @@ parser.add_argument('--configtest', help='Execute load/commit config tests',
140140 action = 'store_true' , default = False )
141141parser .add_argument ('--tpmtest' , help = 'Execute TPM encrypted config tests' ,
142142 action = 'store_true' , default = False )
143+ parser .add_argument ('--ifnametest' , help = 'Execute interface naming/hw-id persistence tests' ,
144+ action = 'store_true' , default = False )
143145parser .add_argument ('--sbtest' , help = 'Execute Secure Boot tests' ,
144146 action = 'store_true' , default = False )
145147parser .add_argument ('--cloud-init' , help = 'Execute cloud-init tests' ,
@@ -387,6 +389,8 @@ if args.test_image_update:
387389 _primary_modes .append ('--test-image-update' )
388390if args .tpmtest :
389391 _primary_modes .append ('--tpmtest' )
392+ if args .ifnametest :
393+ _primary_modes .append ('--ifnametest' )
390394if args .raid :
391395 _primary_modes .append ('--raid' )
392396if args .smoketest :
@@ -397,8 +401,8 @@ if args.sbtest:
397401 _primary_modes .append ('--sbtest' )
398402if len (_primary_modes ) > 1 :
399403 log .error ('Incompatible combination of testcase flags (%s): only one of '
400- '--cloud-init, --test-image-update, --tpmtest, --raid , --smoketest , '
401- '--configtest, --sbtest may be set.' , ', ' .join (_primary_modes ))
404+ '--cloud-init, --test-image-update, --tpmtest, --ifnametest , --raid , '
405+ '--smoketest, -- configtest, --sbtest may be set.' , ', ' .join (_primary_modes ))
402406 sys .exit (1 )
403407
404408if args .no_interfaces and not args .smoketest :
@@ -1304,6 +1308,34 @@ try:
13041308 c .sendline ('exit' )
13051309 c .expect (op_mode_prompt )
13061310
1311+ elif args .ifnametest :
1312+ # A missing/deleted hw-id binding, or a fully deleted interface
1313+ # config, must not change the eth0..eth7 <-> MAC mapping after
1314+ # the next reboot (regression check for the boot-time naming race).
1315+ log .info ('Running interface naming/hw-id persistence tests' )
1316+ del_idx , hwid_idx = random .sample (range (8 ), 2 )
1317+ log .info (f'Deleting eth{ del_idx } entirely, removing hw-id only on eth{ hwid_idx } ' )
1318+
1319+ c .sendline ('configure' )
1320+ c .expect (cfg_mode_prompt )
1321+ c .sendline (f'delete interfaces ethernet eth{ del_idx } ' )
1322+ c .expect (cfg_mode_prompt )
1323+ c .sendline (f'delete interfaces ethernet eth{ hwid_idx } hw-id' )
1324+ c .expect (cfg_mode_prompt )
1325+ c .sendline ('commit' )
1326+ c .expect (cfg_mode_prompt )
1327+ c .sendline ('save' )
1328+ c .expect (cfg_mode_prompt )
1329+ c .sendline ('exit' )
1330+ c .expect (op_mode_prompt )
1331+
1332+ log .info ('Rebooting to verify interface naming survives across reboot' )
1333+ c .sendline ('reboot now' )
1334+ waitForLogin (c , log )
1335+ loginVM (c , log )
1336+
1337+ verify_eth_mac_mapping (c , log )
1338+
13071339 elif args .raid :
13081340 # Verify RAID subsystem - by deleting a disk and re-create the array
13091341 # from scratch
0 commit comments