當前位置: 首頁>>代碼示例>>Python>>正文


Python NsmUtil.isPerfClass方法代碼示例

本文整理匯總了Python中isp.nsmUtil.NsmUtil.isPerfClass方法的典型用法代碼示例。如果您正苦於以下問題:Python NsmUtil.isPerfClass方法的具體用法?Python NsmUtil.isPerfClass怎麽用?Python NsmUtil.isPerfClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在isp.nsmUtil.NsmUtil的用法示例。


在下文中一共展示了NsmUtil.isPerfClass方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run

# 需要導入模塊: from isp.nsmUtil import NsmUtil [as 別名]
# 或者: from isp.nsmUtil.NsmUtil import isPerfClass [as 別名]
    def run(self, catalog, testCaseFileName, online, pod=None, currentObject=None):
        testCaseFilePath = Define._PathTestCase + '/' + testCaseFileName
        json_data = open(testCaseFilePath)
        self._logger.debug('test case json file path: ' + testCaseFilePath)
        data = json.load(json_data)
        #pprint(data)
        json_data.close()
                                
        for className, testSuite in data.items():
            NsmUtil.printHeadLine1(' class: ' + className )
            
            #thisObject = eval(className)(catalog, None, None, None, None)
            #name = None
            
            thisObject = None
            name = None
            if currentObject:
                thisObject = currentObject
                name = thisObject.createName
                self._thisObject = thisObject
            else:
                thisObject = eval(className)(catalog, None, None, None, None)
                
                            
            for testCase in testSuite:
                
                self._totalTestCase += 1
                
                testCaseId = None
                action = None
                category = None
                requestBodyFileName = None
                description = None
                
                testCaseId = testCase['id']
                action = testCase['action']
                category = testCase['category']
                
                
                if 'skip' in testCase.keys() and testCase['skip'] == 'true': 
                    self._logger.info('skip this test case')
                    self._resultList.append([className, name, action, category, str(testCaseId), 'skipped'])
                    continue
                
                if 'online' in testCase.keys() and testCase['online'] == 'true': online = True
                if 'request.body.file' in testCase.keys(): requestBodyFileName = testCase['request.body.file']
                
                
                if 'name' in testCase.keys(): 
                    name = testCase['name']
                    
                    if Define._StressTest:
                        name = self.getStressObjectName(name, className)
                            
                         
                if 'description' in testCase.keys(): description = testCase['description']
                
                for ipv4StartKey, ipv4StartValue in testCase.items():
                    if ipv4StartKey.endswith('ipv4.start'):
                        if ipv4StartValue == 'InternetEdgeZoneLayer3VlanReservedIpAddress':
                            oneIpAddress = self._internetEdgeZoneLayer3VlanReservedIpAddressList.pop()
                            testCase[ipv4StartKey] = oneIpAddress
                            ipv4EndKey = ipv4StartKey.replace('.ipv4.start', '.ipv4.end')
                            testCase[ipv4EndKey] = oneIpAddress
                        elif ipv4StartValue == 'SecuredInternetEdgeZoneLayer3VlanReservedIpAddress':
                            oneIpAddress = self._securedInternetEdgeZoneLayer3VlanReservedIpAddressList.pop()
                            testCase[ipv4StartKey] = oneIpAddress
                            ipv4EndKey = ipv4StartKey.replace('.ipv4.start', '.ipv4.end')
                            testCase[ipv4EndKey] = oneIpAddress   
                
                if 'uids' in testCase.keys():
                    for oneUid in testCase['uids']:
                        uidVariable = oneUid['variable']
                        uidClassName = oneUid['class']
                        uidObjectName = oneUid['name'] 
                        
                        if Define._StressTest:
                            uidObjectName = self.getStressObjectName(uidObjectName, uidClassName)
                            
                        testCase[uidVariable] = self.getUid(uidClassName, uidObjectName)
                        if not testCase[uidVariable]:
                            self._logger.error('-------->>>>>> uid for ' + uidClassName + ' [' + uidObjectName + '] can not be None' )
                            continue
                    del testCase['uids']
                
                if action != 'update':
                    NsmUtil.printHeadLine2(className + ' [' + name + '] - ' + action + ' - ' + category + ' - test case ' + str(testCaseId))
                
            
                try:
                
                    if action == 'create':
                        if online: thisObject.setOnLine()
                        elif not online: thisObject.setOffLine()
                        
                        
                        if Define._Performance and NsmUtil.isPerfClass(className):
                            Define._CurrentPerfClassName = className
                            Define._CurrentPerfObjectName = name
                            Define._CurrentPerfAction = action
#.........這裏部分代碼省略.........
開發者ID:huhe56,項目名稱:nsm-rest-api,代碼行數:103,代碼來源:test.py


注:本文中的isp.nsmUtil.NsmUtil.isPerfClass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。