Revision bcb7c357 snf-tools/synnefo_tools/burnin.py

b/snf-tools/synnefo_tools/burnin.py
288 288
        keys = frozenset(["osfamily", "root_partition"])
289 289
        details = self.client.list_images(detail=True)
290 290
        for i in details:
291
            self.assertTrue(keys.issubset(i["metadata"]["values"].keys()))
291
            self.assertTrue(keys.issubset(i["metadata"].keys()))
292 292

  
293 293
    def test_006_download_image(self):
294 294
        """Download image from pithos+"""
......
503 503
    def _get_ipv4(self, server):
504 504
        """Get the public IPv4 of a server from the detailed server info"""
505 505

  
506
        nics = server["attachments"]["values"]
506
        nics = server["attachments"]
507 507

  
508 508
        for nic in nics:
509 509
            net_id = nic["network_id"]
......
517 517
    def _get_ipv6(self, server):
518 518
        """Get the public IPv6 of a server from the detailed server info"""
519 519

  
520
        nics = server["attachments"]["values"]
520
        nics = server["attachments"]
521 521

  
522 522
        for nic in nics:
523 523
            net_id = nic["network_id"]
......
675 675
        log.info("Server id: " + str(server["id"]))
676 676
        log.info("Server password: " + server["adminPass"])
677 677
        self.assertEqual(server["name"], self.servername)
678
        self.assertEqual(server["flavorRef"], self.flavorid)
679
        self.assertEqual(server["imageRef"], self.imageid)
678
        self.assertEqual(server["flavor"], self.flavorid)
679
        self.assertEqual(server["image"], self.imageid)
680 680
        self.assertEqual(server["status"], "BUILD")
681 681

  
682 682
        # Update class attributes to reflect data on building server
......
699 699

  
700 700
        server = servers[0]
701 701
        self.assertEqual(server["name"], self.servername)
702
        self.assertEqual(server["flavorRef"], self.flavorid)
703
        self.assertEqual(server["imageRef"], self.imageid)
702
        self.assertEqual(server["flavor"], self.flavorid)
703
        self.assertEqual(server["image"], self.imageid)
704 704
        self.assertEqual(server["status"], "BUILD")
705 705

  
706 706
    def test_002b_server_is_building_in_details(self):
......
710 710

  
711 711
        server = self.client.get_server_details(self.serverid)
712 712
        self.assertEqual(server["name"], self.servername)
713
        self.assertEqual(server["flavorRef"], self.flavorid)
714
        self.assertEqual(server["imageRef"], self.imageid)
713
        self.assertEqual(server["flavor"], self.flavorid)
714
        self.assertEqual(server["image"], self.imageid)
715 715
        self.assertEqual(server["status"], "BUILD")
716 716

  
717 717
    def test_002c_set_server_metadata(self):
......
719 719
        log.info("Creating server metadata")
720 720

  
721 721
        image = self.client.get_image_details(self.imageid)
722
        os_value = image["metadata"]["values"]["os"]
723
        users = image["metadata"]["values"].get("users", None)
722
        os_value = image["metadata"]["os"]
723
        users = image["metadata"].get("users", None)
724 724
        self.client.update_server_metadata(self.serverid, OS=os_value)
725 725

  
726 726
        userlist = users.split()
......
995 995
    def _get_ipv4(self, server):
996 996
        """Get the public IPv4 of a server from the detailed server info"""
997 997

  
998
        nics = server["attachments"]["values"]
998
        nics = server["attachments"]
999 999

  
1000 1000
        for nic in nics:
1001 1001
            net_id = nic["network_id"]
......
1035 1035
                                            self.imageid, personality=None)
1036 1036

  
1037 1037
        self.assertEqual(serverA["name"], self.servername)
1038
        self.assertEqual(serverA["flavorRef"], self.flavorid)
1039
        self.assertEqual(serverA["imageRef"], self.imageid)
1038
        self.assertEqual(serverA["flavor"], self.flavorid)
1039
        self.assertEqual(serverA["image"], self.imageid)
1040 1040
        self.assertEqual(serverA["status"], "BUILD")
1041 1041

  
1042 1042
        # Update class attributes to reflect data on building server
......
1079 1079
                                            self.imageid, personality=None)
1080 1080

  
1081 1081
        self.assertEqual(serverB["name"], self.servername)
1082
        self.assertEqual(serverB["flavorRef"], self.flavorid)
1083
        self.assertEqual(serverB["imageRef"], self.imageid)
1082
        self.assertEqual(serverB["flavor"], self.flavorid)
