Beispiel #1
0
 def getTenant(self):
     self.log("####### test Case: 022_search a tenant ######")
     serverip = Property.getProperties('serverIP')
     myTenant = Property.getProperties('testTenant')
     args = {
         'server_ip': serverip,
         'name': myTenant,
         'email': '*****@*****.**',
         'info': 'insertNewTenantInfo',
         'password': '******',
         'phone': '111-123-234',
         'policy': 'testPolicy',
         'status': '0'
     }
     apikeyValue = singletest.apikey
     tp = TenantPage()
     (ok, message) = tp.insert_tenant(apikeyValue, args)
     self.assertEqual(
         ok, 200,
         'create new tenant failed, return code is : "' + str(ok) + '"')
     (ok, names) = tp.query_tenant(apikeyValue, args)
     self.assertIn(
         args['name'], names,
         'query tenant failed,the name you would like to query does not exist.'
     )
     tp.delete_tenant(apikeyValue, args)
Beispiel #2
0
 def editTenant(self):
     self.log("####### test Case: 000_edit a tenant ######")
     serverip = Property.getProperties('serverIP')
     myTenant = Property.getProperties('testTenant')
     args = {
         'server_ip': serverip,
         'name': myTenant,
         'email': '*****@*****.**',
         'info': 'insertNewTenantInfo',
         'password': '******',
         'phone': '111-123-234',
         'policy': 'testPolicy',
         'status': '0'
     }
     newPasswd = 'newPassword002'
     newPhone = '111-123.002'
     newEmail = '*****@*****.**'
     apikeyValue = singletest.apikey
     tp = TenantPage()
     (ok, message) = tp.insert_tenant(apikeyValue, args)
     self.assertEqual(
         ok, 200,
         'create new tenant failed, return code is : "' + str(ok) + '"')
     args['password'] = newPasswd
     args['phone'] = newPhone
     args['email'] = newEmail
     (ok, message) = tp.update_tenant(apikeyValue, args)
     self.assertEqual(ok, 200,
                      'update tenant failed,the reason is: ' + str(message))
     tp.delete_tenant(apikeyValue, args)
Beispiel #3
0
 def newTenant(self):
     self.log("####### test Case: 004_create a new tenant ######")
     serverip = Property.getProperties('serverIP')
     myTenant = Property.getProperties('testTenant')
     myGroup = Property.getProperties('testGroup')
     gp = CCCGroup()
     arg = {'server_ip': serverip, 'name': myGroup, 'tenant': myTenant}
     apikeyValue = singletest.apikey
     (ok, message) = gp.delete_group(apikeyValue, arg)
     arg['name'] = 'default'
     (ok, message) = gp.delete_group(apikeyValue,
                                     arg)  # delete group named 'default'
     args = {
         'server_ip': serverip,
         'name': myTenant,
         'email': '*****@*****.**',
         'info': 'insertNewTenantInfo',
         'password': '******',
         'phone': '111-123-234',
         'policy': 'testPolicy',
         'status': '0'
     }
     apikeyValue = singletest.apikey
     tp = TenantPage()
     tp.delete_tenant(apikeyValue, args)
     (ok, message) = tp.insert_tenant(apikeyValue, args)
     self.assertEqual(200, ok, 'Response Code is ' + str(ok))
     self.assertEqual(message, "Success",
                      'Response Body : "message" is :' + message)
     tp.delete_tenant(apikeyValue, args)
Beispiel #4
0
 def createNewAndDeleteStorage(self):
     self.log(
         "####### test Case: 014_Create a new storages ### test Case: 015_Delete a new storages ######"
     )
     cccServerIP = Property.getProperties('serverIP')
     apikeyValue = singletest.apikey
     args = {'server_ip': cccServerIP, 'api_key': apikeyValue}
     sp = CCCStorages()
     (ok, idxs) = sp.query_storages(
         args)  #get the count of idxs before creating new one
     storageInfo = sp.query_first_storages(args)
     storageInfo['name'] = 'new_ceph_local_' + str(time.time())
     storageInfo['target'] = 'panzura_vizion_datastore' + str(time.time())
     args.update(storageInfo)
     self.logInfo(args)
     (ok, message) = sp.post_storages(args)
     self.assertEqual(ok, 0, message)
     (ok, idxsNew) = sp.query_storages(args)
     self.assertTrue(
         len(idxsNew) > len(idxs), "Cannot create new storage successfully")
     # find the new id that just was created, then try to delete it
     for idx in idxsNew:
         if idx not in idxs:
             newID = idx
     (ok, message) = sp.delete_storages_by_idx(newID, args)
     self.assertEqual(ok, 0, message)
