openstackclient.tests.network.v2 package

Submodules

openstackclient.tests.network.v2.fakes module

class openstackclient.tests.network.v2.fakes.FakeAvailabilityZone

Bases: object

Fake one or more network availability zones (AZs).

static create_availability_zones(attrs={}, methods={}, count=2)

Create multiple fake AZs.

Parameters:
  • attrs (Dictionary) – A dictionary with all attributes
  • methods (Dictionary) – A dictionary with all methods
  • count (int) – The number of AZs to fake
Returns:

A list of FakeResource objects faking the AZs

static create_one_availability_zone(attrs={}, methods={})

Create a fake AZ.

Parameters:
  • attrs (Dictionary) – A dictionary with all attributes
  • methods (Dictionary) – A dictionary with all methods
Returns:

A FakeResource object with name, state, etc.

class openstackclient.tests.network.v2.fakes.FakeNetwork

Bases: object

Fake one or more networks.

static create_networks(attrs={}, methods={}, count=2)

Create multiple fake networks.

Parameters:
  • attrs (Dictionary) – A dictionary with all attributes
  • methods (Dictionary) – A dictionary with all methods
  • count (int) – The number of networks to fake
Returns:

A list of FakeResource objects faking the networks

static create_one_network(attrs={}, methods={})

Create a fake network.

Parameters:
  • attrs (Dictionary) – A dictionary with all attributes
  • methods (Dictionary) – A dictionary with all methods
Returns:

A FakeResource object, with id, name, admin_state_up, router_external, status, subnets, tenant_id

static get_networks(networks=None, count=2)

Get an iterable MagicMock object with a list of faked networks.

If networks list is provided, then initialize the Mock object with the list. Otherwise create one.

Parameters:
  • networks (List) – A list of FakeResource objects faking networks
  • count (int) – The number of networks to fake
Returns:

An iterable Mock object with side_effect set to a list of faked networks

class openstackclient.tests.network.v2.fakes.FakeNetworkV2Client(**kwargs)

Bases: object

class openstackclient.tests.network.v2.fakes.FakePort

Bases: object

Fake one or more ports.

static create_one_port(attrs={}, methods={})

Create a fake port.

Parameters:
  • attrs (Dictionary) – A dictionary with all attributes
  • methods (Dictionary) – A dictionary with all methods
Returns:

A FakeResource object, with id, name, etc.

static create_ports(attrs={}, methods={}, count=2)

Create multiple fake ports.

Parameters:
  • attrs (Dictionary) – A dictionary with all attributes
  • methods (Dictionary) – A dictionary with all methods
  • count (int) – The number of ports to fake
Returns:

A list of FakeResource objects faking the ports

static get_ports(ports=None, count=2)

Get an iterable MagicMock object with a list of faked ports.

If ports list is provided, then initialize the Mock object with the list. Otherwise create one.

Parameters:
  • ports (List) – A list of FakeResource objects faking ports
  • count (int) – The number of ports to fake
Returns:

An iterable Mock object with side_effect set to a list of faked ports

class openstackclient.tests.network.v2.fakes.FakeRouter

Bases: object

Fake one or more routers.

static create_one_router(attrs={}, methods={})

Create a fake router.

Parameters:
  • attrs (Dictionary) – A dictionary with all attributes
  • methods (Dictionary) – A dictionary with all methods
Returns:

A FakeResource object, with id, name, admin_state_up, status, tenant_id

static create_routers(attrs={}, methods={}, count=2)

Create multiple fake routers.

Parameters:
  • attrs (Dictionary) – A dictionary with all attributes
  • methods (Dictionary) – A dictionary with all methods
  • count (int) – The number of routers to fake
Returns:

A list of FakeResource objects faking the routers

static get_routers(routers=None, count=2)

Get an iterable MagicMock object with a list of faked routers.

If routers list is provided, then initialize the Mock object with the list. Otherwise create one.

