コード例 #1
0
 def test_DeleteCluster_host(self):
     '''
     @summary: 测试用例执行步骤
     @note: (1)删除包含主机的集群
     @note: (2)操作失败,验证返回状态码,验证报错信息
     '''
     clusterapi = ClusterAPIs()
     LogPrint().info("Test: Delete cluster %s." % self.dm.cluster_name)
     r = clusterapi.delCluster(self.dm.cluster_name)
     #         print r
     if r['status_code'] == self.dm.status_code:
         dict_actual = r['result']
         dict_expected = xmltodict.parse(self.dm.expected_info)
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info(
                 "PASS: Returned status code and messages are CORRECT.")
             self.flag = True
         else:
             LogPrint().error("FAIL: Returned message is  INCORRECT.")
             self.flag = False
     else:
         LogPrint().error("FAIL: Returned status code is wrong. ")
         self.flag = False
     self.assertTrue(self.flag)
コード例 #2
0
 def test_UpdateTemplateNic(self):
     '''
     @summary: 为模板编辑网络接口
     @note: 操作成功,验证返回状态码和返回信息
     '''
     self.flag = True
     tempnic_api = TemplateNicsAPIs()
     LogPrint().info("Test: Update nic %s for this template." %
                     self.dm.nic_name)
     r = tempnic_api.updateTemplateNic(self.dm.temp_name, self.dm.nic_name,
                                       self.dm.update_info, self.proid)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         expected_result = xmltodict.parse(
             (self.dm.update_info % self.proid))
         actual_result = r['result']
         if dictCompare.isSubsetDict(expected_result, actual_result):
             LogPrint().info("PASS: UpdateTemplateNic SUCCESS.")
         else:
             LogPrint().error(
                 "FAIL: UpdateTemplateNic fail.The nic_info is WRONG")
             self.flag = False
     else:
         LogPrint().error(
             "FAIL: UpdateTemplateNic fail.The status_code is WRONG")
         self.flag = False
     self.assertTrue(self.flag)
コード例 #3
0
 def test_GetClusterInfo(self):
     '''
     @summary: 测试用例执行步骤
     @note: (1)获取指定集群的信息;
     @note: (2)验证接口返回的状态码、集群信息是否正确。
     '''
     # 测试1:获取集群的信息,并与期望结果进行对比
     self.clusterapi = ClusterAPIs()
     LogPrint().info("Test: Get cluster's ('%s') info." %
                     self.dm.cluster_name)
     r = self.clusterapi.getClusterInfo(self.dm.cluster_name)
     if r['status_code'] == self.dm.status_code:
         dict_actual = r['result']
         dict_expected = xmltodict.parse(self.dm.cluster_info)
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info("PASS: Get Cluster '%s' info SUCCESS." %
                             self.dm.cluster_name)
             self.flag = True
         else:
             LogPrint().error("FAIL: Get Cluster '%s' info INCORRECT." %
                              self.dm.cluster_name)
             self.flag = False
     else:
         LogPrint().error(
             "FAIL: Get Cluster '%s' info FAILED. Returned status code '%s' is WRONG."
             % (self.dm.cluster_name, r['status_code']))
         self.flag = False
     self.assertTrue(self.flag)
コード例 #4
0
    def test_CreateDisk_iscsi_cow(self): 
        '''
        @note: 在iscsi存储域内创建cow类型磁盘
        @note: sprase必须设为true,sharable必须为false,否则报错
        '''
        self.flag = True
        diskapi = DiskAPIs()
        LogPrint().info("Test: Create cow type disk.")
        r = diskapi.createDisk(self.dm.disk_info_cow)
        def is_disk_ok():
            return diskapi.getDiskStatus(self.disk_id)=='ok'
        if r['status_code'] == self.dm.expected_status_code:
            self.disk_id = r['result']['disk']['@id']
            #如果磁盘状态在给定时间内变为ok状态,则继续验证状态码和磁盘信息
            if wait_until(is_disk_ok, 500, 5):
                dict_actual = r['result']
                dict_expected = xmltodict.parse(self.dm.disk_info_cow)
                dictCompare = DictCompare()
                if dictCompare.isSubsetDict(dict_expected, dict_actual):
                    LogPrint().info("PASS: Create cow disk SUCCESS." )