Beispiel #5
0
    def queryServicesByid(self):
        self.log("####### test Case: 008_query all service by ID ######")
        cccServerIP = Property.getProperties('serverIP')
        apikeyValue = singletest.apikey
        args = {'server_ip': cccServerIP, 'api_key': apikeyValue}
        np = CCCNode()
        (ok, ids) = np.query_nodeId(args)
        idInfo = {'id1': ids[0], 'id2': ids[1], 'id3': ids[2], 'id4': ids[3]}
        args.update(idInfo)
        (ok, servers) = np.query_service_by_id(args['id1'], args)
        self.assertEqual(ok, 200, servers)
        self.assertTrue(servers['mdnode'], "mdnode  on node1 should be true")
        self.assertTrue(servers['managementdocker'],
                        "managementnode  on node1 should be true")

        (ok, servers) = np.query_service_by_id(args['id2'], args)
        self.assertEqual(ok, 200, servers)
        self.assertTrue(servers['mdnode'], "mdnode  on node2 should be true")
        self.assertFalse(servers['managementdocker'],
                         "managementnode  on node2 should be false")

        (ok, servers) = np.query_service_by_id(args['id3'], args)
        self.assertEqual(ok, 200, servers)
        self.assertFalse(servers['mdnode'], "mdnode  on node3 should be false")
        self.assertFalse(servers['managementdocker'],
                         "managementnode  on node3 should be false")

        (ok, servers) = np.query_service_by_id(args['id4'], args)
        self.assertEqual(ok, 200, servers)
        self.assertTrue(servers['mdnode'], "mdnode  on node4 should be true")
        self.assertFalse(servers['managementdocker'],
                         "managementnode  on node4 should be false")
Beispiel #6
0
 def queryStorages(self):
     self.log("####### test Case: 013_Query storages ######")
     cccServerIP = Property.getProperties('serverIP')
     apikeyValue = singletest.apikey
     args = {'server_ip': cccServerIP, 'api_key': apikeyValue}
     sp = CCCStorages()
     (ok, idxs) = sp.query_storages(args)
     self.assertEqual(ok, 0, "get all storage failed")
Beispiel #7
0
 def queryMdclusterNode(self):
     self.log("####### test Case: 009_query all mdcluster ######")
     cccServerIP = Property.getProperties('serverIP')
     apikeyValue = singletest.apikey
     args = {'server_ip': cccServerIP, 'api_key': apikeyValue}
     mp = CCCMdcluster()
     (ok, nodeIds) = mp.query_mdcluster_node(args)
     self.assertEqual(ok, 200, 'get nodeID failed')
Beispiel #8
0
 def queryS3services(self):
     self.log("####### test Case: 016_Query all s3 services ######")
     cccServerIP = Property.getProperties('serverIP')
     apikeyValue = singletest.apikey
     args = {'server_ip': cccServerIP, 'api_key': apikeyValue}
     s3sP = CCCS3services()
     (ok, services) = s3sP.query_s3services(args)
     self.assertEqual(ok, 200, " query all services failed!")
Beispiel #9
0
    def queryNodes(self):
        self.log("####### test Case: 005_query all nodes ######")
        cccServerIP = Property.getProperties('serverIP')
        apikeyValue = singletest.apikey
        args = {'server_ip': cccServerIP, 'api_key': apikeyValue}

        np = CCCNode()
        (ok, nodelist) = np.query_node(args)
        self.logInfo(nodelist)
        self.assertEqual(ok, 200, nodelist)
Beispiel #10
0
 def queryMdclusterNodeById(self):
     self.log("####### test Case: 010_query mdcluster by id ######")
     cccServerIP = Property.getProperties('serverIP')
     apikeyValue = singletest.apikey
     args = {'server_ip': cccServerIP, 'api_key': apikeyValue}
     mp = CCCMdcluster()
     (ok, nodeIds) = mp.query_mdcluster_node(args)
     nodeid = {'id': nodeIds[0]}  # try to get the mdcluster by id 1
     args.update(nodeid)
     (ok, hostip) = mp.query_mdcluster_node_by_id(args)
     self.assertEqual(ok, 0, hostip)
Beispiel #11
0
 def queryDockerByid(self):
     self.log("####### test Case: 007_query all dockers by ID ######")
     cccServerIP = Property.getProperties('serverIP')
     apikeyValue = singletest.apikey
     args = {'server_ip': cccServerIP, 'api_key': apikeyValue}
     np = CCCNode()
     (ok, ids) = np.query_nodeId(args)
     idInfo = {'id': ids[0]}  # try to get node1 id
     args.update(idInfo)
     (ok, dockers) = np.query_docker_by_id(args)
     self.assertEqual(ok, 200, dockers)