Parameters:
  • routers (List) – A list of FakeResource objects faking routers
  • count (int) – The number of routers to fake
Returns:

An iterable Mock object with side_effect set to a list of faked routers

class openstackclient.tests.network.v2.fakes.FakeSecurityGroup

Bases: object

Fake one or more security groups.

static create_one_security_group(attrs={}, methods={})

Create a fake security group.

Parameters:
  • attrs (Dictionary) – A dictionary with all attributes
  • methods (Dictionary) – A dictionary with all methods
Returns:

A FakeResource object, with id, name, etc.

static create_security_groups(attrs={}, methods={}, count=2)

Create multiple fake security groups.

Parameters:
  • attrs (Dictionary) – A dictionary with all attributes
  • methods (Dictionary) – A dictionary with all methods
  • count (int) – The number of security groups to fake
Returns:

A list of FakeResource objects faking the security groups

static get_security_groups(security_groups=None, count=2)

Get an iterable MagicMock object with a list of faked security groups.

If security group list is provided, then initialize the Mock object with the list. Otherwise create one.

Parameters:
  • security groups (List) – A list of FakeResource objects faking security groups
  • count (int) – The number of security groups to fake
Returns:

An iterable Mock object with side_effect set to a list of faked security groups

class openstackclient.tests.network.v2.fakes.FakeSubnet

Bases: object

Fake one or more subnets.

static create_one_subnet(attrs={}, methods={})

Create a fake subnet.

Parameters:
  • attrs (Dictionary) – A dictionary with all attributes
  • methods (Dictionary) – A dictionary with all methods
Returns:

A FakeResource object faking the subnet

static create_subnets(attrs={}, methods={}, count=2)

Create multiple fake subnets.

Parameters:
  • attrs (Dictionary) – A dictionary with all attributes
  • methods (Dictionary) – A dictionary with all methods
  • count (int) – The number of subnets to fake
Returns:

A list of FakeResource objects faking the subnets

class openstackclient.tests.network.v2.fakes.TestNetworkV2(*args, **kwargs)

Bases: openstackclient.tests.utils.TestCommand

setUp()
openstackclient.tests.network.v2.fakes.create_extension()

openstackclient.tests.network.v2.test_network module

class openstackclient.tests.network.v2.test_network.TestCreateNetworkIdentityV2(*args, **kwargs)

Bases: openstackclient.tests.network.v2.test_network.TestNetwork

columns = ('admin_state_up', 'availability_zone_hints', 'availability_zones', 'id', 'name', 'project_id', 'router_external', 'status', 'subnets')
data = ('UP', '', '', 'network-id-680a1e4ab44f44c9b4ca0759959835a4', 'network-name-aea6855f4c4147888a2234e4b68e4923', 'project-id-afe531601b3a4842b09cb1fb26c6f40d', 'External', 'ACTIVE', 'a, b')
setUp()
test_create_with_domain_identityv2()
test_create_with_project_identityv2()
class openstackclient.tests.network.v2.test_network.TestCreateNetworkIdentityV3(*args, **kwargs)

Bases: openstackclient.tests.network.v2.test_network.TestNetwork

columns = ('admin_state_up', 'availability_zone_hints', 'availability_zones', 'id', 'name', 'project_id', 'router_external', 'status', 'subnets')
data = ('UP', 'nova', '', 'network-id-5a56264bad2c4a9da27bc6223379a96c', 'network-name-5c6bc960b4e14650bb39cc4a3afbe310', 'project-id-8963c0ac6e8f4890adfd74c92f65acbc', 'External', 'ACTIVE', 'a, b')
setUp()
test_create_all_options()
test_create_default_options()
test_create_no_options()
test_create_other_options()
class openstackclient.tests.network.v2.test_network.TestDeleteNetwork(*args, **kwargs)

Bases: openstackclient.tests.network.v2.test_network.TestNetwork

