How to use show_minimum_packet_rate_rule method in tempest

Best Python code snippet using tempest_python

test_qos.py

Source:test_qos.py Github

copy

Full Screen

...1245 policy['id'],1246 {qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,1247 qos_consts.MIN_KPPS: 1138})1248 # Test 'show rule'1249 retrieved_rule = self.min_pps_client.show_minimum_packet_rate_rule(1250 policy['id'], rule['id'])[self.RULE_NAME]1251 self.assertEqual(rule['id'], retrieved_rule['id'])1252 self.assertEqual(1138, retrieved_rule[qos_consts.MIN_KPPS])1253 self.assertEqual(n_constants.EGRESS_DIRECTION,1254 retrieved_rule[qos_consts.DIRECTION])1255 # Test 'list rules'1256 rules = self.min_pps_client.list_minimum_packet_rate_rules(1257 policy['id'])1258 rules = rules[self.RULES_NAME]1259 rules_ids = [r['id'] for r in rules]1260 self.assertIn(rule['id'], rules_ids)1261 # Test 'show policy'1262 retrieved_policy = self.admin_client.show_qos_policy(policy['id'])1263 policy_rules = retrieved_policy['policy']['rules']1264 self.assertEqual(1, len(policy_rules))1265 self.assertEqual(rule['id'], policy_rules[0]['id'])1266 self.assertEqual('minimum_packet_rate',1267 policy_rules[0]['type'])1268 @decorators.idempotent_id('6b656b57-d2bf-47f9-89a9-1baad1bd5418')1269 def test_rule_create_fail_for_missing_min_kpps(self):1270 policy = self.create_qos_policy(name=self.policy_name,1271 description='test policy',1272 shared=False)1273 self.assertRaises(exceptions.BadRequest,1274 self._create_qos_min_pps_rule,1275 policy['id'],1276 {qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION})1277 @decorators.idempotent_id('f41213e5-2ab8-4916-b106-38d2cac5e18c')1278 def test_rule_create_fail_for_the_same_type(self):1279 policy = self.create_qos_policy(name=self.policy_name,1280 description='test policy',1281 shared=False)1282 self._create_qos_min_pps_rule(policy['id'],1283 {qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,1284 qos_consts.MIN_KPPS: 200})1285 self.assertRaises(exceptions.Conflict,1286 self._create_qos_min_pps_rule,1287 policy['id'],1288 {qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,1289 qos_consts.MIN_KPPS: 201})1290 @decorators.idempotent_id('ceb8e41e-3d72-11ec-a446-d7faae6daec2')1291 def test_rule_create_any_direction_when_egress_direction_exists(self):1292 policy = self.create_qos_policy(name=self.policy_name,1293 description='test policy',1294 shared=False)1295 self._create_qos_min_pps_rule(policy['id'],1296 {qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,1297 qos_consts.MIN_KPPS: 200})1298 self.assertRaises(exceptions.Conflict,1299 self._create_qos_min_pps_rule,1300 policy['id'],1301 {qos_consts.DIRECTION: n_constants.ANY_DIRECTION,1302 qos_consts.MIN_KPPS: 201})1303 @decorators.idempotent_id('a147a71e-3d7b-11ec-8097-278b1afd5fa2')1304 def test_rule_create_egress_direction_when_any_direction_exists(self):1305 policy = self.create_qos_policy(name=self.policy_name,1306 description='test policy',1307 shared=False)1308 self._create_qos_min_pps_rule(policy['id'],1309 {qos_consts.DIRECTION: n_constants.ANY_DIRECTION,1310 qos_consts.MIN_KPPS: 200})1311 self.assertRaises(exceptions.Conflict,1312 self._create_qos_min_pps_rule,1313 policy['id'],1314 {qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,1315 qos_consts.MIN_KPPS: 201})1316 @decorators.idempotent_id('522ed09a-1d7f-4c1b-9195-61f19caf916f')1317 def test_rule_update(self):1318 policy = self.create_qos_policy(name=self.policy_name,1319 description='test policy',1320 shared=False)1321 rule = self._create_qos_min_pps_rule(1322 policy['id'],1323 {qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,1324 qos_consts.MIN_KPPS: 300})1325 self.min_pps_client.update_minimum_packet_rate_rule(1326 policy['id'], rule['id'],1327 **{qos_consts.MIN_KPPS: 350,1328 qos_consts.DIRECTION: n_constants.ANY_DIRECTION})1329 retrieved_rule = self.min_pps_client.show_minimum_packet_rate_rule(1330 policy['id'], rule['id'])[self.RULE_NAME]1331 self.assertEqual(350, retrieved_rule[qos_consts.MIN_KPPS])1332 self.assertEqual(n_constants.ANY_DIRECTION,1333 retrieved_rule[qos_consts.DIRECTION])1334 @decorators.idempotent_id('a020e186-3d60-11ec-88ca-d7f5eec22764')1335 def test_rule_update_direction_conflict(self):1336 policy = self.create_qos_policy(name=self.policy_name,1337 description='test policy',1338 shared=False)1339 rule1 = self._create_qos_min_pps_rule(1340 policy['id'],1341 {qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,1342 qos_consts.MIN_KPPS: 300})1343 rule2 = self._create_qos_min_pps_rule(1344 policy['id'],1345 {qos_consts.DIRECTION: n_constants.INGRESS_DIRECTION,1346 qos_consts.MIN_KPPS: 300})1347 retrieved_rule1 = self.min_pps_client.show_minimum_packet_rate_rule(1348 policy['id'], rule1['id'])[self.RULE_NAME]1349 self.assertEqual(n_constants.EGRESS_DIRECTION,1350 retrieved_rule1[qos_consts.DIRECTION])1351 retrieved_rule2 = self.min_pps_client.show_minimum_packet_rate_rule(1352 policy['id'], rule2['id'])[self.RULE_NAME]1353 self.assertEqual(n_constants.INGRESS_DIRECTION,1354 retrieved_rule2[qos_consts.DIRECTION])1355 self.assertRaises(exceptions.Conflict,1356 self.min_pps_client.update_minimum_packet_rate_rule,1357 policy['id'], rule2['id'],1358 **{qos_consts.DIRECTION: n_constants.ANY_DIRECTION})1359 @decorators.idempotent_id('c49018b6-d358-49a1-a94b-d53224165045')1360 def test_rule_delete(self):1361 policy = self.create_qos_policy(name=self.policy_name,1362 description='test policy',1363 shared=False)1364 rule = self._create_qos_min_pps_rule(1365 policy['id'],1366 {qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,1367 qos_consts.MIN_KPPS: 200})1368 retrieved_rule = self.min_pps_client.show_minimum_packet_rate_rule(1369 policy['id'], rule['id'])[self.RULE_NAME]1370 self.assertEqual(rule['id'], retrieved_rule['id'])1371 self.min_pps_client.delete_minimum_packet_rate_rule(policy['id'],1372 rule['id'])1373 self.assertRaises(exceptions.NotFound,1374 self.min_pps_client.show_minimum_packet_rate_rule,1375 policy['id'], rule['id'])1376 @decorators.idempotent_id('1a6b6128-3d3e-11ec-bf49-57b326d417c0')1377 def test_rule_create_forbidden_for_regular_tenants(self):1378 self.assertRaises(1379 exceptions.Forbidden,1380 self.min_pps_client_primary.create_minimum_packet_rate_rule,1381 'policy', **{qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,1382 qos_consts.MIN_KPPS: 300})...

