Merge "Rebase network resources onto resource2 (2)"
This commit is contained in:
commit
00526ee1a7
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from openstack.network import network_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class MeteringLabel(resource.Resource):
|
||||
|
@ -22,18 +22,24 @@ class MeteringLabel(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',
|
||||
is_shared='shared',
|
||||
project_id='tenant_id'
|
||||
)
|
||||
|
||||
# Properties
|
||||
#: Description of the metering label.
|
||||
description = resource.prop('description')
|
||||
description = resource.Body('description')
|
||||
#: Name of the metering label.
|
||||
name = resource.prop('name')
|
||||
name = resource.Body('name')
|
||||
#: The ID of the project this metering label is associated with.
|
||||
project_id = resource.prop('tenant_id')
|
||||
project_id = resource.Body('tenant_id')
|
||||
#: Indicates whether this label is shared across all tenants.
|
||||
#: *Type: bool*
|
||||
is_shared = resource.prop('shared', type=bool)
|
||||
is_shared = resource.Body('shared', type=bool)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from openstack.network import network_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class MeteringLabelRule(resource.Resource):
|
||||
|
@ -22,21 +22,28 @@ class MeteringLabelRule(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(
|
||||
'direction', 'metering_label_id', 'remote_ip_prefix',
|
||||
project_id='tenant_id',
|
||||
)
|
||||
|
||||
# Properties
|
||||
#: ingress or egress: The direction in which metering label rule is
|
||||
#: applied. Default: ``"ingress"``
|
||||
direction = resource.prop('direction')
|
||||
direction = resource.Body('direction')
|
||||
#: Specify whether the ``remote_ip_prefix`` will be excluded or not
|
||||
#: from traffic counters of the metering label, ie: to not count the
|
||||
#: traffic of a specific IP address of a range. Default: ``False``,
|
||||
#: *Type: bool*
|
||||
is_excluded = resource.prop('excluded', type=bool)
|
||||
is_excluded = resource.Body('excluded', type=bool)
|
||||
#: The metering label ID to associate with this metering label rule.
|
||||
metering_label_id = resource.prop('metering_label_id')
|
||||
metering_label_id = resource.Body('metering_label_id')
|
||||
#: The ID of the project this metering label rule is associated with.
|
||||
project_id = resource.Body('tenant_id')
|
||||
#: The remote IP prefix to be associated with this metering label rule.
|
||||
remote_ip_prefix = resource.prop('remote_ip_prefix')
|
||||
remote_ip_prefix = resource.Body('remote_ip_prefix')
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from openstack.network import network_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class Network(resource.Resource):
|
||||
|
@ -22,74 +22,90 @@ class Network(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 list or datetime fields yet
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'description', 'name', 'status',
|
||||
ipv4_address_scope_id='ipv4_address_scope',
|
||||
ipv6_address_scope_id='ipv6_address_scope',
|
||||
is_admin_state_up='admin_state_up',
|
||||
is_port_security_enabled='port_security_enabled',
|
||||
is_shared='shared',
|
||||
revision_number='revision',
|
||||
)
|
||||
|
||||
# Properties
|
||||
#: Availability zone hints to use when scheduling the network.
|
||||
#: *Type: list of availability zone names*
|
||||
availability_zone_hints = resource.prop('availability_zone_hints')
|
||||
availability_zone_hints = resource.Body('availability_zone_hints')
|
||||
#: Availability zones for the network.
|
||||
#: *Type: list of availability zone names*
|
||||
availability_zones = resource.prop('availability_zones')
|
||||
availability_zones = resource.Body('availability_zones')
|
||||
#: Timestamp when the network was created.
|
||||
created_at = resource.prop('created_at')
|
||||
created_at = resource.Body('created_at')
|
||||
#: The network description.
|
||||
description = resource.prop('description')
|
||||
#: DNS Domain for the network
|
||||
dns_domain = resource.prop('dns_domain')
|
||||
description = resource.Body('description')
|
||||
#: The DNS domain associated.
|
||||
dns_domain = resource.Body('dns_domain')
|
||||
#: The ID of the IPv4 address scope for the network.
|
||||
ipv4_address_scope_id = resource.prop('ipv4_address_scope')
|
||||
ipv4_address_scope_id = resource.Body('ipv4_address_scope')
|
||||
#: The ID of the IPv6 address scope for the network.
|
||||
ipv6_address_scope_id = resource.prop('ipv6_address_scope')
|
||||
ipv6_address_scope_id = resource.Body('ipv6_address_scope')
|
||||
#: The administrative state of the network, 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)
|
||||
#: Whether or not this is the default external network.
|
||||
#: *Type: bool*
|
||||
is_default = resource.prop('is_default', type=bool)
|
||||
is_default = resource.Body('is_default', type=bool)
|
||||
#: The port security status, which is enabled ``True`` or disabled
|
||||
#: ``False``. *Type: bool* *Default: False*
|
||||
is_port_security_enabled = resource.prop('port_security_enabled',
|
||||
#: Available for multiple provider extensions.
|
||||
is_port_security_enabled = resource.Body('port_security_enabled',
|
||||
type=bool,
|
||||
default=False)
|
||||
#: Whether or not the router is external.
|
||||
#: *Type: bool* *Default: False*
|
||||
is_router_external = resource.prop('router:external',
|
||||
type=bool,
|
||||
is_router_external = resource.Body('router:external', type=bool,
|
||||
default=False)
|
||||
#: Indicates whether this network is shared across all tenants.
|
||||
#: By default, only administrative users can change this value.
|
||||
#: *Type: bool*
|
||||
is_shared = resource.prop('shared', type=bool)
|
||||
is_shared = resource.Body('shared', type=bool)
|
||||
#: Read-only. The maximum transmission unit (MTU) of the network resource.
|
||||
mtu = resource.prop('mtu', type=int)
|
||||
mtu = resource.Body('mtu', type=int)
|
||||
#: The network name.
|
||||
name = resource.prop('name')
|
||||
name = resource.Body('name')
|
||||
#: The ID of the project this network is associated with.
|
||||
project_id = resource.prop('tenant_id')
|
||||
project_id = resource.Body('project_id')
|
||||
#: 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')
|
||||
#: Available for multiple provider extensions.
|
||||
provider_network_type = resource.Body('provider:network_type')
|
||||
#: The physical network where this network object is implemented.
|
||||
provider_physical_network = resource.prop('provider:physical_network')
|
||||
#: Available for multiple provider extensions.
|
||||
provider_physical_network = resource.Body('provider:physical_network')
|
||||
#: An isolated segment ID on the physical network. The provider
|
||||
#: network type defines the segmentation model.
|
||||
provider_segmentation_id = resource.prop('provider:segmentation_id')
|
||||
#: Available for multiple provider extensions.
|
||||
provider_segmentation_id = resource.Body('provider:segmentation_id')
|
||||
#: The ID of the QoS policy attached to the port.
|
||||
qos_policy_id = resource.prop('qos_policy_id')
|
||||
qos_policy_id = resource.Body('qos_policy_id')
|
||||
#: Revision number of the network. *Type: int*
|
||||
revision_number = resource.prop('revision_number', type=int)
|
||||
segments = resource.prop('segments')
|
||||
revision_number = resource.Body('revision', type=int)
|
||||
#: A list of provider segment objects.
|
||||
#: Available for multiple provider extensions.
|
||||
segments = resource.Body('segments')
|
||||
#: The network status.
|
||||
status = resource.prop('status')
|
||||
status = resource.Body('status')
|
||||
#: The associated subnet IDs.
|
||||
#: *Type: list of strs of the subnet IDs*
|
||||
subnet_ids = resource.prop('subnets', type=list)
|
||||
subnet_ids = resource.Body('subnets', type=list)
|
||||
#: Timestamp when the network was last updated.
|
||||
updated_at = resource.prop('updated_at')
|
||||
updated_at = resource.Body('updated_at')
|
||||
|
||||
|
||||
class NetworkHostingDHCPAgent(resource.Resource):
|
||||
|
@ -101,7 +117,9 @@ class NetworkHostingDHCPAgent(resource.Resource):
|
|||
|
||||
# capabilities
|
||||
allow_create = False
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = False
|
||||
allow_delete = False
|
||||
allow_list = True
|
||||
|
||||
# NOTE: Doesn't support query yet.
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from openstack.network import network_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class NetworkIPAvailability(resource.Resource):
|
||||
|
@ -23,24 +23,29 @@ class NetworkIPAvailability(resource.Resource):
|
|||
|
||||
# capabilities
|
||||
allow_create = False
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = False
|
||||
allow_delete = False
|
||||
allow_list = True
|
||||
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'network_id', 'network_name',
|
||||
project_id='tenant_id'
|
||||
)
|
||||
|
||||
# Properties
|
||||
#: Network ID to use when listing network IP availability.
|
||||
network_id = resource.prop('network_id')
|
||||
network_id = resource.Body('network_id')
|
||||
#: Network Name for the particular network IP availability.
|
||||
network_name = resource.prop('network_name')
|
||||
network_name = resource.Body('network_name')
|
||||
#: The Subnet IP Availability of all subnets of a network.
|
||||
#: *Type: list*
|
||||
subnet_ip_availability = resource.prop('subnet_ip_availability', type=list)
|
||||
subnet_ip_availability = resource.Body('subnet_ip_availability', type=list)
|
||||
#: The ID of the project this network IP availability is associated with.
|
||||
project_id = resource.prop('tenant_id')
|
||||
project_id = resource.Body('tenant_id')
|
||||
#: The total ips of a network.
|
||||
#: *Type: int*
|
||||
total_ips = resource.prop('total_ips', type=int)
|
||||
total_ips = resource.Body('total_ips', type=int)
|
||||
#: The used or consumed ip of a network
|
||||
#: *Type: int*
|
||||
used_ips = resource.prop('used_ips', type=int)
|
||||
used_ips = resource.Body('used_ips', 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 Pool(resource.Resource):
|
||||
|
@ -22,38 +22,57 @@ class Pool(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', 'health_monitor_id', 'lb_algorithm', 'name',
|
||||
'protocol', 'provider', 'subnet_id', 'vip_id',
|
||||
is_admin_state_up='admin_state_up',
|
||||
project_id='tenant_id',
|
||||
)
|
||||
|
||||
# Properties
|
||||
#: Description for the pool.
|
||||
description = resource.prop('description')
|
||||
#: The ID of the associated health monitor.
|
||||
health_monitor_id = resource.prop('healthmonitor_id')
|
||||
description = resource.Body('description')
|
||||
#: The ID of the associated health monitors.
|
||||
health_monitor_ids = resource.Body('health_monitors', type=list)
|
||||
#: The statuses of the associated health monitors.
|
||||
health_monitor_status = resource.Body('health_monitor_status', type=list)
|
||||
#: The administrative state of the pool, 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 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')
|
||||
lb_algorithm = resource.Body('lb_algorithm')
|
||||
#: List of associated listeners.
|
||||
#: *Type: list of dicts which contain the listener IDs*
|
||||
listener_ids = resource.prop('listeners', type=list)
|
||||
listener_ids = resource.Body('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)
|
||||
load_balancer_ids = resource.Body('loadbalancers', 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)
|
||||
member_ids = resource.Body('members', type=list)
|
||||
#: Pool name. Does not have to be unique.
|
||||
name = resource.prop('name')
|
||||
name = resource.Body('name')
|
||||
#: The ID of the project this pool is associated with.
|
||||
project_id = resource.prop('tenant_id')
|
||||
project_id = resource.Body('tenant_id')
|
||||
#: The protocol of the pool, which is TCP, HTTP, or HTTPS.
|
||||
protocol = resource.prop('protocol')
|
||||
protocol = resource.Body('protocol')
|
||||
#: The provider name of the load balancer service.
|
||||
provider = resource.Body('provider')
|
||||
#: Human readable description of the status.
|
||||
status = resource.Body('status')
|
||||
#: The status of the network.
|
||||
status_description = resource.Body('status_description')
|
||||
#: The subnet on whic the members of the pool will be located.
|
||||
subnet_id = resource.Body('subnet_id')
|
||||
#: Session persistence algorithm that should be used (if any).
|
||||
#: *Type: dict with keys ``type`` and ``cookie_name``*
|
||||
session_persistence = resource.prop('session_persistence')
|
||||
session_persistence = resource.Body('session_persistence')
|
||||
#: The ID of the virtual IP (VIP) address.
|
||||
virtual_ip_id = resource.Body('vip_id')
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from openstack.network import network_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class PoolMember(resource.Resource):
|
||||
|
@ -22,35 +22,35 @@ class PoolMember(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', 'name', 'protocol_port', 'subnet_id', 'weight',
|
||||
is_admin_state_up='admin_state_up',
|
||||
project_id='tenant_id',
|
||||
)
|
||||
|
||||
# Properties
|
||||
#: The ID of the owning pool
|
||||
pool_id = resource.URI('pool_id')
|
||||
#: The IP address of the pool member.
|
||||
address = resource.prop('address')
|
||||
address = resource.Body('address')
|
||||
#: The administrative state of the pool member, 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)
|
||||
#: Name of the pool member.
|
||||
name = resource.prop('name')
|
||||
name = resource.Body('name')
|
||||
#: The ID of the project this pool member is associated with.
|
||||
project_id = resource.prop('tenant_id')
|
||||
project_id = resource.Body('tenant_id')
|
||||
#: The port on which the application is hosted.
|
||||
protocol_port = resource.prop('protocol_port', type=int)
|
||||
protocol_port = resource.Body('protocol_port', type=int)
|
||||
#: Subnet ID in which to access this pool member.
|
||||
subnet_id = resource.prop('subnet_id')
|
||||
subnet_id = resource.Body('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
|
||||
#: with a weight of 10 receives five times as much traffic as a member
|
||||
#: with weight of 2.
|
||||
weight = resource.prop('weight', type=int)
|
||||
|
||||
@classmethod
|
||||
def _get_create_body(cls, attrs):
|
||||
# Exclude pool_id from attrs since it is not expected by LBaaS service
|
||||
if 'pool_id' in attrs:
|
||||
attrs.pop('pool_id')
|
||||
|
||||
return {cls.resource_key: attrs}
|
||||
weight = resource.Body('weight', 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 Port(resource.Resource):
|
||||
|
@ -22,29 +22,38 @@ class Port(resource.Resource):
|
|||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
||||
# NOTE: we skip query on list or datetime fields for now
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'description', 'device_id', 'device_owner', 'ip_address',
|
||||
'mac_address', 'name', 'network_id', 'status', 'subnet_id',
|
||||
is_admin_state_up='admin_state_up',
|
||||
is_port_security_enabled='port_security_enabled',
|
||||
project_id='tenant_id',
|
||||
)
|
||||
|
||||
# Properties
|
||||
#: Allowed address pairs.
|
||||
allowed_address_pairs = resource.prop('allowed_address_pairs')
|
||||
allowed_address_pairs = resource.Body('allowed_address_pairs', type=list)
|
||||
#: The ID of the host where the port is allocated. In some cases,
|
||||
#: different implementations can run on different hosts.
|
||||
binding_host_id = resource.prop('binding:host_id')
|
||||
binding_host_id = resource.Body('binding:host_id')
|
||||
#: A dictionary the enables the application running on the specified
|
||||
#: host to pass and receive vif port-specific information to the plug-in.
|
||||
#: *Type: dict*
|
||||
binding_profile = resource.prop('binding:profile', type=dict)
|
||||
binding_profile = resource.Body('binding:profile', type=dict)
|
||||
#: Read-only. A dictionary that enables the application to pass
|
||||
#: information about functions that the Networking API provides.
|
||||
#: To enable or disable port filtering features such as security group
|
||||
#: and anti-MAC/IP spoofing, specify ``port_filter: True`` or
|
||||
#: ``port_filter: False``. *Type: dict*
|
||||
binding_vif_details = resource.prop('binding:vif_details', type=dict)
|
||||
binding_vif_details = resource.Body('binding:vif_details', type=dict)
|
||||
#: Read-only. The vif type for the specified port.
|
||||
binding_vif_type = resource.prop('binding:vif_type')
|
||||
binding_vif_type = resource.Body('binding:vif_type')
|
||||
#: The vnic type that is bound to the neutron port.
|
||||
#:
|
||||
#: In POST and PUT operations, specify a value of ``normal`` (virtual nic),
|
||||
|
@ -55,48 +64,58 @@ 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')
|
||||
binding_vnic_type = resource.Body('binding:vnic_type')
|
||||
#: Timestamp when the port was created.
|
||||
created_at = resource.prop('created_at')
|
||||
created_at = resource.Body('created_at')
|
||||
#: The port description.
|
||||
description = resource.prop('description')
|
||||
description = resource.Body('description')
|
||||
#: Device ID of this port.
|
||||
device_id = resource.prop('device_id')
|
||||
device_id = resource.Body('device_id')
|
||||
#: Device owner of this port (e.g. ``network:dhcp``).
|
||||
device_owner = resource.prop('device_owner')
|
||||
device_owner = resource.Body('device_owner')
|
||||
#: DNS assignment for the port.
|
||||
dns_assignment = resource.prop('dns_assignment')
|
||||
dns_assignment = resource.Body('dns_assignment')
|
||||
#: DNS name for the port.
|
||||
dns_name = resource.prop('dns_name')
|
||||
dns_name = resource.Body('dns_name')
|
||||
#: Extra DHCP options.
|
||||
extra_dhcp_opts = resource.prop('extra_dhcp_opts')
|
||||
extra_dhcp_opts = resource.Body('extra_dhcp_opts', type=list)
|
||||
#: IP addresses of an allowed address pair.
|
||||
ip_address = resource.Body('ip_address')
|
||||
#: IP addresses for the port. Includes the IP address and subnet ID.
|
||||
fixed_ips = resource.prop('fixed_ips')
|
||||
fixed_ips = resource.Body('fixed_ips', type=list)
|
||||
#: The administrative state of the port, 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 port security status, which is enabled ``True`` or disabled
|
||||
#: ``False``. *Type: bool* *Default: False*
|
||||
is_port_security_enabled = resource.prop('port_security_enabled',
|
||||
type=bool,
|
||||
default=False)
|
||||
#: The MAC address of the port.
|
||||
mac_address = resource.prop('mac_address')
|
||||
is_port_security_enabled = resource.Body('port_security_enabled',
|
||||
type=bool, default=False)
|
||||
#: The MAC address of an allowed address pair.
|
||||
mac_address = resource.Body('mac_address')
|
||||
#: The port 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 who owns the network. Only administrative
|
||||
#: users can specify a project ID other than their own.
|
||||
project_id = resource.prop('tenant_id')
|
||||
project_id = resource.Body('tenant_id')
|
||||
#: The extra DHCP option name.
|
||||
option_name = resource.Body('opt_name')
|
||||
#: The extra DHCP option value.
|
||||
option_value = resource.Body('opt_value')
|
||||
#: The ID of the QoS policy attached to the port.
|
||||
qos_policy_id = resource.prop('qos_policy_id')
|
||||
qos_policy_id = resource.Body('qos_policy_id')
|
||||
#: Revision number of the port. *Type: int*
|
||||
revision_number = resource.prop('revision_number', type=int)
|
||||
revision_number = resource.Body('revision', type=int)
|
||||
#: 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)
|
||||
security_group_ids = resource.Body('security_groups', type=list)
|
||||
#: The port status. Value is ``ACTIVE`` or ``DOWN``.
|
||||
status = resource.prop('status')
|
||||
status = resource.Body('status')
|
||||
#: The ID of the subnet. If you specify only a subnet UUID, OpenStack
|
||||
#: networking allocates an available IP from that subnet to the port.
|
||||
#: If you specify both a subnet ID and an IP address, OpenStack networking
|
||||
#: tries to allocate the address to the port.
|
||||
subnet_id = resource.Body('subnet_id')
|
||||
#: Timestamp when the port 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 QoSPolicy(resource.Resource):
|
||||
|
@ -22,21 +22,21 @@ class QoSPolicy(resource.Resource):
|
|||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
||||
# Properties
|
||||
#: QoS policy name.
|
||||
name = resource.prop('name')
|
||||
name = resource.Body('name')
|
||||
#: 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')
|
||||
project_id = resource.Body('tenant_id')
|
||||
#: The QoS policy description.
|
||||
description = resource.prop('description')
|
||||
description = resource.Body('description')
|
||||
#: Indicates whether this QoS policy is shared across all projects.
|
||||
#: *Type: bool*
|
||||
is_shared = resource.prop('shared', type=bool)
|
||||
is_shared = resource.Body('shared', type=bool)
|
||||
#: List of QoS rules applied to this QoS policy.
|
||||
rules = resource.prop('rules')
|
||||
rules = resource.Body('rules')
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from openstack.network import network_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class Quota(resource.Resource):
|
||||
|
@ -21,42 +21,42 @@ class Quota(resource.Resource):
|
|||
service = network_service.NetworkService()
|
||||
|
||||
# capabilities
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
||||
# Properties
|
||||
#: The maximum amount of floating IPs you can have. *Type: int*
|
||||
floating_ips = resource.prop('floatingip', type=int)
|
||||
floating_ips = resource.Body('floatingip', type=int)
|
||||
#: The maximum amount of health monitors you can create. *Type: int*
|
||||
health_monitors = resource.prop('healthmonitor', type=int)
|
||||
health_monitors = resource.Body('healthmonitor', type=int)
|
||||
#: The maximum amount of listeners you can create. *Type: int*
|
||||
listeners = resource.prop('listener', type=int)
|
||||
listeners = resource.Body('listener', type=int)
|
||||
#: The maximum amount of load balancers you can create. *Type: int*
|
||||
load_balancers = resource.prop('loadbalancer', type=int)
|
||||
load_balancers = resource.Body('loadbalancer', type=int)
|
||||
#: The maximum amount of L7 policies you can create. *Type: int*
|
||||
l7_policies = resource.prop('l7policy', type=int)
|
||||
l7_policies = resource.Body('l7policy', type=int)
|
||||
#: The maximum amount of networks you can create. *Type: int*
|
||||
networks = resource.prop('network', type=int)
|
||||
networks = resource.Body('network', type=int)
|
||||
#: The maximum amount of pools you can create. *Type: int*
|
||||
pools = resource.prop('pool', type=int)
|
||||
pools = resource.Body('pool', type=int)
|
||||
#: The maximum amount of ports you can create. *Type: int*
|
||||
ports = resource.prop('port', type=int)
|
||||
ports = resource.Body('port', type=int)
|
||||
#: The ID of the project these quota values are for.
|
||||
project_id = resource.prop('tenant_id')
|
||||
project_id = resource.Body('tenant_id')
|
||||
#: The maximum amount of RBAC policies you can create. *Type: int*
|
||||
rbac_policies = resource.prop('rbac_policy', type=int)
|
||||
rbac_policies = resource.Body('rbac_policy', type=int)
|
||||
#: The maximum amount of routers you can create. *Type: int*
|
||||
routers = resource.prop('router', type=int)
|
||||
routers = resource.Body('router', type=int)
|
||||
#: The maximum amount of subnets you can create. *Type: int*
|
||||
subnets = resource.prop('subnet', type=int)
|
||||
subnets = resource.Body('subnet', type=int)
|
||||
#: The maximum amount of subnet pools you can create. *Type: int*
|
||||
subnet_pools = resource.prop('subnetpool', type=int)
|
||||
subnet_pools = resource.Body('subnetpool', type=int)
|
||||
#: The maximum amount of security group rules you can create. *Type: int*
|
||||
security_group_rules = resource.prop('security_group_rule', type=int)
|
||||
security_group_rules = resource.Body('security_group_rule', type=int)
|
||||
#: The maximum amount of security groups you can create. *Type: int*
|
||||
security_groups = resource.prop('security_group', type=int)
|
||||
security_groups = resource.Body('security_group', type=int)
|
||||
|
||||
|
||||
class QuotaDefault(Quota):
|
||||
|
@ -67,3 +67,7 @@ class QuotaDefault(Quota):
|
|||
allow_update = False
|
||||
allow_delete = False
|
||||
allow_list = False
|
||||
|
||||
# Properties
|
||||
#: The ID of the project.
|
||||
project = resource.URI('project')
|
||||
|
|
|
@ -33,15 +33,15 @@ class TestMeteringLabel(testtools.TestCase):
|
|||
self.assertEqual('/metering/metering-labels', 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 = metering_label.MeteringLabel(EXAMPLE)
|
||||
sot = metering_label.MeteringLabel(**EXAMPLE)
|
||||
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['shared'], sot.shared)
|
||||
self.assertEqual(EXAMPLE['shared'], sot.is_shared)
|
||||
|
|
|
@ -20,7 +20,8 @@ EXAMPLE = {
|
|||
'excluded': False,
|
||||
'id': IDENTIFIER,
|
||||
'metering_label_id': '4',
|
||||
'remote_ip_prefix': '5',
|
||||
'tenant_id': '5',
|
||||
'remote_ip_prefix': '6',
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,15 +34,16 @@ class TestMeteringLabelRule(testtools.TestCase):
|
|||
self.assertEqual('/metering/metering-label-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.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = metering_label_rule.MeteringLabelRule(EXAMPLE)
|
||||
sot = metering_label_rule.MeteringLabelRule(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['direction'], sot.direction)
|
||||
self.assertFalse(sot.is_excluded)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['metering_label_id'], sot.metering_label_id)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['remote_ip_prefix'], sot.remote_ip_prefix)
|
||||
|
|
|
@ -17,30 +17,30 @@ from openstack.network.v2 import network
|
|||
IDENTIFIER = 'IDENTIFIER'
|
||||
EXAMPLE = {
|
||||
'admin_state_up': True,
|
||||
'id': IDENTIFIER,
|
||||
'name': '3',
|
||||
'tenant_id': '4',
|
||||
'provider:network_type': '5',
|
||||
'provider:physical_network': '6',
|
||||
'provider:segmentation_id': '7',
|
||||
'router:external': True,
|
||||
'segments': '9',
|
||||
'shared': True,
|
||||
'status': '11',
|
||||
'subnets': ['12a', '12b'],
|
||||
'mtu': 1400,
|
||||
'port_security_enabled': True,
|
||||
'availability_zone_hints': ['15', '16'],
|
||||
'availability_zones': ['16'],
|
||||
'ipv4_address_scope': '17',
|
||||
'ipv6_address_scope': '18',
|
||||
'description': '19',
|
||||
'qos_policy_id': '20',
|
||||
'availability_zone_hints': ['1', '2'],
|
||||
'availability_zones': ['3'],
|
||||
'created_at': '2016-03-09T12:14:57.233772',
|
||||
'updated_at': '2016-07-09T12:14:57.233772',
|
||||
'description': '4',
|
||||
'dns_domain': '5',
|
||||
'id': IDENTIFIER,
|
||||
'ipv4_address_scope': '6',
|
||||
'ipv6_address_scope': '7',
|
||||
'is_default': False,
|
||||
'revision_number': 23,
|
||||
'dns_domain': 24,
|
||||
'mtu': 8,
|
||||
'name': '9',
|
||||
'port_security_enabled': True,
|
||||
'project_id': '10',
|
||||
'provider:network_type': '11',
|
||||
'provider:physical_network': '12',
|
||||
'provider:segmentation_id': '13',
|
||||
'qos_policy_id': '14',
|
||||
'revision': 15,
|
||||
'router:external': True,
|
||||
'segments': '16',
|
||||
'shared': True,
|
||||
'status': '17',
|
||||
'subnets': ['18', '19'],
|
||||
'updated_at': '2016-07-09T12:14:57.233772',
|
||||
}
|
||||
|
||||
|
||||
|
@ -53,45 +53,45 @@ class TestNetwork(testtools.TestCase):
|
|||
self.assertEqual('/networks', 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 = network.Network(EXAMPLE)
|
||||
sot = network.Network(**EXAMPLE)
|
||||
self.assertTrue(sot.is_admin_state_up)
|
||||
self.assertEqual(EXAMPLE['availability_zone_hints'],
|
||||
sot.availability_zone_hints)
|
||||
self.assertEqual(EXAMPLE['availability_zones'],
|
||||
sot.availability_zones)
|
||||
self.assertEqual(EXAMPLE['created_at'], sot.created_at)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['dns_domain'], sot.dns_domain)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['ipv4_address_scope'],
|
||||
sot.ipv4_address_scope_id)
|
||||
self.assertEqual(EXAMPLE['ipv6_address_scope'],
|
||||
sot.ipv6_address_scope_id)
|
||||
self.assertFalse(sot.is_default)
|
||||
self.assertEqual(EXAMPLE['mtu'], sot.mtu)
|
||||
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertTrue(sot.is_port_security_enabled)
|
||||
self.assertEqual(EXAMPLE['project_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['provider:network_type'],
|
||||
sot.provider_network_type)
|
||||
self.assertEqual(EXAMPLE['provider:physical_network'],
|
||||
sot.provider_physical_network)
|
||||
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.assertTrue(sot.is_router_external)
|
||||
self.assertEqual(EXAMPLE['segments'], sot.segments)
|
||||
self.assertTrue(sot.is_shared)
|
||||
self.assertEqual(EXAMPLE['status'], sot.status)
|
||||
self.assertEqual(EXAMPLE['subnets'], sot.subnet_ids)
|
||||
self.assertEqual(EXAMPLE['mtu'], sot.mtu)
|
||||
self.assertTrue(sot.is_port_security_enabled)
|
||||
self.assertEqual(EXAMPLE['availability_zone_hints'],
|
||||
sot.availability_zone_hints)
|
||||
self.assertEqual(EXAMPLE['availability_zones'],
|
||||
sot.availability_zones)
|
||||
self.assertEqual(EXAMPLE['ipv4_address_scope'],
|
||||
sot.ipv4_address_scope_id)
|
||||
self.assertEqual(EXAMPLE['ipv6_address_scope'],
|
||||
sot.ipv6_address_scope_id)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['qos_policy_id'], sot.qos_policy_id)
|
||||
self.assertEqual(EXAMPLE['created_at'], sot.created_at)
|
||||
self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
|
||||
self.assertFalse(sot.is_default)
|
||||
self.assertEqual(EXAMPLE['revision_number'], sot.revision_number)
|
||||
self.assertEqual(EXAMPLE['dns_domain'], sot.dns_domain)
|
||||
|
||||
|
||||
class TestNetworkHostingDHCPAgent(testtools.TestCase):
|
||||
|
@ -104,7 +104,7 @@ class TestNetworkHostingDHCPAgent(testtools.TestCase):
|
|||
self.assertEqual('dhcp-agent', net.resource_name)
|
||||
self.assertEqual('network', net.service.service_type)
|
||||
self.assertFalse(net.allow_create)
|
||||
self.assertTrue(net.allow_retrieve)
|
||||
self.assertTrue(net.allow_get)
|
||||
self.assertFalse(net.allow_update)
|
||||
self.assertFalse(net.allow_delete)
|
||||
self.assertTrue(net.allow_list)
|
||||
|
|
|
@ -48,15 +48,14 @@ class TestNetworkIPAvailability(testtools.TestCase):
|
|||
self.assertEqual('network_name', sot.name_attribute)
|
||||
self.assertEqual('network', sot.service.service_type)
|
||||
self.assertFalse(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertFalse(sot.allow_update)
|
||||
self.assertFalse(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = network_ip_availability.NetworkIPAvailability(EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['network_id'],
|
||||
sot.network_id)
|
||||
sot = network_ip_availability.NetworkIPAvailability(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['network_id'], sot.network_id)
|
||||
self.assertEqual(EXAMPLE['network_name'], sot.network_name)
|
||||
self.assertEqual(EXAMPLE['subnet_ip_availability'],
|
||||
sot.subnet_ip_availability)
|
||||
|
@ -66,7 +65,7 @@ class TestNetworkIPAvailability(testtools.TestCase):
|
|||
|
||||
def test_make_it_with_optional(self):
|
||||
sot = network_ip_availability.NetworkIPAvailability(
|
||||
EXAMPLE_WITH_OPTIONAL)
|
||||
**EXAMPLE_WITH_OPTIONAL)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['network_id'], sot.network_id)
|
||||
self.assertEqual(EXAMPLE_WITH_OPTIONAL['network_name'],
|
||||
sot.network_name)
|
||||
|
|
|
@ -18,7 +18,8 @@ IDENTIFIER = 'IDENTIFIER'
|
|||
EXAMPLE = {
|
||||
'admin_state_up': True,
|
||||
'description': '2',
|
||||
'healthmonitor_id': '3',
|
||||
'health_monitors': ['3'],
|
||||
'health_monitor_status': ['4'],
|
||||
'id': IDENTIFIER,
|
||||
'lb_algorithm': '5',
|
||||
'listeners': [{'id': '6'}],
|
||||
|
@ -26,8 +27,13 @@ EXAMPLE = {
|
|||
'name': '8',
|
||||
'tenant_id': '9',
|
||||
'protocol': '10',
|
||||
'session_persistence': '11',
|
||||
'loadbalancers': [{'id': '12'}],
|
||||
'provider': '11',
|
||||
'session_persistence': '12',
|
||||
'status': '13',
|
||||
'status_description': '14',
|
||||
'subnet_id': '15',
|
||||
'loadbalancers': [{'id': '16'}],
|
||||
'vip_id': '17',
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,16 +46,18 @@ class TestPool(testtools.TestCase):
|
|||
self.assertEqual('/lbaas/pools', 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 = pool.Pool(EXAMPLE)
|
||||
sot = pool.Pool(**EXAMPLE)
|
||||
self.assertTrue(sot.is_admin_state_up)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['healthmonitor_id'], sot.health_monitor_id)
|
||||
self.assertEqual(EXAMPLE['health_monitors'], sot.health_monitor_ids)
|
||||
self.assertEqual(EXAMPLE['health_monitor_status'],
|
||||
sot.health_monitor_status)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['lb_algorithm'], sot.lb_algorithm)
|
||||
self.assertEqual(EXAMPLE['listeners'], sot.listener_ids)
|
||||
|
@ -57,6 +65,11 @@ class TestPool(testtools.TestCase):
|
|||
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['protocol'], sot.protocol)
|
||||
self.assertEqual(EXAMPLE['provider'], sot.provider)
|
||||
self.assertEqual(EXAMPLE['session_persistence'],
|
||||
sot.session_persistence)
|
||||
self.assertEqual(EXAMPLE['status'], sot.status)
|
||||
self.assertEqual(EXAMPLE['status_description'], sot.status_description)
|
||||
self.assertEqual(EXAMPLE['subnet_id'], sot.subnet_id)
|
||||
self.assertEqual(EXAMPLE['loadbalancers'], sot.load_balancer_ids)
|
||||
self.assertEqual(EXAMPLE['vip_id'], sot.virtual_ip_id)
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
|
||||
import testtools
|
||||
|
||||
from openstack.network.v2 import pool_member
|
||||
|
@ -26,6 +24,7 @@ EXAMPLE = {
|
|||
'subnet_id': '6',
|
||||
'weight': 7,
|
||||
'name': '8',
|
||||
'pool_id': 'FAKE_POOL',
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,13 +37,13 @@ class TestPoolMember(testtools.TestCase):
|
|||
self.assertEqual('/lbaas/pools/%(pool_id)s/members', 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 = pool_member.PoolMember(EXAMPLE)
|
||||
sot = pool_member.PoolMember(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['address'], sot.address)
|
||||
self.assertTrue(sot.is_admin_state_up)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
|
@ -53,9 +52,4 @@ class TestPoolMember(testtools.TestCase):
|
|||
self.assertEqual(EXAMPLE['subnet_id'], sot.subnet_id)
|
||||
self.assertEqual(EXAMPLE['weight'], sot.weight)
|
||||
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||
|
||||
def test_create_body(self):
|
||||
params = copy.deepcopy(EXAMPLE)
|
||||
params['pool_id'] = {'POOL1_ID'}
|
||||
body = pool_member.PoolMember._get_create_body(params)
|
||||
self.assertEqual(EXAMPLE, body['member'])
|
||||
self.assertEqual(EXAMPLE['pool_id'], sot.pool_id)
|
||||
|
|
|
@ -23,25 +23,29 @@ EXAMPLE = {
|
|||
'binding:vif_details': {'5': 5},
|
||||
'binding:vif_type': '6',
|
||||
'binding:vnic_type': '7',
|
||||
'device_id': '8',
|
||||
'device_owner': '9',
|
||||
'extra_dhcp_opts': [{'10': 10}],
|
||||
'fixed_ips': [{'11': '12'}],
|
||||
'id': IDENTIFIER,
|
||||
'mac_address': '13',
|
||||
'name': '14',
|
||||
'network_id': '15',
|
||||
'tenant_id': '16',
|
||||
'security_groups': ['17'],
|
||||
'status': '18',
|
||||
'port_security_enabled': True,
|
||||
'dns_assignment': [{'19': 19}],
|
||||
'dns_name': '20',
|
||||
'description': '21',
|
||||
'qos_policy_id': '22',
|
||||
'created_at': '2016-03-09T12:14:57.233772',
|
||||
'description': '8',
|
||||
'device_id': '9',
|
||||
'device_owner': '10',
|
||||
'dns_assignment': [{'11': 11}],
|
||||
'dns_name': '12',
|
||||
'extra_dhcp_opts': [{'13': 13}],
|
||||
'fixed_ips': [{'14': '14'}],
|
||||
'id': IDENTIFIER,
|
||||
'ip_address': '15',
|
||||
'mac_address': '16',
|
||||
'name': '17',
|
||||
'network_id': '18',
|
||||
'opt_name': '19',
|
||||
'opt_value': '20',
|
||||
'port_security_enabled': True,
|
||||
'qos_policy_id': '21',
|
||||
'revision': 22,
|
||||
'security_groups': ['23'],
|
||||
'subnet_id': '24',
|
||||
'status': '25',
|
||||
'tenant_id': '26',
|
||||
'updated_at': '2016-07-09T12:14:57.233772',
|
||||
'revision_number': 25,
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,13 +58,13 @@ class TestPort(testtools.TestCase):
|
|||
self.assertEqual('/ports', 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 = port.Port(EXAMPLE)
|
||||
sot = port.Port(**EXAMPLE)
|
||||
self.assertTrue(sot.is_admin_state_up)
|
||||
self.assertEqual(EXAMPLE['allowed_address_pairs'],
|
||||
sot.allowed_address_pairs)
|
||||
|
@ -70,22 +74,26 @@ class TestPort(testtools.TestCase):
|
|||
sot.binding_vif_details)
|
||||
self.assertEqual(EXAMPLE['binding:vif_type'], sot.binding_vif_type)
|
||||
self.assertEqual(EXAMPLE['binding:vnic_type'], sot.binding_vnic_type)
|
||||
self.assertEqual(EXAMPLE['created_at'], sot.created_at)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['device_id'], sot.device_id)
|
||||
self.assertEqual(EXAMPLE['device_owner'], sot.device_owner)
|
||||
self.assertEqual(EXAMPLE['dns_assignment'], sot.dns_assignment)
|
||||
self.assertEqual(EXAMPLE['dns_name'], sot.dns_name)
|
||||
self.assertEqual(EXAMPLE['extra_dhcp_opts'], sot.extra_dhcp_opts)
|
||||
self.assertEqual(EXAMPLE['fixed_ips'], sot.fixed_ips)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['ip_address'], sot.ip_address)
|
||||
self.assertEqual(EXAMPLE['mac_address'], sot.mac_address)
|
||||
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['opt_name'], sot.option_name)
|
||||
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['security_groups'], sot.security_group_ids)
|
||||
self.assertEqual(EXAMPLE['status'], sot.status)
|
||||
self.assertTrue(sot.is_port_security_enabled)
|
||||
self.assertEqual(EXAMPLE['dns_assignment'], sot.dns_assignment)
|
||||
self.assertEqual(EXAMPLE['dns_name'], sot.dns_name)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['qos_policy_id'], sot.qos_policy_id)
|
||||
self.assertEqual(EXAMPLE['created_at'], sot.created_at)
|
||||
self.assertEqual(EXAMPLE['subnet_id'], sot.subnet_id)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['updated_at'], sot.updated_at)
|
||||
self.assertEqual(EXAMPLE['revision_number'], sot.revision_number)
|
||||
|
|
|
@ -34,13 +34,13 @@ class TestQoSPolicy(testtools.TestCase):
|
|||
self.assertEqual('/qos/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 = qos_policy.QoSPolicy(EXAMPLE)
|
||||
sot = qos_policy.QoSPolicy(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||
|
|
|
@ -43,13 +43,13 @@ class TestQuota(testtools.TestCase):
|
|||
self.assertEqual('/quotas', sot.base_path)
|
||||
self.assertEqual('network', sot.service.service_type)
|
||||
self.assertFalse(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 = quota.Quota(EXAMPLE)
|
||||
sot = quota.Quota(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['floatingip'], sot.floating_ips)
|
||||
self.assertEqual(EXAMPLE['network'], sot.networks)
|
||||
self.assertEqual(EXAMPLE['port'], sot.ports)
|
||||
|
@ -71,32 +71,33 @@ class TestQuota(testtools.TestCase):
|
|||
class TestQuotaDefault(testtools.TestCase):
|
||||
|
||||
def test_basic(self):
|
||||
default = quota.QuotaDefault()
|
||||
self.assertEqual('quota', default.resource_key)
|
||||
self.assertEqual('quotas', default.resources_key)
|
||||
self.assertEqual('/quotas/%(project)s/default', default.base_path)
|
||||
self.assertEqual('network', default.service.service_type)
|
||||
self.assertFalse(default.allow_create)
|
||||
self.assertTrue(default.allow_retrieve)
|
||||
self.assertFalse(default.allow_update)
|
||||
self.assertFalse(default.allow_delete)
|
||||
self.assertFalse(default.allow_list)
|
||||
sot = quota.QuotaDefault()
|
||||
self.assertEqual('quota', sot.resource_key)
|
||||
self.assertEqual('quotas', sot.resources_key)
|
||||
self.assertEqual('/quotas/%(project)s/default', sot.base_path)
|
||||
self.assertEqual('network', sot.service.service_type)
|
||||
self.assertFalse(sot.allow_create)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertFalse(sot.allow_update)
|
||||
self.assertFalse(sot.allow_delete)
|
||||
self.assertFalse(sot.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
default = quota.Quota(EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['floatingip'], default.floating_ips)
|
||||
self.assertEqual(EXAMPLE['network'], default.networks)
|
||||
self.assertEqual(EXAMPLE['port'], default.ports)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], default.project_id)
|
||||
self.assertEqual(EXAMPLE['router'], default.routers)
|
||||
self.assertEqual(EXAMPLE['subnet'], default.subnets)
|
||||
self.assertEqual(EXAMPLE['subnetpool'], default.subnet_pools)
|
||||
sot = quota.QuotaDefault(project='FAKE_PROJECT', **EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['floatingip'], sot.floating_ips)
|
||||
self.assertEqual(EXAMPLE['network'], sot.networks)
|
||||
self.assertEqual(EXAMPLE['port'], sot.ports)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['router'], sot.routers)
|
||||
self.assertEqual(EXAMPLE['subnet'], sot.subnets)
|
||||
self.assertEqual(EXAMPLE['subnetpool'], sot.subnet_pools)
|
||||
self.assertEqual(EXAMPLE['security_group_rule'],
|
||||
default.security_group_rules)
|
||||
self.assertEqual(EXAMPLE['security_group'], default.security_groups)
|
||||
self.assertEqual(EXAMPLE['rbac_policy'], default.rbac_policies)
|
||||
self.assertEqual(EXAMPLE['healthmonitor'], default.health_monitors)
|
||||
self.assertEqual(EXAMPLE['listener'], default.listeners)
|
||||
self.assertEqual(EXAMPLE['loadbalancer'], default.load_balancers)
|
||||
self.assertEqual(EXAMPLE['l7policy'], default.l7_policies)
|
||||
self.assertEqual(EXAMPLE['pool'], default.pools)
|
||||
sot.security_group_rules)
|
||||
self.assertEqual(EXAMPLE['security_group'], sot.security_groups)
|
||||
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)
|
||||
self.assertEqual('FAKE_PROJECT', sot.project)
|
||||
|
|
Loading…
Reference in New Issue