Merge "Add network resource properties"
This commit is contained in:
commit
8c3e9cd760
|
@ -30,6 +30,8 @@ class FloatingIP(resource.Resource):
|
||||||
allow_list = True
|
allow_list = True
|
||||||
|
|
||||||
# Properties
|
# Properties
|
||||||
|
#: The floating IP description.
|
||||||
|
description = resource.prop('description')
|
||||||
#: The fixed IP address associated with the floating IP. If you
|
#: The fixed IP address associated with the floating IP. If you
|
||||||
#: intend to associate the floating IP with a fixed IP at creation
|
#: intend to associate the floating IP with a fixed IP at creation
|
||||||
#: time, then you must indicate the identifier of the internal port.
|
#: time, then you must indicate the identifier of the internal port.
|
||||||
|
@ -47,6 +49,8 @@ class FloatingIP(resource.Resource):
|
||||||
project_id = resource.prop('tenant_id')
|
project_id = resource.prop('tenant_id')
|
||||||
#: The ID of an associated router.
|
#: The ID of an associated router.
|
||||||
router_id = resource.prop('router_id')
|
router_id = resource.prop('router_id')
|
||||||
|
#: The floating IP status. Value is ``ACTIVE`` or ``DOWN``.
|
||||||
|
status = resource.prop('status')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def find_available(cls, session):
|
def find_available(cls, session):
|
||||||
|
|
|
@ -39,6 +39,8 @@ class HealthMonitor(resource.Resource):
|
||||||
is_admin_state_up = resource.prop('admin_state_up', type=bool)
|
is_admin_state_up = resource.prop('admin_state_up', type=bool)
|
||||||
#: Maximum consecutive health probe tries.
|
#: Maximum consecutive health probe tries.
|
||||||
max_retries = resource.prop('max_retries')
|
max_retries = resource.prop('max_retries')
|
||||||
|
#: Name of the health monitor.
|
||||||
|
name = resource.prop('name')
|
||||||
#: List of pools associated with this health monitor
|
#: List of pools associated with this health monitor
|
||||||
#: *Type: list of dicts which contain the pool IDs*
|
#: *Type: list of dicts which contain the pool IDs*
|
||||||
pool_ids = resource.prop('pools', type=list)
|
pool_ids = resource.prop('pools', type=list)
|
||||||
|
|
|
@ -40,6 +40,9 @@ class LoadBalancer(resource.Resource):
|
||||||
name = resource.prop('name')
|
name = resource.prop('name')
|
||||||
#: Status of load_balancer operating, e.g. ONLINE, OFFLINE.
|
#: Status of load_balancer operating, e.g. ONLINE, OFFLINE.
|
||||||
operating_status = resource.prop('operating_status')
|
operating_status = resource.prop('operating_status')
|
||||||
|
#: List of pools associated with this load balancer.
|
||||||
|
#: *Type: list of dicts which contain the pool IDs*
|
||||||
|
pool_ids = resource.prop('pools', type=list)
|
||||||
#: The ID of 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')
|
project_id = resource.prop('tenant_id')
|
||||||
#: The name of the provider.
|
#: The name of the provider.
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from openstack import format
|
||||||
from openstack.network import network_service
|
from openstack.network import network_service
|
||||||
from openstack import resource
|
from openstack import resource
|
||||||
|
|
||||||
|
@ -34,6 +35,11 @@ class Network(resource.Resource):
|
||||||
#: Availability zones for the network.
|
#: Availability zones for the network.
|
||||||
#: *Type: list of availability zone names*
|
#: *Type: list of availability zone names*
|
||||||
availability_zones = resource.prop('availability_zones')
|
availability_zones = resource.prop('availability_zones')
|
||||||
|
#: Timestamp when the network was created.
|
||||||
|
#: *Type: datetime object parsed from ISO 8601 formatted string*
|
||||||
|
created_at = resource.prop('created_at', type=format.ISO8601)
|
||||||
|
#: The network description.
|
||||||
|
description = resource.prop('description')
|
||||||
#: The ID of the IPv4 address scope for the network.
|
#: The ID of the IPv4 address scope for the network.
|
||||||
ipv4_address_scope_id = resource.prop('ipv4_address_scope')
|
ipv4_address_scope_id = resource.prop('ipv4_address_scope')
|
||||||
#: The ID of the IPv6 address scope for the network.
|
#: The ID of the IPv6 address scope for the network.
|
||||||
|
@ -41,6 +47,9 @@ class Network(resource.Resource):
|
||||||
#: The administrative state of the network, which is up ``True`` or
|
#: The administrative state of the network, which is up ``True`` or
|
||||||
#: down ``False``. *Type: bool*
|
#: down ``False``. *Type: bool*
|
||||||
is_admin_state_up = resource.prop('admin_state_up', type=bool)
|
is_admin_state_up = resource.prop('admin_state_up', type=bool)
|
||||||
|
#: Whether or not this is the default external network.
|
||||||
|
#: *Type: bool*
|
||||||
|
is_default = resource.prop('is_default', type=bool)
|
||||||
#: The port security status, which is enabled ``True`` or disabled
|
#: The port security status, which is enabled ``True`` or disabled
|
||||||
#: ``False``. *Type: bool* *Default: False*
|
#: ``False``. *Type: bool* *Default: False*
|
||||||
is_port_security_enabled = resource.prop('port_security_enabled',
|
is_port_security_enabled = resource.prop('port_security_enabled',
|
||||||
|
@ -75,3 +84,6 @@ class Network(resource.Resource):
|
||||||
#: The associated subnet IDs.
|
#: The associated subnet IDs.
|
||||||
#: *Type: list of strs of the subnet IDs*
|
#: *Type: list of strs of the subnet IDs*
|
||||||
subnet_ids = resource.prop('subnets', type=list)
|
subnet_ids = resource.prop('subnets', type=list)
|
||||||
|
#: Timestamp when the network was last updated.
|
||||||
|
#: *Type: datetime object parsed from ISO 8601 formatted string*
|
||||||
|
updated_at = resource.prop('updated_at', type=format.ISO8601)
|
||||||
|
|
|
@ -42,6 +42,9 @@ class Pool(resource.Resource):
|
||||||
#: List of associated listeners.
|
#: List of associated listeners.
|
||||||
#: *Type: list of dicts which contain the listener IDs*
|
#: *Type: list of dicts which contain the listener IDs*
|
||||||
listener_ids = resource.prop('listeners', type=list)
|
listener_ids = resource.prop('listeners', type=list)
|
||||||
|
#: List of associated load balancers.
|
||||||
|
#: *Type: list of dicts which contain the load balancer IDs*
|
||||||
|
load_balancer_ids = resource.prop('loadbalancers', type=list)
|
||||||
#: List of members that belong to the pool.
|
#: List of members that belong to the pool.
|
||||||
#: *Type: list of dicts which contain the member IDs*
|
#: *Type: list of dicts which contain the member IDs*
|
||||||
member_ids = resource.prop('members', type=list)
|
member_ids = resource.prop('members', type=list)
|
||||||
|
|
|
@ -33,6 +33,8 @@ class PoolMember(resource.Resource):
|
||||||
#: The administrative state of the pool member, which is up ``True`` or
|
#: The administrative state of the pool member, which is up ``True`` or
|
||||||
#: down ``False``. *Type: bool*
|
#: down ``False``. *Type: bool*
|
||||||
is_admin_state_up = resource.prop('admin_state_up', type=bool)
|
is_admin_state_up = resource.prop('admin_state_up', type=bool)
|
||||||
|
#: Name of the pool member.
|
||||||
|
name = resource.prop('name')
|
||||||
#: The ID of 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')
|
project_id = resource.prop('tenant_id')
|
||||||
#: The port on which the application is hosted.
|
#: The port on which the application is hosted.
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from openstack import format
|
||||||
from openstack.network import network_service
|
from openstack.network import network_service
|
||||||
from openstack import resource
|
from openstack import resource
|
||||||
|
|
||||||
|
@ -56,6 +57,11 @@ class Port(resource.Resource):
|
||||||
#: In GET operations, the binding:vnic_type extended attribute is
|
#: In GET operations, the binding:vnic_type extended attribute is
|
||||||
#: visible to only port owners and administrative users.
|
#: visible to only port owners and administrative users.
|
||||||
binding_vnic_type = resource.prop('binding:vnic_type')
|
binding_vnic_type = resource.prop('binding:vnic_type')
|
||||||
|
#: Timestamp when the port was created.
|
||||||
|
#: *Type: datetime object parsed from ISO 8601 formatted string*
|
||||||
|
created_at = resource.prop('created_at', type=format.ISO8601)
|
||||||
|
#: The port description.
|
||||||
|
description = resource.prop('description')
|
||||||
#: Device ID of this port.
|
#: Device ID of this port.
|
||||||
device_id = resource.prop('device_id')
|
device_id = resource.prop('device_id')
|
||||||
#: Device owner of this port (e.g. ``network:dhcp``).
|
#: Device owner of this port (e.g. ``network:dhcp``).
|
||||||
|
@ -90,3 +96,6 @@ class Port(resource.Resource):
|
||||||
security_group_ids = resource.prop('security_groups', type=list)
|
security_group_ids = resource.prop('security_groups', type=list)
|
||||||
#: The port status. Value is ``ACTIVE`` or ``DOWN``.
|
#: The port status. Value is ``ACTIVE`` or ``DOWN``.
|
||||||
status = resource.prop('status')
|
status = resource.prop('status')
|
||||||
|
#: Timestamp when the port was last updated.
|
||||||
|
#: *Type: datetime object parsed from ISO 8601 formatted string*
|
||||||
|
updated_at = resource.prop('updated_at', type=format.ISO8601)
|
||||||
|
|
|
@ -29,12 +29,24 @@ class Quota(resource.Resource):
|
||||||
# Properties
|
# Properties
|
||||||
#: The maximum amount of floating IPs you can have. *Type: int*
|
#: The maximum amount of floating IPs you can have. *Type: int*
|
||||||
floating_ips = resource.prop('floatingip', type=int)
|
floating_ips = resource.prop('floatingip', type=int)
|
||||||
|
#: The maximum amount of health monitors you can create. *Type: int*
|
||||||
|
health_monitors = resource.prop('healthmonitor', type=int)
|
||||||
|
#: The maximum amount of listeners you can create. *Type: int*
|
||||||
|
listeners = resource.prop('listener', type=int)
|
||||||
|
#: The maximum amount of load balancers you can create. *Type: int*
|
||||||
|
load_balancers = resource.prop('loadbalancer', type=int)
|
||||||
|
#: The maximum amount of L7 policies you can create. *Type: int*
|
||||||
|
l7_policies = resource.prop('l7policy', type=int)
|
||||||
#: The maximum amount of networks you can create. *Type: int*
|
#: The maximum amount of networks you can create. *Type: int*
|
||||||
networks = resource.prop('network', type=int)
|
networks = resource.prop('network', type=int)
|
||||||
|
#: The maximum amount of pools you can create. *Type: int*
|
||||||
|
pools = resource.prop('pool', type=int)
|
||||||
#: The maximum amount of ports you can create. *Type: int*
|
#: The maximum amount of ports you can create. *Type: int*
|
||||||
ports = resource.prop('port', type=int)
|
ports = resource.prop('port', type=int)
|
||||||
#: The ID of the project these quota values are for.
|
#: The ID of the project these quota values are for.
|
||||||
project_id = resource.prop('tenant_id')
|
project_id = resource.prop('tenant_id')
|
||||||
|
#: The maximum amount of RBAC policies you can create. *Type: int*
|
||||||
|
rbac_policies = resource.prop('rbac_policy', type=int)
|
||||||
#: The maximum amount of routers you can create. *Type: int*
|
#: The maximum amount of routers you can create. *Type: int*
|
||||||
routers = resource.prop('router', type=int)
|
routers = resource.prop('router', type=int)
|
||||||
#: The maximum amount of subnets you can create. *Type: int*
|
#: The maximum amount of subnets you can create. *Type: int*
|
||||||
|
@ -45,5 +57,3 @@ class Quota(resource.Resource):
|
||||||
security_group_rules = resource.prop('security_group_rule', type=int)
|
security_group_rules = resource.prop('security_group_rule', type=int)
|
||||||
#: The maximum amount of security groups you can create. *Type: int*
|
#: The maximum amount of security groups you can create. *Type: int*
|
||||||
security_groups = resource.prop('security_group', type=int)
|
security_groups = resource.prop('security_group', type=int)
|
||||||
#: The maximum amount of RBAC policies you can create. *Type: int*
|
|
||||||
rbac_policies = resource.prop('rbac_policy', type=int)
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ class Router(resource.Resource):
|
||||||
#: Availability zones for the router.
|
#: Availability zones for the router.
|
||||||
#: *Type: list of availability zone names*
|
#: *Type: list of availability zone names*
|
||||||
availability_zones = resource.prop('availability_zones')
|
availability_zones = resource.prop('availability_zones')
|
||||||
|
#: The router description.
|
||||||
|
description = resource.prop('description')
|
||||||
#: The ``network_id``, for the external gateway. *Type: dict*
|
#: The ``network_id``, for the external gateway. *Type: dict*
|
||||||
external_gateway_info = resource.prop('external_gateway_info', type=dict)
|
external_gateway_info = resource.prop('external_gateway_info', type=dict)
|
||||||
#: The administrative state of the router, which is up ``True``
|
#: The administrative state of the router, which is up ``True``
|
||||||
|
|
|
@ -33,6 +33,8 @@ class SecurityGroupRule(resource.Resource):
|
||||||
#: rule is applied to incoming ingress traffic for that instance.
|
#: rule is applied to incoming ingress traffic for that instance.
|
||||||
#: An egress rule is applied to traffic leaving the instance.
|
#: An egress rule is applied to traffic leaving the instance.
|
||||||
direction = resource.prop('direction')
|
direction = resource.prop('direction')
|
||||||
|
#: The security group rule description.
|
||||||
|
description = resource.prop('description')
|
||||||
#: Must be IPv4 or IPv6, and addresses represented in CIDR must match
|
#: Must be IPv4 or IPv6, and addresses represented in CIDR must match
|
||||||
#: the ingress or egress rules.
|
#: the ingress or egress rules.
|
||||||
ethertype = resource.prop('ethertype')
|
ethertype = resource.prop('ethertype')
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from openstack import format
|
||||||
from openstack.network import network_service
|
from openstack.network import network_service
|
||||||
from openstack import resource
|
from openstack import resource
|
||||||
|
|
||||||
|
@ -32,6 +33,11 @@ class Subnet(resource.Resource):
|
||||||
allocation_pools = resource.prop('allocation_pools')
|
allocation_pools = resource.prop('allocation_pools')
|
||||||
#: The CIDR.
|
#: The CIDR.
|
||||||
cidr = resource.prop('cidr')
|
cidr = resource.prop('cidr')
|
||||||
|
#: Timestamp when the subnet was created.
|
||||||
|
#: *Type: datetime object parsed from ISO 8601 formatted string*
|
||||||
|
created_at = resource.prop('created_at', type=format.ISO8601)
|
||||||
|
#: The subnet description.
|
||||||
|
description = resource.prop('description')
|
||||||
#: A list of DNS nameservers.
|
#: A list of DNS nameservers.
|
||||||
dns_nameservers = resource.prop('dns_nameservers')
|
dns_nameservers = resource.prop('dns_nameservers')
|
||||||
#: The gateway IP address.
|
#: The gateway IP address.
|
||||||
|
@ -56,3 +62,6 @@ class Subnet(resource.Resource):
|
||||||
project_id = resource.prop('tenant_id')
|
project_id = resource.prop('tenant_id')
|
||||||
#: The subnet pool ID from which to obtain a CIDR.
|
#: The subnet pool ID from which to obtain a CIDR.
|
||||||
subnet_pool_id = resource.prop('subnetpool_id')
|
subnet_pool_id = resource.prop('subnetpool_id')
|
||||||
|
#: Timestamp when the subnet was last updated.
|
||||||
|
#: *Type: datetime object parsed from ISO 8601 formatted string*
|
||||||
|
updated_at = resource.prop('updated_at', type=format.ISO8601)
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from openstack import format
|
||||||
from openstack.network import network_service
|
from openstack.network import network_service
|
||||||
from openstack import resource
|
from openstack import resource
|
||||||
|
|
||||||
|
@ -30,6 +31,9 @@ class SubnetPool(resource.Resource):
|
||||||
# Properties
|
# Properties
|
||||||
#: The ID of the address scope associated with the subnet pool.
|
#: The ID of the address scope associated with the subnet pool.
|
||||||
address_scope_id = resource.prop('address_scope_id')
|
address_scope_id = resource.prop('address_scope_id')
|
||||||
|
#: Timestamp when the subnet pool was created.
|
||||||
|
#: *Type: datetime object parsed from ISO 8601 formatted string*
|
||||||
|
created_at = resource.prop('created_at', type=format.ISO8601)
|
||||||
#: The length of the prefix to allocate when the cidr or prefixlen
|
#: The length of the prefix to allocate when the cidr or prefixlen
|
||||||
#: attributes are omitted when creating a subnet. *Type: int*
|
#: attributes are omitted when creating a subnet. *Type: int*
|
||||||
default_prefix_length = resource.prop('default_prefixlen', type=int)
|
default_prefix_length = resource.prop('default_prefixlen', type=int)
|
||||||
|
@ -39,9 +43,14 @@ class SubnetPool(resource.Resource):
|
||||||
#: default_quota is measured units of /64. All projects that use the
|
#: default_quota is measured units of /64. All projects that use the
|
||||||
#: subnet pool have the same prefix quota applied. *Type: int*
|
#: subnet pool have the same prefix quota applied. *Type: int*
|
||||||
default_quota = resource.prop('default_quota', type=int)
|
default_quota = resource.prop('default_quota', type=int)
|
||||||
|
#: The subnet pool description.
|
||||||
|
description = resource.prop('description')
|
||||||
#: Read-only. The IP address family of the list of prefixes.
|
#: Read-only. The IP address family of the list of prefixes.
|
||||||
#: *Type: int*
|
#: *Type: int*
|
||||||
ip_version = resource.prop('ip_version', type=int)
|
ip_version = resource.prop('ip_version', type=int)
|
||||||
|
#: Whether or not this is the default subnet pool.
|
||||||
|
#: *Type: bool*
|
||||||
|
is_default = resource.prop('is_default', type=bool)
|
||||||
#: Indicates whether this subnet pool is shared across all projects.
|
#: Indicates whether this subnet pool is shared across all projects.
|
||||||
#: *Type: bool*
|
#: *Type: bool*
|
||||||
is_shared = resource.prop('shared', type=bool)
|
is_shared = resource.prop('shared', type=bool)
|
||||||
|
@ -59,3 +68,6 @@ class SubnetPool(resource.Resource):
|
||||||
#: The adjacent prefixes are merged and treated as a single prefix.
|
#: The adjacent prefixes are merged and treated as a single prefix.
|
||||||
#: *Type: list*
|
#: *Type: list*
|
||||||
prefixes = resource.prop('prefixes', type=list)
|
prefixes = resource.prop('prefixes', type=list)
|
||||||
|
#: Timestamp when the subnet pool was last updated.
|
||||||
|
#: *Type: datetime object parsed from ISO 8601 formatted string*
|
||||||
|
updated_at = resource.prop('updated_at', type=format.ISO8601)
|
||||||
|
|
|
@ -24,6 +24,8 @@ EXAMPLE = {
|
||||||
'port_id': '5',
|
'port_id': '5',
|
||||||
'tenant_id': '6',
|
'tenant_id': '6',
|
||||||
'router_id': '7',
|
'router_id': '7',
|
||||||
|
'description': '8',
|
||||||
|
'status': 'ACTIVE',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,6 +54,8 @@ class TestFloatingIP(testtools.TestCase):
|
||||||
self.assertEqual(EXAMPLE['port_id'], sot.port_id)
|
self.assertEqual(EXAMPLE['port_id'], sot.port_id)
|
||||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||||
self.assertEqual(EXAMPLE['router_id'], sot.router_id)
|
self.assertEqual(EXAMPLE['router_id'], sot.router_id)
|
||||||
|
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||||
|
self.assertEqual(EXAMPLE['status'], sot.status)
|
||||||
|
|
||||||
def test_find_available(self):
|
def test_find_available(self):
|
||||||
mock_session = mock.Mock()
|
mock_session = mock.Mock()
|
||||||
|
|
|
@ -27,6 +27,7 @@ EXAMPLE = {
|
||||||
'timeout': '9',
|
'timeout': '9',
|
||||||
'type': '10',
|
'type': '10',
|
||||||
'url_path': '11',
|
'url_path': '11',
|
||||||
|
'name': '12',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,3 +58,4 @@ class TestHealthMonitor(testtools.TestCase):
|
||||||
self.assertEqual(EXAMPLE['timeout'], sot.timeout)
|
self.assertEqual(EXAMPLE['timeout'], sot.timeout)
|
||||||
self.assertEqual(EXAMPLE['type'], sot.type)
|
self.assertEqual(EXAMPLE['type'], sot.type)
|
||||||
self.assertEqual(EXAMPLE['url_path'], sot.url_path)
|
self.assertEqual(EXAMPLE['url_path'], sot.url_path)
|
||||||
|
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||||
|
|
|
@ -28,6 +28,7 @@ EXAMPLE = {
|
||||||
'vip_subnet_id': '10',
|
'vip_subnet_id': '10',
|
||||||
'vip_port_id': '11',
|
'vip_port_id': '11',
|
||||||
'provider': '12',
|
'provider': '12',
|
||||||
|
'pools': [{'id', '13'}],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,3 +61,4 @@ class TestLoadBalancer(testtools.TestCase):
|
||||||
self.assertEqual(EXAMPLE['vip_subnet_id'], sot.vip_subnet_id)
|
self.assertEqual(EXAMPLE['vip_subnet_id'], sot.vip_subnet_id)
|
||||||
self.assertEqual(EXAMPLE['vip_port_id'], sot.vip_port_id)
|
self.assertEqual(EXAMPLE['vip_port_id'], sot.vip_port_id)
|
||||||
self.assertEqual(EXAMPLE['provider'], sot.provider)
|
self.assertEqual(EXAMPLE['provider'], sot.provider)
|
||||||
|
self.assertEqual(EXAMPLE['pools'], sot.pool_ids)
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from openstack.network.v2 import network
|
from openstack.network.v2 import network
|
||||||
|
@ -34,6 +36,10 @@ EXAMPLE = {
|
||||||
'availability_zones': ['16'],
|
'availability_zones': ['16'],
|
||||||
'ipv4_address_scope': '17',
|
'ipv4_address_scope': '17',
|
||||||
'ipv6_address_scope': '18',
|
'ipv6_address_scope': '18',
|
||||||
|
'description': '19',
|
||||||
|
'created_at': '2016-03-09T12:14:57.233772',
|
||||||
|
'updated_at': '2016-07-09T12:14:57.233772',
|
||||||
|
'is_default': False,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,3 +84,11 @@ class TestNetwork(testtools.TestCase):
|
||||||
sot.ipv4_address_scope_id)
|
sot.ipv4_address_scope_id)
|
||||||
self.assertEqual(EXAMPLE['ipv6_address_scope'],
|
self.assertEqual(EXAMPLE['ipv6_address_scope'],
|
||||||
sot.ipv6_address_scope_id)
|
sot.ipv6_address_scope_id)
|
||||||
|
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||||
|
dt = datetime.datetime(2016, 3, 9, 12, 14, 57, 233772).replace(
|
||||||
|
tzinfo=None)
|
||||||
|
self.assertEqual(dt, sot.created_at.replace(tzinfo=None))
|
||||||
|
dt = datetime.datetime(2016, 7, 9, 12, 14, 57, 233772).replace(
|
||||||
|
tzinfo=None)
|
||||||
|
self.assertEqual(dt, sot.updated_at.replace(tzinfo=None))
|
||||||
|
self.assertFalse(sot.is_default)
|
||||||
|
|
|
@ -27,6 +27,7 @@ EXAMPLE = {
|
||||||
'tenant_id': '9',
|
'tenant_id': '9',
|
||||||
'protocol': '10',
|
'protocol': '10',
|
||||||
'session_persistence': '11',
|
'session_persistence': '11',
|
||||||
|
'loadbalancers': [{'id': '12'}],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,3 +59,4 @@ class TestPool(testtools.TestCase):
|
||||||
self.assertEqual(EXAMPLE['protocol'], sot.protocol)
|
self.assertEqual(EXAMPLE['protocol'], sot.protocol)
|
||||||
self.assertEqual(EXAMPLE['session_persistence'],
|
self.assertEqual(EXAMPLE['session_persistence'],
|
||||||
sot.session_persistence)
|
sot.session_persistence)
|
||||||
|
self.assertEqual(EXAMPLE['loadbalancers'], sot.load_balancer_ids)
|
||||||
|
|
|
@ -25,6 +25,7 @@ EXAMPLE = {
|
||||||
'protocol_port': 5,
|
'protocol_port': 5,
|
||||||
'subnet_id': '6',
|
'subnet_id': '6',
|
||||||
'weight': 7,
|
'weight': 7,
|
||||||
|
'name': '8',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,6 +52,7 @@ class TestPoolMember(testtools.TestCase):
|
||||||
self.assertEqual(EXAMPLE['protocol_port'], sot.protocol_port)
|
self.assertEqual(EXAMPLE['protocol_port'], sot.protocol_port)
|
||||||
self.assertEqual(EXAMPLE['subnet_id'], sot.subnet_id)
|
self.assertEqual(EXAMPLE['subnet_id'], sot.subnet_id)
|
||||||
self.assertEqual(EXAMPLE['weight'], sot.weight)
|
self.assertEqual(EXAMPLE['weight'], sot.weight)
|
||||||
|
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||||
|
|
||||||
def test_create_body(self):
|
def test_create_body(self):
|
||||||
params = copy.deepcopy(EXAMPLE)
|
params = copy.deepcopy(EXAMPLE)
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from openstack.network.v2 import port
|
from openstack.network.v2 import port
|
||||||
|
@ -37,6 +39,9 @@ EXAMPLE = {
|
||||||
'port_security_enabled': True,
|
'port_security_enabled': True,
|
||||||
'dns_assignment': [{'19': 19}],
|
'dns_assignment': [{'19': 19}],
|
||||||
'dns_name': '20',
|
'dns_name': '20',
|
||||||
|
'description': '21',
|
||||||
|
'created_at': '2016-03-09T12:14:57.233772',
|
||||||
|
'updated_at': '2016-07-09T12:14:57.233772',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,3 +84,10 @@ class TestPort(testtools.TestCase):
|
||||||
self.assertTrue(sot.is_port_security_enabled)
|
self.assertTrue(sot.is_port_security_enabled)
|
||||||
self.assertEqual(EXAMPLE['dns_assignment'], sot.dns_assignment)
|
self.assertEqual(EXAMPLE['dns_assignment'], sot.dns_assignment)
|
||||||
self.assertEqual(EXAMPLE['dns_name'], sot.dns_name)
|
self.assertEqual(EXAMPLE['dns_name'], sot.dns_name)
|
||||||
|
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||||
|
dt = datetime.datetime(2016, 3, 9, 12, 14, 57, 233772).replace(
|
||||||
|
tzinfo=None)
|
||||||
|
self.assertEqual(dt, sot.created_at.replace(tzinfo=None))
|
||||||
|
dt = datetime.datetime(2016, 7, 9, 12, 14, 57, 233772).replace(
|
||||||
|
tzinfo=None)
|
||||||
|
self.assertEqual(dt, sot.updated_at.replace(tzinfo=None))
|
||||||
|
|
|
@ -26,6 +26,11 @@ EXAMPLE = {
|
||||||
'security_group_rule': 8,
|
'security_group_rule': 8,
|
||||||
'security_group': 9,
|
'security_group': 9,
|
||||||
'rbac_policy': -1,
|
'rbac_policy': -1,
|
||||||
|
'healthmonitor': 11,
|
||||||
|
'listener': 12,
|
||||||
|
'loadbalancer': 13,
|
||||||
|
'l7policy': 14,
|
||||||
|
'pool': 15,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,3 +61,8 @@ class TestQuota(testtools.TestCase):
|
||||||
sot.security_group_rules)
|
sot.security_group_rules)
|
||||||
self.assertEqual(EXAMPLE['security_group'], sot.security_groups)
|
self.assertEqual(EXAMPLE['security_group'], sot.security_groups)
|
||||||
self.assertEqual(EXAMPLE['rbac_policy'], sot.rbac_policies)
|
self.assertEqual(EXAMPLE['rbac_policy'], sot.rbac_policies)
|
||||||
|
self.assertEqual(EXAMPLE['healthmonitor'], sot.health_monitors)
|
||||||
|
self.assertEqual(EXAMPLE['listener'], sot.listeners)
|
||||||
|
self.assertEqual(EXAMPLE['loadbalancer'], sot.load_balancers)
|
||||||
|
self.assertEqual(EXAMPLE['l7policy'], sot.l7_policies)
|
||||||
|
self.assertEqual(EXAMPLE['pool'], sot.pools)
|
||||||
|
|
|
@ -26,6 +26,7 @@ EXAMPLE = {
|
||||||
'routes': [],
|
'routes': [],
|
||||||
'availability_zone_hints': [],
|
'availability_zone_hints': [],
|
||||||
'availability_zones': [],
|
'availability_zones': [],
|
||||||
|
'description': '10',
|
||||||
}
|
}
|
||||||
|
|
||||||
EXAMPLE_WITH_OPTIONAL = {
|
EXAMPLE_WITH_OPTIONAL = {
|
||||||
|
@ -42,6 +43,7 @@ EXAMPLE_WITH_OPTIONAL = {
|
||||||
'distributed': True,
|
'distributed': True,
|
||||||
'availability_zone_hints': ['zone-1', 'zone-2'],
|
'availability_zone_hints': ['zone-1', 'zone-2'],
|
||||||
'availability_zones': ['zone-2'],
|
'availability_zones': ['zone-2'],
|
||||||
|
'description': 'description',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,6 +77,7 @@ class TestRouter(testtools.TestCase):
|
||||||
sot.availability_zone_hints)
|
sot.availability_zone_hints)
|
||||||
self.assertEqual(EXAMPLE['availability_zones'],
|
self.assertEqual(EXAMPLE['availability_zones'],
|
||||||
sot.availability_zones)
|
sot.availability_zones)
|
||||||
|
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||||
|
|
||||||
def test_make_it_with_optional(self):
|
def test_make_it_with_optional(self):
|
||||||
sot = router.Router(EXAMPLE_WITH_OPTIONAL)
|
sot = router.Router(EXAMPLE_WITH_OPTIONAL)
|
||||||
|
@ -92,6 +95,8 @@ class TestRouter(testtools.TestCase):
|
||||||
sot.availability_zone_hints)
|
sot.availability_zone_hints)
|
||||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['availability_zones'],
|
self.assertEqual(EXAMPLE_WITH_OPTIONAL['availability_zones'],
|
||||||
sot.availability_zones)
|
sot.availability_zones)
|
||||||
|
self.assertEqual(EXAMPLE_WITH_OPTIONAL['description'],
|
||||||
|
sot.description)
|
||||||
|
|
||||||
def test_add_interface_subnet(self):
|
def test_add_interface_subnet(self):
|
||||||
# Add subnet to a router
|
# Add subnet to a router
|
||||||
|
|
|
@ -26,6 +26,7 @@ EXAMPLE = {
|
||||||
'remote_group_id': '8',
|
'remote_group_id': '8',
|
||||||
'remote_ip_prefix': '9',
|
'remote_ip_prefix': '9',
|
||||||
'security_group_id': '10',
|
'security_group_id': '10',
|
||||||
|
'description': '11',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,3 +56,4 @@ class TestSecurityGroupRule(testtools.TestCase):
|
||||||
self.assertEqual(EXAMPLE['remote_group_id'], sot.remote_group_id)
|
self.assertEqual(EXAMPLE['remote_group_id'], sot.remote_group_id)
|
||||||
self.assertEqual(EXAMPLE['remote_ip_prefix'], sot.remote_ip_prefix)
|
self.assertEqual(EXAMPLE['remote_ip_prefix'], sot.remote_ip_prefix)
|
||||||
self.assertEqual(EXAMPLE['security_group_id'], sot.security_group_id)
|
self.assertEqual(EXAMPLE['security_group_id'], sot.security_group_id)
|
||||||
|
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from openstack.network.v2 import subnet
|
from openstack.network.v2 import subnet
|
||||||
|
@ -30,6 +32,9 @@ EXAMPLE = {
|
||||||
'network_id': '10',
|
'network_id': '10',
|
||||||
'tenant_id': '11',
|
'tenant_id': '11',
|
||||||
'subnetpool_id': '12',
|
'subnetpool_id': '12',
|
||||||
|
'description': '13',
|
||||||
|
'created_at': '2016-03-09T12:14:57.233772',
|
||||||
|
'updated_at': '2016-07-09T12:14:57.233772',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,3 +68,10 @@ class TestSubnet(testtools.TestCase):
|
||||||
self.assertEqual(EXAMPLE['network_id'], sot.network_id)
|
self.assertEqual(EXAMPLE['network_id'], sot.network_id)
|
||||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||||
self.assertEqual(EXAMPLE['subnetpool_id'], sot.subnet_pool_id)
|
self.assertEqual(EXAMPLE['subnetpool_id'], sot.subnet_pool_id)
|
||||||
|
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||||
|
dt = datetime.datetime(2016, 3, 9, 12, 14, 57, 233772).replace(
|
||||||
|
tzinfo=None)
|
||||||
|
self.assertEqual(dt, sot.created_at.replace(tzinfo=None))
|
||||||
|
dt = datetime.datetime(2016, 7, 9, 12, 14, 57, 233772).replace(
|
||||||
|
tzinfo=None)
|
||||||
|
self.assertEqual(dt, sot.updated_at.replace(tzinfo=None))
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from openstack.network.v2 import subnet_pool
|
from openstack.network.v2 import subnet_pool
|
||||||
|
@ -27,6 +29,10 @@ EXAMPLE = {
|
||||||
'ip_version': 4,
|
'ip_version': 4,
|
||||||
'shared': True,
|
'shared': True,
|
||||||
'address_scope_id': '11',
|
'address_scope_id': '11',
|
||||||
|
'description': '12',
|
||||||
|
'created_at': '2016-03-09T12:14:57.233772',
|
||||||
|
'updated_at': '2016-07-09T12:14:57.233772',
|
||||||
|
'is_default': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,3 +66,11 @@ class TestSubnetpool(testtools.TestCase):
|
||||||
self.assertEqual(EXAMPLE['ip_version'], sot.ip_version)
|
self.assertEqual(EXAMPLE['ip_version'], sot.ip_version)
|
||||||
self.assertTrue(sot.is_shared)
|
self.assertTrue(sot.is_shared)
|
||||||
self.assertEqual(EXAMPLE['address_scope_id'], sot.address_scope_id)
|
self.assertEqual(EXAMPLE['address_scope_id'], sot.address_scope_id)
|
||||||
|
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||||
|
dt = datetime.datetime(2016, 3, 9, 12, 14, 57, 233772).replace(
|
||||||
|
tzinfo=None)
|
||||||
|
self.assertEqual(dt, sot.created_at.replace(tzinfo=None))
|
||||||
|
dt = datetime.datetime(2016, 7, 9, 12, 14, 57, 233772).replace(
|
||||||
|
tzinfo=None)
|
||||||
|
self.assertEqual(dt, sot.updated_at.replace(tzinfo=None))
|
||||||
|
self.assertTrue(sot.is_default)
|
||||||
|
|
Loading…
Reference in New Issue