Revision 946da8b6
b/snf-tools/synnefo_tools/burnin.py | ||
---|---|---|
54 | 54 |
|
55 | 55 |
from kamaki.clients.compute import ComputeClient |
56 | 56 |
from kamaki.clients.cyclades import CycladesClient |
57 |
from kamaki.clients.image import ImageClient |
|
57 | 58 |
from kamaki.clients import ClientError |
58 | 59 |
|
59 | 60 |
from fabric.api import * |
... | ... | |
72 | 73 |
API = None |
73 | 74 |
TOKEN = None |
74 | 75 |
DEFAULT_API = "https://cyclades.okeanos.grnet.gr/api/v1.1" |
76 |
DEFAULT_PLANKTON = "https://cyclades.okeanos.grnet.gr/plankton" |
|
77 |
DEFAULT_PLANKTON_USER = "images@okeanos.grnet.gr" |
|
75 | 78 |
|
76 | 79 |
# A unique id identifying this test run |
77 | 80 |
TEST_RUN_ID = datetime.datetime.strftime(datetime.datetime.now(), |
... | ... | |
104 | 107 |
"""Initialize kamaki, get (detailed) list of images""" |
105 | 108 |
log.info("Getting simple and detailed list of images") |
106 | 109 |
|
107 |
cls.client = ComputeClient(API, TOKEN)
|
|
108 |
cls.images = cls.client.list_images()
|
|
109 |
cls.dimages = cls.client.list_images(detail=True)
|
|
110 |
cls.plankton = ImageClient(PLANKTON, TOKEN)
|
|
111 |
cls.images = cls.plankton.list_public()
|
|
112 |
cls.dimages = cls.plankton.list_public(detail=True)
|
|
110 | 113 |
|
111 | 114 |
def test_001_list_images(self): |
112 | 115 |
"""Test image list actually returns images""" |
... | ... | |
123 | 126 |
self.assertEqual(names, dnames) |
124 | 127 |
|
125 | 128 |
def test_004_unique_image_names(self): |
126 |
"""Test images have unique names""" |
|
127 |
names = sorted(map(lambda x: x["name"], self.images)) |
|
129 |
"""Test system images have unique names""" |
|
130 |
sys_images = filter(lambda x: x['owner'] == PLANKTON_USER, |
|
131 |
self.dimages) |
|
132 |
names = sorted(map(lambda x: x["name"], sys_images)) |
|
128 | 133 |
self.assertEqual(sorted(list(set(names))), names) |
129 | 134 |
|
130 | 135 |
def test_005_image_metadata(self): |
... | ... | |
512 | 517 |
|
513 | 518 |
def test_005_server_has_ipv6(self): |
514 | 519 |
"""Test active server has a valid IPv6 address""" |
520 |
self._skipIf(NO_IPV6, "--no-ipv6 flag enabled") |
|
515 | 521 |
|
516 | 522 |
log.info("Validate server's IPv6") |
517 | 523 |
|
... | ... | |
534 | 540 |
|
535 | 541 |
def test_007_server_responds_to_ping_IPv6(self): |
536 | 542 |
"""Test server responds to ping on IPv6 address""" |
537 |
|
|
543 |
self._skipIf(NO_IPV6, "--no-ipv6 flag enabled") |
|
538 | 544 |
log.info("Testing if server responds to pings in IPv6") |
539 | 545 |
|
540 | 546 |
server = self.client.get_server_details(self.serverid) |
... | ... | |
593 | 599 |
def test_013_ssh_to_server_IPv6(self): |
594 | 600 |
"""Test SSH to server public IPv6 works, verify hostname""" |
595 | 601 |
self._skipIf(self.is_windows, "only valid for Linux servers") |
602 |
self._skipIf(NO_IPV6, "--no-ipv6 flag enabled") |
|
603 |
|
|
596 | 604 |
server = self.client.get_server_details(self.serverid) |
597 | 605 |
self._insist_on_ssh_hostname(self._get_ipv6(server), |
598 | 606 |
self.username, self.passwd) |
... | ... | |
612 | 620 |
def test_015_rdp_to_server_IPv6(self): |
613 | 621 |
"Test RDP connection to server public IPv6 works""" |
614 | 622 |
self._skipIf(not self.is_windows, "only valid for Windows servers") |
623 |
self._skipIf(NO_IPV6, "--no-ipv6 flag enabled") |
|
624 |
|
|
615 | 625 |
server = self.client.get_server_details(self.serverid) |
616 | 626 |
ipv6 = self._get_ipv6(server) |
617 | 627 |
sock = _get_tcp_connection(socket.AF_INET6, ipv6, 3389) |
... | ... | |
1328 | 1338 |
action="store", type="string", dest="api", |
1329 | 1339 |
help="The API URI to use to reach the Synnefo API", |
1330 | 1340 |
default=DEFAULT_API) |
1341 |
parser.add_option("--plankton", |
|
1342 |
action="store", type="string", dest="plankton", |
|
1343 |
help="The API URI to use to reach the Plankton API", |
|
1344 |
default=DEFAULT_PLANKTON) |
|
1345 |
parser.add_option("--plankton-user", |
|
1346 |
action="store", type="string", dest="plankton_user", |
|
1347 |
help="Owner of system images", |
|
1348 |
default=DEFAULT_PLANKTON_USER) |
|
1331 | 1349 |
parser.add_option("--token", |
1332 | 1350 |
action="store", type="string", dest="token", |
1333 | 1351 |
help="The token to use for authentication to the API") |
... | ... | |
1336 | 1354 |
help="Do not fail immediately if one of the tests " \ |
1337 | 1355 |
"fails (EXPERIMENTAL)", |
1338 | 1356 |
default=False) |
1357 |
parser.add_option("--no-ipv6", |
|
1358 |
action="store_true", dest="no_ipv6", |
|
1359 |
help="Disables ipv6 related tests", |
|
1360 |
default=False) |
|
1339 | 1361 |
parser.add_option("--action-timeout", |
1340 | 1362 |
action="store", type="int", dest="action_timeout", |
1341 | 1363 |
metavar="TIMEOUT", |
... | ... | |
1440 | 1462 |
|
1441 | 1463 |
(opts, args) = parse_arguments(sys.argv[1:]) |
1442 | 1464 |
|
1443 |
global API, TOKEN |
|
1465 |
global API, TOKEN, PLANKTON, PLANKTON_USER, NO_IPV6
|
|
1444 | 1466 |
API = opts.api |
1445 | 1467 |
TOKEN = opts.token |
1468 |
PLANKTON = opts.plankton |
|
1469 |
PLANKTON_USER = opts.plankton_user |
|
1470 |
NO_IPV6 = opts.no_ipv6 |
|
1446 | 1471 |
|
1447 | 1472 |
# Cleanup stale servers from previous runs |
1448 | 1473 |
if opts.show_stale: |
Also available in: Unified diff