当前位置: 首页>>代码示例>>Python>>正文


Python NsmUtil.printHeadLine2方法代码示例

本文整理汇总了Python中isp.nsmUtil.NsmUtil.printHeadLine2方法的典型用法代码示例。如果您正苦于以下问题:Python NsmUtil.printHeadLine2方法的具体用法?Python NsmUtil.printHeadLine2怎么用?Python NsmUtil.printHeadLine2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在isp.nsmUtil.NsmUtil的用法示例。


在下文中一共展示了NsmUtil.printHeadLine2方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getDetail

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine2 [as 别名]
 def getDetail(self, testCaseId):
     
     NsmUtil.printHeadLine2('START: get detail test case ' + testCaseId)
     
     nameDash = self.createName.replace(' ', '-')
     debugDetailFilePath = Define._PathResponseCreateDefault + '/' + nameDash + '-detail-' + testCaseId + '.xml'
     
     if (self.isOffLine):
         self.logger.debug('get detail from file: ' + debugDetailFilePath)
         self.detailXml = Util.readFile(debugDetailFilePath)
     else:    
         try:
             self.getDetailUrl = Util.getXpathValue(self.createTaskXml, XPath._TaskElementUid)
         except:
             self.getDetailUrl = self.uid
         self.logger.info('get detail url: ' + self.getDetailUrl)
         self.detailXml = HttpUtil.doGet(self.getDetailUrl, Define._credential) if self.getDetailUrl and self.getDetailUrl != '' else None
         if self.detailXml:
             self.logger.debug('write detail to file: ' + debugDetailFilePath)
             Util.writeFile(debugDetailFilePath, self.detailXml)
                 
     if self.detailXml:
         self.uid = Util.getXpathValue(self.detailXml, XPath._DetailUid)
         self.logger.info('uid for ' + self.createName + ': ' + self.uid)
         self.getCatalogUrl = Util.getXpathValue(self.detailXml, XPath._DetailLinkCatalog)
         Element._uidList.append([self.uid, self.mySubClassName, self.createName])
     
     NsmUtil.printHeadLine2('END: get detail test case ' + testCaseId)
     return self.detailXml
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:31,代码来源:element.py

示例2: create

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine2 [as 别名]
 def create(self, testCaseId):
     
     NsmUtil.printHeadLine2('START: create test case ' + testCaseId)
     
     Element.populateCreateParameter(self)
     
     requestBody = Util.readFile(self.requestBodyFilePath)
     requestBody = requestBody.replace('${uid}', self.createUid)
     requestBody = requestBody.replace('${name}', self.createName)
     requestBody = requestBody.replace('${description}', self.createDescription)
     
     for key, value in self.requestParams.items():
         keyStr = '${' + key + '}'
         requestBody = requestBody.replace(keyStr, value)
     
     self.logger.info('create request: ' + self.catalogCreateUrl)
     
     # pod creation request body is too huge, skip it
     if self.mySubClassName != 'Pod':
         self.logger.info('request body: ' + "\n\n" + requestBody +"\n")
     
     nameDash = self.createName.replace(' ', '-')
     debugCreateFilePath = Define._PathResponseCreateDefault + '/' + nameDash + '-create-' + testCaseId + '.xml'
     
     status = None
     if (self.isOffLine):
         timeStart = datetime.now()
         
         self.logger.debug('get create task from file: ' + debugCreateFilePath)
         self.createTaskXml = Util.readFile(debugCreateFilePath)
         
         myTask = Task(self.createTaskXml)
         status = myTask.checkResult()
         self.createTaskXml = myTask.taskXml
         
         if Define._Performance and Define._CurrentPerfAction:
             timeEnd = datetime.now()
             Define._PerformanceData.setCurrentTenantClassLog(Define._CurrentPerfClassName, Define._CurrentPerfObjectName, Define._CurrentPerfAction, timeStart, timeEnd)
         
     else:
         timeStart = datetime.now()
         
         self.createTaskXml = HttpUtil.doPost(self.catalogCreateUrl, Define._credential, requestBody)
         self.logger.debug('write pending create task to file: ' + debugCreateFilePath + '-pending.xml')
         Util.writeFile(debugCreateFilePath+'-pending.xml', self.createTaskXml)
         
         myTask = Task(self.createTaskXml)
         status = myTask.checkResult()
         self.createTaskXml = myTask.taskXml
 
         if Define._Performance and Define._CurrentPerfAction:
             timeEnd = datetime.now()
             Define._PerformanceData.setCurrentTenantClassLog(Define._CurrentPerfClassName, Define._CurrentPerfObjectName, Define._CurrentPerfAction, timeStart, timeEnd)
 
         self.logger.info('write final create task to file ' + debugCreateFilePath)
         #self.logger.info(self.createTaskXml)
         Util.writeFile(debugCreateFilePath, self.createTaskXml)
         
     NsmUtil.printHeadLine2('END: create test case ' + testCaseId)
     return status
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:62,代码来源:element.py

