diff --git a/examples/network/delete.py b/examples/network/delete.py index eedd0b61..41e7a3bb 100644 --- a/examples/network/delete.py +++ b/examples/network/delete.py @@ -23,6 +23,6 @@ def delete_network(conn): example_network = conn.network.find_network( 'openstacksdk-example-project-network') - for example_subnet in example_network.subnets: + for example_subnet in example_network.subnet_ids: conn.network.delete_subnet(example_subnet, ignore_missing=False) conn.network.delete_network(example_network, ignore_missing=False) diff --git a/openstack/network/v2/floating_ip.py b/openstack/network/v2/floating_ip.py index 8d5a607b..03a6d120 100644 --- a/openstack/network/v2/floating_ip.py +++ b/openstack/network/v2/floating_ip.py @@ -43,7 +43,7 @@ class FloatingIP(resource.Resource): floating_network_id = resource.prop('floating_network_id') #: The port ID. port_id = resource.prop('port_id') - #: The project this floating IP is associated with. + #: The ID of the project this floating IP is associated with. project_id = resource.prop('tenant_id') #: The ID of an associated router. router_id = resource.prop('router_id') diff --git a/openstack/network/v2/health_monitor.py b/openstack/network/v2/health_monitor.py index bce33231..9d7a6878 100644 --- a/openstack/network/v2/health_monitor.py +++ b/openstack/network/v2/health_monitor.py @@ -39,9 +39,10 @@ class HealthMonitor(resource.Resource): http_method = resource.prop('http_method') #: Maximum consecutive health probe tries. max_retries = resource.prop('max_retries') - #: List of IDs of lbaas pools healthmonitor assocaited with - pools = resource.prop('pools') - #: Owner of the VIP + #: List of pools associated with this health monitor + #: *Type: list of dicts which contain the pool IDs* + pool_ids = resource.prop('pools', type=list) + #: The ID of the project this health monitor is associated with. project_id = resource.prop('tenant_id') #: The maximum number of seconds for a monitor to wait for a connection #: to be established before it times out. This value must be less than diff --git a/openstack/network/v2/listener.py b/openstack/network/v2/listener.py index 7e652e13..434f7263 100644 --- a/openstack/network/v2/listener.py +++ b/openstack/network/v2/listener.py @@ -40,12 +40,12 @@ class Listener(resource.Resource): default_tls_container_ref = resource.prop('default_tls_container_ref') #: Description for the listener. description = resource.prop('description') - #: List of IDs of load_balancers associate with this listener. - #: *Type: list* - loadbalancers = resource.prop('loadbalancers') + #: List of load balancers associated with this listener. + #: *Type: list of dicts which contain the load balancer IDs* + load_balancer_ids = resource.prop('loadbalancers') #: Name of the listener name = resource.prop('name') - #: The project this listener is associated with. + #: The ID of the project this listener is associated with. project_id = resource.prop('tenant_id') #: The protocol of the listener, which is TCP, HTTP, HTTPS #: or TERMINATED_HTTPS. diff --git a/openstack/network/v2/load_balancer.py b/openstack/network/v2/load_balancer.py index bfad8fd3..c9ad9175 100644 --- a/openstack/network/v2/load_balancer.py +++ b/openstack/network/v2/load_balancer.py @@ -28,23 +28,23 @@ class LoadBalancer(resource.Resource): allow_list = True # Properties - #: The administrative state of the load_balancer, which is up + #: The administrative state of the load balancer, which is up #: ``True`` or down ``False``. *Type: bool* admin_state_up = resource.prop('admin_state_up', type=bool) - #: Description for the load_balancer. + #: Description for the load balancer. description = resource.prop('description') - #: List of IDs of listeners associated with this load_balancer. - #: *Type: list* - listeners = resource.prop('listeners') - #: Name of the load_balancer + #: List of listeners associated with this load balancer. + #: *Type: list of dicts which contain the listener IDs* + listener_ids = resource.prop('listeners', type=list) + #: Name of the load balancer name = resource.prop('name') #: Status of load_balancer operating, e.g. ONLINE, OFFLINE. operating_status = resource.prop('operating_status') - #: The project this load_balancer is associated with. + #: The ID of the project this load balancer is associated with. project_id = resource.prop('tenant_id') #: The name of the provider. provider = resource.prop('provider') - #: Status of load_balancer provisioning, e.g. ACTIVE, INACTIVE. + #: Status of load balancer provisioning, e.g. ACTIVE, INACTIVE. provisioning_status = resource.prop('provisioning_status') #: The IP address of the VIP. vip_address = resource.prop('vip_address') diff --git a/openstack/network/v2/metering_label.py b/openstack/network/v2/metering_label.py index 7dd08616..1374bf70 100644 --- a/openstack/network/v2/metering_label.py +++ b/openstack/network/v2/metering_label.py @@ -28,9 +28,9 @@ class MeteringLabel(resource.Resource): allow_list = True # Properties - #: Description of the label. + #: Description of the metering label. description = resource.prop('description') - #: Name of the label. + #: Name of the metering label. name = resource.prop('name') - #: Project this label is associated with. + #: The ID of the project this metering label is associated with. project_id = resource.prop('tenant_id') diff --git a/openstack/network/v2/metering_label_rule.py b/openstack/network/v2/metering_label_rule.py index 1a1827aa..92b16a52 100644 --- a/openstack/network/v2/metering_label_rule.py +++ b/openstack/network/v2/metering_label_rule.py @@ -28,7 +28,7 @@ class MeteringLabelRule(resource.Resource): allow_list = True # Properties - #: ingress or egress: The direction in which metering rule is + #: ingress or egress: The direction in which metering label rule is #: applied. Default: ``"ingress"`` direction = resource.prop('direction') #: Specify whether the ``remote_ip_prefix`` will be excluded or not @@ -36,7 +36,7 @@ class MeteringLabelRule(resource.Resource): #: traffic of a specific IP address of a range. Default: ``False``, #: *Type: bool* excluded = resource.prop('excluded', type=bool) - #: The meteting label ID to associate with this metering rule. + #: The metering label ID to associate with this metering label rule. metering_label_id = resource.prop('metering_label_id') - #: The remote IP prefix to be associated with this metering rule. + #: The remote IP prefix to be associated with this metering label rule. remote_ip_prefix = resource.prop('remote_ip_prefix') diff --git a/openstack/network/v2/network.py b/openstack/network/v2/network.py index c9f63d61..fd2e36ed 100644 --- a/openstack/network/v2/network.py +++ b/openstack/network/v2/network.py @@ -39,15 +39,15 @@ class Network(resource.Resource): availability_zones = resource.prop('availability_zones') #: The network name. name = resource.prop('name') - #: The project this network is associated with. + #: The ID of the project this network is associated with. project_id = resource.prop('tenant_id') - # TODO(briancurtin): These provider_ explanations are made up because - # they're undocumented. - #: Type of network, such as vlan. + #: The type of physical network that maps to this network resource. + #: For example, ``flat``, ``vlan``, ``vxlan``, or ``gre``. provider_network_type = resource.prop('provider:network_type') - #: ID of the physical network. + #: The physical network where this network object is implemented. provider_physical_network = resource.prop('provider:physical_network') - #: Segmentation ID. + #: An isolated segment ID on the physical network. The provider + #: network type defines the segmentation model. provider_segmentation_id = resource.prop('provider:segmentation_id') #: Whether or not the router is external. *Type: bool* router_external = resource.prop('router:external') @@ -60,8 +60,9 @@ class Network(resource.Resource): shared = resource.prop('shared', type=bool) #: The network status. status = resource.prop('status') - #: The associated subnets. - subnets = resource.prop('subnets') + #: The associated subnet IDs. + #: *Type: list of strs of the subnet IDs* + subnet_ids = resource.prop('subnets', type=list) #: Read-only. The maximum transmission unit (MTU) of the network resource. mtu = resource.prop('mtu', type=int) #: The port security status, which is enabled ``True`` or disabled diff --git a/openstack/network/v2/pool.py b/openstack/network/v2/pool.py index 9ab0bb3a..6446564b 100644 --- a/openstack/network/v2/pool.py +++ b/openstack/network/v2/pool.py @@ -34,18 +34,20 @@ class Pool(resource.Resource): #: Description for the pool. description = resource.prop('description') #: The ID of the associated health monitor. - healthmonitor_id = resource.prop('healthmonitor_id') + health_monitor_id = resource.prop('healthmonitor_id') #: The load-balancer algorithm, which is round-robin, least-connections, #: and so on. This value, which must be supported, is dependent on the #: load-balancer provider. Round-robin must be supported. lb_algorithm = resource.prop('lb_algorithm') - #: List of IDs of associated listeners. *Type: list* - listeners = resource.prop('listeners') - #: List of members that belong to the pool. *Type: list* - members = resource.prop('members') + #: List of associated listeners. + #: *Type: list of dicts which contain the listener IDs* + listener_ids = resource.prop('listeners', type=list) + #: List of members that belong to the pool. + #: *Type: list of dicts which contain the member IDs* + member_ids = resource.prop('members', type=list) #: Pool name. Does not have to be unique. name = resource.prop('name') - #: The project this pool is associated with. + #: The ID of the project this pool is associated with. project_id = resource.prop('tenant_id') #: The protocol of the pool, which is TCP, HTTP, or HTTPS. protocol = resource.prop('protocol') diff --git a/openstack/network/v2/pool_member.py b/openstack/network/v2/pool_member.py index 17815edd..85a2d383 100644 --- a/openstack/network/v2/pool_member.py +++ b/openstack/network/v2/pool_member.py @@ -33,11 +33,11 @@ class PoolMember(resource.Resource): #: The administrative state of the pool member, which is up ``True`` or #: down ``False``. *Type: bool* admin_state_up = resource.prop('admin_state_up', type=bool) - #: The project this pool member is associated with. + #: The ID of the project this pool member is associated with. project_id = resource.prop('tenant_id') #: The port on which the application is hosted. protocol_port = resource.prop('protocol_port', type=int) - #: Subnet in which to access this pool member. + #: Subnet ID in which to access this pool member. subnet_id = resource.prop('subnet_id') #: A positive integer value that indicates the relative portion of traffic #: that this member should receive from the pool. For example, a member diff --git a/openstack/network/v2/port.py b/openstack/network/v2/port.py index 8e29ed1c..6df89a6a 100644 --- a/openstack/network/v2/port.py +++ b/openstack/network/v2/port.py @@ -59,9 +59,9 @@ class Port(resource.Resource): #: In GET operations, the binding:vnic_type extended attribute is #: visible to only port owners and administrative users. binding_vnic_type = resource.prop('binding:vnic_type') - #: The ID of the device that uses this port. For example, a virtual server. + #: Device ID of this port. device_id = resource.prop('device_id') - #: The ID of the entity that uses this port. For example, a dhcp agent. + #: Device owner of this port (e.g. ``network:dhcp``). device_owner = resource.prop('device_owner') #: DNS assignment for the port. dns_assignment = resource.prop('dns_assignment') @@ -80,8 +80,9 @@ class Port(resource.Resource): #: The ID of the project who owns the network. Only administrative #: users can specify a project ID other than their own. project_id = resource.prop('tenant_id') - #: The IDs of any attached security groups. *Type: list* - security_groups = resource.prop('security_groups', type=list) + #: The IDs of any attached security groups. + #: *Type: list of strs of the security group IDs* + security_group_ids = resource.prop('security_groups', type=list) #: The port status. Value is ``ACTIVE`` or ``DOWN``. status = resource.prop('status') #: The port security status, which is enabled ``True`` or disabled diff --git a/openstack/network/v2/quota.py b/openstack/network/v2/quota.py index d16e7184..de11e45c 100644 --- a/openstack/network/v2/quota.py +++ b/openstack/network/v2/quota.py @@ -33,7 +33,7 @@ class Quota(resource.Resource): networks = resource.prop('network', type=int) #: The maximum amount of ports you can create. *Type: int* ports = resource.prop('port', type=int) - #: The project these quota values are for. + #: The ID of the project these quota values are for. project_id = resource.prop('tenant_id') #: The maximum amount of routers you can create. *Type: int* routers = resource.prop('router', type=int) diff --git a/openstack/network/v2/router.py b/openstack/network/v2/router.py index b088bd18..a0075933 100644 --- a/openstack/network/v2/router.py +++ b/openstack/network/v2/router.py @@ -42,7 +42,7 @@ class Router(resource.Resource): external_gateway_info = resource.prop('external_gateway_info', type=dict) #: The router name. name = resource.prop('name') - #: The project this router is associated with. + #: The ID of the project this router is associated with. project_id = resource.prop('tenant_id') #: The router status. status = resource.prop('status') diff --git a/openstack/network/v2/security_group.py b/openstack/network/v2/security_group.py index cb96d1e4..da919da4 100644 --- a/openstack/network/v2/security_group.py +++ b/openstack/network/v2/security_group.py @@ -33,7 +33,7 @@ class SecurityGroup(resource.Resource): description = resource.prop('description') #: The security group name. name = resource.prop('name') - #: The project this security group is associated with. + #: The ID of the project this security group is associated with. project_id = resource.prop('tenant_id') #: A list of #: :class:`~openstack.network.v2.security_group_rule.SecurityGroupRule` diff --git a/openstack/network/v2/security_group_rule.py b/openstack/network/v2/security_group_rule.py index c0ec7a9c..ecbb3304 100644 --- a/openstack/network/v2/security_group_rule.py +++ b/openstack/network/v2/security_group_rule.py @@ -46,14 +46,14 @@ class SecurityGroupRule(resource.Resource): #: must be less than or equal to the value of the port_range_max #: attribute. If the protocol is ICMP, this value must be an ICMP type. port_range_min = resource.prop('port_range_min') - #: The project this rule is associated with. + #: The ID of the project this security group rule is associated with. project_id = resource.prop('tenant_id') #: The protocol that is matched by the security group rule. #: Valid values are ``null``, ``tcp``, ``udp``, and ``icmp``. protocol = resource.prop('protocol') - #: The remote group ID to be associated with this security group rule. - #: You can specify either ``remote_group_id`` or ``remote_ip_prefix`` - #: in the request body. + #: The remote security group ID to be associated with this security + #: group rule. You can specify either ``remote_group_id`` or + #: ``remote_ip_prefix`` in the request body. remote_group_id = resource.prop('remote_group_id') #: The remote IP prefix to be associated with this security group rule. #: You can specify either ``remote_group_id`` or ``remote_ip_prefix`` diff --git a/openstack/network/v2/subnet.py b/openstack/network/v2/subnet.py index 120507e1..e08d715a 100644 --- a/openstack/network/v2/subnet.py +++ b/openstack/network/v2/subnet.py @@ -11,7 +11,6 @@ # under the License. from openstack.network import network_service -from openstack.network.v2 import subnet_pool as _subnet_pool from openstack import resource @@ -55,8 +54,7 @@ class Subnet(resource.Resource): name = resource.prop('name') #: The ID of the attached network. network_id = resource.prop('network_id') - #: The project this subnet is associated with. + #: The ID of the project this subnet is associated with. project_id = resource.prop('tenant_id') - #: The subnet pool from which to obtain a CIDR. *Type: SubnetPool* - subnet_pool = resource.prop('subnetpool_id', - type=_subnet_pool.SubnetPool) + #: The subnet pool ID from which to obtain a CIDR. + subnet_pool_id = resource.prop('subnetpool_id') diff --git a/openstack/network/v2/subnet_pool.py b/openstack/network/v2/subnet_pool.py index 2e51ad52..22409725 100644 --- a/openstack/network/v2/subnet_pool.py +++ b/openstack/network/v2/subnet_pool.py @@ -45,7 +45,7 @@ class SubnetPool(resource.Resource): #: default_quota is measured units of /64. All projects that use the #: subnet pool have the same prefix quota applied. *Type: int* default_quota = resource.prop('default_quota', type=int) - #: The project that owns the subnet pool. + #: The ID of the project that owns the subnet pool. project_id = resource.prop('tenant_id') #: A list of subnet prefixes that are assigned to the subnet pool. #: The adjacent prefixes are merged and treated as a single prefix. diff --git a/openstack/network/v2/vpn_service.py b/openstack/network/v2/vpn_service.py index 6ec3f449..1f6f1e45 100644 --- a/openstack/network/v2/vpn_service.py +++ b/openstack/network/v2/vpn_service.py @@ -39,9 +39,9 @@ class VPNService(resource.Resource): name = resource.prop('name') #: ID of the router into which the VPN service is inserted. router_id = resource.prop('router_id') - #: The project this vpnservice is associated with. + #: The ID of the project this vpnservice is associated with. project_id = resource.prop('tenant_id') #: The vpnservice status. status = resource.prop('status') - #: The subnet on which the tenant wants the vpnservice. + #: The ID of the subnet on which the tenant wants the vpnservice. subnet_id = resource.prop('subnet_id') diff --git a/openstack/tests/unit/network/v2/test_health_monitor.py b/openstack/tests/unit/network/v2/test_health_monitor.py index e3d8215e..a0eeb9b2 100644 --- a/openstack/tests/unit/network/v2/test_health_monitor.py +++ b/openstack/tests/unit/network/v2/test_health_monitor.py @@ -52,7 +52,7 @@ class TestHealthMonitor(testtools.TestCase): self.assertEqual(EXAMPLE['http_method'], sot.http_method) self.assertEqual(EXAMPLE['id'], sot.id) self.assertEqual(EXAMPLE['max_retries'], sot.max_retries) - self.assertEqual(EXAMPLE['pools'], sot.pools) + self.assertEqual(EXAMPLE['pools'], sot.pool_ids) self.assertEqual(EXAMPLE['tenant_id'], sot.project_id) self.assertEqual(EXAMPLE['timeout'], sot.timeout) self.assertEqual(EXAMPLE['type'], sot.type) diff --git a/openstack/tests/unit/network/v2/test_listener.py b/openstack/tests/unit/network/v2/test_listener.py index acbee540..a17edf8e 100644 --- a/openstack/tests/unit/network/v2/test_listener.py +++ b/openstack/tests/unit/network/v2/test_listener.py @@ -52,7 +52,7 @@ class TestListener(testtools.TestCase): self.assertEqual(EXAMPLE['default_pool_id'], sot.default_pool_id) self.assertEqual(EXAMPLE['description'], sot.description) self.assertEqual(EXAMPLE['id'], sot.id) - self.assertEqual(EXAMPLE['loadbalancers'], sot.loadbalancers) + self.assertEqual(EXAMPLE['loadbalancers'], sot.load_balancer_ids) self.assertEqual(EXAMPLE['name'], sot.name) self.assertEqual(EXAMPLE['tenant_id'], sot.project_id) self.assertEqual(EXAMPLE['protocol'], sot.protocol) diff --git a/openstack/tests/unit/network/v2/test_load_balancer.py b/openstack/tests/unit/network/v2/test_load_balancer.py index c2f6eb90..00570d66 100644 --- a/openstack/tests/unit/network/v2/test_load_balancer.py +++ b/openstack/tests/unit/network/v2/test_load_balancer.py @@ -19,7 +19,7 @@ EXAMPLE = { 'admin_state_up': True, 'description': '2', 'id': IDENTIFIER, - 'listeners': '4', + 'listeners': [{'id', '4'}], 'name': '5', 'operating_status': '6', 'provisioning_status': '7', @@ -50,7 +50,7 @@ class TestLoadBalancer(testtools.TestCase): self.assertEqual(EXAMPLE['admin_state_up'], sot.admin_state_up) self.assertEqual(EXAMPLE['description'], sot.description) self.assertEqual(EXAMPLE['id'], sot.id) - self.assertEqual(EXAMPLE['listeners'], sot.listeners) + self.assertEqual(EXAMPLE['listeners'], sot.listener_ids) self.assertEqual(EXAMPLE['name'], sot.name) self.assertEqual(EXAMPLE['operating_status'], sot.operating_status) self.assertEqual(EXAMPLE['provisioning_status'], diff --git a/openstack/tests/unit/network/v2/test_network.py b/openstack/tests/unit/network/v2/test_network.py index ee7f61b5..f2d88e68 100644 --- a/openstack/tests/unit/network/v2/test_network.py +++ b/openstack/tests/unit/network/v2/test_network.py @@ -27,7 +27,7 @@ EXAMPLE = { 'segments': '9', 'shared': True, 'status': '11', - 'subnets': '12', + 'subnets': ['12a', '12b'], 'mtu': 1400, 'port_security_enabled': True, 'availability_zone_hints': ['15', '16'], @@ -65,7 +65,7 @@ class TestNetwork(testtools.TestCase): self.assertEqual(EXAMPLE['segments'], sot.segments) self.assertEqual(EXAMPLE['shared'], sot.shared) self.assertEqual(EXAMPLE['status'], sot.status) - self.assertEqual(EXAMPLE['subnets'], sot.subnets) + self.assertEqual(EXAMPLE['subnets'], sot.subnet_ids) self.assertEqual(EXAMPLE['mtu'], sot.mtu) self.assertEqual(EXAMPLE['port_security_enabled'], sot.is_port_security_enabled) diff --git a/openstack/tests/unit/network/v2/test_pool.py b/openstack/tests/unit/network/v2/test_pool.py index e89f3144..8d0d8d79 100644 --- a/openstack/tests/unit/network/v2/test_pool.py +++ b/openstack/tests/unit/network/v2/test_pool.py @@ -48,11 +48,11 @@ class TestPool(testtools.TestCase): sot = pool.Pool(EXAMPLE) self.assertEqual(EXAMPLE['admin_state_up'], sot.admin_state_up) self.assertEqual(EXAMPLE['description'], sot.description) - self.assertEqual(EXAMPLE['healthmonitor_id'], sot.healthmonitor_id) + self.assertEqual(EXAMPLE['healthmonitor_id'], sot.health_monitor_id) self.assertEqual(EXAMPLE['id'], sot.id) self.assertEqual(EXAMPLE['lb_algorithm'], sot.lb_algorithm) - self.assertEqual(EXAMPLE['listeners'], sot.listeners) - self.assertEqual(EXAMPLE['members'], sot.members) + self.assertEqual(EXAMPLE['listeners'], sot.listener_ids) + self.assertEqual(EXAMPLE['members'], sot.member_ids) self.assertEqual(EXAMPLE['name'], sot.name) self.assertEqual(EXAMPLE['tenant_id'], sot.project_id) self.assertEqual(EXAMPLE['protocol'], sot.protocol) diff --git a/openstack/tests/unit/network/v2/test_port.py b/openstack/tests/unit/network/v2/test_port.py index 75140701..7060858a 100644 --- a/openstack/tests/unit/network/v2/test_port.py +++ b/openstack/tests/unit/network/v2/test_port.py @@ -74,7 +74,7 @@ class TestPort(testtools.TestCase): self.assertEqual(EXAMPLE['name'], sot.name) self.assertEqual(EXAMPLE['network_id'], sot.network_id) self.assertEqual(EXAMPLE['tenant_id'], sot.project_id) - self.assertEqual(EXAMPLE['security_groups'], sot.security_groups) + self.assertEqual(EXAMPLE['security_groups'], sot.security_group_ids) self.assertEqual(EXAMPLE['status'], sot.status) self.assertEqual(EXAMPLE['port_security_enabled'], sot.is_port_security_enabled) diff --git a/openstack/tests/unit/network/v2/test_subnet.py b/openstack/tests/unit/network/v2/test_subnet.py index c34a0475..851d2730 100644 --- a/openstack/tests/unit/network/v2/test_subnet.py +++ b/openstack/tests/unit/network/v2/test_subnet.py @@ -13,7 +13,6 @@ import testtools from openstack.network.v2 import subnet -from openstack.network.v2 import subnet_pool IDENTIFIER = 'IDENTIFIER' EXAMPLE = { @@ -63,6 +62,4 @@ class TestSubnet(testtools.TestCase): self.assertEqual(EXAMPLE['name'], sot.name) self.assertEqual(EXAMPLE['network_id'], sot.network_id) self.assertEqual(EXAMPLE['tenant_id'], sot.project_id) - subnet_pool_data = {'id': EXAMPLE['subnetpool_id']} - self.assertEqual(subnet_pool.SubnetPool(subnet_pool_data), - sot.subnet_pool) + self.assertEqual(EXAMPLE['subnetpool_id'], sot.subnet_pool_id)