1
1
# -*- coding: utf-8 -*-
2
2
3
- # Copyright (c) IBM Corporation 2023, 2024
3
+ # Copyright (c) IBM Corporation 2023, 2025
4
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
5
# you may not use this file except in compliance with the License.
6
6
# You may obtain a copy of the License at
16
16
17
17
__metaclass__ = type
18
18
19
+ TEST_VOL_ADDR = '01A2'
20
+ TEST_VOL_SER = 'USER02'
19
21
from ibm_zos_core .tests .helpers .volumes import Volume_Handler
20
22
from ibm_zos_core .tests .helpers .dataset import get_tmp_ds_name
21
23
@@ -39,12 +41,13 @@ def clear_volume(hosts, volume):
39
41
# verify_volid below or change value to match current volume serial on
40
42
# target.
41
43
42
- def test_guard_rail_and_setup (ansible_zos_module , volumes_on_systems ):
44
+ def test_guard_rail_and_setup (ansible_zos_module ):
43
45
hosts = ansible_zos_module
44
46
# remove all data sets from target volume. Expected to be the following 3
45
- volumes = Volume_Handler (volumes_on_systems )
46
- volume_1 = volumes .get_available_vol ()
47
- volume_2 = volumes .get_available_vol ()
47
+
48
+ volume_1 = TEST_VOL_SER
49
+ volume_2 = TEST_VOL_ADDR
50
+
48
51
clear_volume (hosts , volume_1 )
49
52
50
53
params = {
@@ -72,12 +75,11 @@ def test_guard_rail_and_setup(ansible_zos_module, volumes_on_systems):
72
75
hosts .all .zos_operator (cmd = f"vary { volume_2 } ,online" )
73
76
74
77
75
- def test_index_param_index (ansible_zos_module , volumes_on_systems ):
78
+ def test_index_param_index (ansible_zos_module ):
76
79
hosts = ansible_zos_module
77
80
78
- volumes = Volume_Handler (volumes_on_systems )
79
- volume_1 = volumes .get_available_vol ()
80
- volume_2 = volumes .get_available_vol ()
81
+ volume_1 = TEST_VOL_SER
82
+ volume_2 = TEST_VOL_ADDR
81
83
82
84
# take volume offline
83
85
hosts .all .zos_operator (cmd = f"vary { volume_2 } ,offline" )
@@ -104,12 +106,11 @@ def test_index_param_index(ansible_zos_module, volumes_on_systems):
104
106
hosts .all .zos_operator (cmd = f"vary { volume_2 } ,online" )
105
107
106
108
107
- def test_index_param_index_sms_false (ansible_zos_module , volumes_on_systems ):
109
+ def test_index_param_index_sms_false (ansible_zos_module ):
108
110
hosts = ansible_zos_module
109
111
110
- volumes = Volume_Handler (volumes_on_systems )
111
- volume_1 = volumes .get_available_vol ()
112
- volume_2 = volumes .get_available_vol ()
112
+ volume_1 = TEST_VOL_SER
113
+ volume_2 = TEST_VOL_ADDR
113
114
114
115
# take volume offline
115
116
hosts .all .zos_operator (cmd = f"vary { volume_2 } ,offline" )
@@ -138,12 +139,11 @@ def test_index_param_index_sms_false(ansible_zos_module, volumes_on_systems):
138
139
139
140
140
141
# check that correct volume_addr is assigned to correct volid
141
- def test_volid_address_assigned_correctly (ansible_zos_module , volumes_on_systems ):
142
+ def test_volid_address_assigned_correctly (ansible_zos_module ):
142
143
hosts = ansible_zos_module
143
144
144
- volumes = Volume_Handler (volumes_on_systems )
145
- volume_1 = volumes .get_available_vol ()
146
- volume_2 = volumes .get_available_vol ()
145
+ volume_1 = TEST_VOL_SER
146
+ volume_2 = TEST_VOL_ADDR
147
147
148
148
params = {
149
149
'address' : volume_2 ,
@@ -185,12 +185,12 @@ def test_volid_address_assigned_correctly(ansible_zos_module, volumes_on_systems
185
185
186
186
assert volume_1 in display_cmd_output
187
187
188
- def test_no_index_sms_managed_mutually_exclusive (ansible_zos_module , volumes_on_systems ):
188
+ def test_no_index_sms_managed_mutually_exclusive (ansible_zos_module ):
189
189
hosts = ansible_zos_module
190
190
191
- volumes = Volume_Handler ( volumes_on_systems )
192
- volume_1 = volumes . get_available_vol ()
193
- volume_2 = volumes . get_available_vol ()
191
+ volume_1 = TEST_VOL_SER
192
+ volume_2 = TEST_VOL_ADDR
193
+
194
194
195
195
params = {
196
196
'address' : volume_2 ,
@@ -212,12 +212,11 @@ def test_no_index_sms_managed_mutually_exclusive(ansible_zos_module, volumes_on_
212
212
assert "'Index' cannot be False" in result .get ("msg" )
213
213
214
214
215
- def test_vtoc_size_parm (ansible_zos_module , volumes_on_systems ):
215
+ def test_vtoc_size_parm (ansible_zos_module ):
216
216
hosts = ansible_zos_module
217
217
218
- volumes = Volume_Handler (volumes_on_systems )
219
- volume_1 = volumes .get_available_vol ()
220
- volume_2 = volumes .get_available_vol ()
218
+ volume_1 = TEST_VOL_SER
219
+ volume_2 = TEST_VOL_ADDR
221
220
params = {
222
221
'address' : volume_2 ,
223
222
'verify_offline' : False ,
@@ -240,12 +239,11 @@ def test_vtoc_size_parm(ansible_zos_module, volumes_on_systems):
240
239
assert VTOC_LOC_MSG .format (params .get ('vtoc_size' )) in content_str
241
240
242
241
243
- def test_good_param_values_only_volid (ansible_zos_module , volumes_on_systems ):
242
+ def test_good_param_values_only_volid (ansible_zos_module ):
244
243
hosts = ansible_zos_module
245
244
246
- volumes = Volume_Handler (volumes_on_systems )
247
- volume_1 = volumes .get_available_vol ()
248
- volume_2 = volumes .get_available_vol ()
245
+ volume_1 = TEST_VOL_SER
246
+ volume_2 = TEST_VOL_ADDR
249
247
250
248
params = {
251
249
'address' : volume_2 ,
@@ -265,12 +263,11 @@ def test_good_param_values_only_volid(ansible_zos_module, volumes_on_systems):
265
263
hosts .all .zos_operator (cmd = f"vary { volume_2 } ,online" )
266
264
267
265
268
- def test_good_param_values_volid_n_verify_volid (ansible_zos_module , volumes_on_systems ):
266
+ def test_good_param_values_volid_n_verify_volid (ansible_zos_module ):
269
267
hosts = ansible_zos_module
270
268
271
- volumes = Volume_Handler (volumes_on_systems )
272
- volume_1 = volumes .get_available_vol ()
273
- volume_2 = volumes .get_available_vol ()
269
+ volume_1 = TEST_VOL_SER
270
+ volume_2 = TEST_VOL_ADDR
274
271
275
272
params = {
276
273
'address' : volume_2 ,
@@ -291,12 +288,11 @@ def test_good_param_values_volid_n_verify_volid(ansible_zos_module, volumes_on_s
291
288
hosts .all .zos_operator (cmd = f"vary { volume_2 } ,online" )
292
289
293
290
294
- def test_good_param_values_volid_n_verify_volume_empty (ansible_zos_module , volumes_on_systems ):
291
+ def test_good_param_values_volid_n_verify_volume_empty (ansible_zos_module ):
295
292
hosts = ansible_zos_module
296
293
297
- volumes = Volume_Handler (volumes_on_systems )
298
- volume_1 = volumes .get_available_vol ()
299
- volume_2 = volumes .get_available_vol ()
294
+ volume_1 = TEST_VOL_SER
295
+ volume_2 = TEST_VOL_ADDR
300
296
301
297
params = {
302
298
'address' : volume_2 ,
@@ -317,13 +313,12 @@ def test_good_param_values_volid_n_verify_volume_empty(ansible_zos_module, volum
317
313
hosts .all .zos_operator (cmd = f"vary { volume_2 } ,online" )
318
314
319
315
320
- def test_bad_param_values_address_not_hexadecimal (ansible_zos_module , volumes_on_systems ):
316
+ def test_bad_param_values_address_not_hexadecimal (ansible_zos_module ):
321
317
hosts = ansible_zos_module
322
318
323
319
expected_rc = 12
324
- volumes = Volume_Handler (volumes_on_systems )
325
- volume_1 = volumes .get_available_vol ()
326
- volume_2 = volumes .get_available_vol ()
320
+ volume_1 = TEST_VOL_SER
321
+ volume_2 = TEST_VOL_ADDR
327
322
328
323
params = {
329
324
"address" : 'XYZ' ,
@@ -345,13 +340,12 @@ def test_bad_param_values_address_not_hexadecimal(ansible_zos_module, volumes_on
345
340
hosts .all .zos_operator (cmd = f"vary { volume_2 } ,online" )
346
341
347
342
348
- def test_bad_param_values_address_length_too_short (ansible_zos_module , volumes_on_systems ):
343
+ def test_bad_param_values_address_length_too_short (ansible_zos_module ):
349
344
hosts = ansible_zos_module
350
345
351
346
expected_rc = 12
352
- volumes = Volume_Handler (volumes_on_systems )
353
- volume_1 = volumes .get_available_vol ()
354
- volume_2 = volumes .get_available_vol ()
347
+ volume_1 = TEST_VOL_SER
348
+ volume_2 = TEST_VOL_ADDR
355
349
356
350
params = {
357
351
"address" : '01' ,
@@ -373,14 +367,12 @@ def test_bad_param_values_address_length_too_short(ansible_zos_module, volumes_o
373
367
hosts .all .zos_operator (cmd = f"vary { volume_2 } ,online" )
374
368
375
369
376
- def test_bad_param_values_address_specified_is_not_accesible_to_current (ansible_zos_module , volumes_on_systems ):
370
+ def test_bad_param_values_address_specified_is_not_accesible_to_current (ansible_zos_module ):
377
371
hosts = ansible_zos_module
378
372
379
373
expected_rc = 12
380
- volumes = Volume_Handler (volumes_on_systems )
381
- volume_1 = volumes .get_available_vol ()
382
- volume_2 = volumes .get_available_vol ()
383
-
374
+ volume_1 = TEST_VOL_SER
375
+ volume_2 = TEST_VOL_ADDR
384
376
params = {
385
377
"address" : '0000' ,
386
378
"verify_offline" : False ,
@@ -401,13 +393,12 @@ def test_bad_param_values_address_specified_is_not_accesible_to_current(ansible_
401
393
hosts .all .zos_operator (cmd = f"vary { volume_2 } ,online" )
402
394
403
395
404
- def test_bad_param_values_negative_value_for_vtoc_size (ansible_zos_module , volumes_on_systems ):
396
+ def test_bad_param_values_negative_value_for_vtoc_size (ansible_zos_module ):
405
397
hosts = ansible_zos_module
406
398
407
399
expected_rc = 12
408
- volumes = Volume_Handler (volumes_on_systems )
409
- volume_1 = volumes .get_available_vol ()
410
- volume_2 = volumes .get_available_vol ()
400
+ volume_1 = TEST_VOL_SER
401
+ volume_2 = TEST_VOL_ADDR
411
402
412
403
params = {
413
404
"address" : volume_2 ,
@@ -430,13 +421,12 @@ def test_bad_param_values_negative_value_for_vtoc_size(ansible_zos_module, volum
430
421
hosts .all .zos_operator (cmd = f"vary { volume_2 } ,online" )
431
422
432
423
433
- def test_bad_param_incorrect_existing_volid (ansible_zos_module , volumes_on_systems ):
424
+ def test_bad_param_incorrect_existing_volid (ansible_zos_module ):
434
425
hosts = ansible_zos_module
435
426
436
427
expected_rc = 12
437
- volumes = Volume_Handler (volumes_on_systems )
438
- volume_1 = volumes .get_available_vol ()
439
- volume_2 = volumes .get_available_vol ()
428
+ volume_1 = TEST_VOL_SER
429
+ volume_2 = TEST_VOL_ADDR
440
430
441
431
params = {
442
432
"address" : volume_2 ,
@@ -459,13 +449,12 @@ def test_bad_param_incorrect_existing_volid(ansible_zos_module, volumes_on_syste
459
449
hosts .all .zos_operator (cmd = f"vary { volume_2 } ,online" )
460
450
461
451
462
- def test_bad_param_volid_value_too_long (ansible_zos_module , volumes_on_systems ):
452
+ def test_bad_param_volid_value_too_long (ansible_zos_module ):
463
453
hosts = ansible_zos_module
464
454
465
455
expected_rc = 12
466
- volumes = Volume_Handler (volumes_on_systems )
467
- volume_1 = volumes .get_available_vol ()
468
- volume_2 = volumes .get_available_vol ()
456
+ volume_1 = TEST_VOL_SER
457
+ volume_2 = TEST_VOL_ADDR
469
458
470
459
params = {
471
460
"address" : 'ABCDEFGHIJK' ,
@@ -495,13 +484,12 @@ def test_bad_param_volid_value_too_long(ansible_zos_module, volumes_on_systems):
495
484
# If there is a data set remaining on the volume, that would interfere
496
485
# with other tests!
497
486
498
- def test_no_existing_data_sets_check (ansible_zos_module , volumes_on_systems ):
487
+ def test_no_existing_data_sets_check (ansible_zos_module ):
499
488
hosts = ansible_zos_module
500
489
dataset = get_tmp_ds_name ()
501
490
502
- volumes = Volume_Handler (volumes_on_systems )
503
- volume_1 = volumes .get_available_vol ()
504
- volume_2 = volumes .get_available_vol ()
491
+ volume_1 = TEST_VOL_SER
492
+ volume_2 = TEST_VOL_ADDR
505
493
506
494
setup_params = {
507
495
'address' : volume_2 ,
@@ -555,12 +543,11 @@ def test_no_existing_data_sets_check(ansible_zos_module, volumes_on_systems):
555
543
# Therefore, while testing against the EC machines, the verify_offline
556
544
# check needs to be skipped in order for ickdsf to be invoked.
557
545
558
- def test_minimal_params (ansible_zos_module , volumes_on_systems ):
546
+ def test_minimal_params (ansible_zos_module ):
559
547
hosts = ansible_zos_module
560
548
561
- volumes = Volume_Handler (volumes_on_systems )
562
- volume_1 = volumes .get_available_vol ()
563
- volume_2 = volumes .get_available_vol ()
549
+ volume_1 = TEST_VOL_SER
550
+ volume_2 = TEST_VOL_ADDR
564
551
565
552
params = {
566
553
"address" :volume_2 ,
0 commit comments