示例3: verifyCreate

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine2 [as 别名]
 def verifyCreate(self):
     if self.mySubClassName != 'Pod' and self.isOffLine and self.createTaskXml: self.logger.info(Util.prettfyXmlByString(self.createTaskXml))
     
     NsmUtil.printHeadLine2('START: create response verification: parameters from request body')
     
     status = True
     for key, value in self.requestParams.items():
         keyItems = key.split('.')
         pattern = None
         if key.endswith('.ipv4.start'):
             pattern = '<ipv4Start>' + value + '</ipv4Start>'
         elif key.endswith('.ipv4.end'):
             pattern = '<ipv4End>' + value + '</ipv4End>'
         elif key.endswith('.ipv4') or key.endswith('.mask') or key.endswith('.protocol') or key.endswith('.start') or key.endswith('.end') or key.endswith('.ASNumber') or key.endswith('.uid') or key == 'name' or key == 'description':
             pattern = '<' + keyItems[-1] + '>' + value + '</' + keyItems[-1] + '>'
         elif key.endswith('.netmask'):
             pattern = '<integer>' + value + '</integer>'
         elif key.startswith('serverfarm.probe.') or key == 'lb.algorithm':
             pattern = '<string>' + value + '</string>'
         elif key.endswith('redirect.port'):
             pattern = '<redirectPort>' + value + '</redirectPort>'
         
         if pattern:
             if self.createTaskXml.find(pattern) < 0:
                 status = False
                 NsmUtil.printStatusHeadLine2('Failed: pattern not found: ' + pattern)
             else:
                 NsmUtil.printStatusHeadLine2('Passed: pattern found: ' + pattern)
             
     NsmUtil.printHeadLine2('END: create response verification: parameters from request body')
     return status
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:33,代码来源:element.py

示例4: delete

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine2 [as 别名]
    def delete(self, testCaseId):
        
        NsmUtil.printHeadLine2('START: delete test case ' + testCaseId)

        self.deleteUrl = self.uid + '/delete'
        nameDash = self.createName.replace(' ', '-')
        debugDeleteFilePath = Define._PathResponseDelete + '/' + nameDash + '-delete-' + testCaseId + '.xml'
        self.logger.info('delete url: ' + self.deleteUrl)
        
        status = None
        if (self.isOffLine):
            self.logger.debug('get delete task from file: ' + debugDeleteFilePath)
            self.deleteTaskXml = Util.readFile(debugDeleteFilePath)
            
            myTask = Task(self.deleteTaskXml)
            status = myTask.checkResult()
            self.deleteTaskXml = myTask.taskXml
        else:
            self.deleteTaskXml = HttpUtil.doPost(self.deleteUrl, Define._credential)
            self.logger.debug('write pending delete task to file: ' + debugDeleteFilePath + '-pending.xml')
            Util.writeFile(debugDeleteFilePath+'-pending.xml', self.deleteTaskXml)
            
            myTask = Task(self.deleteTaskXml)
            status = myTask.checkResult()
            self.deleteTaskXml = myTask.taskXml
    
            self.logger.info('write to file ' + debugDeleteFilePath)
            #self.logger.info(self.deleteTaskXml)
            Util.writeFile(debugDeleteFilePath, self.deleteTaskXml)
             
        NsmUtil.printHeadLine2('END: delete test case ' + testCaseId)
        return status
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:34,代码来源:element.py