Full Screen

Full Screen

test_qos_minimum_packet_rate_rules_client.py

Source:test_qos_minimum_packet_rate_rules_client.py Github

copy

Full Screen

...55 bytes_body,56 200,57 qos_policy_id=self.FAKE_QOS_POLICY_ID58 )59 def _test_show_minimum_packet_rate_rule(self, bytes_body=False):60 self.check_service_client_function(61 self.qos_min_pps_client.show_minimum_packet_rate_rule,62 "tempest.lib.common.rest_client.RestClient.get",63 self.FAKE_MIN_PPS_RULE_RESPONSE,64 bytes_body,65 200,66 qos_policy_id=self.FAKE_QOS_POLICY_ID,67 rule_id=self.FAKE_MIN_PPS_RULE_ID68 )69 def _test_update_qos_polcy(self, bytes_body=False):70 update_kwargs = {71 "min_kpps": "20000"72 }73 resp_body = {74 "minimum_packet_rate_rule": copy.deepcopy(75 self.FAKE_MIN_PPS_RULE_RESPONSE['minimum_packet_rate_rule']76 )77 }78 resp_body["minimum_packet_rate_rule"].update(update_kwargs)79 self.check_service_client_function(80 self.qos_min_pps_client.update_minimum_packet_rate_rule,81 "tempest.lib.common.rest_client.RestClient.put",82 resp_body,83 bytes_body,84 200,85 qos_policy_id=self.FAKE_QOS_POLICY_ID,86 rule_id=self.FAKE_MIN_PPS_RULE_ID,87 **update_kwargs)88 def test_create_minimum_packet_rate_rule_with_str_body(self):89 self._test_create_minimum_packet_rate_rule()90 def test_create_minimum_packet_rate_rule_with_bytes_body(self):91 self._test_create_minimum_packet_rate_rule(bytes_body=True)92 def test_update_minimum_packet_rate_rule_with_str_body(self):93 self._test_update_qos_polcy()94 def test_update_minimum_packet_rate_rule_with_bytes_body(self):95 self._test_update_qos_polcy(bytes_body=True)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):...

Full Screen

Full Screen

qos_minimum_packet_rate_rules_client.py

Source:qos_minimum_packet_rate_rules_client.py Github

copy

Full Screen

...31 uri = '/qos/policies/%s/minimum_packet_rate_rules/%s' % (32 qos_policy_id, rule_id)33 post_data = {'minimum_packet_rate_rule': kwargs}34 return self.update_resource(uri, post_data)35 def show_minimum_packet_rate_rule(self, qos_policy_id, rule_id, **fields):36 """Show details of a minimum packet rate rule.37 For full list of available parameters, please refer to the official38 API reference:39 https://docs.openstack.org/api-ref/network/v2/index.html#show-minimum-packet-rate-rule-details40 """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 """...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful