Rebase network proxy to proxy2
Change-Id: Id0b11cd98c332582cec3017a1237ad54cbcc41ac
This commit is contained in:
parent
076ec4adc8
commit
28922b3c28
File diff suppressed because it is too large
Load Diff
@ -40,4 +40,4 @@ class Flavor(resource.Resource):
|
||||
#: Service type to which the flavor applies
|
||||
service_type = resource.Body('service_type')
|
||||
#: IDs of service profiles associated with this flavor
|
||||
service_profile_ids = resource.Body('service_profiles')
|
||||
service_profile_ids = resource.Body('service_profiles', type=list)
|
||||
|
@ -32,8 +32,7 @@ class FloatingIP(resource.Resource):
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'description', 'fixed_ip_address', 'floating_ip_address',
|
||||
'floating_network_id', 'port_id', 'router_id', 'status',
|
||||
project_id='tenant_id',
|
||||
revision_number='revision')
|
||||
project_id='tenant_id')
|
||||
|
||||
# Properties
|
||||
#: Timestamp at which the floating IP was created.
|
||||
|
@ -29,13 +29,15 @@ class Network(resource.Resource):
|
||||
|
||||
# NOTE: We don't support query on list or datetime fields yet
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'description', 'name', 'status',
|
||||
'description', 'name', 'project_id', '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',
|
||||
provider_network_type='provider:network_type',
|
||||
provider_physical_network='provider:physical_network',
|
||||
provider_segmentation_id='provider:segmentation_id',
|
||||
)
|
||||
|
||||
# Properties
|
||||
|
@ -28,8 +28,8 @@ class Pool(resource.Resource):
|
||||
allow_list = True
|
||||
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'description', 'health_monitor_id', 'lb_algorithm', 'name',
|
||||
'protocol', 'provider', 'subnet_id', 'vip_id',
|
||||
'description', 'lb_algorithm', 'name',
|
||||
'protocol', 'provider', 'subnet_id', 'virtual_ip_id',
|
||||
is_admin_state_up='admin_state_up',
|
||||
project_id='tenant_id',
|
||||
)
|
||||
@ -69,7 +69,7 @@ class Pool(resource.Resource):
|
||||
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.
|
||||
#: The subnet on which 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``*
|
||||
|
@ -27,6 +27,12 @@ class QoSPolicy(resource.Resource):
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'name', 'description',
|
||||
project_id='tenant_id',
|
||||
is_shared='shared'
|
||||
)
|
||||
|
||||
# Properties
|
||||
#: QoS policy name.
|
||||
name = resource.Body('name')
|
||||
|
@ -27,6 +27,8 @@ class QoSRuleType(resource.Resource):
|
||||
allow_delete = False
|
||||
allow_list = True
|
||||
|
||||
_query_mapping = resource.QueryParameters('type')
|
||||
|
||||
# Properties
|
||||
#: QoS rule type name.
|
||||
type = resource.Body('type')
|
||||
|
@ -27,7 +27,10 @@ class RBACPolicy(resource.Resource):
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
||||
# NOTE: This resource doesn't support query parameters
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'action', 'object_id', 'object_type', 'project_id',
|
||||
'target_project_id',
|
||||
)
|
||||
|
||||
# Properties
|
||||
#: ID of the object that this RBAC policy affects.
|
||||
|
@ -28,9 +28,11 @@ class SecurityGroupRule(resource.Resource):
|
||||
allow_list = True
|
||||
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'description', 'direction', 'ethertype', 'protocol',
|
||||
'description', 'direction', 'protocol',
|
||||
'remote_group_id', 'security_group_id',
|
||||
ether_type='ethertype',
|
||||
project_id='tenant_id',
|
||||
|
||||
)
|
||||
|
||||
# Properties
|
||||
|
@ -35,7 +35,7 @@ class ServiceProfile(resource.Resource):
|
||||
# Properties
|
||||
#: Description of the service flavor profile.
|
||||
description = resource.Body('description')
|
||||
#: Provider Driver for the service flavor profile
|
||||
#: Provider driver for the service flavor profile
|
||||
driver = resource.Body('driver')
|
||||
#: Sets enabled flag
|
||||
is_enabled = resource.Body('enabled', type=bool)
|
||||
|
@ -47,7 +47,8 @@ from openstack.network.v2 import service_provider
|
||||
from openstack.network.v2 import subnet
|
||||
from openstack.network.v2 import subnet_pool
|
||||
from openstack.network.v2 import vpn_service
|
||||
from openstack.tests.unit import test_proxy_base
|
||||
from openstack import proxy2 as proxy_base2
|
||||
from openstack.tests.unit import test_proxy_base2
|
||||
|
||||
|
||||
QOS_POLICY_ID = 'qos-policy-id-' + uuid.uuid4().hex
|
||||
@ -56,7 +57,7 @@ NETWORK_ID = 'network-id-' + uuid.uuid4().hex
|
||||
AGENT_ID = 'agent-id-' + uuid.uuid4().hex
|
||||
|
||||
|
||||
class TestNetworkProxy(test_proxy_base.TestProxyBase):
|
||||
class TestNetworkProxy(test_proxy_base2.TestProxyBase):
|
||||
def setUp(self):
|
||||
super(TestNetworkProxy, self).setUp()
|
||||
self.proxy = _proxy.Proxy(self.session)
|
||||
@ -116,7 +117,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
|
||||
agent.DHCPAgentHostingNetwork,
|
||||
paginated=False,
|
||||
method_kwargs={'agent': AGENT_ID},
|
||||
expected_kwargs={'path_args': {'agent_id': AGENT_ID}},
|
||||
expected_kwargs={'agent_id': AGENT_ID}
|
||||
)
|
||||
|
||||
def test_network_hosting_dhcp_agents(self):
|
||||
@ -125,7 +126,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
|
||||
network.NetworkHostingDHCPAgent,
|
||||
paginated=False,
|
||||
method_kwargs={'network': NETWORK_ID},
|
||||
expected_kwargs={'path_args': {'network_id': NETWORK_ID}},
|
||||
expected_kwargs={'network_id': NETWORK_ID}
|
||||
)
|
||||
|
||||
def test_extension_find(self):
|
||||
@ -380,8 +381,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
|
||||
self.verify_create(self.proxy.create_pool_member,
|
||||
pool_member.PoolMember,
|
||||
method_kwargs={"pool": "test_id"},
|
||||
expected_kwargs={"path_args": {
|
||||
"pool_id": "test_id"}})
|
||||
expected_kwargs={"pool_id": "test_id"})
|
||||
|
||||
def test_pool_member_delete(self):
|
||||
self.verify_delete(self.proxy.delete_pool_member,
|
||||
@ -394,28 +394,31 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
|
||||
{"pool": "test_id"}, {"pool_id": "test_id"})
|
||||
|
||||
def test_pool_member_find(self):
|
||||
self.verify_find(self.proxy.find_pool_member,
|
||||
pool_member.PoolMember,
|
||||
path_args={"pool_id": "test_id"})
|
||||
self._verify2('openstack.proxy2.BaseProxy._find',
|
||||
self.proxy.find_pool_member,
|
||||
method_args=["MEMBER", "POOL"],
|
||||
expected_args=[pool_member.PoolMember, "MEMBER"],
|
||||
expected_kwargs={"pool_id": "POOL",
|
||||
"ignore_missing": True})
|
||||
|
||||
def test_pool_member_get(self):
|
||||
self._verify2('openstack.proxy.BaseProxy._get',
|
||||
self._verify2('openstack.proxy2.BaseProxy._get',
|
||||
self.proxy.get_pool_member,
|
||||
method_args=["resource_or_id", "test_id"],
|
||||
expected_args=[pool_member.PoolMember,
|
||||
"resource_or_id"],
|
||||
expected_kwargs={"path_args": {"pool_id": "test_id"}})
|
||||
method_args=["MEMBER", "POOL"],
|
||||
expected_args=[pool_member.PoolMember, "MEMBER"],
|
||||
expected_kwargs={"pool_id": "POOL"})
|
||||
|
||||
def test_pool_members(self):
|
||||
self.verify_list(self.proxy.pool_members, pool_member.PoolMember,
|
||||
paginated=False, method_args=["test_id"],
|
||||
expected_kwargs={"path_args": {
|
||||
"pool_id": "test_id"}})
|
||||
expected_kwargs={"pool_id": "test_id"})
|
||||
|
||||
def test_pool_member_update(self):
|
||||
self.verify_update(self.proxy.update_pool_member,
|
||||
pool_member.PoolMember,
|
||||
path_args={"pool_id": "test_id"})
|
||||
self._verify2("openstack.proxy2.BaseProxy._update",
|
||||
self.proxy.update_pool_member,
|
||||
method_args=["MEMBER", "POOL"],
|
||||
expected_args=[pool_member.PoolMember, "MEMBER"],
|
||||
expected_kwargs={"pool_id": "POOL"})
|
||||
|
||||
def test_pool_create_attrs(self):
|
||||
self.verify_create(self.proxy.create_pool, pool.Pool)
|
||||
@ -464,33 +467,39 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
|
||||
self.proxy.create_qos_bandwidth_limit_rule,
|
||||
qos_bandwidth_limit_rule.QoSBandwidthLimitRule,
|
||||
method_kwargs={'qos_policy': QOS_POLICY_ID},
|
||||
expected_kwargs={'path_args': {'qos_policy_id': QOS_POLICY_ID}})
|
||||
expected_kwargs={'qos_policy_id': QOS_POLICY_ID})
|
||||
|
||||
def test_qos_bandwidth_limit_rule_delete(self):
|
||||
self.verify_delete(
|
||||
self.proxy.delete_qos_bandwidth_limit_rule,
|
||||
qos_bandwidth_limit_rule.QoSBandwidthLimitRule,
|
||||
False, input_path_args=["resource_or_id", QOS_POLICY_ID],
|
||||
expected_path_args={'qos_policy_id': QOS_POLICY_ID},)
|
||||
expected_kwargs={'qos_policy_id': QOS_POLICY_ID})
|
||||
|
||||
def test_qos_bandwidth_limit_rule_delete_ignore(self):
|
||||
self.verify_delete(
|
||||
self.proxy.delete_qos_bandwidth_limit_rule,
|
||||
qos_bandwidth_limit_rule.QoSBandwidthLimitRule,
|
||||
True, input_path_args=["resource_or_id", QOS_POLICY_ID],
|
||||
expected_path_args={'qos_policy_id': QOS_POLICY_ID}, )
|
||||
expected_kwargs={'qos_policy_id': QOS_POLICY_ID})
|
||||
|
||||
def test_qos_bandwidth_limit_rule_find(self):
|
||||
self.verify_find(self.proxy.find_qos_bandwidth_limit_rule,
|
||||
qos_bandwidth_limit_rule.QoSBandwidthLimitRule,
|
||||
path_args={'qos_policy_id': QOS_POLICY_ID})
|
||||
policy = qos_policy.QoSPolicy.new(id=QOS_POLICY_ID)
|
||||
self._verify2('openstack.proxy2.BaseProxy._find',
|
||||
self.proxy.find_qos_bandwidth_limit_rule,
|
||||
method_args=['rule_id', policy],
|
||||
expected_args=[
|
||||
qos_bandwidth_limit_rule.QoSBandwidthLimitRule,
|
||||
'rule_id'],
|
||||
expected_kwargs={'ignore_missing': True,
|
||||
'qos_policy_id': QOS_POLICY_ID})
|
||||
|
||||
def test_qos_bandwidth_limit_rule_get(self):
|
||||
self.verify_get(
|
||||
self.proxy.get_qos_bandwidth_limit_rule,
|
||||
qos_bandwidth_limit_rule.QoSBandwidthLimitRule,
|
||||
method_kwargs={'qos_policy': QOS_POLICY_ID},
|
||||
expected_kwargs={'path_args': {'qos_policy_id': QOS_POLICY_ID}})
|
||||
expected_kwargs={'qos_policy_id': QOS_POLICY_ID})
|
||||
|
||||
def test_qos_bandwidth_limit_rules(self):
|
||||
self.verify_list(
|
||||
@ -498,20 +507,26 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
|
||||
qos_bandwidth_limit_rule.QoSBandwidthLimitRule,
|
||||
paginated=False,
|
||||
method_kwargs={'qos_policy': QOS_POLICY_ID},
|
||||
expected_kwargs={'path_args': {'qos_policy_id': QOS_POLICY_ID}})
|
||||
expected_kwargs={'qos_policy_id': QOS_POLICY_ID})
|
||||
|
||||
def test_qos_bandwidth_limit_rule_update(self):
|
||||
self.verify_update(
|
||||
self.proxy.update_qos_bandwidth_limit_rule,
|
||||
qos_bandwidth_limit_rule.QoSBandwidthLimitRule,
|
||||
path_args={'qos_policy_id': QOS_POLICY_ID})
|
||||
policy = qos_policy.QoSPolicy.new(id=QOS_POLICY_ID)
|
||||
self._verify2('openstack.proxy2.BaseProxy._update',
|
||||
self.proxy.update_qos_bandwidth_limit_rule,
|
||||
method_args=['rule_id', policy],
|
||||
method_kwargs={'foo': 'bar'},
|
||||
expected_args=[
|
||||
qos_bandwidth_limit_rule.QoSBandwidthLimitRule,
|
||||
'rule_id'],
|
||||
expected_kwargs={'qos_policy_id': QOS_POLICY_ID,
|
||||
'foo': 'bar'})
|
||||
|
||||
def test_qos_dscp_marking_rule_create_attrs(self):
|
||||
self.verify_create(
|
||||
self.proxy.create_qos_dscp_marking_rule,
|
||||
qos_dscp_marking_rule.QoSDSCPMarkingRule,
|
||||
method_kwargs={'qos_policy': QOS_POLICY_ID},
|
||||
expected_kwargs={'path_args': {'qos_policy_id': QOS_POLICY_ID}})
|
||||
expected_kwargs={'qos_policy_id': QOS_POLICY_ID})
|
||||
|
||||
def test_qos_dscp_marking_rule_delete(self):
|
||||
self.verify_delete(
|
||||
@ -528,16 +543,21 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
|
||||
expected_path_args={'qos_policy_id': QOS_POLICY_ID}, )
|
||||
|
||||
def test_qos_dscp_marking_rule_find(self):
|
||||
self.verify_find(self.proxy.find_qos_dscp_marking_rule,
|
||||
qos_dscp_marking_rule.QoSDSCPMarkingRule,
|
||||
path_args={'qos_policy_id': QOS_POLICY_ID})
|
||||
policy = qos_policy.QoSPolicy.new(id=QOS_POLICY_ID)
|
||||
self._verify2('openstack.proxy2.BaseProxy._find',
|
||||
self.proxy.find_qos_dscp_marking_rule,
|
||||
method_args=['rule_id', policy],
|
||||
expected_args=[qos_dscp_marking_rule.QoSDSCPMarkingRule,
|
||||
'rule_id'],
|
||||
expected_kwargs={'ignore_missing': True,
|
||||
'qos_policy_id': QOS_POLICY_ID})
|
||||
|
||||
def test_qos_dscp_marking_rule_get(self):
|
||||
self.verify_get(
|
||||
self.proxy.get_qos_dscp_marking_rule,
|
||||
qos_dscp_marking_rule.QoSDSCPMarkingRule,
|
||||
method_kwargs={'qos_policy': QOS_POLICY_ID},
|
||||
expected_kwargs={'path_args': {'qos_policy_id': QOS_POLICY_ID}})
|
||||
expected_kwargs={'qos_policy_id': QOS_POLICY_ID})
|
||||
|
||||
def test_qos_dscp_marking_rules(self):
|
||||
self.verify_list(
|
||||
@ -545,20 +565,26 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
|
||||
qos_dscp_marking_rule.QoSDSCPMarkingRule,
|
||||
paginated=False,
|
||||
method_kwargs={'qos_policy': QOS_POLICY_ID},
|
||||
expected_kwargs={'path_args': {'qos_policy_id': QOS_POLICY_ID}})
|
||||
expected_kwargs={'qos_policy_id': QOS_POLICY_ID})
|
||||
|
||||
def test_qos_dscp_marking_rule_update(self):
|
||||
self.verify_update(
|
||||
self.proxy.update_qos_dscp_marking_rule,
|
||||
qos_dscp_marking_rule.QoSDSCPMarkingRule,
|
||||
path_args={'qos_policy_id': QOS_POLICY_ID})
|
||||
policy = qos_policy.QoSPolicy.new(id=QOS_POLICY_ID)
|
||||
self._verify2('openstack.proxy2.BaseProxy._update',
|
||||
self.proxy.update_qos_dscp_marking_rule,
|
||||
method_args=['rule_id', policy],
|
||||
method_kwargs={'foo': 'bar'},
|
||||
expected_args=[
|
||||
qos_dscp_marking_rule.QoSDSCPMarkingRule,
|
||||
'rule_id'],
|
||||
expected_kwargs={'qos_policy_id': QOS_POLICY_ID,
|
||||
'foo': 'bar'})
|
||||
|
||||
def test_qos_minimum_bandwidth_rule_create_attrs(self):
|
||||
self.verify_create(
|
||||
self.proxy.create_qos_minimum_bandwidth_rule,
|
||||
qos_minimum_bandwidth_rule.QoSMinimumBandwidthRule,
|
||||
method_kwargs={'qos_policy': QOS_POLICY_ID},
|
||||
expected_kwargs={'path_args': {'qos_policy_id': QOS_POLICY_ID}})
|
||||
expected_kwargs={'qos_policy_id': QOS_POLICY_ID})
|
||||
|
||||
def test_qos_minimum_bandwidth_rule_delete(self):
|
||||
self.verify_delete(
|
||||
@ -575,16 +601,22 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
|
||||
expected_path_args={'qos_policy_id': QOS_POLICY_ID}, )
|
||||
|
||||
def test_qos_minimum_bandwidth_rule_find(self):
|
||||
self.verify_find(self.proxy.find_qos_minimum_bandwidth_rule,
|
||||
qos_minimum_bandwidth_rule.QoSMinimumBandwidthRule,
|
||||
path_args={'qos_policy_id': QOS_POLICY_ID})
|
||||
policy = qos_policy.QoSPolicy.new(id=QOS_POLICY_ID)
|
||||
self._verify2('openstack.proxy2.BaseProxy._find',
|
||||
self.proxy.find_qos_minimum_bandwidth_rule,
|
||||
method_args=['rule_id', policy],
|
||||
expected_args=[
|
||||
qos_minimum_bandwidth_rule.QoSMinimumBandwidthRule,
|
||||
'rule_id'],
|
||||
expected_kwargs={'ignore_missing': True,
|
||||
'qos_policy_id': QOS_POLICY_ID})
|
||||
|
||||
def test_qos_minimum_bandwidth_rule_get(self):
|
||||
self.verify_get(
|
||||
self.proxy.get_qos_minimum_bandwidth_rule,
|
||||
qos_minimum_bandwidth_rule.QoSMinimumBandwidthRule,
|
||||
method_kwargs={'qos_policy': QOS_POLICY_ID},
|
||||
expected_kwargs={'path_args': {'qos_policy_id': QOS_POLICY_ID}})
|
||||
expected_kwargs={'qos_policy_id': QOS_POLICY_ID})
|
||||
|
||||
def test_qos_minimum_bandwidth_rules(self):
|
||||
self.verify_list(
|
||||
@ -592,13 +624,19 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
|
||||
qos_minimum_bandwidth_rule.QoSMinimumBandwidthRule,
|
||||
paginated=False,
|
||||
method_kwargs={'qos_policy': QOS_POLICY_ID},
|
||||
expected_kwargs={'path_args': {'qos_policy_id': QOS_POLICY_ID}})
|
||||
expected_kwargs={'qos_policy_id': QOS_POLICY_ID})
|
||||
|
||||
def test_qos_minimum_bandwidth_rule_update(self):
|
||||
self.verify_update(
|
||||
self.proxy.update_qos_minimum_bandwidth_rule,
|
||||
qos_minimum_bandwidth_rule.QoSMinimumBandwidthRule,
|
||||
path_args={'qos_policy_id': QOS_POLICY_ID})
|
||||
policy = qos_policy.QoSPolicy.new(id=QOS_POLICY_ID)
|
||||
self._verify2('openstack.proxy2.BaseProxy._update',
|
||||
self.proxy.update_qos_minimum_bandwidth_rule,
|
||||
method_args=['rule_id', policy],
|
||||
method_kwargs={'foo': 'bar'},
|
||||
expected_args=[
|
||||
qos_minimum_bandwidth_rule.QoSMinimumBandwidthRule,
|
||||
'rule_id'],
|
||||
expected_kwargs={'qos_policy_id': QOS_POLICY_ID,
|
||||
'foo': 'bar'})
|
||||
|
||||
def test_qos_policy_create_attrs(self):
|
||||
self.verify_create(self.proxy.create_qos_policy, qos_policy.QoSPolicy)
|
||||
@ -637,12 +675,16 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
|
||||
def test_quota_get(self):
|
||||
self.verify_get(self.proxy.get_quota, quota.Quota)
|
||||
|
||||
def test_quota_default_get(self):
|
||||
self.verify_get(self.proxy.get_quota_default, quota.QuotaDefault,
|
||||
value=[mock.sentinel.project_id],
|
||||
expected_args=[quota.QuotaDefault],
|
||||
expected_kwargs={"path_args": {
|
||||
"project": mock.sentinel.project_id}})
|
||||
@mock.patch.object(proxy_base2.BaseProxy, "_get_resource")
|
||||
def test_quota_default_get(self, mock_get):
|
||||
fake_quota = mock.Mock(project_id='PROJECT')
|
||||
mock_get.return_value = fake_quota
|
||||
self._verify2("openstack.proxy2.BaseProxy._get",
|
||||
self.proxy.get_quota_default,
|
||||
method_args=['QUOTA_ID'],
|
||||
expected_args=[quota.QuotaDefault],
|
||||
expected_kwargs={'project': "PROJECT"})
|
||||
mock_get.assert_called_once_with(quota.Quota, 'QUOTA_ID')
|
||||
|
||||
def test_quotas(self):
|
||||
self.verify_list(self.proxy.quotas, quota.Quota, paginated=False)
|
||||
@ -915,5 +957,4 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
|
||||
value=[mock.sentinel.project_id],
|
||||
expected_args=[
|
||||
auto_allocated_topology.ValidateTopology],
|
||||
expected_kwargs={"path_args": {
|
||||
"project": mock.sentinel.project_id}})
|
||||
expected_kwargs={"project": mock.sentinel.project_id})
|
||||
|
Loading…
Reference in New Issue
Block a user