#                 return True
                else:
                    LogPrint().error("FAIL: The disk_info is WRONG")
                    self.flag = False
            else:
                LogPrint().error("FAIL: The disk status is not OK. " )
                self.flag = False
        else:
            LogPrint().error("FAIL: Returned status code is %s. "% r['status_code'])
            self.flag = False
コード例 #5
0
 def test_UpdateCluster_host(self):
     '''
     @summary: 测试步骤
     @note: (1)
     @note: (2)
     '''
     clusterapi = ClusterAPIs()
     LogPrint().info(
         "Test: Edit cluster's name while there are hosts in cluster.")
     r = clusterapi.updateCluster(self.dm.cluster_name,
                                  self.dm.cluster_info_new)
     if r['status_code'] == self.dm.status_code:
         dict_actual = r['result']
         dict_expected = xmltodict.parse(self.dm.cluster_info_new)
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info(
                 "PASS: ITC0201040203_test_UpdateCluster_host_name SUCCESS."
             )
             self.flag = True
         else:
             LogPrint().error(
                 "FAIL: ITC0201040203_test_UpdateCluster_host_name. Error-info INCORRECT."
             )
             self.flag = False
     else:
         LogPrint().error(
             "FAIL: ITC0201040203_test_UpdateCluster_host_name.Status_code is wrong. "
         )
         self.flag = False
     self.assertTrue(self.flag)
コード例 #6
0
 def test_UpdateNetworkofCluster(self):
     '''
     @summary: 测试用例执行步骤
     @note: 更新集群网络信息
     @note: 操作成功,验证返回状态码,验证更新信息是否正确
     '''
     LogPrint().info("Test: Update Network %s of Cluster %s. " %
                     (self.dm.nw_name, self.dm.cluster_name))
     r = self.clusterapi.updateNetworkOfCluster(self.dm.cluster_name,
                                                self.dm.nw_name,
                                                self.dm.nw_info_new)
     if r['status_code'] == self.dm.status_code:
         dict_actual = self.clusterapi.getClusterNetworkInfo(
             self.dm.cluster_name, self.dm.nw_name)
         #dict_expected = {'network':xmltodict.parse(self.dm.nw_info_new)['network']}
         dict_expected = xmltodict.parse(self.dm.nw_info_new)
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info(
                 "PASS: Detach Network %s from Cluster %s SUCCESS. " %
                 (self.dm.nw_name, self.dm.cluster_name))
         else:
             LogPrint().info("FAIL: Returned message is WRONG. ")
     else:
         LogPrint().info("FAIL: Returned status code is WRONG.")
コード例 #7
0
 def test_GetTemplateDiskInfo(self):
     '''
     @summary: 获取模板的磁盘详情
     @note: 操作成功,验证返回状态码和返回信息
     '''
     self.flag = True
     tempdisk_api = TemplateDisksAPIs()
     LogPrint().info("Test: Get disk info of template %s." %
                     self.dm.temp_name)
     r = tempdisk_api.getTemplateDiskInfo(self.dm.temp_name,
                                          self.dm.disk_name)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         sd_id = StorageDomainAPIs().getStorageDomainIdByName(
             ModuleData.data1_nfs_name)
         expected_result = xmltodict.parse(self.dm.disk_info % sd_id)
         actual_result = r['result']
         if dictCompare.isSubsetDict(expected_result, actual_result):
             LogPrint().info("PASS: Get disk info of template %s SUCCESS." %
                             self.dm.temp_name)
         else:
             LogPrint().error("FAIL: The disk_info is WRONG")
             self.flag = False
     else:
         LogPrint().error("FAIL: The status_code is WRONG")
         self.flag = False
     self.assertTrue(self.flag)