1083
        self.assertEqual(serverB["image"], self.imageid)
1084 1084
        self.assertEqual(serverB["status"], "BUILD")
1085 1085

  
1086 1086
        # Update class attributes to reflect data on building server
......
1168 1168

  
1169 1169
            netsA = [x['network_id']
1170 1170
                     for x in self.client.get_server_details(
1171
                         self.serverid['A'])['attachments']['values']]
1171
                         self.serverid['A'])['attachments']]
1172 1172
            netsB = [x['network_id']
1173 1173
                     for x in self.client.get_server_details(
1174
                         self.serverid['B'])['attachments']['values']]
1174
                         self.serverid['B'])['attachments']]
1175 1175

  
1176 1176
            if (self.networkid in netsA) and (self.networkid in netsB):
1177 1177
                conn_exists = True
......
1186 1186
        cls.priv_ip = dict()
1187 1187

  
1188 1188
        nicsA = self.client.get_server_details(
1189
            self.serverid['A'])['attachments']['values']
1189
            self.serverid['A'])['attachments']
1190 1190
        nicsB = self.client.get_server_details(
1191
            self.serverid['B'])['attachments']['values']
1191
            self.serverid['B'])['attachments']
1192 1192

  
1193 1193
        if conn_exists:
1194 1194
            for nic in nicsA:
......
1339 1339

  
1340 1340
        server = self.client.get_server_details(self.serverid['A'])
1341 1341
        image = self.client.get_image_details(self.imageid)
1342
        os_value = image['metadata']['values']['os']
1342
        os_value = image['metadata']['os']
1343 1343

  
1344
        users = image["metadata"]["values"].get("users", None)
1344
        users = image["metadata"].get("users", None)
1345 1345
        userlist = users.split()
1346 1346

  
1347 1347
        if "root" in userlist:
......
1373 1373

  
1374 1374
        server = self.client.get_server_details(self.serverid['B'])
1375 1375
        image = self.client.get_image_details(self.imageid)
1376
        os_value = image['metadata']['values']['os']
1376
        os_value = image['metadata']['os']
1377 1377

  
1378
        users = image["metadata"]["values"].get("users", None)
1378
        users = image["metadata"].get("users", None)
1379 1379
        userlist = users.split()
1380 1380

  
1381 1381
        if "root" in userlist:
......
1407 1407

  
1408 1408
        server = self.client.get_server_details(self.serverid['A'])
1409 1409
        image = self.client.get_image_details(self.imageid)
1410
        os_value = image['metadata']['values']['os']
1410
        os_value = image['metadata']['os']
1411 1411
        hostip = self._get_ipv4(server)
1412 1412

  
1413
        users = image["metadata"]["values"].get("users", None)
1413
        users = image["metadata"].get("users", None)
1414 1414
        userlist = users.split()
1415 1415

  
1416 1416
        if "root" in userlist:
......
1440 1440
        log.info("Disconnecting servers from private network")
1441 1441

  
1442 1442
        prev_state = self.client.get_network_details(self.networkid)
1443
        prev_nics = prev_state['attachments']['values']
1443
        prev_nics = prev_state['attachments']
1444 1444
        #prev_conn = len(prev_nics)
1445 1445

  
1446 1446
        nicsA = [x['id']
1447 1447
                 for x in self.client.get_server_details(
1448
                     self.serverid['A'])['attachments']['values']]
1448
                     self.serverid['A'])['attachments']]
1449 1449
        nicsB = [x['id']
1450 1450
                 for x in self.client.get_server_details(
1451
                     self.serverid['B'])['attachments']['values']]
1451
                     self.serverid['B'])['attachments']]
1452 1452

  
1453 1453
        for nic in prev_nics:
1454 1454
            if nic in nicsA:
......
1462 1462
        while True:
1463 1463
            netsA = [x['network_id']
1464 1464
                     for x in self.client.get_server_details(
1465
                         self.serverid['A'])['attachments']['values']]
1465
                         self.serverid['A'])['attachments']]
1466 1466
            netsB = [x['network_id']
1467 1467
                     for x in self.client.get_server_details(
1468
                         self.serverid['B'])['attachments']['values']]
1468
                         self.serverid['B'])['attachments']]
1469 1469

  
1470 1470
            #connected = (self.client.get_network_details(self.networkid))
1471
            #connections = connected['attachments']['values']
1471
            #connections = connected['attachments']
1472 1472
            if (self.networkid not in netsA) and (self.networkid not in netsB):
1473 1473
                conn_exists = False
1474 1474
                break

Also available in: Unified diff