setUp()
test_delete()
class openstackclient.tests.network.v2.test_network.TestListNetwork(*args, **kwargs)

Bases: openstackclient.tests.network.v2.test_network.TestNetwork

columns = ('ID', 'Name', 'Subnets')
columns_long = ('ID', 'Name', 'Status', 'Project', 'State', 'Shared', 'Subnets', 'Network Type', 'Router Type', 'Availability Zones')
data = [('network-id-d72b56a8ebcc494a8e0c0dbf6863e1bb', 'network-name-bacac03e6745490f9f8d54715462e177', 'a, b'), ('network-id-f1d6c5768e814c6db74a67f0243c0df8', 'network-name-1fcbeb2397de4f8d8afc4fd5dcecfcbc', 'a, b'), ('network-id-8127a190c97549cea8d3a36d93d4797d', 'network-name-55e753905bc14268b275b5ecee2b8ced', 'a, b')]
data_long = [('network-id-d72b56a8ebcc494a8e0c0dbf6863e1bb', 'network-name-bacac03e6745490f9f8d54715462e177', 'ACTIVE', 'project-id-d9f6cf20a6f8490fafb0b064cf2cc61f', 'UP', False, 'a, b', 'vlan', 'External', ''), ('network-id-f1d6c5768e814c6db74a67f0243c0df8', 'network-name-1fcbeb2397de4f8d8afc4fd5dcecfcbc', 'ACTIVE', 'project-id-7d5311a53bf646bfa074922c0d01c858', 'UP', False, 'a, b', 'vlan', 'External', ''), ('network-id-8127a190c97549cea8d3a36d93d4797d', 'network-name-55e753905bc14268b275b5ecee2b8ced', 'ACTIVE', 'project-id-cc35cfe0755440a2996caa4ee4e9bc07', 'UP', False, 'a, b', 'vlan', 'External', '')]
net = <FakeResource admin_state_up=True, availability_zone_hints=[], availability_zones=[], id=network-id-8127a190c97549cea8d3a36d93d4797d, keys=<MagicMock id='140496616308880'>, name=network-name-55e753905bc14268b275b5ecee2b8ced, project_id=project-id-cc35cfe0755440a2996caa4ee4e9bc07, provider_network_type=vlan, router_external=True, shared=False, status=ACTIVE, subnets=['a', 'b'], tenant_id=project-id-cc35cfe0755440a2996caa4ee4e9bc07>
setUp()
test_list_external()
test_network_list_long()
test_network_list_no_options()
class openstackclient.tests.network.v2.test_network.TestNetwork(*args, **kwargs)

Bases: openstackclient.tests.network.v2.fakes.TestNetworkV2

setUp()
class openstackclient.tests.network.v2.test_network.TestSetNetwork(*args, **kwargs)

Bases: openstackclient.tests.network.v2.test_network.TestNetwork

setUp()
test_set_nothing()
test_set_that()
test_set_this()
class openstackclient.tests.network.v2.test_network.TestShowNetwork(*args, **kwargs)

Bases: openstackclient.tests.network.v2.test_network.TestNetwork

columns = ('admin_state_up', 'availability_zone_hints', 'availability_zones', 'id', 'name', 'project_id', 'router_external', 'status', 'subnets')
data = ('UP', '', '', 'network-id-aaddad53e3a449689c33015bdd60b23d', 'network-name-c555180f1dbf4dec9d4d200d9547adff', 'project-id-4221e700a4944a4f9706cf828627426b', 'External', 'ACTIVE', 'a, b')
setUp()
test_show_all_options()
test_show_no_options()

openstackclient.tests.network.v2.test_port module

class openstackclient.tests.network.v2.test_port.TestDeletePort(*args, **kwargs)

Bases: openstackclient.tests.network.v2.test_port.TestPort

setUp()
test_delete()
class openstackclient.tests.network.v2.test_port.TestPort(*args, **kwargs)