示例5: start2

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine2 [as 别名]
 def start2():
     test = TestSimple()
     test.start()
     NsmUtil.saveUid(test._uidList)
     NsmUtil.saveResult(test._resultList)
     NsmUtil.printHeadLine2('total test case: ' + str(test._totalTestCase))
     NsmUtil.printHeadLine1('test completed')
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:9,代码来源:test-simple-update.py

示例6: reset

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine2 [as 别名]
 def reset(self):
     evalMap = {
         '${tftp-server-host}': DeviceDefine._TFTPHost,
     }
     resetCmdList = self._cmdMap['reset']
     resetCmdList = DeviceElement.evaluate(resetCmdList, evalMap)
     NsmUtil.printHeadLine2('reset device to base line config')
     return self.processCmdList(resetCmdList)
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:10,代码来源:deviceElement.py

示例7: copy

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine2 [as 别名]
 def copy(self):
     evalMap = {
         '${tftp-server-host}': DeviceDefine._TFTPHost, 
         '${host-name}': self._host,
     }
     copyCmdList = self._cmdMap['copy']
     copyCmdList = DeviceElement.evaluate(copyCmdList, evalMap)
     NsmUtil.printHeadLine2('copy running config to tftp server')
     return self.processCmdList(copyCmdList)
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:11,代码来源:deviceElement.py

示例8: getReservations

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine2 [as 别名]
 def getReservations(self, testCaseId):
     
     NsmUtil.printHeadLine2('START: get ip reservation test case ' + str(testCaseId))
     
     allocatedUrl = self.relLinkDictionary['nsmr:ipreservations']
     responseFileName = self.createName + '-reservations-' + testCaseId + '.xml'
     responseFilePath = Define._PathResponseCreateDefault + '/' + responseFileName
     responseFilePath = responseFilePath.replace(' ', '-')
     responseXml = Element.getRequest(self, allocatedUrl, responseFilePath)
 
     NsmUtil.printHeadLine2('END: get ip reservation test case ' + str(testCaseId))
     return responseXml
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:14,代码来源:element.py

示例9: verifyUpdate

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine2 [as 别名]
 def verifyUpdate(self, updateVerificationPatternList, storage):
     if self.mySubClassName != 'Pod' and self.isOffLine and self.updateTaskXml: self.logger.info(Util.prettfyXmlByString(self.updateTaskXml))
     
     NsmUtil.printHeadLine2('START: update response verification: parameters from request body')
     
     status = True
     for pattern in updateVerificationPatternList:
         if self.updateTaskXml.find(pattern) < 0:
             status = False
             NsmUtil.printStatusHeadLine2('Failed: pattern not found: ' + pattern)
         else:
             NsmUtil.printStatusHeadLine2('Passed: pattern found: ' + pattern)
     
     NsmUtil.printHeadLine2('END: update response verification: parameters from request body')
     return status
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:17,代码来源:element.py