コード例 #8
0
 def test_UpdateCluster_host(self):
     '''
     @summary: 测试步骤
     @note: (1)更改含有主机的集群CPU类型;
     @note: (2)操作成功,验证接口返回的状态码、相关信息是否正确。
     '''
     clusterapi = ClusterAPIs()
     LogPrint().info(
         "Test: Edit cluster's cpu type if there are hosts in this cluster."
     )
     r = clusterapi.updateCluster(self.dm.cluster_name,
                                  self.dm.cluster_info_new)
     if r['status_code'] == self.dm.status_code:
         dict_actual = r['result']
         dict_expected = xmltodict.parse(self.dm.expected_info)
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info(
                 "PASS: ITC0201040201_test_UpdateCluster_host_cputype SUCCESS."
             )
             self.flag = True
         else:
             LogPrint().error(
                 "FAIL: ITC0201040201_test_UpdateCluster_host_cputype .Error-info INCORRECT."
             )
             self.flag = False
     else:
         LogPrint().error("FAIL: Returned status code '%s' is WRONG." %
                          r['status_code'])
         self.flag = False
     self.assertTrue(self.flag)
コード例 #9
0
 def test_UpdateCluster_host(self):
     '''
     @summary: 测试步骤
     @note: (1)
     @note: (2)
     '''
     clusterapi = ClusterAPIs()
     LogPrint().info(
         "Test: Improve cluster's CPU level while there are hosts in cluster."
     )
     r = clusterapi.updateCluster(self.dm.cluster_name,
                                  self.dm.cluster_info_new)
     if r['status_code'] == self.dm.status_code:
         dict_actual = r['result']
         dict_expected = xmltodict.parse(self.dm.expected_info)
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info(
                 "PASS: ITC0201040202_test_UpdateCluster_host_upcpu SUCCESS."
             )
             self.flag = True
         else:
             LogPrint().error(
                 "FAIL: ITC0201040202_test_UpdateCluster_host_upcpu. Error-info INCORRECT."
             )
             self.flag = False
     else:
         LogPrint().error("FAIL: Returned tatus_code '%s' is WRONG." %
                          r['status_code'])
         self.flag = False
     self.assertTrue(self.flag)
コード例 #10
0
 def test_CreateCluster_Dup(self):
     '''
     @summary: 测试步骤
     @note: (1)创建一个重名的Cluster;
     @note: (2)操作失败,验证接口返回的状态码、提示信息是否正确。
     '''
     clusterapi = ClusterAPIs()
     LogPrint().info("Test: Create a cluster with dup name.")
     r = clusterapi.createCluster(self.dm.cluster_info)
     if r['status_code'] == self.dm.status_code:
         dict_actual = r['result']
         dict_expected = xmltodict.parse(self.dm.error_info)
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info(
                 "PASS: Returned status code and info are CORRECT while creating cluster with dup name."
             )
             self.flag = True
         else:
             LogPrint().error(
                 "FAIL: Returned info are INCORRECT while creating cluster with dup name."
             )
             self.flag = False
     else:
         LogPrint().error("FAIL: Returned status code '%s' is WRONG. " %
                          r['status_code'])
         self.flag = False
     self.assertTrue(self.flag)
コード例 #11
0
 def test_CreateCluster(self):
     '''
     @summary: 测试步骤
     @note: (1)创建一个集群;
     @note: (2)操作成功,验证接口返回的状态码、集群信息是否正确。
     '''
     LogPrint().info("Test: Create a cluster '%s'." % self.dm.cluster_name)
     r = self.clusterapi.createCluster(self.dm.cluster_info)
     if r['status_code'] == self.dm.status_code:
         dict_actual = r['result']
         dict_expected = xmltodict.parse(self.dm.cluster_info)
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info("PASS: Create Cluster '%s' SUCCESS." %
                             self.dm.cluster_name)
             self.flag = True
         else:
             LogPrint().error("FAIL: Create Cluster '%s'  INCORRECT." %
                              self.dm.cluster_name)
             self.flag = False
     else:
         LogPrint().error("FAIL: Returned status code '%s' is WRONG." %
                          r['status_code'])
         self.flag = False
     self.assertTrue(self.flag)
コード例 #12
0
 def test_CreateTemplateNic_proid(self):
     '''
     @summary: 为模板创建网络接口,指定配置集
     @note: 操作成功,验证返回状态码和返回信息
     '''
     tempnic_api = TemplateNicsAPIs()
     LogPrint().info(
         "Test-: Create a nic %s with profile %s for template %s." %
         (self.dm.nic_name, self.dm.profile_name, self.dm.temp_name))
     r = tempnic_api.createTemplateNic(self.dm.temp_name, self.dm.nic_data,
                                       self.proid)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         expected_result = xmltodict.parse((self.dm.nic_data % self.proid))
         actual_result = r['result']
         if dictCompare.isSubsetDict(expected_result, actual_result):
             LogPrint().info(
                 "PASS: Create a nic %s with profile %s for template %s SUCCESS."
                 % (self.dm.nic_name, self.dm.profile_name,
                    self.dm.temp_name))
         else:
             LogPrint().error("FAIL: The nic_info is WRONG")
             self.flag = False
     else:
         LogPrint().error("FAIL: The status_code is WRONG")
         self.flag = False
     self.assertTrue(self.flag)