Beispiel #12
0
 def queryNodesById(self):
     self.log("####### test Case: 006_query node by ID ######")
     cccServerIP = Property.getProperties('serverIP')
     apikeyValue = singletest.apikey
     args = {'server_ip': cccServerIP, 'api_key': apikeyValue}
     np = CCCNode()
     (ok, ids) = np.query_nodeId(args)
     idInfo = {'id': ids[2]}  # try to get node3 id
     args.update(idInfo)
     (ok, hostip) = np.query_node_by_id(args)
     self.logInfo(hostip)
     self.assertEqual(ok, 200, hostip)
Beispiel #13
0
 def postNewMdclusterById(self):
     self.log(
         "####### test Case: 012_Create a new mdcluster by id, this case depense on 011 ######"
     )
     cccServerIP = Property.getProperties('serverIP')
     apikeyValue = singletest.apikey
     args = {'server_ip': cccServerIP, 'api_key': apikeyValue}
     np = CCCNode()
     (ok, ids) = np.query_nodeId(args)
     newId = {'id': ids[-1]}  # the the last node to post new mdcluster
     args.update(newId)
     mp = CCCMdcluster()
     (ok, msg) = mp.post_mdcluster_node_by_id(args)
     self.assertEqual(ok, 0, 'create new MD node ' + str(msg))
Beispiel #14
0
 def deleteMdclusterNodeById(self):
     self.log("####### test Case: 011_Delete a mdcluster by id ######")
     cccServerIP = Property.getProperties('serverIP')
     apikeyValue = singletest.apikey
     args = {'server_ip': cccServerIP, 'api_key': apikeyValue}
     mp = CCCMdcluster()
     (ok, nodeIds) = mp.query_mdcluster_node(args)
     nodeid = {'id': nodeIds[1]}  # try to get the mdcluster by id 2
     args.update(nodeid)
     (ok, message) = mp.delete_mdcluster_node_by_id(args)
     self.assertEqual(ok, 0, message)
     (ok, message) = mp.query_mdcluster_node_by_id(args)
     self.assertEqual(ok, 0,
                      "md still exists, did not be delete successfull")
Beispiel #15
0
 def login(self):
     
     user = Property.getProperties('loginUser')
     passwd = Property.getProperties('loginPasswd')
     serverIp = Property.getProperties('serverIP')
     login_json = json.dumps({'username': user, 
                              'password': passwd 
                             })
     insert_url = 'https://' + serverIp + ':8443/auth/login'
     headers = {'content-type':'application/json'}
     response = requests.put(insert_url, data=login_json, headers=headers, verify=False, timeout=60)
            
     login_json = json.dumps({'username': user, 
                              'password': passwd 
                             })
     insert_url = 'https://' + serverIp + ':8443/auth/login'
     headers = {'content-type':'application/json'}
     response = requests.put(insert_url, data=login_json, headers=headers, verify=False, timeout=60)
     
     self.logInfo(response.status_code)
     apikey = response.json()['data']['apikey']
     self.logInfo("*****apikey***** for login is : " + apikey)
     return (response.status_code, apikey)
Beispiel #16
0
 def createNewGroup(self):
     self.log("####### test Case: 002_create a new group ######")
     serverip = Property.getProperties('serverIP')
     myTenant = Property.getProperties('testTenant')
     myGroup = Property.getProperties('testGroup')
     args = {
         'server_ip': serverip,
         'name': myTenant,
         'email': '*****@*****.**',
         'info': 'insertNewTenantInfo',
         'password': '******',
         'phone': '111-123-234',
         'status': '0',
         'tenant': myTenant
     }
     apikeyValue = singletest.apikey
     tp = TenantPage()
     tp.delete_tenant(apikeyValue, args)
     (ok, message) = tp.insert_tenant(apikeyValue, args)
     gp = CCCGroup()
     args['name'] = myGroup
     gp.delete_group(apikeyValue, args)
     (ok, message) = gp.insert_group(apikeyValue, args)
     self.assertEqual(ok, 0, message)
Beispiel #17
0
    def stopS3servicesByIdSubid(self):
        self.log("####### test Case: 021_Stop a new s3 services ######")
        cccServerIP = Property.getProperties('serverIP')
        apikeyValue = singletest.apikey
        args = {'server_ip': cccServerIP, 'api_key': apikeyValue}

        s3sp = CCCS3services()
        (ok, services) = s3sp.query_s3services(args)
        serviceids = {
            'id': services[0]['sid'],  #select the first service to do stop
            'subid': services[0]['ssubid']
        }
        args.update(serviceids)
        (ok, message) = s3sp.stop_s3services_by_id_subid(args)
        self.assertEqual(ok, 200, message)
