Best Python code snippet using tempest_python
test_network.py
Source:test_network.py
...137 self.assertTrue(138 policy.enforce(self.context,139 'get_network:provider:segmentation_id',140 self.alt_target))141 def test_update_network(self):142 self.assertTrue(143 policy.enforce(self.context, 'update_network', self.target))144 self.assertTrue(145 policy.enforce(self.context, 'update_network', self.alt_target))146 def test_update_network_segments(self):147 self.assertTrue(148 policy.enforce(self.context,149 'update_network:segments', self.target))150 self.assertTrue(151 policy.enforce(self.context,152 'update_network:segments', self.alt_target))153 def test_update_network_shared(self):154 self.assertTrue(155 policy.enforce(self.context, 'update_network:shared', self.target))156 self.assertTrue(157 policy.enforce(self.context,158 'update_network:shared', self.alt_target))159 def test_update_network_provider_network_type(self):160 self.assertTrue(161 policy.enforce(self.context,162 'update_network:provider:network_type',163 self.target))164 self.assertTrue(165 policy.enforce(self.context,166 'update_network:provider:network_type',167 self.alt_target))168 def test_update_network_provider_physical_network(self):169 self.assertTrue(170 policy.enforce(self.context,171 'update_network:provider:physical_network',172 self.target))173 self.assertTrue(174 policy.enforce(self.context,175 'update_network:provider:physical_network',176 self.alt_target))177 def test_update_network_provider_segmentation_id(self):178 self.assertTrue(179 policy.enforce(self.context,180 'update_network:provider:segmentation_id',181 self.target))182 self.assertTrue(183 policy.enforce(self.context,184 'update_network:provider:segmentation_id',185 self.alt_target))186 def test_update_network_external(self):187 self.assertTrue(188 policy.enforce(self.context,189 'update_network:router:external', self.target))190 self.assertTrue(191 policy.enforce(self.context,192 'update_network:router:external', self.alt_target))193 def test_update_network_default(self):194 self.assertTrue(195 policy.enforce(self.context,196 'update_network:is_default', self.target))197 self.assertTrue(198 policy.enforce(self.context,199 'update_network:is_default', self.alt_target))200 def test_update_network_port_security_enabled(self):201 self.assertTrue(202 policy.enforce(self.context,203 'update_network:port_security_enabled',204 self.target))205 self.assertTrue(206 policy.enforce(self.context,207 'update_network:port_security_enabled',208 self.alt_target))209 def test_delete_network(self):210 self.assertTrue(211 policy.enforce(self.context, 'delete_network', self.target))212 self.assertTrue(213 policy.enforce(self.context, 'delete_network', self.alt_target))214class SystemMemberTests(SystemAdminTests):215 def setUp(self):216 super(SystemMemberTests, self).setUp()217 self.context = self.system_member_ctx218 def test_create_network(self):219 self.assertRaises(220 base_policy.PolicyNotAuthorized,221 policy.enforce, self.context, 'create_network', self.target)222 self.assertRaises(223 base_policy.PolicyNotAuthorized,224 policy.enforce, self.context, 'create_network', self.alt_target)225 def test_create_network_shared(self):226 self.assertRaises(227 base_policy.PolicyNotAuthorized,228 policy.enforce,229 self.context, 'create_network:shared', self.target)230 self.assertRaises(231 base_policy.PolicyNotAuthorized,232 policy.enforce,233 self.context, 'create_network:shared', self.alt_target)234 def test_create_network_external(self):235 self.assertRaises(236 base_policy.PolicyNotAuthorized,237 policy.enforce,238 self.context, 'create_network:router:external', self.target)239 self.assertRaises(240 base_policy.PolicyNotAuthorized,241 policy.enforce,242 self.context, 'create_network:router:external', self.alt_target)243 def test_create_network_default(self):244 self.assertRaises(245 base_policy.PolicyNotAuthorized,246 policy.enforce,247 self.context, 'create_network:is_default', self.target)248 self.assertRaises(249 base_policy.PolicyNotAuthorized,250 policy.enforce,251 self.context, 'create_network:is_default', self.alt_target)252 def test_create_network_port_security_enabled(self):253 self.assertRaises(254 base_policy.PolicyNotAuthorized,255 policy.enforce,256 self.context, 'create_network:port_security_enabled',257 self.target)258 self.assertRaises(259 base_policy.PolicyNotAuthorized,260 policy.enforce,261 self.context, 'create_network:port_security_enabled',262 self.alt_target)263 def test_create_network_segments(self):264 self.assertRaises(265 base_policy.PolicyNotAuthorized,266 policy.enforce,267 self.context, 'create_network:segments', self.target)268 self.assertRaises(269 base_policy.PolicyNotAuthorized,270 policy.enforce,271 self.context, 'create_network:segments', self.alt_target)272 def test_create_network_provider_network_type(self):273 self.assertRaises(274 base_policy.PolicyNotAuthorized,275 policy.enforce,276 self.context, 'create_network:provider:network_type', self.target)277 self.assertRaises(278 base_policy.PolicyNotAuthorized,279 policy.enforce,280 self.context, 'create_network:provider:network_type',281 self.alt_target)282 def test_create_network_provider_physical_network(self):283 self.assertRaises(284 base_policy.PolicyNotAuthorized,285 policy.enforce,286 self.context, 'create_network:provider:physical_network',287 self.target)288 self.assertRaises(289 base_policy.PolicyNotAuthorized,290 policy.enforce,291 self.context, 'create_network:provider:physical_network',292 self.alt_target)293 def test_create_network_provider_segmentation_id(self):294 self.assertRaises(295 base_policy.PolicyNotAuthorized,296 policy.enforce,297 self.context, 'create_network:provider:segmentation_id',298 self.target)299 self.assertRaises(300 base_policy.PolicyNotAuthorized,301 policy.enforce,302 self.context, 'create_network:provider:segmentation_id',303 self.alt_target)304 def test_update_network(self):305 self.assertRaises(306 base_policy.PolicyNotAuthorized,307 policy.enforce, self.context, 'update_network', self.target)308 self.assertRaises(309 base_policy.PolicyNotAuthorized,310 policy.enforce, self.context, 'update_network', self.alt_target)311 def test_update_network_segments(self):312 self.assertRaises(313 base_policy.PolicyNotAuthorized,314 policy.enforce,315 self.context, 'update_network:segments', self.target)316 self.assertRaises(317 base_policy.PolicyNotAuthorized,318 policy.enforce,319 self.context, 'update_network:segments', self.alt_target)320 def test_update_network_shared(self):321 self.assertRaises(322 base_policy.PolicyNotAuthorized,323 policy.enforce,324 self.context, 'update_network:shared', self.target)325 self.assertRaises(326 base_policy.PolicyNotAuthorized,327 policy.enforce,328 self.context, 'update_network:shared', self.alt_target)329 def test_update_network_provider_network_type(self):330 self.assertRaises(331 base_policy.PolicyNotAuthorized,332 policy.enforce,333 self.context, 'update_network:provider:network_type', self.target)334 self.assertRaises(335 base_policy.PolicyNotAuthorized,336 policy.enforce,337 self.context, 'update_network:provider:network_type',338 self.alt_target)339 def test_update_network_provider_physical_network(self):340 self.assertRaises(341 base_policy.PolicyNotAuthorized,342 policy.enforce,343 self.context, 'update_network:provider:physical_network',344 self.target)345 self.assertRaises(346 base_policy.PolicyNotAuthorized,347 policy.enforce,348 self.context, 'update_network:provider:physical_network',349 self.alt_target)350 def test_update_network_provider_segmentation_id(self):351 self.assertRaises(352 base_policy.PolicyNotAuthorized,353 policy.enforce,354 self.context, 'update_network:provider:segmentation_id',355 self.target)356 self.assertRaises(357 base_policy.PolicyNotAuthorized,358 policy.enforce,359 self.context, 'update_network:provider:segmentation_id',360 self.alt_target)361 def test_update_network_external(self):362 self.assertRaises(363 base_policy.PolicyNotAuthorized,364 policy.enforce,365 self.context, 'update_network:router:external', self.target)366 self.assertRaises(367 base_policy.PolicyNotAuthorized,368 policy.enforce,369 self.context, 'update_network:router:external', self.alt_target)370 def test_update_network_default(self):371 self.assertRaises(372 base_policy.PolicyNotAuthorized,373 policy.enforce,374 self.context, 'update_network:is_default', self.target)375 self.assertRaises(376 base_policy.PolicyNotAuthorized,377 policy.enforce,378 self.context, 'update_network:is_default', self.alt_target)379 def test_update_network_port_security_enabled(self):380 self.assertRaises(381 base_policy.PolicyNotAuthorized,382 policy.enforce,383 self.context, 'update_network:port_security_enabled',384 self.target)385 self.assertRaises(386 base_policy.PolicyNotAuthorized,387 policy.enforce,388 self.context, 'update_network:port_security_enabled',389 self.alt_target)390 def test_delete_network(self):391 self.assertRaises(392 base_policy.PolicyNotAuthorized,393 policy.enforce, self.context, 'delete_network', self.target)394 self.assertRaises(395 base_policy.PolicyNotAuthorized,396 policy.enforce, self.context, 'delete_network', self.alt_target)397class SystemReaderTests(SystemMemberTests):398 def setUp(self):399 super(SystemReaderTests, self).setUp()400 self.context = self.system_reader_ctx401class ProjectAdminTests(NetworkAPITestCase):402 def setUp(self):403 super(ProjectAdminTests, self).setUp()404 self.context = self.project_admin_ctx405 def test_create_network(self):406 self.assertTrue(407 policy.enforce(self.context, 'create_network', self.target))408 self.assertRaises(409 base_policy.PolicyNotAuthorized,410 policy.enforce,411 self.context, 'create_network', self.alt_target)412 def test_create_network_shared(self):413 self.assertRaises(414 base_policy.PolicyNotAuthorized,415 policy.enforce,416 self.context, 'create_network:shared', self.target)417 self.assertRaises(418 base_policy.PolicyNotAuthorized,419 policy.enforce,420 self.context, 'create_network:shared', self.alt_target)421 def test_create_network_external(self):422 self.assertRaises(423 base_policy.PolicyNotAuthorized,424 policy.enforce,425 self.context, 'create_network:router:external', self.target)426 self.assertRaises(427 base_policy.PolicyNotAuthorized,428 policy.enforce,429 self.context, 'create_network:router:external', self.alt_target)430 def test_create_network_default(self):431 self.assertRaises(432 base_policy.PolicyNotAuthorized,433 policy.enforce,434 self.context, 'create_network:is_default', self.target)435 self.assertRaises(436 base_policy.PolicyNotAuthorized,437 policy.enforce,438 self.context, 'create_network:is_default', self.alt_target)439 def test_create_network_port_security_enabled(self):440 self.assertTrue(441 policy.enforce(self.context,442 'create_network:port_security_enabled',443 self.target))444 self.assertRaises(445 base_policy.PolicyNotAuthorized,446 policy.enforce,447 self.context, 'create_network:port_security_enabled',448 self.alt_target)449 def test_create_network_segments(self):450 self.assertRaises(451 base_policy.PolicyNotAuthorized,452 policy.enforce,453 self.context, 'create_network:segments', self.target)454 self.assertRaises(455 base_policy.PolicyNotAuthorized,456 policy.enforce,457 self.context, 'create_network:segments', self.alt_target)458 def test_create_network_provider_network_type(self):459 self.assertRaises(460 base_policy.PolicyNotAuthorized,461 policy.enforce,462 self.context, 'create_network:provider:network_type', self.target)463 self.assertRaises(464 base_policy.PolicyNotAuthorized,465 policy.enforce,466 self.context, 'create_network:provider:network_type',467 self.alt_target)468 def test_create_network_provider_physical_network(self):469 self.assertRaises(470 base_policy.PolicyNotAuthorized,471 policy.enforce,472 self.context, 'create_network:provider:physical_network',473 self.target)474 self.assertRaises(475 base_policy.PolicyNotAuthorized,476 policy.enforce,477 self.context, 'create_network:provider:physical_network',478 self.alt_target)479 def test_create_network_provider_segmentation_id(self):480 self.assertRaises(481 base_policy.PolicyNotAuthorized,482 policy.enforce,483 self.context, 'create_network:provider:segmentation_id',484 self.target)485 self.assertRaises(486 base_policy.PolicyNotAuthorized,487 policy.enforce,488 self.context, 'create_network:provider:segmentation_id',489 self.alt_target)490 def test_get_network(self):491 self.assertTrue(492 policy.enforce(self.context, 'get_network', self.target))493 self.assertRaises(494 base_policy.PolicyNotAuthorized,495 policy.enforce,496 self.context, 'get_network', self.alt_target)497 def test_get_network_external(self):498 self.assertTrue(499 policy.enforce(self.context,500 'get_network:router:external', self.target))501 self.assertRaises(502 base_policy.PolicyNotAuthorized,503 policy.enforce,504 self.context, 'get_network:router:external', self.alt_target)505 def test_get_network_segments(self):506 self.assertRaises(507 base_policy.PolicyNotAuthorized,508 policy.enforce,509 self.context, 'get_network:segments', self.target)510 self.assertRaises(511 base_policy.PolicyNotAuthorized,512 policy.enforce,513 self.context, 'get_network:segments', self.alt_target)514 def test_get_network_provider_network_type(self):515 self.assertRaises(516 base_policy.PolicyNotAuthorized,517 policy.enforce,518 self.context, 'get_network:provider:network_type', self.target)519 self.assertRaises(520 base_policy.PolicyNotAuthorized,521 policy.enforce,522 self.context, 'get_network:provider:network_type', self.alt_target)523 def test_get_network_provider_physical_network(self):524 self.assertRaises(525 base_policy.PolicyNotAuthorized,526 policy.enforce,527 self.context, 'get_network:provider:physical_network',528 self.target)529 self.assertRaises(530 base_policy.PolicyNotAuthorized,531 policy.enforce,532 self.context, 'get_network:provider:physical_network',533 self.alt_target)534 def test_get_network_provider_segmentation_id(self):535 self.assertRaises(536 base_policy.PolicyNotAuthorized,537 policy.enforce,538 self.context, 'get_network:provider:segmentation_id',539 self.target)540 self.assertRaises(541 base_policy.PolicyNotAuthorized,542 policy.enforce,543 self.context, 'get_network:provider:segmentation_id',544 self.alt_target)545 def test_update_network(self):546 self.assertTrue(547 policy.enforce(self.context, 'update_network', self.target))548 self.assertRaises(549 base_policy.PolicyNotAuthorized,550 policy.enforce,551 self.context, 'update_network', self.alt_target)552 def test_update_network_segments(self):553 self.assertRaises(554 base_policy.PolicyNotAuthorized,555 policy.enforce,556 self.context, 'update_network:segments', self.target)557 self.assertRaises(558 base_policy.PolicyNotAuthorized,559 policy.enforce,560 self.context, 'update_network:segments', self.alt_target)561 def test_update_network_shared(self):562 self.assertRaises(563 base_policy.PolicyNotAuthorized,564 policy.enforce,565 self.context, 'update_network:shared', self.target)566 self.assertRaises(567 base_policy.PolicyNotAuthorized,568 policy.enforce,569 self.context, 'update_network:shared', self.alt_target)570 def test_update_network_provider_network_type(self):571 self.assertRaises(572 base_policy.PolicyNotAuthorized,573 policy.enforce,574 self.context, 'update_network:provider:network_type', self.target)575 self.assertRaises(576 base_policy.PolicyNotAuthorized,577 policy.enforce,578 self.context, 'update_network:provider:network_type',579 self.alt_target)580 def test_update_network_provider_physical_network(self):581 self.assertRaises(582 base_policy.PolicyNotAuthorized,583 policy.enforce,584 self.context, 'update_network:provider:physical_network',585 self.target)586 self.assertRaises(587 base_policy.PolicyNotAuthorized,588 policy.enforce,589 self.context, 'update_network:provider:physical_network',590 self.alt_target)591 def test_update_network_provider_segmentation_id(self):592 self.assertRaises(593 base_policy.PolicyNotAuthorized,594 policy.enforce,595 self.context, 'update_network:provider:segmentation_id',596 self.target)597 self.assertRaises(598 base_policy.PolicyNotAuthorized,599 policy.enforce,600 self.context, 'update_network:provider:segmentation_id',601 self.alt_target)602 def test_update_network_external(self):603 self.assertRaises(604 base_policy.PolicyNotAuthorized,605 policy.enforce,606 self.context, 'update_network:router:external', self.target)607 self.assertRaises(608 base_policy.PolicyNotAuthorized,609 policy.enforce,610 self.context, 'update_network:router:external', self.alt_target)611 def test_update_network_default(self):612 self.assertRaises(613 base_policy.PolicyNotAuthorized,614 policy.enforce,615 self.context, 'update_network:is_default', self.target)616 self.assertRaises(617 base_policy.PolicyNotAuthorized,618 policy.enforce,619 self.context, 'update_network:is_default', self.alt_target)620 def test_update_network_port_security_enabled(self):621 self.assertTrue(622 policy.enforce(self.context,623 'update_network:port_security_enabled',624 self.target))625 self.assertRaises(626 base_policy.PolicyNotAuthorized,627 policy.enforce,628 self.context, 'update_network:port_security_enabled',629 self.alt_target)630 def test_delete_network(self):631 self.assertTrue(632 policy.enforce(self.context, 'delete_network', self.target))633 self.assertRaises(634 base_policy.PolicyNotAuthorized,635 policy.enforce,636 self.context, 'delete_network', self.alt_target)637class ProjectMemberTests(ProjectAdminTests):638 def setUp(self):639 super(ProjectMemberTests, self).setUp()640 self.context = self.project_member_ctx641class ProjectReaderTests(ProjectMemberTests):642 def setUp(self):643 super(ProjectReaderTests, self).setUp()644 self.context = self.project_reader_ctx645 def test_create_network(self):646 self.assertRaises(647 base_policy.PolicyNotAuthorized,648 policy.enforce, self.context, 'create_network', self.target)649 self.assertRaises(650 base_policy.PolicyNotAuthorized,651 policy.enforce, self.context, 'create_network', self.alt_target)652 def test_create_network_shared(self):653 self.assertRaises(654 base_policy.PolicyNotAuthorized,655 policy.enforce,656 self.context, 'create_network:shared', self.target)657 self.assertRaises(658 base_policy.PolicyNotAuthorized,659 policy.enforce,660 self.context, 'create_network:shared', self.alt_target)661 def test_create_network_external(self):662 self.assertRaises(663 base_policy.PolicyNotAuthorized,664 policy.enforce,665 self.context, 'create_network:router:external', self.target)666 self.assertRaises(667 base_policy.PolicyNotAuthorized,668 policy.enforce,669 self.context, 'create_network:router:external', self.alt_target)670 def test_create_network_default(self):671 self.assertRaises(672 base_policy.PolicyNotAuthorized,673 policy.enforce,674 self.context, 'create_network:is_default', self.target)675 self.assertRaises(676 base_policy.PolicyNotAuthorized,677 policy.enforce,678 self.context, 'create_network:is_default', self.alt_target)679 def test_create_network_port_security_enabled(self):680 self.assertRaises(681 base_policy.PolicyNotAuthorized,682 policy.enforce,683 self.context, 'create_network:port_security_enabled',684 self.target)685 self.assertRaises(686 base_policy.PolicyNotAuthorized,687 policy.enforce,688 self.context, 'create_network:port_security_enabled',689 self.alt_target)690 def test_create_network_segments(self):691 self.assertRaises(692 base_policy.PolicyNotAuthorized,693 policy.enforce,694 self.context, 'create_network:segments', self.target)695 self.assertRaises(696 base_policy.PolicyNotAuthorized,697 policy.enforce,698 self.context, 'create_network:segments', self.alt_target)699 def test_create_network_provider_network_type(self):700 self.assertRaises(701 base_policy.PolicyNotAuthorized,702 policy.enforce,703 self.context, 'create_network:provider:network_type', self.target)704 self.assertRaises(705 base_policy.PolicyNotAuthorized,706 policy.enforce,707 self.context, 'create_network:provider:network_type',708 self.alt_target)709 def test_create_network_provider_physical_network(self):710 self.assertRaises(711 base_policy.PolicyNotAuthorized,712 policy.enforce,713 self.context, 'create_network:provider:physical_network',714 self.target)715 self.assertRaises(716 base_policy.PolicyNotAuthorized,717 policy.enforce,718 self.context, 'create_network:provider:physical_network',719 self.alt_target)720 def test_create_network_provider_segmentation_id(self):721 self.assertRaises(722 base_policy.PolicyNotAuthorized,723 policy.enforce,724 self.context, 'create_network:provider:segmentation_id',725 self.target)726 self.assertRaises(727 base_policy.PolicyNotAuthorized,728 policy.enforce,729 self.context, 'create_network:provider:segmentation_id',730 self.alt_target)731 def test_get_network_segments(self):732 self.assertRaises(733 base_policy.PolicyNotAuthorized,734 policy.enforce,735 self.context, 'get_network:segments', self.target)736 self.assertRaises(737 base_policy.PolicyNotAuthorized,738 policy.enforce,739 self.context, 'get_network:segments', self.alt_target)740 def test_get_network_provider_network_type(self):741 self.assertRaises(742 base_policy.PolicyNotAuthorized,743 policy.enforce,744 self.context, 'get_network:provider:network_type', self.target)745 self.assertRaises(746 base_policy.PolicyNotAuthorized,747 policy.enforce,748 self.context, 'get_network:provider:network_type', self.alt_target)749 def test_get_network_provider_physical_network(self):750 self.assertRaises(751 base_policy.PolicyNotAuthorized,752 policy.enforce,753 self.context, 'get_network:provider:physical_network',754 self.target)755 self.assertRaises(756 base_policy.PolicyNotAuthorized,757 policy.enforce,758 self.context, 'get_network:provider:physical_network',759 self.alt_target)760 def test_get_network_provider_segmentation_id(self):761 self.assertRaises(762 base_policy.PolicyNotAuthorized,763 policy.enforce,764 self.context, 'get_network:provider:segmentation_id',765 self.target)766 self.assertRaises(767 base_policy.PolicyNotAuthorized,768 policy.enforce,769 self.context, 'get_network:provider:segmentation_id',770 self.alt_target)771 def test_update_network(self):772 self.assertRaises(773 base_policy.PolicyNotAuthorized,774 policy.enforce, self.context, 'update_network', self.target)775 self.assertRaises(776 base_policy.PolicyNotAuthorized,777 policy.enforce, self.context, 'update_network', self.alt_target)778 def test_update_network_segments(self):779 self.assertRaises(780 base_policy.PolicyNotAuthorized,781 policy.enforce,782 self.context, 'update_network:segments', self.target)783 self.assertRaises(784 base_policy.PolicyNotAuthorized,785 policy.enforce,...
network.py
Source:network.py
1# Licensed under the Apache License, Version 2.0 (the "License"); you may2# not use this file except in compliance with the License. You may obtain3# a copy of the License at4#5# http://www.apache.org/licenses/LICENSE-2.06#7# Unless required by applicable law or agreed to in writing, software8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the10# License for the specific language governing permissions and limitations11# under the License.12from oslo_policy import policy13from neutron.conf.policies import base14COLLECTION_PATH = '/networks'15RESOURCE_PATH = '/networks/{id}'16ACTION_POST = [17 {'method': 'POST', 'path': COLLECTION_PATH},18]19ACTION_PUT = [20 {'method': 'PUT', 'path': RESOURCE_PATH},21]22ACTION_DELETE = [23 {'method': 'DELETE', 'path': RESOURCE_PATH},24]25ACTION_GET = [26 {'method': 'GET', 'path': COLLECTION_PATH},27 {'method': 'GET', 'path': RESOURCE_PATH},28]29rules = [30 policy.RuleDefault(31 'external',32 'field:networks:router:external=True',33 'Definition of an external network'),34 policy.DocumentedRuleDefault(35 'create_network',36 base.RULE_ANY,37 'Create a network',38 ACTION_POST39 ),40 policy.DocumentedRuleDefault(41 'create_network:shared',42 base.RULE_ADMIN_ONLY,43 'Create a shared network',44 ACTION_POST45 ),46 policy.DocumentedRuleDefault(47 'create_network:router:external',48 base.RULE_ADMIN_ONLY,49 'Create an external network',50 ACTION_POST51 ),52 policy.DocumentedRuleDefault(53 'create_network:is_default',54 base.RULE_ADMIN_ONLY,55 'Specify ``is_default`` attribute when creating a network',56 ACTION_POST57 ),58 policy.DocumentedRuleDefault(59 'create_network:port_security_enabled',60 base.RULE_ANY,61 'Specify ``port_security_enabled`` attribute when creating a network',62 ACTION_POST63 ),64 policy.DocumentedRuleDefault(65 'create_network:segments',66 base.RULE_ADMIN_ONLY,67 'Specify ``segments`` attribute when creating a network',68 ACTION_POST69 ),70 policy.DocumentedRuleDefault(71 'create_network:provider:network_type',72 base.RULE_ADMIN_ONLY,73 'Specify ``provider:network_type`` when creating a network',74 ACTION_POST75 ),76 policy.DocumentedRuleDefault(77 'create_network:provider:physical_network',78 base.RULE_ADMIN_ONLY,79 'Specify ``provider:physical_network`` when creating a network',80 ACTION_POST81 ),82 policy.DocumentedRuleDefault(83 'create_network:provider:segmentation_id',84 base.RULE_ADMIN_ONLY,85 'Specify ``provider:segmentation_id`` when creating a network',86 ACTION_POST87 ),88 policy.DocumentedRuleDefault(89 'get_network',90 base.policy_or(base.RULE_ADMIN_OR_OWNER,91 'rule:shared',92 'rule:external',93 base.RULE_ADVSVC),94 'Get a network',95 ACTION_GET96 ),97 policy.DocumentedRuleDefault(98 'get_network:router:external',99 base.RULE_ANY,100 'Get ``router:external`` attribute of a network',101 ACTION_GET102 ),103 policy.DocumentedRuleDefault(104 'get_network:segments',105 base.RULE_ADMIN_ONLY,106 'Get ``segments`` attribute of a network',107 ACTION_GET108 ),109 policy.DocumentedRuleDefault(110 'get_network:provider:network_type',111 base.RULE_ADMIN_ONLY,112 'Get ``provider:network_type`` attribute of a network',113 ACTION_GET114 ),115 policy.DocumentedRuleDefault(116 'get_network:provider:physical_network',117 base.RULE_ADMIN_ONLY,118 'Get ``provider:physical_network`` attribute of a network',119 ACTION_GET120 ),121 policy.DocumentedRuleDefault(122 'get_network:provider:segmentation_id',123 base.RULE_ADMIN_ONLY,124 'Get ``provider:segmentation_id`` attribute of a network',125 ACTION_GET126 ),127 policy.DocumentedRuleDefault(128 'update_network',129 base.RULE_ADMIN_OR_OWNER,130 'Update a network',131 ACTION_PUT132 ),133 policy.DocumentedRuleDefault(134 'update_network:segments',135 base.RULE_ADMIN_ONLY,136 'Update ``segments`` attribute of a network',137 ACTION_PUT138 ),139 policy.DocumentedRuleDefault(140 'update_network:shared',141 base.RULE_ADMIN_ONLY,142 'Update ``shared`` attribute of a network',143 ACTION_PUT144 ),145 policy.DocumentedRuleDefault(146 'update_network:provider:network_type',147 base.RULE_ADMIN_ONLY,148 'Update ``provider:network_type`` attribute of a network',149 ACTION_PUT150 ),151 policy.DocumentedRuleDefault(152 'update_network:provider:physical_network',153 base.RULE_ADMIN_ONLY,154 'Update ``provider:physical_network`` attribute of a network',155 ACTION_PUT156 ),157 policy.DocumentedRuleDefault(158 'update_network:provider:segmentation_id',159 base.RULE_ADMIN_ONLY,160 'Update ``provider:segmentation_id`` attribute of a network',161 ACTION_PUT162 ),163 policy.DocumentedRuleDefault(164 'update_network:router:external',165 base.RULE_ADMIN_ONLY,166 'Update ``router:external`` attribute of a network',167 ACTION_PUT168 ),169 policy.DocumentedRuleDefault(170 'update_network:is_default',171 base.RULE_ADMIN_ONLY,172 'Update ``is_default`` attribute of a network',173 ACTION_PUT174 ),175 policy.DocumentedRuleDefault(176 'update_network:port_security_enabled',177 base.RULE_ADMIN_OR_OWNER,178 'Update ``port_security_enabled`` attribute of a network',179 ACTION_PUT180 ),181 policy.DocumentedRuleDefault(182 'delete_network',183 base.RULE_ADMIN_OR_OWNER,184 'Delete a network',185 ACTION_DELETE186 ),187]188def list_rules():...
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!!