File tree Expand file tree Collapse file tree
pytest_fixtures/component Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Subnet Fixtures
2+ from fauxfactory import gen_ipaddr
23import pytest
34
45
56@pytest .fixture (scope = 'module' )
67def module_default_subnet (module_target_sat , module_org , module_location ):
7- return module_target_sat .api .Subnet (
8- location = [module_location ], organization = [module_org ]
9- ).create ()
8+ subnet_kwargs = {
9+ 'location' : [module_location ],
10+ 'organization' : [module_org ],
11+ }
12+ # Create subnet with appropriate network type based on satellite configuration
13+ if module_target_sat .network_type .has_ipv6 :
14+ subnet_kwargs ['network_type' ] = 'IPv6'
15+ subnet_kwargs ['network' ] = gen_ipaddr (ip3 = True , ipv6 = True )
16+ subnet_kwargs ['mask' ] = 'ffff:ffff:ffff:ffff::'
17+ subnet_kwargs ['ipam' ] = 'EUI-64'
18+ else :
19+ subnet_kwargs ['network_type' ] = 'IPv4'
20+ return module_target_sat .api .Subnet (** subnet_kwargs ).create ()
Original file line number Diff line number Diff line change @@ -396,9 +396,19 @@ def test_positive_create_and_update_with_subnet(
396396 location = module_location , organization = module_org , subnet = module_default_subnet
397397 ).create ()
398398 assert host .subnet .read ().name == module_default_subnet .name
399- new_subnet = module_target_sat .api .Subnet (
400- location = [module_location ], organization = [module_org ]
401- ).create ()
399+ # Create subnet with appropriate network type based on satellite configuration
400+ subnet_kwargs = {
401+ 'location' : [module_location ],
402+ 'organization' : [module_org ],
403+ }
404+ if module_target_sat .network_type .has_ipv6 :
405+ subnet_kwargs ['network_type' ] = 'IPv6'
406+ subnet_kwargs ['network' ] = gen_ipaddr (ip3 = True , ipv6 = True )
407+ subnet_kwargs ['mask' ] = 'ffff:ffff:ffff:ffff::'
408+ subnet_kwargs ['ipam' ] = 'EUI-64'
409+ else :
410+ subnet_kwargs ['network_type' ] = 'IPv4'
411+ new_subnet = module_target_sat .api .Subnet (** subnet_kwargs ).create ()
402412 host .subnet = new_subnet
403413 host = host .update (['subnet' ])
404414 assert host .subnet .read ().name == new_subnet .name
You can’t perform that action at this time.
0 commit comments