/usr/lib/python2.7/dist-packages/tempest_lib/tests/services/compute/test_servers_client.py is in python-tempest-lib 0.14.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 | # Copyright 2015 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import copy
from tempest_lib.services.compute import servers_client
from tempest_lib.tests import fake_auth_provider
from tempest_lib.tests.services.compute import base
class TestServersClient(base.BaseComputeServiceTest):
FAKE_SERVERS = {'servers': [{
"id": "616fb98f-46ca-475e-917e-2563e5a8cd19",
"links": [
{
"href": "http://os.co/v2/616fb98f-46ca-475e-917e-2563e5a8cd19",
"rel": "self"
},
{
"href": "http://os.co/616fb98f-46ca-475e-917e-2563e5a8cd19",
"rel": "bookmark"
}
],
"name": u"new\u1234-server-test"}]
}
FAKE_SERVER_DIAGNOSTICS = {
"cpu0_time": 17300000000,
"memory": 524288,
"vda_errors": -1,
"vda_read": 262144,
"vda_read_req": 112,
"vda_write": 5778432,
"vda_write_req": 488,
"vnet1_rx": 2070139,
"vnet1_rx_drop": 0,
"vnet1_rx_errors": 0,
"vnet1_rx_packets": 26701,
"vnet1_tx": 140208,
"vnet1_tx_drop": 0,
"vnet1_tx_errors": 0,
"vnet1_tx_packets": 662
}
FAKE_SERVER_GET = {'server': {
"accessIPv4": "",
"accessIPv6": "",
"addresses": {
"private": [
{
"addr": "192.168.0.3",
"version": 4
}
]
},
"created": "2012-08-20T21:11:09Z",
"flavor": {
"id": "1",
"links": [
{
"href": "http://os.com/openstack/flavors/1",
"rel": "bookmark"
}
]
},
"hostId": "65201c14a29663e06d0748e561207d998b343e1d164bfa0aafa9c45d",
"id": "893c7791-f1df-4c3d-8383-3caae9656c62",
"image": {
"id": "70a599e0-31e7-49b7-b260-868f441e862b",
"links": [
{
"href": "http://imgs/70a599e0-31e7-49b7-b260-868f441e862b",
"rel": "bookmark"
}
]
},
"links": [
{
"href": "http://v2/srvs/893c7791-f1df-4c3d-8383-3caae9656c62",
"rel": "self"
},
{
"href": "http://srvs/893c7791-f1df-4c3d-8383-3caae9656c62",
"rel": "bookmark"
}
],
"metadata": {
u"My Server N\u1234me": u"Apa\u1234che1"
},
"name": u"new\u1234-server-test",
"progress": 0,
"status": "ACTIVE",
"tenant_id": "openstack",
"updated": "2012-08-20T21:11:09Z",
"user_id": "fake"}
}
FAKE_SERVER_POST = {"server": {
"id": "616fb98f-46ca-475e-917e-2563e5a8cd19",
"adminPass": "fake-admin-pass",
"security_groups": [
'fake-security-group-1',
'fake-security-group-2'
],
"links": [
{
"href": "http://os.co/v2/616fb98f-46ca-475e-917e-2563e5a8cd19",
"rel": "self"
},
{
"href": "http://os.co/616fb98f-46ca-475e-917e-2563e5a8cd19",
"rel": "bookmark"
}
],
"OS-DCF:diskConfig": "fake-disk-config"}
}
FAKE_ADDRESS = {"addresses": {
"private": [
{
"addr": "192.168.0.3",
"version": 4
}
]}
}
FAKE_COMMON_VOLUME = {
"id": "a6b0875b-6b5d-4a5a-81eb-0c3aa62e5fdb",
"device": "fake-device",
"volumeId": "a6b0875b-46ca-475e-917e-0c3aa62e5fdb",
"serverId": "616fb98f-46ca-475e-917e-2563e5a8cd19"
}
FAKE_VIRTUAL_INTERFACES = {
"id": "a6b0875b-46ca-475e-917e-0c3aa62e5fdb",
"mac_address": "00:25:90:5b:f8:c3",
"OS-EXT-VIF-NET:net_id": "fake-os-net-id"
}
FAKE_INSTANCE_ACTIONS = {
"action": "fake-action",
"request_id": "16fb98f-46ca-475e-917e-2563e5a8cd19",
"user_id": "16fb98f-46ca-475e-917e-2563e5a8cd12",
"project_id": "16fb98f-46ca-475e-917e-2563e5a8cd34",
"start_time": "09MAR2015 11:15",
"message": "fake-msg",
"instance_uuid": "16fb98f-46ca-475e-917e-2563e5a8cd12"
}
FAKE_VNC_CONSOLE = {
"type": "fake-type",
"url": "http://os.co/v2/616fb98f-46ca-475e-917e-2563e5a8cd19"
}
FAKE_INSTANCE_ACTION_EVENTS = {
"event": "fake-event",
"start_time": "09MAR2015 11:15",
"finish_time": "09MAR2015 11:15",
"result": "fake-result",
"traceback": "fake-trace-back"
}
FAKE_INSTANCE_WITH_EVENTS = copy.deepcopy(FAKE_INSTANCE_ACTIONS)
FAKE_INSTANCE_WITH_EVENTS['events'] = [FAKE_INSTANCE_ACTION_EVENTS]
FAKE_REBUILD_SERVER = copy.deepcopy(FAKE_SERVER_GET)
FAKE_REBUILD_SERVER['server']['adminPass'] = 'fake-admin-pass'
server_id = FAKE_SERVER_GET['server']['id']
network_id = 'a6b0875b-6b5d-4a5a-81eb-0c3aa62e5fdb'
def setUp(self):
super(TestServersClient, self).setUp()
fake_auth = fake_auth_provider.FakeAuthProvider()
self.client = servers_client.ServersClient(
fake_auth, 'compute', 'regionOne')
def test_list_servers_with_str_body(self):
self._test_list_servers()
def test_list_servers_with_bytes_body(self):
self._test_list_servers(bytes_body=True)
def _test_list_servers(self, bytes_body=False):
self.check_service_client_function(
self.client.list_servers,
'tempest_lib.common.rest_client.RestClient.get',
self.FAKE_SERVERS,
bytes_body)
def test_show_server_with_str_body(self):
self._test_show_server()
def test_show_server_with_bytes_body(self):
self._test_show_server(bytes_body=True)
def _test_show_server(self, bytes_body=False):
self.check_service_client_function(
self.client.show_server,
'tempest_lib.common.rest_client.RestClient.get',
self.FAKE_SERVER_GET,
bytes_body,
server_id=self.server_id
)
def test_delete_server(self, bytes_body=False):
self.check_service_client_function(
self.client.delete_server,
'tempest_lib.common.rest_client.RestClient.delete',
{},
status=204,
server_id=self.server_id
)
def test_create_server_with_str_body(self):
self._test_create_server()
def test_create_server_with_bytes_body(self):
self._test_create_server(True)
def _test_create_server(self, bytes_body=False):
self.check_service_client_function(
self.client.create_server,
'tempest_lib.common.rest_client.RestClient.post',
self.FAKE_SERVER_POST,
bytes_body,
status=202,
name='fake-name',
imageRef='fake-image-ref',
flavorRef='fake-flavor-ref'
)
def test_list_addresses_with_str_body(self):
self._test_list_addresses()
def test_list_addresses_with_bytes_body(self):
self._test_list_addresses(True)
def _test_list_addresses(self, bytes_body=False):
self.check_service_client_function(
self.client.list_addresses,
'tempest_lib.common.rest_client.RestClient.get',
self.FAKE_ADDRESS,
bytes_body,
server_id=self.server_id
)
def test_list_addresses_by_network_with_str_body(self):
self._test_list_addresses_by_network()
def test_list_addresses_by_network_with_bytes_body(self):
self._test_list_addresses_by_network(True)
def _test_list_addresses_by_network(self, bytes_body=False):
self.check_service_client_function(
self.client.list_addresses_by_network,
'tempest_lib.common.rest_client.RestClient.get',
self.FAKE_ADDRESS['addresses'],
server_id=self.server_id,
network_id=self.network_id
)
def test_action_with_str_body(self):
self._test_action()
def test_action_with_bytes_body(self):
self._test_action(True)
def _test_action(self, bytes_body=False):
self.check_service_client_function(
self.client.action,
'tempest_lib.common.rest_client.RestClient.post',
{},
server_id=self.server_id,
action_name='fake-action-name',
schema={'status_code': 200}
)
def test_create_backup_with_str_body(self):
self._test_create_backup()
def test_create_backup_with_bytes_body(self):
self._test_create_backup(True)
def _test_create_backup(self, bytes_body=False):
self.check_service_client_function(
self.client.create_backup,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id,
backup_type='fake-backup',
rotation='fake-rotation',
name='fake-name'
)
def test_change_password_with_str_body(self):
self._test_change_password()
def test_change_password_with_bytes_body(self):
self._test_change_password(True)
def _test_change_password(self, bytes_body=False):
self.check_service_client_function(
self.client.change_password,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id,
adminPass='fake-admin-pass'
)
def test_show_password_with_str_body(self):
self._test_show_password()
def test_show_password_with_bytes_body(self):
self._test_show_password(True)
def _test_show_password(self, bytes_body=False):
self.check_service_client_function(
self.client.show_password,
'tempest_lib.common.rest_client.RestClient.get',
{'password': 'fake-password'},
server_id=self.server_id
)
def test_delete_password_with_str_body(self):
self._test_delete_password()
def test_delete_password_with_bytes_body(self):
self._test_delete_password(True)
def _test_delete_password(self, bytes_body=False):
self.check_service_client_function(
self.client.delete_password,
'tempest_lib.common.rest_client.RestClient.delete',
{},
status=204,
server_id=self.server_id
)
def test_reboot_server_with_str_body(self):
self._test_reboot_server()
def test_reboot_server_with_bytes_body(self):
self._test_reboot_server(True)
def _test_reboot_server(self, bytes_body=False):
self.check_service_client_function(
self.client.reboot_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id,
type='fake-reboot-type'
)
def test_rebuild_server_with_str_body(self):
self._test_rebuild_server()
def test_rebuild_server_with_bytes_body(self):
self._test_rebuild_server(True)
def _test_rebuild_server(self, bytes_body=False):
self.check_service_client_function(
self.client.rebuild_server,
'tempest_lib.common.rest_client.RestClient.post',
self.FAKE_REBUILD_SERVER,
status=202,
server_id=self.server_id,
image_ref='fake-image-ref'
)
def test_resize_server_with_str_body(self):
self._test_resize_server()
def test_resize_server_with_bytes_body(self):
self._test_resize_server(True)
def _test_resize_server(self, bytes_body=False):
self.check_service_client_function(
self.client.resize_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id,
flavor_ref='fake-flavor-ref'
)
def test_confirm_resize_server_with_str_body(self):
self._test_confirm_resize_server()
def test_confirm_resize_server_with_bytes_body(self):
self._test_confirm_resize_server(True)
def _test_confirm_resize_server(self, bytes_body=False):
self.check_service_client_function(
self.client.confirm_resize_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=204,
server_id=self.server_id
)
def test_revert_resize_server_with_str_body(self):
self._test_revert_resize()
def test_revert_resize_server_with_bytes_body(self):
self._test_revert_resize(True)
def _test_revert_resize(self, bytes_body=False):
self.check_service_client_function(
self.client.revert_resize_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_list_server_metadata_with_str_body(self):
self._test_list_server_metadata()
def test_list_server_metadata_with_bytes_body(self):
self._test_list_server_metadata()
def _test_list_server_metadata(self, bytes_body=False):
self.check_service_client_function(
self.client.list_server_metadata,
'tempest_lib.common.rest_client.RestClient.get',
{'metadata': {'fake-key': 'fake-meta-data'}},
server_id=self.server_id
)
def test_set_server_metadata_with_str_body(self):
self._test_set_server_metadata()
def test_set_server_metadata_with_bytes_body(self):
self._test_set_server_metadata(True)
def _test_set_server_metadata(self, bytes_body=False):
self.check_service_client_function(
self.client.set_server_metadata,
'tempest_lib.common.rest_client.RestClient.put',
{'metadata': {'fake-key': 'fake-meta-data'}},
server_id=self.server_id,
meta='fake-meta'
)
def test_update_server_metadata_with_str_body(self):
self._test_update_server_metadata()
def test_update_server_metadata_with_bytes_body(self):
self._test_update_server_metadata(True)
def _test_update_server_metadata(self, bytes_body=False):
self.check_service_client_function(
self.client.update_server_metadata,
'tempest_lib.common.rest_client.RestClient.post',
{'metadata': {'fake-key': 'fake-meta-data'}},
server_id=self.server_id,
meta='fake-meta'
)
def test_show_server_metadata_item_with_str_body(self):
self._test_show_server_metadata()
def test_show_server_metadata_item_with_bytes_body(self):
self._test_show_server_metadata(True)
def _test_show_server_metadata(self, bytes_body=False):
self.check_service_client_function(
self.client.show_server_metadata_item,
'tempest_lib.common.rest_client.RestClient.get',
{'meta': {'fake-key': 'fake-meta-data'}},
server_id=self.server_id,
key='fake-key'
)
def test_set_server_metadata_item_with_str_body(self):
self._test_set_server_metadata_item()
def test_set_server_metadata_item_with_bytes_body(self):
self._test_set_server_metadata_item(True)
def _test_set_server_metadata_item(self, bytes_body=False):
self.check_service_client_function(
self.client.set_server_metadata_item,
'tempest_lib.common.rest_client.RestClient.put',
{'meta': {'fake-key': 'fake-meta-data'}},
server_id=self.server_id,
key='fake-key',
meta='fake-meta'
)
def test_delete_server_metadata_item_with_str_body(self):
self._test_delete_server_metadata()
def test_delete_server_metadata_item_with_bytes_body(self):
self._test_delete_server_metadata(True)
def _test_delete_server_metadata(self, bytes_body=False):
self.check_service_client_function(
self.client.delete_server_metadata_item,
'tempest_lib.common.rest_client.RestClient.delete',
{},
status=204,
server_id=self.server_id,
key='fake-key'
)
def test_stop_server_with_str_body(self):
self._test_stop_server()
def test_stop_server_with_bytes_body(self):
self._test_stop_server(True)
def _test_stop_server(self, bytes_body=False):
self.check_service_client_function(
self.client.stop_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_start_server_with_str_body(self):
self._test_start_server()
def test_start_server_with_bytes_body(self):
self._test_start_server(True)
def _test_start_server(self, bytes_body=False):
self.check_service_client_function(
self.client.start_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_attach_volume_with_str_body(self):
self._test_attach_volume_server()
def test_attach_volume_with_bytes_body(self):
self._test_attach_volume_server(True)
def _test_attach_volume_server(self, bytes_body=False):
self.check_service_client_function(
self.client.attach_volume,
'tempest_lib.common.rest_client.RestClient.post',
{'volumeAttachment': self.FAKE_COMMON_VOLUME},
server_id=self.server_id
)
def test_detach_volume_with_str_body(self):
self._test_detach_volume_server()
def test_detach_volume_with_bytes_body(self):
self._test_detach_volume_server(True)
def _test_detach_volume_server(self, bytes_body=False):
self.check_service_client_function(
self.client.detach_volume,
'tempest_lib.common.rest_client.RestClient.delete',
{},
status=202,
server_id=self.server_id,
volume_id=self.FAKE_COMMON_VOLUME['volumeId']
)
def test_show_volume_attachment_with_str_body(self):
self._test_show_volume_attachment()
def test_show_volume_attachment_with_bytes_body(self):
self._test_show_volume_attachment(True)
def _test_show_volume_attachment(self, bytes_body=False):
self.check_service_client_function(
self.client.show_volume_attachment,
'tempest_lib.common.rest_client.RestClient.get',
{'volumeAttachment': self.FAKE_COMMON_VOLUME},
server_id=self.server_id,
volume_id=self.FAKE_COMMON_VOLUME['volumeId']
)
def test_list_volume_attachments_with_str_body(self):
self._test_list_volume_attachments()
def test_list_volume_attachments_with_bytes_body(self):
self._test_list_volume_attachments(True)
def _test_list_volume_attachments(self, bytes_body=False):
self.check_service_client_function(
self.client.list_volume_attachments,
'tempest_lib.common.rest_client.RestClient.get',
{'volumeAttachments': [self.FAKE_COMMON_VOLUME]},
server_id=self.server_id
)
def test_add_security_group_with_str_body(self):
self._test_add_security_group()
def test_add_security_group_with_bytes_body(self):
self._test_add_security_group(True)
def _test_add_security_group(self, bytes_body=False):
self.check_service_client_function(
self.client.add_security_group,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id,
name='fake-name'
)
def test_remove_security_group_with_str_body(self):
self._test_remove_security_group()
def test_remove_security_group_with_bytes_body(self):
self._test_remove_security_group(True)
def _test_remove_security_group(self, bytes_body=False):
self.check_service_client_function(
self.client.remove_security_group,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id,
name='fake-name'
)
def test_live_migrate_server_with_str_body(self):
self._test_live_migrate_server()
def test_live_migrate_server_with_bytes_body(self):
self._test_live_migrate_server(True)
def _test_live_migrate_server(self, bytes_body=False):
self.check_service_client_function(
self.client.live_migrate_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_migrate_server_with_str_body(self):
self._test_migrate_server()
def test_migrate_server_with_bytes_body(self):
self._test_migrate_server(True)
def _test_migrate_server(self, bytes_body=False):
self.check_service_client_function(
self.client.migrate_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_lock_server_with_str_body(self):
self._test_lock_server()
def test_lock_server_with_bytes_body(self):
self._test_lock_server(True)
def _test_lock_server(self, bytes_body=False):
self.check_service_client_function(
self.client.lock_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_unlock_server_with_str_body(self):
self._test_unlock_server()
def test_unlock_server_with_bytes_body(self):
self._test_unlock_server(True)
def _test_unlock_server(self, bytes_body=False):
self.check_service_client_function(
self.client.unlock_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_suspend_server_with_str_body(self):
self._test_suspend_server()
def test_suspend_server_with_bytes_body(self):
self._test_suspend_server(True)
def _test_suspend_server(self, bytes_body=False):
self.check_service_client_function(
self.client.suspend_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_resume_server_with_str_body(self):
self._test_resume_server()
def test_resume_server_with_bytes_body(self):
self._test_resume_server(True)
def _test_resume_server(self, bytes_body=False):
self.check_service_client_function(
self.client.resume_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_pause_server_with_str_body(self):
self._test_pause_server()
def test_pause_server_with_bytes_body(self):
self._test_pause_server(True)
def _test_pause_server(self, bytes_body=False):
self.check_service_client_function(
self.client.pause_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_unpause_server_with_str_body(self):
self._test_unpause_server()
def test_unpause_server_with_bytes_body(self):
self._test_unpause_server(True)
def _test_unpause_server(self, bytes_body=False):
self.check_service_client_function(
self.client.unpause_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_reset_state_with_str_body(self):
self._test_reset_state()
def test_reset_state_with_bytes_body(self):
self._test_reset_state(True)
def _test_reset_state(self, bytes_body=False):
self.check_service_client_function(
self.client.reset_state,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id,
state='fake-state'
)
def test_shelve_server_with_str_body(self):
self._test_shelve_server()
def test_shelve_server_with_bytes_body(self):
self._test_shelve_server(True)
def _test_shelve_server(self, bytes_body=False):
self.check_service_client_function(
self.client.shelve_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_unshelve_server_with_str_body(self):
self._test_unshelve_server()
def test_unshelve_server_with_bytes_body(self):
self._test_unshelve_server(True)
def _test_unshelve_server(self, bytes_body=False):
self.check_service_client_function(
self.client.unshelve_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_shelve_offload_server_with_str_body(self):
self._test_shelve_offload_server()
def test_shelve_offload_server_with_bytes_body(self):
self._test_shelve_offload_server(True)
def _test_shelve_offload_server(self, bytes_body=False):
self.check_service_client_function(
self.client.shelve_offload_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_get_console_output_with_str_body(self):
self._test_get_console_output()
def test_get_console_output_with_bytes_body(self):
self._test_get_console_output(True)
def _test_get_console_output(self, bytes_body=False):
self.check_service_client_function(
self.client.get_console_output,
'tempest_lib.common.rest_client.RestClient.post',
{'output': 'fake-output'},
server_id=self.server_id,
length='fake-length'
)
def test_list_virtual_interfaces_with_str_body(self):
self._test_list_virtual_interfaces()
def test_list_virtual_interfaces_with_bytes_body(self):
self._test_list_virtual_interfaces(True)
def _test_list_virtual_interfaces(self, bytes_body=False):
self.check_service_client_function(
self.client.list_virtual_interfaces,
'tempest_lib.common.rest_client.RestClient.get',
{'virtual_interfaces': [self.FAKE_VIRTUAL_INTERFACES]},
server_id=self.server_id
)
def test_rescue_server_with_str_body(self):
self._test_rescue_server()
def test_rescue_server_with_bytes_body(self):
self._test_rescue_server(True)
def _test_rescue_server(self, bytes_body=False):
self.check_service_client_function(
self.client.rescue_server,
'tempest_lib.common.rest_client.RestClient.post',
{'adminPass': 'fake-admin-pass'},
server_id=self.server_id
)
def test_unrescue_server_with_str_body(self):
self._test_unrescue_server()
def test_unrescue_server_with_bytes_body(self):
self._test_unrescue_server(True)
def _test_unrescue_server(self, bytes_body=False):
self.check_service_client_function(
self.client.unrescue_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_show_server_diagnostics_with_str_body(self):
self._test_show_server_diagnostics()
def test_show_server_diagnostics_with_bytes_body(self):
self._test_show_server_diagnostics(True)
def _test_show_server_diagnostics(self, bytes_body=False):
self.check_service_client_function(
self.client.show_server_diagnostics,
'tempest_lib.common.rest_client.RestClient.get',
self.FAKE_SERVER_DIAGNOSTICS,
status=200,
server_id=self.server_id
)
def test_list_instance_actions_with_str_body(self):
self._test_list_instance_actions()
def test_list_instance_actions_with_bytes_body(self):
self._test_list_instance_actions(True)
def _test_list_instance_actions(self, bytes_body=False):
self.check_service_client_function(
self.client.list_instance_actions,
'tempest_lib.common.rest_client.RestClient.get',
{'instanceActions': [self.FAKE_INSTANCE_ACTIONS]},
server_id=self.server_id
)
def test_show_instance_action_with_str_body(self):
self._test_show_instance_action()
def test_show_instance_action_with_bytes_body(self):
self._test_show_instance_action(True)
def _test_show_instance_action(self, bytes_body=False):
self.check_service_client_function(
self.client.show_instance_action,
'tempest_lib.common.rest_client.RestClient.get',
{'instanceAction': self.FAKE_INSTANCE_WITH_EVENTS},
server_id=self.server_id,
request_id='fake-request-id'
)
def test_force_delete_server_with_str_body(self):
self._test_force_delete_server()
def test_force_delete_server_with_bytes_body(self):
self._test_force_delete_server(True)
def _test_force_delete_server(self, bytes_body=False):
self.check_service_client_function(
self.client.force_delete_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_restore_soft_deleted_server_with_str_body(self):
self._test_restore_soft_deleted_server()
def test_restore_soft_deleted_server_with_bytes_body(self):
self._test_restore_soft_deleted_server(True)
def _test_restore_soft_deleted_server(self, bytes_body=False):
self.check_service_client_function(
self.client.restore_soft_deleted_server,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_reset_network_with_str_body(self):
self._test_reset_network()
def test_reset_network_with_bytes_body(self):
self._test_reset_network(True)
def _test_reset_network(self, bytes_body=False):
self.check_service_client_function(
self.client.reset_network,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_inject_network_info_with_str_body(self):
self._test_inject_network_info()
def test_inject_network_info_with_bytes_body(self):
self._test_inject_network_info(True)
def _test_inject_network_info(self, bytes_body=False):
self.check_service_client_function(
self.client.inject_network_info,
'tempest_lib.common.rest_client.RestClient.post',
{},
status=202,
server_id=self.server_id
)
def test_get_vnc_console_with_str_body(self):
self._test_get_vnc_console()
def test_get_vnc_console_with_bytes_body(self):
self._test_get_vnc_console(True)
def _test_get_vnc_console(self, bytes_body=False):
self.check_service_client_function(
self.client.get_vnc_console,
'tempest_lib.common.rest_client.RestClient.post',
{'console': self.FAKE_VNC_CONSOLE},
server_id=self.server_id,
type='fake-console-type'
)
|