Bases: openstackclient.tests.network.v2.fakes.TestNetworkV2

setUp()
class openstackclient.tests.network.v2.test_port.TestShowPort(*args, **kwargs)

Bases: openstackclient.tests.network.v2.test_port.TestPort

columns = ('admin_state_up', 'allowed_address_pairs', 'binding_host_id', 'binding_profile', 'binding_vif_details', 'binding_vif_type', 'binding_vnic_type', 'device_id', 'device_owner', 'dns_assignment', 'dns_name', 'extra_dhcp_opts', 'fixed_ips', 'id', 'mac_address', 'name', 'network_id', 'port_security_enabled', 'project_id', 'security_groups', 'status')
data = ('UP', '', 'binding-host-id-a04ef77bff9b4fc9a2fed3533739e90f', '', '', 'ovs', 'normal', 'device-id-dd4253707c9347658fb8fc45e4101014', 'compute:nova', '', 'dns-name-f983427cf6414858a52f6dab016a3f15', '', '', 'port-id-255496434e434283a760d82f0a3b5b61', 'fa:16:3e:a9:4e:72', 'port-name-e3ab7c1140014931ae4d4afc87fd0401', 'network-id-ad88e6beb4d5430a806d548b51c963f1', True, 'project-id-dc00ccee222c480393c576d4e8ed567e', '', 'ACTIVE')
setUp()
test_show_all_options()
test_show_no_options()

openstackclient.tests.network.v2.test_router module

class openstackclient.tests.network.v2.test_router.TestCreateRouter(*args, **kwargs)

Bases: openstackclient.tests.network.v2.test_router.TestRouter

columns = ('admin_state_up', 'distributed', 'ha', 'id', 'name', 'project_id')
data = ('UP', False, False, 'router-id-a73f2faed828477aa792e18ac6fa0cc0', 'router-name-e43bc780d5324079865363b4c8eaa6b1', 'project-id-e0e0211dfe4642939d040e623d60a9c4')
new_router = <FakeResource admin_state_up=True, availability_zone_hints=[], availability_zones=[], distributed=False, external_gateway_info={}, ha=False, id=router-id-a73f2faed828477aa792e18ac6fa0cc0, keys=<MagicMock id='140496548980560'>, name=router-name-e43bc780d5324079865363b4c8eaa6b1, routes=[], status=ACTIVE, tenant_id=project-id-e0e0211dfe4642939d040e623d60a9c4>
setUp()
test_create_default_options()
test_create_no_options()
test_create_with_AZ_hints()
class openstackclient.tests.network.v2.test_router.TestDeleteRouter(*args, **kwargs)

Bases: openstackclient.tests.network.v2.test_router.TestRouter

setUp()
test_delete()
class openstackclient.tests.network.v2.test_router.TestListRouter(*args, **kwargs)

Bases: openstackclient.tests.network.v2.test_router.TestRouter