示例10: testIpAddressPool

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine2 [as 别名]
 def testIpAddressPool(self, provider, poolType, online):
     NsmUtil.printHeadLine2('IpAddressPool' + ' [' + poolType + '] - ' + 'detail' + ' - ' + 'positive' + ' - test case ' + str(1))
     self._totalTestCase += 1
     
     ipAddressPoolUid = None
     if poolType == 'Global': ipAddressPoolUid = provider.getGlobalIpAddressPoolUid()
     else: ipAddressPoolUid = provider.getInfrastructureIpAddressPoolUid()
     
     ipAddressPool = IpAddressPool(ipAddressPoolUid, 'Provider', poolType)
     if not online: ipAddressPool.setOffLine()
     ipAddressPoolDetail = ipAddressPool.getDetail()
     assert ipAddressPoolDetail
     result = NsmUtil.printResult(ipAddressPoolDetail, 'positive')
     self._resultList.append(['IpAddressPool', poolType, 'detail', 'positive', str(1), str(result)])
     return ipAddressPool
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:17,代码来源:test-devkit.py

示例11: start1

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine2 [as 别名]
    def start1():
        test = TestSimple()
        try:
            test.start()
        except: 
            test._logger.error('!!!!!!!!!!!!! something is wrong !!!!!!!!!!!!!')
            errorType = sys.exc_info()[0]
            errorValue = sys.exc_info()[1]
            errorTraceBack = traceback.extract_tb(sys.exc_info()[2])
            test._logger.error('Error Type: ' + str(errorType))
            test._logger.error('Error Value: ' + str(errorValue))
            test._logger.error('Traceback: ')
            for oneStack in errorTraceBack:
                test._logger.error(oneStack)
                
        NsmUtil.saveUid(test._uidList)
        NsmUtil.saveResult(test._resultList)
        NsmUtil.printHeadLine2('total test case: ' + str(test._totalTestCase))
        NsmUtil.printHeadLine1('test completed')
        
        if (not Define._DummyAgent and TestSimple.__online1 and TestSimple.__online2 and TestSimple.__online3 and TestSimple.__online4 and TestSimple.__online5):
            time.sleep(300)
            
        if Define._SaveNSMLog:
            Reset.saveNSMLog()
        if Define._CopyCreateRunningConfig:
            Reset.copyCreateRunningConfig()
                
        if Define._DeviceVerification:
            perl = '/usr/local/ActivePerl-5.16/bin/perl'
            dirNSMPerl = '/Users/huhe/Install/workspace/NSM-NBAPI-Perl'
            dirDeviceVerification = dirNSMPerl + '/device-verification'
            cmdPerlNSM = dirDeviceVerification + '/NSM.pl'
            cmdPerlParse = dirDeviceVerification + '/Parse.pl'
            cmdPerlProcess = dirDeviceVerification + '/Process.pl'
            
            p = subprocess.Popen(perl + ' ' + cmdPerlNSM, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
            for line in p.stdout.readlines(): print line
            retval = p.wait()
            
            p = subprocess.Popen(perl + ' ' + cmdPerlParse, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
            for line in p.stdout.readlines(): print line
            retval = p.wait()

            p = subprocess.Popen(perl + ' ' + cmdPerlProcess, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
            for line in p.stdout.readlines(): print line
            retval = p.wait()
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:49,代码来源:test-simple.py

示例12: verifyParamemtersExist

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine2 [as 别名]
 def verifyParamemtersExist(self, params, responseXml):
     NsmUtil.printHeadLine2('START: response verification: paramemters exist in response verification')
     #if self.mySubClassName != 'Pod': self.logger.info(responseXml)
     status = True
     for param in params:
         if responseXml.find(param) < 0:
             status = False
             NsmUtil.printStatusHeadLine2('Failed: pattern not found: ' + param)
         else:
             NsmUtil.printStatusHeadLine2('Passed: pattern found: ' + param)
             
     NsmUtil.printHeadLine2('END: response verification: paramemters exist in response verification')
     return status
 
 
     
     
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:15,代码来源:element.py

示例13: update

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine2 [as 别名]
    def update(self, objectClassName, requestBody, category, testCaseId):
        
        NsmUtil.printHeadLine2('START: update test case ' + str(testCaseId))
        
        self.updateUrl = self.uid + '/put'
        self.logger.info('update request url: ' + self.updateUrl)
        if self.mySubClassName != 'Pod':
            self.logger.info('request body: ' + "\n\n" + requestBody +"\n")
        else:
            podRequestFilePath = Define._PathLog + '/pod-request-body.xml'
            Util.writeFile(podRequestFilePath, requestBody)
        
        name = self.createName + ' Update ' + category + ' ' + str(testCaseId) 
        nameDash = name.replace(' ', '-')
        
        debugUpdateClassPath = Define._PathResponseUpdate + '/' + objectClassName
        Util.mkdir(debugUpdateClassPath)
        debugUpdateFilePath = debugUpdateClassPath + '/' + nameDash + '.xml'
        
        status = None
        if (self.isOffLine):
            self.logger.debug('get update task from file: ' + debugUpdateFilePath)
            self.updateTaskXml = Util.readFile(debugUpdateFilePath)
            
            myTask = Task(self.updateTaskXml)
            status = myTask.checkResult()
            self.updateTaskXml = myTask.taskXml
        else:
            self.updateTaskXml = HttpUtil.doPost(self.updateUrl, Define._credential, requestBody)
            if not self.updateTaskXml:
                return False
                
            self.logger.debug('write pending update task to file: ' + debugUpdateFilePath + '-pending.xml')
            Util.writeFile(debugUpdateFilePath+'-pending.xml', self.updateTaskXml)
            
            myTask = Task(self.updateTaskXml)
            status = myTask.checkResult()
            self.updateTaskXml = myTask.taskXml

            self.logger.info('write final update task to file ' + debugUpdateFilePath)
            #self.logger.info(self.updateTaskXml)
            Util.writeFile(debugUpdateFilePath, self.updateTaskXml)
                
        NsmUtil.printHeadLine2('END: update test case ' + str(testCaseId))
        return status
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:47,代码来源:element.py

示例14: verifyUpdate

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine2 [as 别名]
 def verifyUpdate(self, updateVerificationPatternList, storage):
     NsmUtil.printHeadLine2('START: update response verification')
             
     vrfDeviceName1 = 'l3.aggregation.switch.1.mgmt.addr'
     vrfDeviceName2 = 'l3.aggregation.switch.2.mgmt.addr'
     vrfDeviceIP1 = self.pod.getParameterStringValueByName(vrfDeviceName1)
     vrfDeviceIP2 = self.pod.getParameterStringValueByName(vrfDeviceName2)
     param1 = '<ipv4>' + vrfDeviceIP1 + '</ipv4>'
     param2 = '<ipv4>' + vrfDeviceIP2 + '</ipv4>'
     params = [param1, param2]
     status = Element.verifyParamemtersExist(self, params, self.updateTaskXml)
     
     NsmUtil.printHeadLine2('END: update response verification')
     
     if status: 
         return True
     else:
         return False
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:20,代码来源:edgeZone.py

示例15: start1

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine2 [as 别名]
 def start1():
     test = TestAll()
     try:
         test.start()
     except:
         test._logger.error('!!!!!!!!!!!!! something is wrong !!!!!!!!!!!!!')
         errorType = sys.exc_info()[0]
         errorValue = sys.exc_info()[1]
         errorTraceBack = traceback.extract_tb(sys.exc_info()[2])
         test._logger.error('Error Type: ' + str(errorType))
         test._logger.error('Error Value: ' + str(errorValue))
         test._logger.error('Traceback: ')
         for oneStack in errorTraceBack:
             test._logger.error(oneStack)
             
     NsmUtil.saveUid(test._uidList)
     NsmUtil.saveResult(test._resultList)
     NsmUtil.printHeadLine2('total test case: ' + str(test._totalTestCase))
     NsmUtil.printHeadLine1('test completed')
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:21,代码来源:test-all.py


注:本文中的isp.nsmUtil.NsmUtil.printHeadLine2方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。