X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/a47f574c23d9148fb64baed9339b76a3a5b3b607..255e19d46c090d2fd5f4191e8da76ca53f78d5b5:/qa/qa_rapi.py diff --git a/qa/qa_rapi.py b/qa/qa_rapi.py index 0f9054f..7c668c5 100644 --- a/qa/qa_rapi.py +++ b/qa/qa_rapi.py @@ -41,16 +41,17 @@ NoProxyOpener = urllib2.build_opener(urllib2.ProxyHandler({})) INSTANCE_FIELDS = ("name", "os", "pnode", "snodes", - "admin_state", "admin_ram", - "disk_template", "ip", "mac", "bridge", - "sda_size", "sdb_size", "vcpus", - "oper_state", "status", "tags") + "admin_state", + "disk_template", "disk.sizes", + "nic.ips", "nic.macs", "nic.bridges", + "beparams", "hvparams", + "oper_state", "oper_ram", "status", "tags") NODE_FIELDS = ("name", "dtotal", "dfree", "mtotal", "mnode", "mfree", "pinst_cnt", "sinst_cnt", "tags") -LIST_FIELDS = ("name", "uri") +LIST_FIELDS = ("id", "uri") def Enabled(): @@ -80,7 +81,7 @@ def _DoTests(uris): for uri, verify in uris: assert uri.startswith("/") - url = "http://%s:%s%s" % (host, port, uri) + url = "https://%s:%s%s" % (host, port, uri) print "Testing %s ..." % url @@ -97,7 +98,6 @@ def _DoTests(uris): AssertEqual(data, verify) -@qa_utils.DefineHook('rapi-version') def TestVersion(): """Testing remote API version. @@ -107,7 +107,6 @@ def TestVersion(): ]) -@qa_utils.DefineHook('rapi-empty-cluster') def TestEmptyCluster(): """Testing remote API on an empty cluster. @@ -121,8 +120,8 @@ def TestEmptyCluster(): def _VerifyNodes(data): master_entry = { - "name": master_name, - "uri": "/nodes/%s" % master_name, + "id": master_name, + "uri": "/2/nodes/%s" % master_name, } AssertIn(master_entry, data) @@ -133,17 +132,16 @@ def TestEmptyCluster(): _DoTests([ ("/", None), - ("/info", _VerifyInfo), - ("/tags", None), - ("/nodes", _VerifyNodes), - ("/nodes?bulk=1", _VerifyNodesBulk), - ("/instances", []), - ("/instances?bulk=1", []), - ("/os", None), + ("/2/info", _VerifyInfo), + ("/2/tags", None), + ("/2/nodes", _VerifyNodes), + ("/2/nodes?bulk=1", _VerifyNodesBulk), + ("/2/instances", []), + ("/2/instances?bulk=1", []), + ("/2/os", None), ]) -@qa_utils.DefineHook('rapi-instance') def TestInstance(instance): """Testing getting instance(s) info via remote API. @@ -151,24 +149,23 @@ def TestInstance(instance): def _VerifyInstance(data): for entry in INSTANCE_FIELDS: AssertIn(entry, data) - + def _VerifyInstancesList(data): for instance in data: - for entry in LIST_FIELDS: + for entry in LIST_FIELDS: AssertIn(entry, instance) - + def _VerifyInstancesBulk(data): for instance_data in data: _VerifyInstance(instance_data) _DoTests([ - ("/instances/%s" % instance["name"], _VerifyInstance), - ("/instances", _VerifyInstancesList), - ("/instances?bulk=1", _VerifyInstancesBulk), + ("/2/instances/%s" % instance["name"], _VerifyInstance), + ("/2/instances", _VerifyInstancesList), + ("/2/instances?bulk=1", _VerifyInstancesBulk), ]) -@qa_utils.DefineHook('rapi-node') def TestNode(node): """Testing getting node(s) info via remote API. @@ -176,20 +173,20 @@ def TestNode(node): def _VerifyNode(data): for entry in NODE_FIELDS: AssertIn(entry, data) - + def _VerifyNodesList(data): for node in data: - for entry in LIST_FIELDS: + for entry in LIST_FIELDS: AssertIn(entry, node) - + def _VerifyNodesBulk(data): for node_data in data: _VerifyNode(node_data) _DoTests([ - ("/nodes/%s" % node["primary"], _VerifyNode), - ("/nodes", _VerifyNodesList), - ("/nodes?bulk=1", _VerifyNodesBulk), + ("/2/nodes/%s" % node["primary"], _VerifyNode), + ("/2/nodes", _VerifyNodesList), + ("/2/nodes?bulk=1", _VerifyNodesBulk), ]) @@ -198,11 +195,11 @@ def TestTags(kind, name, tags): """ if kind == constants.TAG_CLUSTER: - uri = "/tags" + uri = "/2/tags" elif kind == constants.TAG_NODE: - uri = "/nodes/%s/tags" % name + uri = "/2/nodes/%s/tags" % name elif kind == constants.TAG_INSTANCE: - uri = "/instances/%s/tags" % name + uri = "/2/instances/%s/tags" % name else: raise errors.ProgrammerError("Unknown tag kind")