columns = ('ID', 'Name', 'Status', 'State', 'Distributed', 'HA', 'Project')
columns_long = ('ID', 'Name', 'Status', 'State', 'Distributed', 'HA', 'Project', 'Routes', 'External gateway info', 'Availability zones')
data = [('router-id-9bcb601c46bf4530b8977f9fefb7b2be', 'router-name-f077e96e2bad48a48ae533aa7aefc854', 'ACTIVE', 'UP', False, False, 'project-id-ca4d91be450045c58569b4258de33ae7'), ('router-id-2aecb7ec280e4abfbc9a7885100cc8f2', 'router-name-968dd1569e7447a68f5c029f50dcec22', 'ACTIVE', 'UP', False, False, 'project-id-a50a060e5478451c890623f9b2d6add7'), ('router-id-164d5e2db37f41a783a541c90a64b0cb', 'router-name-6fe6a8c199f047d990cfb99a4b0b1bea', 'ACTIVE', 'UP', False, False, 'project-id-35a1a33812f84be7ad95123c66e7b746')]
data_long = [('router-id-9bcb601c46bf4530b8977f9fefb7b2be', 'router-name-f077e96e2bad48a48ae533aa7aefc854', 'ACTIVE', 'UP', False, False, 'project-id-ca4d91be450045c58569b4258de33ae7', [], '{}', ''), ('router-id-2aecb7ec280e4abfbc9a7885100cc8f2', 'router-name-968dd1569e7447a68f5c029f50dcec22', 'ACTIVE', 'UP', False, False, 'project-id-a50a060e5478451c890623f9b2d6add7', [], '{}', ''), ('router-id-164d5e2db37f41a783a541c90a64b0cb', 'router-name-6fe6a8c199f047d990cfb99a4b0b1bea', 'ACTIVE', 'UP', False, False, 'project-id-35a1a33812f84be7ad95123c66e7b746', [], '{}', '')]
i = 2
r = <FakeResource admin_state_up=True, availability_zone_hints=[], availability_zones=[], distributed=False, external_gateway_info={}, ha=False, id=router-id-164d5e2db37f41a783a541c90a64b0cb, keys=<MagicMock id='140496654590480'>, name=router-name-6fe6a8c199f047d990cfb99a4b0b1bea, routes=[], status=ACTIVE, tenant_id=project-id-35a1a33812f84be7ad95123c66e7b746>
routers = [<FakeResource admin_state_up=True, availability_zone_hints=[], availability_zones=[], distributed=False, external_gateway_info={}, ha=False, id=router-id-9bcb601c46bf4530b8977f9fefb7b2be, keys=<MagicMock id='140496528195408'>, name=router-name-f077e96e2bad48a48ae533aa7aefc854, routes=[], status=ACTIVE, tenant_id=project-id-ca4d91be450045c58569b4258de33ae7>, <FakeResource admin_state_up=True, availability_zone_hints=[], availability_zones=[], distributed=False, external_gateway_info={}, ha=False, id=router-id-2aecb7ec280e4abfbc9a7885100cc8f2, keys=<MagicMock id='140496654296656'>, name=router-name-968dd1569e7447a68f5c029f50dcec22, routes=[], status=ACTIVE, tenant_id=project-id-a50a060e5478451c890623f9b2d6add7>, <FakeResource admin_state_up=True, availability_zone_hints=[], availability_zones=[], distributed=False, external_gateway_info={}, ha=False, id=router-id-164d5e2db37f41a783a541c90a64b0cb, keys=<MagicMock id='140496654590480'>, name=router-name-6fe6a8c199f047d990cfb99a4b0b1bea, routes=[], status=ACTIVE, tenant_id=project-id-35a1a33812f84be7ad95123c66e7b746>]
setUp()
test_router_list_long()
test_router_list_no_options()
class openstackclient.tests.network.v2.test_router.TestRouter(*args, **kwargs)

Bases: openstackclient.tests.network.v2.fakes.TestNetworkV2

setUp()
class openstackclient.tests.network.v2.test_router.TestSetRouter(*args, **kwargs)

Bases: openstackclient.tests.network.v2.test_router.TestRouter

setUp()
test_set_distributed_centralized()
test_set_nothing()
test_set_that()
test_set_this()
class openstackclient.tests.network.v2.test_router.TestShowRouter(*args, **kwargs)

Bases: openstackclient.tests.network.v2.test_router.TestRouter

columns = ('admin_state_up', 'distributed', 'ha', 'id', 'name', 'tenant_id')
data = ('UP', False, False, 'router-id-cdb8780185bf425989f9b5ad712ca80e', 'router-name-8fd038345c034e9db99cc7a0ad5ddcb3', 'project-id-a98e668955c84a9bb66febefc9be6039')
setUp()
test_show_all_options()
test_show_no_options()

openstackclient.tests.network.v2.test_security_group module

