aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/common
diff options
context:
space:
mode:
authorShobhi Jain <shobhi.jain@intel.com>2018-02-21 16:13:16 +0000
committerShobhi Jain <shobhi.jain@intel.com>2018-03-20 16:28:15 +0000
commit68c934be759962d18d109fde35726f416088a126 (patch)
treeecf8df2ea20ce4c4095da92d6fea4c400e7502c0 /yardstick/common
parent16aa0b60244b742c2b6478cea93b1eebce4c335f (diff)
Replace neutron router interface deletion with shade.
Function remove_interface_router now uses shade client instead of neutron client. JIRA: YARDSTICK-890 Change-Id: I6bd36e35a339cce64dfa8b69c1e7b56cd70af956 Signed-off-by: Shobhi Jain <shobhi.jain@intel.com>
Diffstat (limited to 'yardstick/common')
-rw-r--r--yardstick/common/exceptions.py4
-rw-r--r--yardstick/common/openstack_utils.py27
2 files changed, 23 insertions, 8 deletions
diff --git a/yardstick/common/exceptions.py b/yardstick/common/exceptions.py
index 8160c5b0c..972486c8d 100644
--- a/yardstick/common/exceptions.py
+++ b/yardstick/common/exceptions.py
@@ -124,3 +124,7 @@ class UnsupportedPodFormatError(YardstickException):
class ScenarioCreateRouterError(YardstickException):
message = 'Create Neutron Router Scenario failed'
+
+
+class ScenarioRemoveRouterIntError(YardstickException):
+ message = 'Remove Neutron Router Interface Scenario failed'
diff --git a/yardstick/common/openstack_utils.py b/yardstick/common/openstack_utils.py
index a4fd4e550..e1a133fe9 100644
--- a/yardstick/common/openstack_utils.py
+++ b/yardstick/common/openstack_utils.py
@@ -563,16 +563,27 @@ def remove_gateway_router(neutron_client, router_id): # pragma: no cover
return False
-def remove_interface_router(neutron_client, router_id, subnet_id,
- **json_body): # pragma: no cover
- json_body.update({"subnet_id": subnet_id})
+def remove_router_interface(shade_client, router, subnet_id=None,
+ port_id=None):
+ """Detach a subnet from an internal router interface.
+
+ At least one of subnet_id or port_id must be supplied. If you specify both
+ subnet and port ID, the subnet ID must correspond to the subnet ID of the
+ first IP address on the port specified by the port ID.
+ Otherwise an error occurs.
+
+ :param router: The dict object of the router being changed
+ :param subnet_id:(string) The ID of the subnet to use for the interface
+ :param port_id:(string) The ID of the port to use for the interface
+ :returns: True on success
+ """
try:
- neutron_client.remove_interface_router(router=router_id,
- body=json_body)
+ shade_client.remove_router_interface(
+ router, subnet_id=subnet_id, port_id=port_id)
return True
- except Exception: # pylint: disable=broad-except
- log.error("Error [remove_interface_router(neutron_client, '%s', "
- "'%s')]", router_id, subnet_id)
+ except exc.OpenStackCloudException as o_exc:
+ log.error("Error [remove_interface_router(shade_client)]. "
+ "Exception message: %s", o_exc.orig_message)
return False