コード例 #13
0
 def do_test(xml_info):
     self.flag = True
     r = diskapi.createDisk(xml_info)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(xmltodict.parse(self.dm.expected_info_list[self.expected_result_index]), r['result']):
             LogPrint().info("PASS: The returned status code and messages are CORRECT.")
         else:
             LogPrint().error("FAIL: The returned messages are INCORRECT.")
             self.flag = False
     else:
         LogPrint().error("FAIL: The returned status code is '%s' while it should be '%s'." % (r['status_code'], self.dm.expected_status_code))
         self.flag = False
     self.assertTrue(self.flag)
     self.expected_result_index += 1
コード例 #14
0
ファイル: Profile.py プロジェクト: yqylove/oVirt3.3WebAPITest
 def test_CreateProfile_DupName(self):
     '''
     @note: 操作失败,检查返回状态码和提示信息
     '''
     self.flag = True
     LogPrint().info("Test: Create a dupname profile for network %s."% self.dm.nw_name)
     r = self.proapi.createProfiles(self.dm.profile_info, self.nw_id)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(r['result'], xmltodict.parse(self.dm.expected_info)):
             LogPrint().info("PASS: The returned status code and messages are CORRECT when create dup profile.")
         else:
             LogPrint().error("FAIL: The returned messages are INCORRECCT when create dup profile.")
             self.flag = False
     else:
         LogPrint().error("FAIL: The returned status code is '%s', INCORRECT. " % r['status_code'])
         self.flag = False
     self.assertTrue(self.flag)
コード例 #15
0
 def test_CreateDisk_VerifyName(self):
     '''
     @summary: 验证名称合法性:包含非法字符
     @note: 操作失败,验证返回状态码及报错信息
     ''' 
     diskapi = DiskAPIs()
     LogPrint().info("Test: Create disk and verify name.")
     r = diskapi.createDisk(self.dm.disk_info)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(xmltodict.parse(self.dm.expected_info), r['result']):
             LogPrint().info("PASS: The returned status code and messages are CORRECT.")
         else:
             LogPrint().error("FAIL: The returned messages are INCORRECT.")
             self.flag = False
     else:
             LogPrint().error("FAIL: The returned status code is '%s' while it should be '%s'." % (r['status_code'], self.dm.expected_status_code))
             self.flag = False
     self.assertTrue(self.flag)
コード例 #16
0
ファイル: Profile.py プロジェクト: yqylove/oVirt3.3WebAPITest
 def test_UpdateNetwork(self):
     '''
     @summary: 编辑配置集,更改所属网络
     @note: 操作失败,验证返回状态码,验证报错信息
     ''' 
     self.flag = True
     LogPrint().info("Test: Update profile %s.Change its network."%self.dm.profile_name)
     r = self.proapi.updateProfile(self.dm.profile_name, self.nw_id, self.dm.update_info)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(r['result'], xmltodict.parse(self.dm.expected_info)):
             LogPrint().info("PASS: The returned status code and messages are CORRECT when update dup network.")
         else:
             LogPrint().error("FAIL: The returned messages are INCORRECCT when update dup network.")
             self.flag = False
     else:
         LogPrint().error("FAIL: The returned status code is '%s', INCORRECT. " % r['status_code'])
         self.flag = False
     self.assertTrue(self.flag)