class openstackclient.tests.network.v2.test_security_group.TestDeleteSecurityGroupCompute(*args, **kwargs)

Bases: openstackclient.tests.network.v2.test_security_group.TestSecurityGroup

setUp()
test_security_group_delete()
class openstackclient.tests.network.v2.test_security_group.TestDeleteSecurityGroupNetwork(*args, **kwargs)

Bases: openstackclient.tests.network.v2.test_security_group.TestSecurityGroup

setUp()
test_security_group_delete()
class openstackclient.tests.network.v2.test_security_group.TestSecurityGroup(*args, **kwargs)

Bases: openstackclient.tests.network.v2.fakes.TestNetworkV2

setUp()

openstackclient.tests.network.v2.test_subnet module

class openstackclient.tests.network.v2.test_subnet.TestListSubnet(*args, **kwargs)

Bases: openstackclient.tests.network.v2.test_subnet.TestSubnet

columns = ('ID', 'Name', 'Network', 'Subnet')
columns_long = ('ID', 'Name', 'Network', 'Subnet', 'Project', 'DHCP', 'Name Servers', 'Allocation Pools', 'Host Routes', 'IP Version', 'Gateway')
data = [('subnet-id-fdad43f7514544e2aaf31a5d5998a8b9', 'subnet-name-3d3c9fea0421446bb9f0dd2ea279bbf9', 'network-id-3920239061c5408f90810b9ab5a279df', '10.10.10.0/24'), ('subnet-id-6a4413819a814afb81714d4ba16688c0', 'subnet-name-f01de1e49b1c420782d99cf38c0283de', 'network-id-d961a7a1bb9f4124804f87e4af596f45', '10.10.10.0/24'), ('subnet-id-e7a6c29ea6c44265a54b9010cafe456f', 'subnet-name-af768593ee9f44399f6db8a3757e5ba6', 'network-id-1e77125d300546b69ccdc6a53ee5a5c8', '10.10.10.0/24')]
data_long = [('subnet-id-fdad43f7514544e2aaf31a5d5998a8b9', 'subnet-name-3d3c9fea0421446bb9f0dd2ea279bbf9', 'network-id-3920239061c5408f90810b9ab5a279df', '10.10.10.0/24', 'project-id-ba422e23a42b4dc7a5a6472f3845feb4', True, '', '', '', '4', '10.10.10.1'), ('subnet-id-6a4413819a814afb81714d4ba16688c0', 'subnet-name-f01de1e49b1c420782d99cf38c0283de', 'network-id-d961a7a1bb9f4124804f87e4af596f45', '10.10.10.0/24', 'project-id-df37282b1a2048dc955de8abec4c677a', True, '', '', '', '4', '10.10.10.1'), ('subnet-id-e7a6c29ea6c44265a54b9010cafe456f', 'subnet-name-af768593ee9f44399f6db8a3757e5ba6', 'network-id-1e77125d300546b69ccdc6a53ee5a5c8', '10.10.10.0/24', 'project-id-01bf8c3433ae4cf89aee3b771dc376ce', True, '', '', '', '4', '10.10.10.1')]
setUp()
subnet = <FakeResource allocation_pools=[], cidr=10.10.10.0/24, dns_nameservers=[], enable_dhcp=True, gateway_ip=10.10.10.1, host_routes=[], id=subnet-id-e7a6c29ea6c44265a54b9010cafe456f, ip_version=4, keys=<MagicMock id='140496615663120'>, name=subnet-name-af768593ee9f44399f6db8a3757e5ba6, network_id=network-id-1e77125d300546b69ccdc6a53ee5a5c8, tenant_id=project-id-01bf8c3433ae4cf89aee3b771dc376ce>
test_subnet_list_long()
test_subnet_list_no_options()
class openstackclient.tests.network.v2.test_subnet.TestSubnet(*args, **kwargs)

Bases: openstackclient.tests.network.v2.fakes.TestNetworkV2

setUp()

Module contents