Best Python code snippet using tempest_python
test_qos.py
Source:test_qos.py
1#2# Licensed under the Apache License, Version 2.0 (the "License"); you may3# not use this file except in compliance with the License. You may obtain4# a copy of the License at5#6# http://www.apache.org/licenses/LICENSE-2.07#8# Unless required by applicable law or agreed to in writing, software9# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT10# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the11# License for the specific language governing permissions and limitations12# under the License.13from unittest import mock14from heat.common import template_format15from heat.engine.clients.os import neutron16from heat.engine import rsrc_defn17from heat.engine import stack18from heat.engine import template19from heat.tests import common20from heat.tests import utils21qos_policy_template = '''22heat_template_version: 2016-04-0823description: This template to define a neutron qos policy.24resources:25 my_qos_policy:26 type: OS::Neutron::QoSPolicy27 properties:28 description: a policy for test29 shared: true30 tenant_id: d66c74c01d6c41b9846088c1ad9634d031'''32bandwidth_limit_rule_template = '''33heat_template_version: 2016-04-0834description: This template to define a neutron bandwidth limit rule.35resources:36 my_bandwidth_limit_rule:37 type: OS::Neutron::QoSBandwidthLimitRule38 properties:39 policy: 477e8273-60a7-4c41-b683-fdb0bc7cd15140 max_kbps: 100041 max_burst_kbps: 100042 tenant_id: d66c74c01d6c41b9846088c1ad9634d043'''44dscp_marking_rule_template = '''45heat_template_version: 2016-04-0846description: This template to define a neutron DSCP marking rule.47resources:48 my_dscp_marking_rule:49 type: OS::Neutron::QoSDscpMarkingRule50 properties:51 policy: 477e8273-60a7-4c41-b683-fdb0bc7cd15152 dscp_mark: 1653 tenant_id: d66c74c01d6c41b9846088c1ad9634d054'''55minimum_bandwidth_rule_template = '''56heat_template_version: 2016-04-0857description: This template to define a neutron minimum bandwidth rule.58resources:59 my_minimum_bandwidth_rule:60 type: OS::Neutron::QoSMinimumBandwidthRule61 properties:62 policy: 477e8273-60a7-4c41-b683-fdb0bc7cd15163 min_kbps: 100064 tenant_id: d66c74c01d6c41b9846088c1ad9634d065'''66minimum_packet_rate_rule_template = '''67heat_template_version: 2021-04-1668description: This template to define a neutron minimum packet rate rule.69resources:70 my_minimum_packet_rate_rule:71 type: OS::Neutron::QoSMinimumPacketRateRule72 properties:73 policy: 477e8273-60a7-4c41-b683-fdb0bc7cd15174 min_kpps: 100075 direction: any76 tenant_id: d66c74c01d6c41b9846088c1ad9634d077'''78class NeutronQoSPolicyTest(common.HeatTestCase):79 def setUp(self):80 super(NeutronQoSPolicyTest, self).setUp()81 self.ctx = utils.dummy_context()82 tpl = template_format.parse(qos_policy_template)83 self.stack = stack.Stack(84 self.ctx,85 'neutron_qos_policy_test',86 template.Template(tpl)87 )88 self.neutronclient = mock.MagicMock()89 self.patchobject(neutron.NeutronClientPlugin, 'has_extension',90 return_value=True)91 self.my_qos_policy = self.stack['my_qos_policy']92 self.my_qos_policy.client = mock.MagicMock(93 return_value=self.neutronclient)94 self.patchobject(self.my_qos_policy, 'physical_resource_name',95 return_value='test_policy')96 def test_qos_policy_handle_create(self):97 policy = {98 'policy': {99 'description': 'a policy for test',100 'id': '9c1eb3fe-7bba-479d-bd43-1d497e53c384',101 'rules': [],102 'tenant_id': 'd66c74c01d6c41b9846088c1ad9634d0',103 'shared': True104 }105 }106 create_props = {'name': 'test_policy',107 'description': 'a policy for test',108 'shared': True,109 'tenant_id': 'd66c74c01d6c41b9846088c1ad9634d0'}110 self.neutronclient.create_qos_policy.return_value = policy111 self.my_qos_policy.handle_create()112 self.assertEqual('9c1eb3fe-7bba-479d-bd43-1d497e53c384',113 self.my_qos_policy.resource_id)114 self.neutronclient.create_qos_policy.assert_called_once_with(115 {'policy': create_props}116 )117 def test_qos_policy_handle_delete(self):118 policy_id = '477e8273-60a7-4c41-b683-fdb0bc7cd151'119 self.my_qos_policy.resource_id = policy_id120 self.neutronclient.delete_qos_policy.return_value = None121 self.assertIsNone(self.my_qos_policy.handle_delete())122 self.neutronclient.delete_qos_policy.assert_called_once_with(123 self.my_qos_policy.resource_id)124 def test_qos_policy_handle_delete_not_found(self):125 policy_id = '477e8273-60a7-4c41-b683-fdb0bc7cd151'126 self.my_qos_policy.resource_id = policy_id127 not_found = self.neutronclient.NotFound128 self.neutronclient.delete_qos_policy.side_effect = not_found129 self.assertIsNone(self.my_qos_policy.handle_delete())130 self.neutronclient.delete_qos_policy.assert_called_once_with(131 self.my_qos_policy.resource_id)132 def test_qos_policy_handle_delete_resource_id_is_none(self):133 self.my_qos_policy.resource_id = None134 self.assertIsNone(self.my_qos_policy.handle_delete())135 self.assertEqual(0, self.neutronclient.delete_qos_policy.call_count)136 def test_qos_policy_handle_update(self):137 policy_id = '477e8273-60a7-4c41-b683-fdb0bc7cd151'138 self.my_qos_policy.resource_id = policy_id139 props = {140 'name': 'test_policy',141 'description': 'test',142 'shared': False143 }144 prop_dict = props.copy()145 update_snippet = rsrc_defn.ResourceDefinition(146 self.my_qos_policy.name,147 self.my_qos_policy.type(),148 props)149 # with name150 self.my_qos_policy.handle_update(json_snippet=update_snippet,151 tmpl_diff={},152 prop_diff=props)153 # without name154 props['name'] = None155 self.my_qos_policy.handle_update(json_snippet=update_snippet,156 tmpl_diff={},157 prop_diff=props)158 self.assertEqual(2, self.neutronclient.update_qos_policy.call_count)159 self.neutronclient.update_qos_policy.assert_called_with(160 policy_id, {'policy': prop_dict})161 def test_qos_policy_get_attr(self):162 self.my_qos_policy.resource_id = 'test policy'163 policy = {164 'policy': {165 'name': 'test_policy',166 'description': 'a policy for test',167 'id': '9c1eb3fe-7bba-479d-bd43-1d497e53c384',168 'rules': [],169 'tenant_id': 'd66c74c01d6c41b9846088c1ad9634d0',170 'shared': True171 }172 }173 self.neutronclient.show_qos_policy.return_value = policy174 self.assertEqual([], self.my_qos_policy.FnGetAtt('rules'))175 self.assertEqual(policy['policy'],176 self.my_qos_policy.FnGetAtt('show'))177 self.neutronclient.show_qos_policy.assert_has_calls(178 [mock.call(self.my_qos_policy.resource_id)] * 2)179class NeutronQoSBandwidthLimitRuleTest(common.HeatTestCase):180 def setUp(self):181 super(NeutronQoSBandwidthLimitRuleTest, self).setUp()182 self.ctx = utils.dummy_context()183 tpl = template_format.parse(bandwidth_limit_rule_template)184 self.stack = stack.Stack(185 self.ctx,186 'neutron_bandwidth_limit_rule_test',187 template.Template(tpl)188 )189 self.neutronclient = mock.MagicMock()190 self.patchobject(neutron.NeutronClientPlugin, 'has_extension',191 return_value=True)192 self.bandwidth_limit_rule = self.stack['my_bandwidth_limit_rule']193 self.bandwidth_limit_rule.client = mock.MagicMock(194 return_value=self.neutronclient)195 self.find_mock = self.patchobject(196 neutron.neutronV20,197 'find_resourceid_by_name_or_id')198 self.policy_id = '477e8273-60a7-4c41-b683-fdb0bc7cd151'199 self.find_mock.return_value = self.policy_id200 def test_rule_handle_create(self):201 rule = {202 'bandwidth_limit_rule': {203 'id': 'cf0eab12-ef8b-4a62-98d0-70576583c17a',204 'max_kbps': 1000,205 'max_burst_kbps': 1000,206 'direction': 'egress',207 'tenant_id': 'd66c74c01d6c41b9846088c1ad9634d0'208 }209 }210 create_props = {'max_kbps': 1000,211 'max_burst_kbps': 1000,212 'direction': 'egress',213 'tenant_id': 'd66c74c01d6c41b9846088c1ad9634d0'}214 self.neutronclient.create_bandwidth_limit_rule.return_value = rule215 self.bandwidth_limit_rule.handle_create()216 self.assertEqual('cf0eab12-ef8b-4a62-98d0-70576583c17a',217 self.bandwidth_limit_rule.resource_id)218 self.neutronclient.create_bandwidth_limit_rule.assert_called_once_with(219 self.policy_id,220 {'bandwidth_limit_rule': create_props})221 def test_rule_handle_delete(self):222 rule_id = 'cf0eab12-ef8b-4a62-98d0-70576583c17a'223 self.bandwidth_limit_rule.resource_id = rule_id224 self.neutronclient.delete_bandwidth_limit_rule.return_value = None225 self.assertIsNone(self.bandwidth_limit_rule.handle_delete())226 self.neutronclient.delete_bandwidth_limit_rule.assert_called_once_with(227 rule_id, self.policy_id)228 def test_rule_handle_delete_not_found(self):229 rule_id = 'cf0eab12-ef8b-4a62-98d0-70576583c17a'230 self.bandwidth_limit_rule.resource_id = rule_id231 not_found = self.neutronclient.NotFound232 self.neutronclient.delete_bandwidth_limit_rule.side_effect = not_found233 self.assertIsNone(self.bandwidth_limit_rule.handle_delete())234 self.neutronclient.delete_bandwidth_limit_rule.assert_called_once_with(235 rule_id, self.policy_id)236 def test_rule_handle_delete_resource_id_is_none(self):237 self.bandwidth_limit_rule.resource_id = None238 self.assertIsNone(self.bandwidth_limit_rule.handle_delete())239 self.assertEqual(0,240 self.neutronclient.bandwidth_limit_rule.call_count)241 def test_rule_handle_update(self):242 rule_id = 'cf0eab12-ef8b-4a62-98d0-70576583c17a'243 self.bandwidth_limit_rule.resource_id = rule_id244 prop_diff = {245 'max_kbps': 500,246 'max_burst_kbps': 400247 }248 self.bandwidth_limit_rule.handle_update(249 json_snippet={},250 tmpl_diff={},251 prop_diff=prop_diff.copy())252 self.neutronclient.update_bandwidth_limit_rule.assert_called_once_with(253 rule_id,254 self.policy_id,255 {'bandwidth_limit_rule': prop_diff})256 def test_rule_get_attr(self):257 self.bandwidth_limit_rule.resource_id = 'test rule'258 rule = {259 'bandwidth_limit_rule': {260 'id': 'cf0eab12-ef8b-4a62-98d0-70576583c17a',261 'max_kbps': 1000,262 'max_burst_kbps': 1000,263 'direction': 'egress',264 'tenant_id': 'd66c74c01d6c41b9846088c1ad9634d0'265 }266 }267 self.neutronclient.show_bandwidth_limit_rule.return_value = rule268 self.assertEqual(rule['bandwidth_limit_rule'],269 self.bandwidth_limit_rule.FnGetAtt('show'))270 self.neutronclient.show_bandwidth_limit_rule.assert_called_once_with(271 self.bandwidth_limit_rule.resource_id, self.policy_id)272class NeutronQoSDscpMarkingRuleTest(common.HeatTestCase):273 def setUp(self):274 super(NeutronQoSDscpMarkingRuleTest, self).setUp()275 self.ctx = utils.dummy_context()276 tpl = template_format.parse(dscp_marking_rule_template)277 self.stack = stack.Stack(278 self.ctx,279 'neutron_dscp_marking_rule_test',280 template.Template(tpl)281 )282 self.neutronclient = mock.MagicMock()283 self.patchobject(neutron.NeutronClientPlugin, 'has_extension',284 return_value=True)285 self.dscp_marking_rule = self.stack['my_dscp_marking_rule']286 self.dscp_marking_rule.client = mock.MagicMock(287 return_value=self.neutronclient)288 self.find_mock = self.patchobject(289 neutron.neutronV20,290 'find_resourceid_by_name_or_id')291 self.policy_id = '477e8273-60a7-4c41-b683-fdb0bc7cd151'292 self.find_mock.return_value = self.policy_id293 def test_rule_handle_create(self):294 rule = {295 'dscp_marking_rule': {296 'id': 'cf0eab12-ef8b-4a62-98d0-70576583c17a',297 'dscp_mark': 16,298 'tenant_id': 'd66c74c01d6c41b9846088c1ad9634d0'299 }300 }301 create_props = {'dscp_mark': 16,302 'tenant_id': 'd66c74c01d6c41b9846088c1ad9634d0'}303 self.neutronclient.create_dscp_marking_rule.return_value = rule304 self.dscp_marking_rule.handle_create()305 self.assertEqual('cf0eab12-ef8b-4a62-98d0-70576583c17a',306 self.dscp_marking_rule.resource_id)307 self.neutronclient.create_dscp_marking_rule.assert_called_once_with(308 self.policy_id,309 {'dscp_marking_rule': create_props})310 def test_rule_handle_delete(self):311 rule_id = 'cf0eab12-ef8b-4a62-98d0-70576583c17a'312 self.dscp_marking_rule.resource_id = rule_id313 self.neutronclient.delete_dscp_marking_rule.return_value = None314 self.assertIsNone(self.dscp_marking_rule.handle_delete())315 self.neutronclient.delete_dscp_marking_rule.assert_called_once_with(316 rule_id, self.policy_id)317 def test_rule_handle_delete_not_found(self):318 rule_id = 'cf0eab12-ef8b-4a62-98d0-70576583c17a'319 self.dscp_marking_rule.resource_id = rule_id320 not_found = self.neutronclient.NotFound321 self.neutronclient.delete_dscp_marking_rule.side_effect = not_found322 self.assertIsNone(self.dscp_marking_rule.handle_delete())323 self.neutronclient.delete_dscp_marking_rule.assert_called_once_with(324 rule_id, self.policy_id)325 def test_rule_handle_delete_resource_id_is_none(self):326 self.dscp_marking_rule.resource_id = None327 self.assertIsNone(self.dscp_marking_rule.handle_delete())328 self.assertEqual(0,329 self.neutronclient.dscp_marking_rule.call_count)330 def test_rule_handle_update(self):331 rule_id = 'cf0eab12-ef8b-4a62-98d0-70576583c17a'332 self.dscp_marking_rule.resource_id = rule_id333 prop_diff = {334 'dscp_mark': 8335 }336 self.dscp_marking_rule.handle_update(337 json_snippet={},338 tmpl_diff={},339 prop_diff=prop_diff)340 self.neutronclient.update_dscp_marking_rule.assert_called_once_with(341 rule_id,342 self.policy_id,343 {'dscp_marking_rule': prop_diff})344 def test_rule_get_attr(self):345 self.dscp_marking_rule.resource_id = 'test rule'346 rule = {347 'dscp_marking_rule': {348 'id': 'cf0eab12-ef8b-4a62-98d0-70576583c17a',349 'dscp_mark': 8,350 'tenant_id': 'd66c74c01d6c41b9846088c1ad9634d0'351 }352 }353 self.neutronclient.show_dscp_marking_rule.return_value = rule354 self.assertEqual(rule['dscp_marking_rule'],355 self.dscp_marking_rule.FnGetAtt('show'))356 self.neutronclient.show_dscp_marking_rule.assert_called_once_with(357 self.dscp_marking_rule.resource_id, self.policy_id)358class NeutronQoSMinimumBandwidthRuleTest(common.HeatTestCase):359 def setUp(self):360 super(NeutronQoSMinimumBandwidthRuleTest, self).setUp()361 self.ctx = utils.dummy_context()362 tpl = template_format.parse(minimum_bandwidth_rule_template)363 self.stack = stack.Stack(364 self.ctx,365 'neutron_minimum_bandwidth_rule_test',366 template.Template(tpl)367 )368 self.neutronclient = mock.MagicMock()369 self.patchobject(neutron.NeutronClientPlugin, 'has_extension',370 return_value=True)371 self.minimum_bandwidth_rule = self.stack['my_minimum_bandwidth_rule']372 self.minimum_bandwidth_rule.client = mock.MagicMock(373 return_value=self.neutronclient)374 self.find_mock = self.patchobject(375 neutron.neutronV20,376 'find_resourceid_by_name_or_id')377 self.policy_id = '477e8273-60a7-4c41-b683-fdb0bc7cd151'378 self.find_mock.return_value = self.policy_id379 def test_rule_handle_create(self):380 rule = {381 'minimum_bandwidth_rule': {382 'id': 'cf0eab12-ef8b-4a62-98d0-70576583c17a',383 'min_kbps': 1000,384 'direction': 'egress',385 'tenant_id': 'd66c74c01d6c41b9846088c1ad9634d0'386 }387 }388 create_props = {'min_kbps': 1000,389 'direction': 'egress',390 'tenant_id': 'd66c74c01d6c41b9846088c1ad9634d0'}391 self.neutronclient.create_minimum_bandwidth_rule.return_value = rule392 self.minimum_bandwidth_rule.handle_create()393 self.assertEqual('cf0eab12-ef8b-4a62-98d0-70576583c17a',394 self.minimum_bandwidth_rule.resource_id)395 self.neutronclient.create_minimum_bandwidth_rule.\396 assert_called_once_with(397 self.policy_id,398 {'minimum_bandwidth_rule': create_props})399 def test_rule_handle_delete(self):400 rule_id = 'cf0eab12-ef8b-4a62-98d0-70576583c17a'401 self.minimum_bandwidth_rule.resource_id = rule_id402 self.neutronclient.delete_minimum_bandwidth_rule.return_value = None403 self.assertIsNone(self.minimum_bandwidth_rule.handle_delete())404 self.neutronclient.delete_minimum_bandwidth_rule.\405 assert_called_once_with(rule_id, self.policy_id)406 def test_rule_handle_delete_not_found(self):407 rule_id = 'cf0eab12-ef8b-4a62-98d0-70576583c17a'408 self.minimum_bandwidth_rule.resource_id = rule_id409 not_found = self.neutronclient.NotFound410 self.neutronclient.delete_minimum_bandwidth_rule.side_effect =\411 not_found412 self.assertIsNone(self.minimum_bandwidth_rule.handle_delete())413 self.neutronclient.delete_minimum_bandwidth_rule.\414 assert_called_once_with(rule_id, self.policy_id)415 def test_rule_handle_delete_resource_id_is_none(self):416 self.minimum_bandwidth_rule.resource_id = None417 self.assertIsNone(self.minimum_bandwidth_rule.handle_delete())418 self.assertEqual(0,419 self.neutronclient.minimum_bandwidth_rule.call_count)420 def test_rule_handle_update(self):421 rule_id = 'cf0eab12-ef8b-4a62-98d0-70576583c17a'422 self.minimum_bandwidth_rule.resource_id = rule_id423 prop_diff = {424 'min_kbps': 500425 }426 self.minimum_bandwidth_rule.handle_update(427 json_snippet={},428 tmpl_diff={},429 prop_diff=prop_diff.copy())430 self.neutronclient.update_minimum_bandwidth_rule.\431 assert_called_once_with(432 rule_id,433 self.policy_id,434 {'minimum_bandwidth_rule': prop_diff})435 def test_rule_get_attr(self):436 self.minimum_bandwidth_rule.resource_id = 'test rule'437 rule = {438 'minimum_bandwidth_rule': {439 'id': 'cf0eab12-ef8b-4a62-98d0-70576583c17a',440 'min_kbps': 1000,441 'direction': 'egress',442 'tenant_id': 'd66c74c01d6c41b9846088c1ad9634d0'443 }444 }445 self.neutronclient.show_minimum_bandwidth_rule.return_value = rule446 self.assertEqual(rule['minimum_bandwidth_rule'],447 self.minimum_bandwidth_rule.FnGetAtt('show'))448 self.neutronclient.show_minimum_bandwidth_rule.assert_called_once_with(449 self.minimum_bandwidth_rule.resource_id, self.policy_id)450class NeutronQoSMinimumPacketRateRuleTest(common.HeatTestCase):451 def setUp(self):452 super(NeutronQoSMinimumPacketRateRuleTest, self).setUp()453 self.ctx = utils.dummy_context()454 tpl = template_format.parse(minimum_packet_rate_rule_template)455 self.stack = stack.Stack(456 self.ctx,457 'neutron_minimum_packet_rate_rule_test',458 template.Template(tpl)459 )460 self.neutronclient = mock.MagicMock()461 self.patchobject(neutron.NeutronClientPlugin, 'has_extension',462 return_value=True)463 self.minimum_packet_rate_rule = self.stack[464 'my_minimum_packet_rate_rule']465 self.minimum_packet_rate_rule.client = mock.MagicMock(466 return_value=self.neutronclient)467 self.find_mock = self.patchobject(468 neutron.neutronV20,469 'find_resourceid_by_name_or_id')470 self.policy_id = '477e8273-60a7-4c41-b683-fdb0bc7cd151'471 self.find_mock.return_value = self.policy_id472 def test_rule_handle_create(self):473 rule = {474 'minimum_packet_rate_rule': {475 'id': 'cf0eab12-ef8b-4a62-98d0-70576583c17a',476 'min_kpps': 1000,477 'direction': 'any',478 'tenant_id': 'd66c74c01d6c41b9846088c1ad9634d0'479 }480 }481 create_props = {'min_kpps': 1000,482 'direction': 'any',483 'tenant_id': 'd66c74c01d6c41b9846088c1ad9634d0'}484 self.neutronclient.create_minimum_packet_rate_rule.return_value = rule485 self.minimum_packet_rate_rule.handle_create()486 self.assertEqual('cf0eab12-ef8b-4a62-98d0-70576583c17a',487 self.minimum_packet_rate_rule.resource_id)488 self.neutronclient.create_minimum_packet_rate_rule.\489 assert_called_once_with(490 self.policy_id,491 {'minimum_packet_rate_rule': create_props})492 def test_rule_handle_delete(self):493 rule_id = 'cf0eab12-ef8b-4a62-98d0-70576583c17a'494 self.minimum_packet_rate_rule.resource_id = rule_id495 self.neutronclient.delete_minimum_packet_rate_rule.return_value = None496 self.assertIsNone(self.minimum_packet_rate_rule.handle_delete())497 self.neutronclient.delete_minimum_packet_rate_rule.\498 assert_called_once_with(rule_id, self.policy_id)499 def test_rule_handle_delete_not_found(self):500 rule_id = 'cf0eab12-ef8b-4a62-98d0-70576583c17a'501 self.minimum_packet_rate_rule.resource_id = rule_id502 not_found = self.neutronclient.NotFound503 self.neutronclient.delete_minimum_packet_rate_rule.side_effect =\504 not_found505 self.assertIsNone(self.minimum_packet_rate_rule.handle_delete())506 self.neutronclient.delete_minimum_packet_rate_rule.\507 assert_called_once_with(rule_id, self.policy_id)508 def test_rule_handle_delete_resource_id_is_none(self):509 self.minimum_packet_rate_rule.resource_id = None510 self.assertIsNone(self.minimum_packet_rate_rule.handle_delete())511 self.assertEqual(512 0,513 self.neutronclient.minimum_packet_rate_rule.call_count)514 def test_rule_handle_update(self):515 rule_id = 'cf0eab12-ef8b-4a62-98d0-70576583c17a'516 self.minimum_packet_rate_rule.resource_id = rule_id517 prop_diff = {518 'min_kpps': 500519 }520 self.minimum_packet_rate_rule.handle_update(521 json_snippet={},522 tmpl_diff={},523 prop_diff=prop_diff.copy())524 self.neutronclient.update_minimum_packet_rate_rule.\525 assert_called_once_with(526 rule_id,527 self.policy_id,528 {'minimum_packet_rate_rule': prop_diff})529 def test_rule_get_attr(self):530 self.minimum_packet_rate_rule.resource_id = 'test rule'531 rule = {532 'minimum_packet_rate_rule': {533 'id': 'cf0eab12-ef8b-4a62-98d0-70576583c17a',534 'min_kpps': 1000,535 'direction': 'egress',536 'tenant_id': 'd66c74c01d6c41b9846088c1ad9634d0'537 }538 }539 self.neutronclient.show_minimum_packet_rate_rule.return_value = rule540 self.assertEqual(rule['minimum_packet_rate_rule'],541 self.minimum_packet_rate_rule.FnGetAtt('show'))542 self.neutronclient.show_minimum_packet_rate_rule.\543 assert_called_once_with(544 self.minimum_packet_rate_rule.resource_id,...
test_qos_minimum_packet_rate_rules_client.py
Source:test_qos_minimum_packet_rate_rules_client.py
...96 def test_show_minimum_packet_rate_rule_with_str_body(self):97 self._test_show_minimum_packet_rate_rule()98 def test_show_minimum_packet_rate_rule_with_bytes_body(self):99 self._test_show_minimum_packet_rate_rule(bytes_body=True)100 def test_delete_minimum_packet_rate_rule(self):101 self.check_service_client_function(102 self.qos_min_pps_client.delete_minimum_packet_rate_rule,103 "tempest.lib.common.rest_client.RestClient.delete",104 {},105 status=204,106 qos_policy_id=self.FAKE_QOS_POLICY_ID,107 rule_id=self.FAKE_MIN_PPS_RULE_ID)108 def test_list_minimum_packet_rate_rule_with_str_body(self):109 self._test_list_minimum_packet_rate_rules()110 def test_list_minimum_packet_rate_rule_with_bytes_body(self):...
qos_minimum_packet_rate_rules_client.py
Source:qos_minimum_packet_rate_rules_client.py
...40 """41 uri = '/qos/policies/%s/minimum_packet_rate_rules/%s' % (42 qos_policy_id, rule_id)43 return self.show_resource(uri, **fields)44 def delete_minimum_packet_rate_rule(self, qos_policy_id, rule_id):45 """Deletes a minimum packet rate rule for a QoS policy.46 For full list of available parameters, please refer to the official47 API reference:48 https://docs.openstack.org/api-ref/network/v2/index.html#delete-minimum-packet-rate-rule49 """50 uri = '/qos/policies/%s/minimum_packet_rate_rules/%s' % (51 qos_policy_id, rule_id)52 return self.delete_resource(uri)53 def list_minimum_packet_rate_rules(self, qos_policy_id, **filters):54 """Lists all minimum packet rate rules for a QoS policy.55 For full list of available parameters, please refer to the official56 API reference:57 https://docs.openstack.org/api-ref/network/v2/index.html#list-minimum-packet-rate-rules-for-qos-policy58 """...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!