コード例 #17
0
 def test_DeleteDisk_AttachtoTemp(self): 
     '''
     @summary: 删除附加到模板的磁盘
     @note: 操作失败,验证返回验证码及报错信息
     '''
     self.flag = True
     LogPrint().info("Test: Delete disk attached to template.")
     r = DiskAPIs().deleteDisk(self.disk_id_temp)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(xmltodict.parse(self.dm.expected_info), r['result']):
             LogPrint().info("PASS: The returned status code and messages are CORRECT.")
         else:
             LogPrint().error("FAIL: The returned messages are INCORRECT.")
             self.flag = False
     else:
         LogPrint().error("FAIL: The returned status code is '%s' while it should be '%s'." % (r['status_code'], self.dm.expected_status_code))
         self.flag = False
     self.assertTrue(self.flag)
コード例 #18
0
 def test_CreateNetwork_DupVlan(self):
     '''
     @summary: 创建网络,vlan id重复
     @note: 操作失败,检查返回状态码和报错信息
     '''
     LogPrint().info("Test: Create network %s.Set its vlan id 2."%self.dm.nw_name2)
     r = self.nwapi.createNetwork(self.dm.nw_info2)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(r['result'], xmltodict.parse(self.dm.expected_info)):
             LogPrint().info("PASS: Returned status code and messages are CORRECT when create dup_vlan network.")
             self.flag = True
         else:
             LogPrint().error("FAIL: Returned messages are INCORRECCT when create dup_vlan network.")
             self.flag = False
     else:
         LogPrint().error("FAIL: Returned status code is '%s', INCORRECT. " % r['status_code'])
         self.flag = False
     self.assertTrue(self.flag)
コード例 #19
0
 def test_DeleteDisk_AttachtoRunVm(self): 
     '''
     @summary: 删除附加到运行虚拟机的磁盘
     @note: 操作失败,验证返回状态码和报错信息
     '''
     self.flag = True
     LogPrint().info("Test: Delete disk %s attached to running vm %s."% (self.dm.disk_name, self.dm.vm_name))
     r = self.diskapi.deleteDisk(self.disk_id)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(xmltodict.parse(self.dm.expected_info), r['result']):
             LogPrint().info("PASS: The returned status code and messages are CORRECT.")
         else:
             LogPrint().error("FAIL: The returned messages are INCORRECT.")
             self.flag = False
     else:
         LogPrint().error("FAIL: The returned status code is '%s' while it should be '%s'." % (r['status_code'], self.dm.expected_status_code))
         self.flag = False
     self.assertTrue(self.flag)
コード例 #20
0
 def test_UpdateNetwork(self):
     #对network001进行编辑:名称修改为network002 
     '''
     @summary: 编辑网络重名
     @note: 操作失败,检查返回状态码和报错信息
     ''' 
     LogPrint().info("Test: Update network %s.Set its name be %s."%(self.dm.nw_name1, self.dm.nw_name2))
     r = self.nwapi.updateNetwork(self.dm.nw_name1, self.dm.dc_name, self.dm.update_info)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(r['result'], xmltodict.parse(self.dm.expected_info)):
             LogPrint().info("PASS: The returned status code and messages are CORRECT when update dup network.")
             self.flag = True
         else:
             LogPrint().error("FAIL: The returned messages are INCORRECCT when update dup network.")
             self.flag = False
     else:
         LogPrint().error("FAIL: The returned status code is '%s', INCORRECT. " % r['status_code'])
         self.flag = False
     self.assertTrue(self.flag)
コード例 #21
0
ファイル: Profile.py プロジェクト: yqylove/oVirt3.3WebAPITest
 def test_CreateProfile_VerifyName(self):
     '''
     @summary: 验证名称合法性:包含非法字符
     @note: 操作失败,验证返回状态码和报错信息
     ''' 
     self.proapi = ProfilesAPIs()
     self.flag = True
     LogPrint().info("Test: Create a profile for network %s."%self.dm.nw_name)
     r = self.proapi.createProfiles(self.dm.profile_info, self.nw_id)
     if r['status_code']==self.dm.expected_status_code:
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(xmltodict.parse(self.dm.expected_info), r['result']):
             LogPrint().info("PASS: The returned status code and messages are CORRECT.")
         else:
             LogPrint().error("FAIL: The returned messages are INCORRECT.")
             self.flag = False
     else:
         LogPrint().error("FAIL: The returned status code is '%s' while it should be '%s'." % (r['status_code'], self.dm.expected_status_code))
         self.flag = False
     self.assertTrue(self.flag)