Beispiel #18
0
    def queryS3servicesByIdSubid(self):
        self.log("####### test Case: 019_Create a new s3 services ######")
        cccServerIP = Property.getProperties('serverIP')
        apikeyValue = singletest.apikey
        args = {'server_ip': cccServerIP, 'api_key': apikeyValue}

        s3sp = CCCS3services()
        (ok, services) = s3sp.query_s3services(args)
        serviceids = {
            'id': services[0]['sid'],  #select the first service to do query
            'subid': services[0]['ssubid']
        }
        args.update(serviceids)
        (ok, hostip) = s3sp.query_s3services_by_id_subid(args)
        self.logInfo(hostip)
        self.assertTrue('null' != str(hostip).lower(),
                        "Query service by 'id ' and 'subid' failed")
Beispiel #19
0
 def deleteTenant(self):
     self.log("####### test Case: 001_delete a tenant ######")
     serverip = Property.getProperties('serverIP')
     args = {
         'server_ip': serverip,
         'name': 'tenant_004',
         'email': '*****@*****.**',
         'info': 'insertNewTenantInfo',
         'password': '******',
         'phone': '111-123-234',
         'policy': 'testPolicy',
         'status': '0'
     }
     apikeyValue = singletest.apikey
     tp = TenantPage()
     (ok, message) = tp.insert_tenant(apikeyValue, args)
     self.assertEqual(200, ok, 'Response Code is ' + str(ok))
     (status, message) = tp.delete_tenant(apikeyValue, args)
     self.assertEqual(status, 0, message)
Beispiel #20
0
 def createNewS3user(self):
     self.log("####### test Case: 003_create a new s3 user ######")
     serverip = Property.getProperties('serverIP')
     myTenant = 'testTenant-003'
     myGroup = 'testGroup-003'
     myUserName = '******'
     apikeyValue = singletest.apikey
     args = {
         'server_ip': serverip,
         'name': myGroup,
         'email': '*****@*****.**',
         'info': 'insertNewTenantInfo',
         'password': '******',
         'phone': '111-123-234',
         'status': '0',
         'tenant': myTenant
     }
     tp = TenantPage()
     gp = CCCGroup()
     gp.delete_group(apikeyValue, args)
     args['name'] = myTenant
     tp.delete_tenant(apikeyValue, args)
     (ok, message) = tp.insert_tenant(apikeyValue, args)
     args['name'] = myGroup
     (ok, message) = gp.insert_group(apikeyValue, args)
     args = {
         'server_ip': serverip,
         'name': myUserName,
         'group': myGroup,
         'tenant': myTenant,
         'apikey': apikeyValue
     }
     s3p = CCCS3user()
     s3p.delete_s3user(args)
     (ok, message) = s3p.insert_s3user(args)
     self.logInfo('access info :' + message[0] + message[1])
     testsuite.accessid = str(message[0])
     testsuite.secretKey = str(message[1])
     try:
         self.assertEqual(ok, 200, message)
     finally:
         s3p.delete_s3user(args)
Beispiel #21
0
 def deleteServiceByIdSubid(self):
     self.log("####### test Case: 018_Delete a new s3 services ######")
     cccServerIP = Property.getProperties('serverIP')
     apikeyValue = singletest.apikey
     args = {
         'server_ip': cccServerIP,
         'api_key': apikeyValue,
         'ip': '10.180.108.2'
     }
     np = CCCNode()
     (ok, ids) = np.query_nodeId(args)
     nodeid = {'id': ids[3]}  #select node4 and try to start s3 on it
     args.update(nodeid)
     s3sp = CCCS3services()
     (ok, message) = s3sp.post_s3services_by_id_ip(args)
     self.assertEqual(ok, 0, message)
     (ok, ids) = s3sp.query_s3services(args)
     self.assertEqual(ok, 200, "get ids base on hostip failed.")
     idAndSubid = {'id': ids[-1]['sid'], 'subid': ids[-1]['ssubid']}
     args.update(idAndSubid)
     (ok, message) = s3sp.delete_s3services_by_id_subid(args)
     self.assertEqual(ok, 0, message)
Beispiel #22
0
 def createNewService(self):
     self.log("####### test Case: 017_Create a new s3 services ######")
     cccServerIP = Property.getProperties('serverIP')
     apikeyValue = singletest.apikey
     args = {
         'server_ip': cccServerIP,
         'api_key': apikeyValue,
         'ip': '10.180.108.1'
     }
     np = CCCNode()
     (ok, ids) = np.query_nodeId(args)
     nodeid = {'id': ids[3]}  #select node4 and try to start s3 on it
     args.update(nodeid)
     s3sp = CCCS3services()
     (ok, message) = s3sp.post_s3services_by_id_ip(args)
     self.assertEqual(ok, 0, message)
     self.logInfo("Sleep 5 seconds to wait new service added")
     time.sleep(5)
     (ok, hostsIp) = s3sp.query_s3servicesHostIp(args)
     self.assertTrue(
         [args['ip']] in hostsIp,
         "Cannot find the host ip which just created, post action failed.")