Rebase network resources to resource2 (3)
Change-Id: I56fbc0ca3307a9c2e246a2b56a53f4b112f9ba26
This commit is contained in:
@@ -36,6 +36,8 @@ class FloatingIP(resource.Resource):
|
||||
revision_number='revision')
|
||||
|
||||
# Properties
|
||||
#: Timestamp at which the floating IP was created.
|
||||
created_at = resource.Body('created_at')
|
||||
#: The floating IP description.
|
||||
description = resource.Body('description')
|
||||
#: The fixed IP address associated with the floating IP. If you
|
||||
@@ -54,11 +56,13 @@ class FloatingIP(resource.Resource):
|
||||
#: The ID of the project this floating IP is associated with.
|
||||
project_id = resource.Body('tenant_id')
|
||||
#: Revision number of the floating IP. *Type: int*
|
||||
revision_number = resource.Body('revision', type=int)
|
||||
revision_number = resource.Body('revision_number', type=int)
|
||||
#: The ID of an associated router.
|
||||
router_id = resource.Body('router_id')
|
||||
#: The floating IP status. Value is ``ACTIVE`` or ``DOWN``.
|
||||
status = resource.Body('status')
|
||||
#: Timestamp at which the floating IP was last updated.
|
||||
updated_at = resource.Body('updated_at')
|
||||
|
||||
@classmethod
|
||||
def find_available(cls, session):
|
||||
|
||||
@@ -95,7 +95,7 @@ class Network(resource.Resource):
|
||||
#: The ID of the QoS policy attached to the port.
|
||||
qos_policy_id = resource.Body('qos_policy_id')
|
||||
#: Revision number of the network. *Type: int*
|
||||
revision_number = resource.Body('revision', type=int)
|
||||
revision_number = resource.Body('revision_number', type=int)
|
||||
#: A list of provider segment objects.
|
||||
#: Available for multiple provider extensions.
|
||||
segments = resource.Body('segments')
|
||||
|
||||
@@ -106,7 +106,7 @@ class Port(resource.Resource):
|
||||
#: The ID of the QoS policy attached to the port.
|
||||
qos_policy_id = resource.Body('qos_policy_id')
|
||||
#: Revision number of the port. *Type: int*
|
||||
revision_number = resource.Body('revision', type=int)
|
||||
revision_number = resource.Body('revision_number', type=int)
|
||||
#: The IDs of any attached security groups.
|
||||
#: *Type: list of strs of the security group IDs*
|
||||
security_group_ids = resource.Body('security_groups', type=list)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
from openstack.network import network_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class RBACPolicy(resource.Resource):
|
||||
@@ -22,19 +22,21 @@ class RBACPolicy(resource.Resource):
|
||||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
||||
# NOTE: This resource doesn't support query parameters
|
||||
|
||||
# Properties
|
||||
#: ID of the object that this RBAC policy affects.
|
||||
object_id = resource.prop('object_id')
|
||||
object_id = resource.Body('object_id')
|
||||
#: The ID of the project this RBAC will be enforced.
|
||||
target_project_id = resource.prop('target_tenant')
|
||||
target_project_id = resource.Body('target_tenant')
|
||||
#: The owner project ID.
|
||||
project_id = resource.prop('tenant_id')
|
||||
project_id = resource.Body('tenant_id')
|
||||
#: Type of the object that this RBAC policy affects.
|
||||
object_type = resource.prop('object_type')
|
||||
object_type = resource.Body('object_type')
|
||||
#: Action for the RBAC policy.
|
||||
action = resource.prop('action')
|
||||
action = resource.Body('action')
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
from openstack.network import network_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
from openstack import utils
|
||||
|
||||
|
||||
@@ -23,45 +23,57 @@ class Router(resource.Resource):
|
||||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
||||
# NOTE: We don't support query on datetime, list or dict fields
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'description', 'flavor_id', 'name', 'status',
|
||||
is_admin_state_up='admin_state_up',
|
||||
is_distributed='distributed',
|
||||
is_ha='ha',
|
||||
project_id='tenant_id',
|
||||
)
|
||||
|
||||
# Properties
|
||||
#: Availability zone hints to use when scheduling the router.
|
||||
#: *Type: list of availability zone names*
|
||||
availability_zone_hints = resource.prop('availability_zone_hints')
|
||||
availability_zone_hints = resource.Body('availability_zone_hints',
|
||||
type=list)
|
||||
#: Availability zones for the router.
|
||||
#: *Type: list of availability zone names*
|
||||
availability_zones = resource.prop('availability_zones')
|
||||
availability_zones = resource.Body('availability_zones', type=list)
|
||||
#: Timestamp when the router was created.
|
||||
created_at = resource.prop('created_at')
|
||||
created_at = resource.Body('created_at')
|
||||
#: The router description.
|
||||
description = resource.prop('description')
|
||||
description = resource.Body('description')
|
||||
#: The ``network_id``, for the external gateway. *Type: dict*
|
||||
external_gateway_info = resource.prop('external_gateway_info', type=dict)
|
||||
external_gateway_info = resource.Body('external_gateway_info', type=dict)
|
||||
#: The ID of the flavor.
|
||||
flavor_id = resource.Body('flavor_id')
|
||||
#: The administrative state of the router, which is up ``True``
|
||||
#: or down ``False``. *Type: bool*
|
||||
is_admin_state_up = resource.prop('admin_state_up', type=bool)
|
||||
is_admin_state_up = resource.Body('admin_state_up', type=bool)
|
||||
#: The distributed state of the router, which is distributed ``True``
|
||||
#: or not ``False``. *Type: bool* *Default: False*
|
||||
is_distributed = resource.prop('distributed', type=bool, default=False)
|
||||
is_distributed = resource.Body('distributed', type=bool, default=False)
|
||||
#: The highly-available state of the router, which is highly available
|
||||
#: ``True`` or not ``False``. *Type: bool* *Default: False*
|
||||
is_ha = resource.prop('ha', type=bool, default=False)
|
||||
is_ha = resource.Body('ha', type=bool, default=False)
|
||||
#: The router name.
|
||||
name = resource.prop('name')
|
||||
name = resource.Body('name')
|
||||
#: The ID of the project this router is associated with.
|
||||
project_id = resource.prop('tenant_id')
|
||||
project_id = resource.Body('tenant_id')
|
||||
#: Revision number of the router. *Type: int*
|
||||
revision_number = resource.prop('revision_number', type=int)
|
||||
revision_number = resource.Body('revision', type=int)
|
||||
#: The extra routes configuration for the router.
|
||||
routes = resource.prop('routes', type=list)
|
||||
routes = resource.Body('routes', type=list)
|
||||
#: The router status.
|
||||
status = resource.prop('status')
|
||||
#: Timestamp when the router was last updated.
|
||||
updated_at = resource.prop('updated_at')
|
||||
status = resource.Body('status')
|
||||
#: Timestamp when the router was created.
|
||||
updated_at = resource.Body('updated_at')
|
||||
|
||||
def add_interface(self, session, **body):
|
||||
"""Add an internal interface to a logical router.
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
from openstack.network import network_service
|
||||
from openstack.network.v2 import security_group_rule as group_rules
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class SecurityGroup(resource.Resource):
|
||||
@@ -23,34 +22,30 @@ class SecurityGroup(resource.Resource):
|
||||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'description', 'name',
|
||||
project_id='tenant_id',
|
||||
)
|
||||
|
||||
# Properties
|
||||
#: Timestamp when the security group was created.
|
||||
created_at = resource.prop('created_at')
|
||||
created_at = resource.Body('created_at')
|
||||
#: The security group description.
|
||||
description = resource.prop('description')
|
||||
description = resource.Body('description')
|
||||
#: The security group name.
|
||||
name = resource.prop('name')
|
||||
name = resource.Body('name')
|
||||
#: The ID of the project this security group is associated with.
|
||||
project_id = resource.prop('tenant_id')
|
||||
project_id = resource.Body('tenant_id')
|
||||
#: Revision number of the security group. *Type: int*
|
||||
revision_number = resource.prop('revision_number', type=int)
|
||||
revision_number = resource.Body('revision_number', type=int)
|
||||
#: A list of
|
||||
#: :class:`~openstack.network.v2.security_group_rule.SecurityGroupRule`
|
||||
#: objects. *Type: list*
|
||||
security_group_rules = resource.prop('security_group_rules')
|
||||
security_group_rules = resource.Body('security_group_rules', type=list)
|
||||
#: Timestamp when the security group was last updated.
|
||||
updated_at = resource.prop('updated_at')
|
||||
|
||||
def __init__(self, attrs=None, loaded=False):
|
||||
super(SecurityGroup, self).__init__(attrs=attrs, loaded=loaded)
|
||||
# Convert any raw rules to SecurityGroupRule objects.
|
||||
if self.security_group_rules:
|
||||
rules = []
|
||||
for rule in self.security_group_rules:
|
||||
rules.append(group_rules.SecurityGroupRule.existing(**rule))
|
||||
self.security_group_rules = rules
|
||||
updated_at = resource.Body('updated_at')
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
from openstack.network import network_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class SecurityGroupRule(resource.Resource):
|
||||
@@ -22,51 +22,57 @@ class SecurityGroupRule(resource.Resource):
|
||||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = False
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'description', 'direction', 'ethertype', 'protocol',
|
||||
'remote_group_id', 'security_group_id',
|
||||
project_id='tenant_id',
|
||||
)
|
||||
|
||||
# Properties
|
||||
#: Timestamp when the security group rule was created.
|
||||
created_at = resource.prop('created_at')
|
||||
created_at = resource.Body('created_at')
|
||||
#: The security group rule description.
|
||||
description = resource.Body('description')
|
||||
#: ``ingress`` or ``egress``: The direction in which the security group
|
||||
#: rule is applied. For a compute instance, an ingress security group
|
||||
#: rule is applied to incoming ingress traffic for that instance.
|
||||
#: An egress rule is applied to traffic leaving the instance.
|
||||
direction = resource.prop('direction')
|
||||
#: The security group rule description.
|
||||
description = resource.prop('description')
|
||||
direction = resource.Body('direction')
|
||||
#: Must be IPv4 or IPv6, and addresses represented in CIDR must match
|
||||
#: the ingress or egress rules.
|
||||
ethertype = resource.prop('ethertype')
|
||||
ether_type = resource.Body('ethertype')
|
||||
#: The maximum port number in the range that is matched by the
|
||||
#: security group rule. The port_range_min attribute constrains
|
||||
#: the port_range_max attribute. If the protocol is ICMP, this
|
||||
#: value must be an ICMP type.
|
||||
port_range_max = resource.prop('port_range_max')
|
||||
port_range_max = resource.Body('port_range_max', type=int)
|
||||
#: The minimum port number in the range that is matched by the
|
||||
#: security group rule. If the protocol is TCP or UDP, this value
|
||||
#: 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')
|
||||
port_range_min = resource.Body('port_range_min', type=int)
|
||||
#: The ID of the project this security group rule is associated with.
|
||||
project_id = resource.prop('tenant_id')
|
||||
project_id = resource.Body('tenant_id')
|
||||
#: The protocol that is matched by the security group rule.
|
||||
#: Valid values are ``null``, ``tcp``, ``udp``, and ``icmp``.
|
||||
protocol = resource.prop('protocol')
|
||||
protocol = resource.Body('protocol')
|
||||
#: 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')
|
||||
remote_group_id = resource.Body('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``
|
||||
#: in the request body. This attribute matches the specified IP prefix
|
||||
#: as the source IP address of the IP packet.
|
||||
remote_ip_prefix = resource.prop('remote_ip_prefix')
|
||||
remote_ip_prefix = resource.Body('remote_ip_prefix')
|
||||
#: Revision number of the security group rule. *Type: int*
|
||||
revision_number = resource.prop('revision_number', type=int)
|
||||
revision_number = resource.Body('revision_number', type=int)
|
||||
#: The security group ID to associate with this security group rule.
|
||||
security_group_id = resource.prop('security_group_id')
|
||||
security_group_id = resource.Body('security_group_id')
|
||||
#: Timestamp when the security group rule was last updated.
|
||||
updated_at = resource.prop('updated_at')
|
||||
updated_at = resource.Body('updated_at')
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
from openstack.network import network_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class Segment(resource.Resource):
|
||||
@@ -22,25 +22,30 @@ class Segment(resource.Resource):
|
||||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'description', 'name', 'network_id', 'network_type',
|
||||
'physical_network', 'segmentation_id',
|
||||
)
|
||||
|
||||
# Properties
|
||||
#: The segment description.
|
||||
description = resource.prop('description')
|
||||
description = resource.Body('description')
|
||||
#: The segment name.
|
||||
name = resource.prop('name')
|
||||
name = resource.Body('name')
|
||||
#: The ID of the network associated with this segment.
|
||||
network_id = resource.prop('network_id')
|
||||
network_id = resource.Body('network_id')
|
||||
#: The type of network associated with this segment, such as
|
||||
#: ``flat``, ``geneve``, ``gre``, ``local``, ``vlan`` or ``vxlan``.
|
||||
network_type = resource.prop('network_type')
|
||||
network_type = resource.Body('network_type')
|
||||
#: The name of the physical network associated with this segment.
|
||||
physical_network = resource.prop('physical_network')
|
||||
physical_network = resource.Body('physical_network')
|
||||
#: The segmentation ID for this segment. The network type
|
||||
#: defines the segmentation model, VLAN ID for ``vlan`` network type
|
||||
#: and tunnel ID for ``geneve``, ``gre`` and ``vxlan`` network types.
|
||||
#: *Type: int*
|
||||
segmentation_id = resource.prop('segmentation_id', type=int)
|
||||
segmentation_id = resource.Body('segmentation_id', type=int)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
from openstack.network import network_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class Subnet(resource.Resource):
|
||||
@@ -22,49 +22,62 @@ class Subnet(resource.Resource):
|
||||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
||||
# NOTE: Query on list or datetime fields are currently not supported.
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'cidr', 'description', 'gateway_ip', 'ip_version',
|
||||
'ipv6_address_mode', 'ipv6_ra_mode', 'name', 'network_id',
|
||||
'segment_id',
|
||||
is_dhcp_enabled='enable_dhcp',
|
||||
project_id='tenant_id',
|
||||
subnet_pool_id='subnetpool_id',
|
||||
)
|
||||
|
||||
# Properties
|
||||
#: The start and end addresses for the allocation pools.
|
||||
allocation_pools = resource.prop('allocation_pools')
|
||||
#: List of allocation pools each of which has a start and an end address
|
||||
#: for this subnet
|
||||
allocation_pools = resource.Body('allocation_pools', type=list)
|
||||
#: The CIDR.
|
||||
cidr = resource.prop('cidr')
|
||||
cidr = resource.Body('cidr')
|
||||
#: Timestamp when the subnet was created.
|
||||
created_at = resource.prop('created_at')
|
||||
created_at = resource.Body('created_at')
|
||||
#: The subnet description.
|
||||
description = resource.prop('description')
|
||||
description = resource.Body('description')
|
||||
#: A list of DNS nameservers.
|
||||
dns_nameservers = resource.prop('dns_nameservers')
|
||||
dns_nameservers = resource.Body('dns_nameservers', type=list)
|
||||
#: The gateway IP address.
|
||||
gateway_ip = resource.prop('gateway_ip')
|
||||
gateway_ip = resource.Body('gateway_ip')
|
||||
#: A list of host routes.
|
||||
host_routes = resource.prop('host_routes')
|
||||
#: The IP version, which is ``4`` or ``6``.
|
||||
ip_version = resource.prop('ip_version')
|
||||
#: The IPv6 address modes which are 'dhcpv6-stateful', 'dhcpv6-stateless',
|
||||
#: or 'SLAAC'
|
||||
ipv6_address_mode = resource.prop('ipv6_address_mode')
|
||||
#: The IPv6 router advertisements modes
|
||||
ipv6_ra_mode = resource.prop('ipv6_ra_mode')
|
||||
host_routes = resource.Body('host_routes', type=list)
|
||||
#: The IP version, which is 4 or 6.
|
||||
#: *Type: int*
|
||||
ip_version = resource.Body('ip_version', type=int)
|
||||
#: The IPv6 address modes which are 'dhcpv6-stateful', 'dhcpv6-stateless'
|
||||
#: or 'slacc'.
|
||||
ipv6_address_mode = resource.Body('ipv6_address_mode')
|
||||
#: The IPv6 router advertisements modes which can be 'slaac',
|
||||
#: 'dhcpv6-stateful', 'dhcpv6-stateless'.
|
||||
ipv6_ra_mode = resource.Body('ipv6_ra_mode')
|
||||
#: Set to ``True`` if DHCP is enabled and ``False`` if DHCP is disabled.
|
||||
#: *Type: bool*
|
||||
is_dhcp_enabled = resource.prop('enable_dhcp', type=bool)
|
||||
is_dhcp_enabled = resource.Body('enable_dhcp', type=bool)
|
||||
#: The subnet name.
|
||||
name = resource.prop('name')
|
||||
name = resource.Body('name')
|
||||
#: The ID of the attached network.
|
||||
network_id = resource.prop('network_id')
|
||||
network_id = resource.Body('network_id')
|
||||
#: The ID of the project this subnet is associated with.
|
||||
project_id = resource.prop('tenant_id')
|
||||
project_id = resource.Body('tenant_id')
|
||||
#: Revision number of the subnet. *Type: int*
|
||||
revision_number = resource.prop('revision_number', type=int)
|
||||
revision_number = resource.Body('revision_number', type=int)
|
||||
#: The ID of the segment this subnet is associated with.
|
||||
segment_id = resource.prop('segment_id')
|
||||
segment_id = resource.Body('segment_id')
|
||||
#: Service types for this subnet
|
||||
service_types = resource.prop('service_types', type=list)
|
||||
service_types = resource.Body('service_types', type=list)
|
||||
#: The subnet pool ID from which to obtain a CIDR.
|
||||
subnet_pool_id = resource.prop('subnetpool_id')
|
||||
subnet_pool_id = resource.Body('subnetpool_id')
|
||||
#: Timestamp when the subnet was last updated.
|
||||
updated_at = resource.prop('updated_at')
|
||||
updated_at = resource.Body('updated_at')
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
from openstack.network import network_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class SubnetPool(resource.Resource):
|
||||
@@ -22,51 +22,58 @@ class SubnetPool(resource.Resource):
|
||||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'address_scope_id', 'description', 'ip_version', 'is_default',
|
||||
'name',
|
||||
is_shared='shared',
|
||||
project_id='tenant_id',
|
||||
)
|
||||
|
||||
# Properties
|
||||
#: The ID of the address scope associated with the subnet pool.
|
||||
address_scope_id = resource.prop('address_scope_id')
|
||||
address_scope_id = resource.Body('address_scope_id')
|
||||
#: Timestamp when the subnet pool was created.
|
||||
created_at = resource.prop('created_at')
|
||||
created_at = resource.Body('created_at')
|
||||
#: The length of the prefix to allocate when the cidr or prefixlen
|
||||
#: attributes are omitted when creating a subnet. *Type: int*
|
||||
default_prefix_length = resource.prop('default_prefixlen', type=int)
|
||||
default_prefix_length = resource.Body('default_prefixlen', type=int)
|
||||
#: A per-project quota on the prefix space that can be allocated
|
||||
#: from the subnet pool for project subnets. For IPv4 subnet pools,
|
||||
#: default_quota is measured in units of /32. For IPv6 subnet pools,
|
||||
#: 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)
|
||||
default_quota = resource.Body('default_quota', type=int)
|
||||
#: The subnet pool description.
|
||||
description = resource.prop('description')
|
||||
description = resource.Body('description')
|
||||
#: Read-only. The IP address family of the list of prefixes.
|
||||
#: *Type: int*
|
||||
ip_version = resource.prop('ip_version', type=int)
|
||||
ip_version = resource.Body('ip_version', type=int)
|
||||
#: Whether or not this is the default subnet pool.
|
||||
#: *Type: bool*
|
||||
is_default = resource.prop('is_default', type=bool)
|
||||
is_default = resource.Body('is_default', type=bool)
|
||||
#: Indicates whether this subnet pool is shared across all projects.
|
||||
#: *Type: bool*
|
||||
is_shared = resource.prop('shared', type=bool)
|
||||
is_shared = resource.Body('shared', type=bool)
|
||||
#: The maximum prefix length that can be allocated from the
|
||||
#: subnet pool. *Type: int*
|
||||
maximum_prefix_length = resource.prop('max_prefixlen', type=int)
|
||||
maximum_prefix_length = resource.Body('max_prefixlen', type=int)
|
||||
#: The minimum prefix length that can be allocated from the
|
||||
#: subnet pool. *Type: int*
|
||||
minimum_prefix_length = resource.prop('min_prefixlen', type=int)
|
||||
minimum_prefix_length = resource.Body('min_prefixlen', type=int)
|
||||
#: The subnet pool name.
|
||||
name = resource.prop('name')
|
||||
name = resource.Body('name')
|
||||
#: The ID of the project that owns the subnet pool.
|
||||
project_id = resource.prop('tenant_id')
|
||||
project_id = resource.Body('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.
|
||||
#: *Type: list*
|
||||
prefixes = resource.prop('prefixes', type=list)
|
||||
prefixes = resource.Body('prefixes', type=list)
|
||||
#: Revision number of the subnet pool. *Type: int*
|
||||
revision_number = resource.prop('revision_number', type=int)
|
||||
revision_number = resource.Body('revision_number', type=int)
|
||||
#: Timestamp when the subnet pool was last updated.
|
||||
updated_at = resource.prop('updated_at')
|
||||
updated_at = resource.Body('updated_at')
|
||||
|
||||
@@ -11,9 +11,11 @@
|
||||
# under the License.
|
||||
|
||||
from openstack.network import network_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
# NOTE: The VPN service is unmaintained, need to consider remove it
|
||||
|
||||
class VPNService(resource.Resource):
|
||||
resource_key = 'vpnservice'
|
||||
resources_key = 'vpnservices'
|
||||
@@ -22,26 +24,28 @@ class VPNService(resource.Resource):
|
||||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
||||
# Properties
|
||||
#: Human-readable description for the vpnservice.
|
||||
description = resource.prop('description')
|
||||
#: The unique ID for the vpnservice.
|
||||
id = resource.prop('id')
|
||||
description = resource.Body('description')
|
||||
#: The external IPv4 address that is used for the VPN service.
|
||||
external_v4_ip = resource.Body('external_v4_ip')
|
||||
#: The external IPv6 address that is used for the VPN service.
|
||||
external_v6_ip = resource.Body('external_v6_ip')
|
||||
#: The administrative state of the vpnservice, which is up ``True`` or
|
||||
#: down ``False``. *Type: bool*
|
||||
is_admin_state_up = resource.prop('admin_state_up', type=bool)
|
||||
is_admin_state_up = resource.Body('admin_state_up', type=bool)
|
||||
#: The vpnservice name.
|
||||
name = resource.prop('name')
|
||||
name = resource.Body('name')
|
||||
#: ID of the router into which the VPN service is inserted.
|
||||
router_id = resource.prop('router_id')
|
||||
router_id = resource.Body('router_id')
|
||||
#: The ID of the project this vpnservice is associated with.
|
||||
project_id = resource.prop('tenant_id')
|
||||
project_id = resource.Body('tenant_id')
|
||||
#: The vpnservice status.
|
||||
status = resource.prop('status')
|
||||
status = resource.Body('status')
|
||||
#: The ID of the subnet on which the tenant wants the vpnservice.
|
||||
subnet_id = resource.prop('subnet_id')
|
||||
subnet_id = resource.Body('subnet_id')
|
||||
|
||||
@@ -17,16 +17,18 @@ from openstack.network.v2 import floating_ip
|
||||
|
||||
IDENTIFIER = 'IDENTIFIER'
|
||||
EXAMPLE = {
|
||||
'id': IDENTIFIER,
|
||||
'created_at': '0',
|
||||
'fixed_ip_address': '1',
|
||||
'floating_ip_address': '127.0.0.1',
|
||||
'floating_network_id': '3',
|
||||
'id': IDENTIFIER,
|
||||
'port_id': '5',
|
||||
'tenant_id': '6',
|
||||
'router_id': '7',
|
||||
'description': '8',
|
||||
'status': 'ACTIVE',
|
||||
'revision_number': 12,
|
||||
'updated_at': '13',
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +48,7 @@ class TestFloatingIP(testtools.TestCase):
|
||||
|
||||
def test_make_it(self):
|
||||
sot = floating_ip.FloatingIP(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['created_at'], sot.created_at)
|
||||
self.assertEqual(EXAMPLE['fixed_ip_address'], sot.fixed_ip_address)
|
||||
self.assertEqual(EXAMPLE['floating_ip_address'],
|
||||
sot.floating_ip_address)
|
||||
@@ -58,6 +61,7 @@ class TestFloatingIP(testtools.TestCase):
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['status'], sot.status)
|
||||
self.assertEqual(EXAMPLE['revision_number'], sot.revision_number)
|
||||
self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
|
||||
|
||||
def test_find_available(self):
|
||||
mock_session = mock.Mock()
|
||||
|
||||
@@ -34,7 +34,7 @@ EXAMPLE = {
|
||||
'provider:physical_network': '12',
|
||||
'provider:segmentation_id': '13',
|
||||
'qos_policy_id': '14',
|
||||
'revision': 15,
|
||||
'revision_number': 15,
|
||||
'router:external': True,
|
||||
'segments': '16',
|
||||
'shared': True,
|
||||
@@ -85,7 +85,7 @@ class TestNetwork(testtools.TestCase):
|
||||
self.assertEqual(EXAMPLE['provider:segmentation_id'],
|
||||
sot.provider_segmentation_id)
|
||||
self.assertEqual(EXAMPLE['qos_policy_id'], sot.qos_policy_id)
|
||||
self.assertEqual(EXAMPLE['revision'], sot.revision_number)
|
||||
self.assertEqual(EXAMPLE['revision_number'], sot.revision_number)
|
||||
self.assertTrue(sot.is_router_external)
|
||||
self.assertEqual(EXAMPLE['segments'], sot.segments)
|
||||
self.assertTrue(sot.is_shared)
|
||||
|
||||
@@ -40,7 +40,7 @@ EXAMPLE = {
|
||||
'opt_value': '20',
|
||||
'port_security_enabled': True,
|
||||
'qos_policy_id': '21',
|
||||
'revision': 22,
|
||||
'revision_number': 22,
|
||||
'security_groups': ['23'],
|
||||
'subnet_id': '24',
|
||||
'status': '25',
|
||||
@@ -91,7 +91,7 @@ class TestPort(testtools.TestCase):
|
||||
self.assertEqual(EXAMPLE['opt_value'], sot.option_value)
|
||||
self.assertTrue(sot.is_port_security_enabled)
|
||||
self.assertEqual(EXAMPLE['qos_policy_id'], sot.qos_policy_id)
|
||||
self.assertEqual(EXAMPLE['revision'], sot.revision_number)
|
||||
self.assertEqual(EXAMPLE['revision_number'], sot.revision_number)
|
||||
self.assertEqual(EXAMPLE['security_groups'], sot.security_group_ids)
|
||||
self.assertEqual(EXAMPLE['status'], sot.status)
|
||||
self.assertEqual(EXAMPLE['subnet_id'], sot.subnet_id)
|
||||
|
||||
@@ -16,11 +16,11 @@ from openstack.network.v2 import rbac_policy
|
||||
|
||||
IDENTIFIER = 'IDENTIFIER'
|
||||
EXAMPLE = {
|
||||
'object_id': IDENTIFIER,
|
||||
'tenant_id': '5',
|
||||
'object_type': 'network',
|
||||
'action': 'access_as_shared',
|
||||
'object_id': IDENTIFIER,
|
||||
'object_type': 'network',
|
||||
'target_tenant': '10',
|
||||
'tenant_id': '5',
|
||||
}
|
||||
|
||||
|
||||
@@ -33,16 +33,15 @@ class TestRBACPolicy(testtools.TestCase):
|
||||
self.assertEqual('/rbac-policies', sot.base_path)
|
||||
self.assertEqual('network', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = rbac_policy.RBACPolicy(EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['object_id'],
|
||||
sot.object_id)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['object_type'], sot.object_type)
|
||||
sot = rbac_policy.RBACPolicy(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['action'], sot.action)
|
||||
self.assertEqual(EXAMPLE['object_id'], sot.object_id)
|
||||
self.assertEqual(EXAMPLE['object_type'], sot.object_type)
|
||||
self.assertEqual(EXAMPLE['target_tenant'], sot.target_project_id)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
|
||||
@@ -18,35 +18,43 @@ from openstack.network.v2 import router
|
||||
IDENTIFIER = 'IDENTIFIER'
|
||||
EXAMPLE = {
|
||||
'admin_state_up': True,
|
||||
'external_gateway_info': {'2': '3'},
|
||||
'availability_zone_hints': ['1'],
|
||||
'availability_zones': ['2'],
|
||||
'created_at': 'timestamp1',
|
||||
'description': '3',
|
||||
'distributed': False,
|
||||
'external_gateway_info': {'4': 4},
|
||||
'flavor_id': '5',
|
||||
'ha': False,
|
||||
'id': IDENTIFIER,
|
||||
'name': '4',
|
||||
'tenant_id': '5',
|
||||
'status': '6',
|
||||
'routes': [],
|
||||
'availability_zone_hints': [],
|
||||
'availability_zones': [],
|
||||
'description': '10',
|
||||
'created_at': '2016-10-04T12:14:57.233772',
|
||||
'updated_at': '2016-10-12T12:15:34.233222',
|
||||
'revision_number': 13,
|
||||
'name': '6',
|
||||
'revision': 7,
|
||||
'routes': ['8'],
|
||||
'status': '9',
|
||||
'tenant_id': '10',
|
||||
'updated_at': 'timestamp2',
|
||||
}
|
||||
|
||||
EXAMPLE_WITH_OPTIONAL = {
|
||||
'admin_state_up': False,
|
||||
'external_gateway_info': {'network_id': '1',
|
||||
'enable_snat': True,
|
||||
'external_fixed_ips': []},
|
||||
'id': IDENTIFIER,
|
||||
'name': 'router1',
|
||||
'tenant_id': '2',
|
||||
'status': 'ACTIVE',
|
||||
'routes': [{'nexthop': '172.24.4.20', 'destination': '10.0.3.1/24'}],
|
||||
'ha': True,
|
||||
'distributed': True,
|
||||
'availability_zone_hints': ['zone-1', 'zone-2'],
|
||||
'availability_zones': ['zone-2'],
|
||||
'description': 'description',
|
||||
'distributed': True,
|
||||
'external_gateway_info': {
|
||||
'network_id': '1',
|
||||
'enable_snat': True,
|
||||
'external_fixed_ips': []
|
||||
},
|
||||
'ha': True,
|
||||
'id': IDENTIFIER,
|
||||
'name': 'router1',
|
||||
'routes': [{
|
||||
'nexthop': '172.24.4.20',
|
||||
'destination': '10.0.3.1/24'
|
||||
}],
|
||||
'status': 'ACTIVE',
|
||||
'tenant_id': '2',
|
||||
}
|
||||
|
||||
|
||||
@@ -59,54 +67,55 @@ class TestRouter(testtools.TestCase):
|
||||
self.assertEqual('/routers', sot.base_path)
|
||||
self.assertEqual('network', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = router.Router(EXAMPLE)
|
||||
sot = router.Router(**EXAMPLE)
|
||||
self.assertTrue(sot.is_admin_state_up)
|
||||
self.assertEqual(EXAMPLE['external_gateway_info'],
|
||||
sot.external_gateway_info)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['status'], sot.status)
|
||||
self.assertFalse(sot.is_ha)
|
||||
self.assertFalse(sot.is_distributed)
|
||||
self.assertEqual(EXAMPLE['routes'], sot.routes)
|
||||
self.assertEqual(EXAMPLE['availability_zone_hints'],
|
||||
sot.availability_zone_hints)
|
||||
self.assertEqual(EXAMPLE['availability_zones'],
|
||||
sot.availability_zones)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['created_at'], sot.created_at)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertFalse(sot.is_distributed)
|
||||
self.assertEqual(EXAMPLE['external_gateway_info'],
|
||||
sot.external_gateway_info)
|
||||
self.assertEqual(EXAMPLE['flavor_id'], sot.flavor_id)
|
||||
self.assertFalse(sot.is_ha)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||
self.assertEqual(EXAMPLE['revision'], sot.revision_number)
|
||||
self.assertEqual(EXAMPLE['routes'], sot.routes)
|
||||
self.assertEqual(EXAMPLE['status'], sot.status)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
|
||||
self.assertEqual(EXAMPLE['revision_number'], sot.revision_number)
|
||||
|
||||
def test_make_it_with_optional(self):
|
||||
sot = router.Router(EXAMPLE_WITH_OPTIONAL)
|
||||
sot = router.Router(**EXAMPLE_WITH_OPTIONAL)
|
||||
self.assertFalse(sot.is_admin_state_up)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['external_gateway_info'],
|
||||
sot.external_gateway_info)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['name'], sot.name)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['status'], sot.status)
|
||||
self.assertTrue(sot.is_ha)
|
||||
self.assertTrue(sot.is_distributed)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['routes'], sot.routes)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['availability_zone_hints'],
|
||||
sot.availability_zone_hints)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['availability_zones'],
|
||||
sot.availability_zones)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['description'],
|
||||
sot.description)
|
||||
self.assertTrue(sot.is_distributed)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['external_gateway_info'],
|
||||
sot.external_gateway_info)
|
||||
self.assertTrue(sot.is_ha)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['name'], sot.name)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['routes'], sot.routes)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['status'], sot.status)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['tenant_id'], sot.project_id)
|
||||
|
||||
def test_add_interface_subnet(self):
|
||||
# Add subnet to a router
|
||||
sot = router.Router(EXAMPLE)
|
||||
sot = router.Router(**EXAMPLE)
|
||||
response = mock.Mock()
|
||||
response.body = {"subnet_id": "3", "port_id": "2"}
|
||||
response.json = mock.Mock(return_value=response.body)
|
||||
@@ -121,7 +130,7 @@ class TestRouter(testtools.TestCase):
|
||||
|
||||
def test_add_interface_port(self):
|
||||
# Add port to a router
|
||||
sot = router.Router(EXAMPLE)
|
||||
sot = router.Router(**EXAMPLE)
|
||||
response = mock.Mock()
|
||||
response.body = {"subnet_id": "3", "port_id": "3"}
|
||||
response.json = mock.Mock(return_value=response.body)
|
||||
@@ -137,7 +146,7 @@ class TestRouter(testtools.TestCase):
|
||||
|
||||
def test_remove_interface_subnet(self):
|
||||
# Remove subnet from a router
|
||||
sot = router.Router(EXAMPLE)
|
||||
sot = router.Router(**EXAMPLE)
|
||||
response = mock.Mock()
|
||||
response.body = {"subnet_id": "3", "port_id": "2"}
|
||||
response.json = mock.Mock(return_value=response.body)
|
||||
@@ -152,7 +161,7 @@ class TestRouter(testtools.TestCase):
|
||||
|
||||
def test_remove_interface_port(self):
|
||||
# Remove port from a router
|
||||
sot = router.Router(EXAMPLE)
|
||||
sot = router.Router(**EXAMPLE)
|
||||
response = mock.Mock()
|
||||
response.body = {"subnet_id": "3", "port_id": "3"}
|
||||
response.json = mock.Mock(return_value=response.body)
|
||||
@@ -167,7 +176,7 @@ class TestRouter(testtools.TestCase):
|
||||
|
||||
def test_add_router_gateway(self):
|
||||
# Add gateway to a router
|
||||
sot = router.Router(EXAMPLE_WITH_OPTIONAL)
|
||||
sot = router.Router(**EXAMPLE_WITH_OPTIONAL)
|
||||
response = mock.Mock()
|
||||
response.body = {"network_id": "3", "enable_snat": True}
|
||||
response.json = mock.Mock(return_value=response.body)
|
||||
@@ -182,7 +191,7 @@ class TestRouter(testtools.TestCase):
|
||||
|
||||
def test_remove_router_gateway(self):
|
||||
# Remove gateway to a router
|
||||
sot = router.Router(EXAMPLE_WITH_OPTIONAL)
|
||||
sot = router.Router(**EXAMPLE_WITH_OPTIONAL)
|
||||
response = mock.Mock()
|
||||
response.body = {"network_id": "3", "enable_snat": True}
|
||||
response.json = mock.Mock(return_value=response.body)
|
||||
|
||||
@@ -48,12 +48,16 @@ RULES = [
|
||||
"revision_number": 7,
|
||||
},
|
||||
]
|
||||
|
||||
EXAMPLE = {
|
||||
'created_at': '2016-10-04T12:14:57.233772',
|
||||
'description': '1',
|
||||
'id': IDENTIFIER,
|
||||
'name': '3',
|
||||
'tenant_id': '4',
|
||||
'name': '2',
|
||||
'revision_number': 3,
|
||||
'security_group_rules': RULES,
|
||||
'tenant_id': '4',
|
||||
'updated_at': '2016-10-14T12:16:57.233772',
|
||||
}
|
||||
|
||||
|
||||
@@ -66,20 +70,20 @@ class TestSecurityGroup(testtools.TestCase):
|
||||
self.assertEqual('/security-groups', sot.base_path)
|
||||
self.assertEqual('network', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = security_group.SecurityGroup(EXAMPLE)
|
||||
sot = security_group.SecurityGroup(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['created_at'], sot.created_at)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['revision_number'], sot.revision_number)
|
||||
self.assertEqual(EXAMPLE['security_group_rules'],
|
||||
sot.security_group_rules)
|
||||
# TODO(briancurtin): Reevaluate this test upon fixing
|
||||
# https://bugs.launchpad.net/python-openstacksdk/+bug/1423620
|
||||
# Should be able to test that a rule is a SecurityGroupRule.
|
||||
self.assertEqual(dict, type(sot.security_group_rules[0]))
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
|
||||
|
||||
@@ -16,20 +16,20 @@ from openstack.network.v2 import security_group_rule
|
||||
|
||||
IDENTIFIER = 'IDENTIFIER'
|
||||
EXAMPLE = {
|
||||
'direction': '1',
|
||||
'ethertype': '2',
|
||||
'created_at': '0',
|
||||
'description': '1',
|
||||
'direction': '2',
|
||||
'ethertype': '3',
|
||||
'id': IDENTIFIER,
|
||||
'port_range_max': '4',
|
||||
'port_range_min': '5',
|
||||
'tenant_id': '6',
|
||||
'protocol': '7',
|
||||
'remote_group_id': '8',
|
||||
'remote_ip_prefix': '9',
|
||||
'port_range_max': 4,
|
||||
'port_range_min': 5,
|
||||
'protocol': '6',
|
||||
'remote_group_id': '7',
|
||||
'remote_ip_prefix': '8',
|
||||
'revision_number': 9,
|
||||
'security_group_id': '10',
|
||||
'description': '11',
|
||||
'created_at': '2016-10-04T12:14:57.233772',
|
||||
'updated_at': '2016-10-12T12:15:34.233222',
|
||||
'revision_number': 14,
|
||||
'tenant_id': '11',
|
||||
'updated_at': '12'
|
||||
}
|
||||
|
||||
|
||||
@@ -42,24 +42,24 @@ class TestSecurityGroupRule(testtools.TestCase):
|
||||
self.assertEqual('/security-group-rules', sot.base_path)
|
||||
self.assertEqual('network', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertFalse(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = security_group_rule.SecurityGroupRule(EXAMPLE)
|
||||
sot = security_group_rule.SecurityGroupRule(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['created_at'], sot.created_at)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['direction'], sot.direction)
|
||||
self.assertEqual(EXAMPLE['ethertype'], sot.ethertype)
|
||||
self.assertEqual(EXAMPLE['ethertype'], sot.ether_type)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['port_range_max'], sot.port_range_max)
|
||||
self.assertEqual(EXAMPLE['port_range_min'], sot.port_range_min)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['protocol'], sot.protocol)
|
||||
self.assertEqual(EXAMPLE['remote_group_id'], sot.remote_group_id)
|
||||
self.assertEqual(EXAMPLE['remote_ip_prefix'], sot.remote_ip_prefix)
|
||||
self.assertEqual(EXAMPLE['security_group_id'], sot.security_group_id)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['created_at'], sot.created_at)
|
||||
self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
|
||||
self.assertEqual(EXAMPLE['revision_number'], sot.revision_number)
|
||||
self.assertEqual(EXAMPLE['security_group_id'], sot.security_group_id)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
|
||||
|
||||
@@ -20,9 +20,9 @@ EXAMPLE = {
|
||||
'id': IDENTIFIER,
|
||||
'name': '2',
|
||||
'network_id': '3',
|
||||
'network_type': 'geneve',
|
||||
'physical_network': None,
|
||||
'segmentation_id': 4,
|
||||
'network_type': '4',
|
||||
'physical_network': '5',
|
||||
'segmentation_id': 6,
|
||||
}
|
||||
|
||||
|
||||
@@ -34,14 +34,15 @@ class TestSegment(testtools.TestCase):
|
||||
self.assertEqual('segments', sot.resources_key)
|
||||
self.assertEqual('/segments', sot.base_path)
|
||||
self.assertEqual('network', sot.service.service_type)
|
||||
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = segment.Segment(EXAMPLE)
|
||||
sot = segment.Segment(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||
|
||||
@@ -16,26 +16,26 @@ from openstack.network.v2 import subnet
|
||||
|
||||
IDENTIFIER = 'IDENTIFIER'
|
||||
EXAMPLE = {
|
||||
'allocation_pools': '1',
|
||||
'allocation_pools': [{'1': 1}],
|
||||
'cidr': '2',
|
||||
'dns_nameservers': '3',
|
||||
'created_at': '3',
|
||||
'description': '4',
|
||||
'dns_nameservers': ['5'],
|
||||
'enable_dhcp': True,
|
||||
'gateway_ip': '5',
|
||||
'host_routes': '6',
|
||||
'gateway_ip': '6',
|
||||
'host_routes': ['7'],
|
||||
'id': IDENTIFIER,
|
||||
'ip_version': '8',
|
||||
'ipv6_address_mode': 'dhcpv6-stateless',
|
||||
'ipv6_ra_mode': 'radvd',
|
||||
'name': '9',
|
||||
'network_id': '10',
|
||||
'tenant_id': '11',
|
||||
'subnetpool_id': '12',
|
||||
'description': '13',
|
||||
'service_types': ['VPN'],
|
||||
'created_at': '2016-03-09T12:14:57.233772',
|
||||
'updated_at': '2016-07-09T12:14:57.233772',
|
||||
'segment_id': '16',
|
||||
'revision_number': 17,
|
||||
'ip_version': 8,
|
||||
'ipv6_address_mode': '9',
|
||||
'ipv6_ra_mode': '10',
|
||||
'name': '11',
|
||||
'network_id': '12',
|
||||
'revision_number': 13,
|
||||
'segment_id': '14',
|
||||
'service_types': ['15'],
|
||||
'subnetpool_id': '16',
|
||||
'tenant_id': '17',
|
||||
'updated_at': '18',
|
||||
}
|
||||
|
||||
|
||||
@@ -48,15 +48,17 @@ class TestSubnet(testtools.TestCase):
|
||||
self.assertEqual('/subnets', sot.base_path)
|
||||
self.assertEqual('network', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = subnet.Subnet(EXAMPLE)
|
||||
sot = subnet.Subnet(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['allocation_pools'], sot.allocation_pools)
|
||||
self.assertEqual(EXAMPLE['cidr'], sot.cidr)
|
||||
self.assertEqual(EXAMPLE['created_at'], sot.created_at)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['dns_nameservers'], sot.dns_nameservers)
|
||||
self.assertTrue(sot.is_dhcp_enabled)
|
||||
self.assertEqual(EXAMPLE['gateway_ip'], sot.gateway_ip)
|
||||
@@ -67,11 +69,9 @@ class TestSubnet(testtools.TestCase):
|
||||
self.assertEqual(EXAMPLE['ipv6_ra_mode'], sot.ipv6_ra_mode)
|
||||
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['subnetpool_id'], sot.subnet_pool_id)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['created_at'], sot.created_at)
|
||||
self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
|
||||
self.assertEqual(EXAMPLE['revision_number'], sot.revision_number)
|
||||
self.assertEqual(EXAMPLE['segment_id'], sot.segment_id)
|
||||
self.assertEqual(EXAMPLE['service_types'], sot.service_types)
|
||||
self.assertEqual(EXAMPLE['revision_number'], sot.revision_number)
|
||||
self.assertEqual(EXAMPLE['subnetpool_id'], sot.subnet_pool_id)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
|
||||
|
||||
@@ -16,22 +16,22 @@ from openstack.network.v2 import subnet_pool
|
||||
|
||||
IDENTIFIER = 'IDENTIFIER'
|
||||
EXAMPLE = {
|
||||
'min_prefixlen': 8,
|
||||
'default_prefixlen': 24,
|
||||
'address_scope_id': '1',
|
||||
'created_at': '2',
|
||||
'default_prefixlen': 3,
|
||||
'default_quota': 4,
|
||||
'description': '5',
|
||||
'id': IDENTIFIER,
|
||||
'max_prefixlen': 32,
|
||||
'name': 'private-subnet_pool',
|
||||
'default_quota': 24,
|
||||
'tenant_id': '10',
|
||||
'prefixes': ['10.0.2.0/24', '10.0.4.0/24'],
|
||||
'ip_version': 4,
|
||||
'shared': True,
|
||||
'address_scope_id': '11',
|
||||
'description': '12',
|
||||
'created_at': '2016-03-09T12:14:57.233772',
|
||||
'updated_at': '2016-07-09T12:14:57.233772',
|
||||
'ip_version': 6,
|
||||
'is_default': True,
|
||||
'revision_number': 16,
|
||||
'max_prefixlen': 7,
|
||||
'min_prefixlen': 8,
|
||||
'name': '9',
|
||||
'prefixes': ['10', '11'],
|
||||
'revision_number': 12,
|
||||
'shared': True,
|
||||
'tenant_id': '13',
|
||||
'updated_at': '14',
|
||||
}
|
||||
|
||||
|
||||
@@ -44,29 +44,27 @@ class TestSubnetpool(testtools.TestCase):
|
||||
self.assertEqual('/subnetpools', sot.base_path)
|
||||
self.assertEqual('network', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = subnet_pool.SubnetPool(EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['min_prefixlen'],
|
||||
sot.minimum_prefix_length)
|
||||
sot = subnet_pool.SubnetPool(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['address_scope_id'], sot.address_scope_id)
|
||||
self.assertEqual(EXAMPLE['created_at'], sot.created_at)
|
||||
self.assertEqual(EXAMPLE['default_prefixlen'],
|
||||
sot.default_prefix_length)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['max_prefixlen'],
|
||||
sot.maximum_prefix_length)
|
||||
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||
self.assertEqual(EXAMPLE['default_quota'], sot.default_quota)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['prefixes'], sot.prefixes)
|
||||
self.assertEqual(EXAMPLE['ip_version'], sot.ip_version)
|
||||
self.assertTrue(sot.is_shared)
|
||||
self.assertEqual(EXAMPLE['address_scope_id'], sot.address_scope_id)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['created_at'], sot.created_at)
|
||||
self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['ip_version'], sot.ip_version)
|
||||
self.assertTrue(sot.is_default)
|
||||
self.assertEqual(EXAMPLE['max_prefixlen'], sot.maximum_prefix_length)
|
||||
self.assertEqual(EXAMPLE['min_prefixlen'], sot.minimum_prefix_length)
|
||||
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||
self.assertEqual(EXAMPLE['prefixes'], sot.prefixes)
|
||||
self.assertEqual(EXAMPLE['revision_number'], sot.revision_number)
|
||||
self.assertTrue(sot.is_shared)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
|
||||
|
||||
@@ -16,14 +16,16 @@ from openstack.network.v2 import vpn_service
|
||||
|
||||
IDENTIFIER = 'IDENTIFIER'
|
||||
EXAMPLE = {
|
||||
"router_id": "1",
|
||||
"status": "PENDING_CREATE",
|
||||
"name": "2",
|
||||
"admin_state_up": True,
|
||||
"subnet_id": "3",
|
||||
"tenant_id": "4",
|
||||
"description": "1",
|
||||
"external_v4_ip": "2",
|
||||
"external_v6_ip": "3",
|
||||
"id": IDENTIFIER,
|
||||
"description": "5"
|
||||
"name": "4",
|
||||
"router_id": "5",
|
||||
"status": "6",
|
||||
"subnet_id": "7",
|
||||
"tenant_id": "8",
|
||||
}
|
||||
|
||||
|
||||
@@ -36,18 +38,20 @@ class TestVPNService(testtools.TestCase):
|
||||
self.assertEqual('/vpn/vpnservices', sot.base_path)
|
||||
self.assertEqual('network', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = vpn_service.VPNService(EXAMPLE)
|
||||
sot = vpn_service.VPNService(**EXAMPLE)
|
||||
self.assertTrue(sot.is_admin_state_up)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['external_v4_ip'], sot.external_v4_ip)
|
||||
self.assertEqual(EXAMPLE['external_v6_ip'], sot.external_v6_ip)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||
self.assertEqual(EXAMPLE['router_id'], sot.router_id)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['status'], sot.status)
|
||||
self.assertEqual(EXAMPLE['subnet_id'], sot.subnet_id)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
|
||||
Reference in New Issue
Block a user