コード例 #22
0
ファイル: Profile.py プロジェクト: yqylove/oVirt3.3WebAPITest
 def test_GetProfileInfo_byname(self):
     '''
     @summary: 根据配置集名称获取其信息
     @note: 操作成功,验证返回状态码,验证接口返回信息
     '''
     self.flag = True
     r = self.proapi.getProfileInfo(profile_name=self.dm.profile_name, nw_id=self.nw_id)
     LogPrint().info("Test-1: Get profile %s by NAME."%self.dm.profile_name)
     if r['status_code'] == self.dm.expected_status_code:
         dict_actual = r['result']
         dict_expected = xmltodict.parse((self.dm.profile_info %self.nw_id))
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info("PASS: Get Profile info SUCCESS." )
         else:
             LogPrint().error("FAIL:Returned Profile info INCORRECT.")
             self.flag = False
     else:
         LogPrint().error("FAIL: Returned status code is %s not %s. "% (r['status_code'], self.dm.expected_status_code) )
         self.flag = False
     self.assertTrue(self.flag)
コード例 #23
0
 def test_CreateTemplate_VerifyName(self):
     '''
     @summary: 创建模板,名称不合法
     @note: 操作失败,验证返回状态码和返回信息
     '''
     self.tempapi = TemplatesAPIs()
     LogPrint().info("Test: Create template %s." % self.dm.temp_name)
     r = self.tempapi.createTemplate(self.dm.temp_info)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         d1 = xmltodict.parse(self.dm.expected_info)
         if dictCompare.isSubsetDict(d1, r['result']):
             LogPrint().info(
                 "PASS: Returned status code and messages are CORRECT when create host with dup name."
             )
         else:
             LogPrint().error("FAIL: Returned messages are incorrectly.")
             self.flag = False
     else:
         LogPrint().error("FAIL: Status-code is WRONG.")
         self.assertTrue(False)
コード例 #24
0
ファイル: Profile.py プロジェクト: yqylove/oVirt3.3WebAPITest
 def test_UpdateProfile(self): 
     '''
     @summary: 编辑配置集
     @note: 操作成功,验证返回状态码,验证接口返回信息
     ''' 
     self.flag = True
     LogPrint().info("Test: Update profile %s of network %s."%(self.dm.profile_name, self.dm.nw_name))
     r = self.proapi.updateProfile(self.dm.profile_name, self.nw_id, self.dm.update_info)
     if r['status_code'] == self.dm.expected_status_code:
         dict_actual = r['result']
         dict_expected = xmltodict.parse(self.dm.update_info)
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info("PASS: Update Profile info SUCCESS." )
         else:
             LogPrint().error("FAIL: Update Profile info INCORRECT.")
             self.flag = False
     else:
         LogPrint().error("FAIL: The returned status code is '%s' while it should be '%s'." % (r['status_code'], self.dm.expected_status_code)  )            
         self.flag = False
     self.assertTrue(self.flag)
コード例 #25
0
 def test_UpdateNetwork(self):
     '''
     @summary: 编辑网络
     @note: 操作成功,检查返回状态码和网络信息
     ''' 
     LogPrint().info("Test: Update network %s."%self.dm.nw_name)
     r = self.nwapi.updateNetwork(self.dm.nw_name, self.dm.dc_name, self.dm.update_info)
     if r['status_code'] == self.dm.expected_status_code:
         dict_actual = r['result']
         dict_expected = xmltodict.parse(self.dm.update_info)
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info("PASS: Update Network info SUCCESS." )
             self.flag = True
         else:
             LogPrint().error("FAIL: Update Network info INCORRECT.")
             self.flag = False
     else:
         LogPrint().error("FAIL: Update Network info FAILED. Returned status code '%s' is WRONG." % r['status_code'] )
         self.flag = False
     self.assertTrue(self.flag)
コード例 #26
0
 def test_CreateTemplateNic_NoRequired(self):
     '''
     @summary: 为模板创建网络接口,缺少必填项
     @note: 操作失败,验证返回状态码和返回信息
     '''
     tempnic_api = TemplateNicsAPIs()
     LogPrint().info("Test: Create nic for this template.")
     r = tempnic_api.createTemplateNic(self.dm.temp_name, self.dm.nic_data)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         expected_result = xmltodict.parse(self.dm.expected_info)
         actual_result = r['result']
         if dictCompare.isSubsetDict(expected_result, actual_result):
             LogPrint().info(
                 "PASS: The returned status code and messages are CORRECT.")
         else:
             LogPrint().error("FAIL: Returned messages are incorrectly.")
             self.flag = False
     else:
         LogPrint().error("FAIL: The status_code is WRONG")
         self.flag = False
     self.assertTrue(self.flag)
コード例 #27
0
    def test_GetClusterNetworkInfo(self):
        '''
        @summary: 测试用例执行步骤
        @note: 操作成功,验证网络信息
        '''
        LogPrint().info("Test: Get the cluster %s's network info. " %
                        self.dm.cluster_name)
        r = self.clusterapi.getClusterNetworkInfo(self.dm.cluster_name,
                                                  self.dm.nw_name)
        dict_actual = r
        dict_expected = xmltodict.parse(self.dm.nw_info)
        dictCompare = DictCompare()
        if dictCompare.isSubsetDict(dict_expected, dict_actual):
            LogPrint().info("PASS: Get ClusterNetwork '%s' info SUCCESS." %
                            self.dm.nw_name)


#                 return True
        else:
            LogPrint().error("FAIL: Returned message is WRONG. ")
            self.flag = False
        self.assertTrue(self.flag)
コード例 #28
0
 def test_CreateNetwork(self): 
     '''
     @summary: 测试用例执行步骤
     @note: (1)新建网络;
     @note: (2)验证接口返回的状态码、接口信息是否正确。
     '''
     LogPrint().info("Test: Create network %s."%self.dm.nw_name)
     r = self.nwapi.createNetwork(self.dm.nw_info)
     if r['status_code'] == self.dm.expected_status_code:
         dict_actual = r['result']
         dict_expected = xmltodict.parse(self.dm.nw_info)
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info("PASS: Create Network SUCCESS." )
             self.flag = True
         else:
             LogPrint().error("FAIL: Network's info INCORRECT.")
             self.flag = False
     else:
         LogPrint().error("FAIL: Create Network FAILED. Returned status code '%s' is Wrong." % r['status_code'] )
         self.flag = False
     self.assertTrue(self.flag)
コード例 #29
0
    def test_GetDiskInfo(self):
        '''
        @summary: 根据磁盘id获取磁盘信息
        @note: 操作成功,验证返回状态码,验证磁盘信息
        '''
        LogPrint().info("Test: Get disk %s info."% self.dm.disk_name)
        diskapi = DiskAPIs() 
        r = diskapi.getDiskInfo(self.disk_id)
        if r['status_code'] == self.dm.expected_status_code:
            dict_actual = r['result']
            dict_expected = xmltodict.parse(self.dm.disk_info)
            dictCompare = DictCompare()
            if dictCompare.isSubsetDict(dict_expected, dict_actual):
                LogPrint().info("PASS:Get disk %s info SUCCESS."% self.dm.disk_name)
#                 return True
            else:
                LogPrint().error("FAIL:Returned disk info is WRONG.")
                self.flag = False
        else:
            LogPrint().error("FAIL: Returned status code is %s. "% r['status_code'])
            self.flag = False
        self.assertTrue(self.flag)
コード例 #30
0
 def test_GetNetworkProfileInfo(self):
     '''
     @summary: 获取网络的配置集信息
     @note: 操作成功,验证返回码和接口信息
     '''
     self.nwproapi = NetworkProfilesAPIs()
     LogPrint().info("Test: Get network %s's profile %s info." % (self.dm.nw_name, self.dm.profile_name))
     r = self.nwproapi.getNetworkProfileInfo(self.nw_id, self.dm.profile_name)
     if r['status_code']==self.dm.expected_status_code:
         dict_actual = r['result']
         dict_expected = xmltodict.parse((self.dm.profile_info %self.nw_id))
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info("PASS: Get network %s's profile %s info SUCCESS." % (self.dm.nw_name, self.dm.profile_name) )
             self.flag = True
         else:
             LogPrint().error("FAIL: Returned messages are INCORRECT.")
             self.flag = False
     else:
         LogPrint().error("FAIL: Get NetworkProfile Info FAILED. Returned status code '%s' is WRONG." % r['status_code'] )
         self.flag = False
     self.assertTrue(self.flag)