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


Python NsmUtil.printHeadLine1方法代码示例

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


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

示例1: start2

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine1 [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

示例2: start1

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine1 [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

示例3: action

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine1 [as 别名]
 def action(deviceType, action):
 
     deviceList = None
     if   deviceType == DeviceDefine._DeviceTypeACESM:  deviceList = DeviceDefine._ACESMDeviceList
     elif deviceType == DeviceDefine._DeviceTypeASASM:  deviceList = DeviceDefine._ASASMDeviceList
     elif deviceType == DeviceDefine._DeviceTypeIOS:    deviceList = DeviceDefine._IOSDeviceList
     elif deviceType == DeviceDefine._DeviceTypeN1K:    deviceList = DeviceDefine._N1KDeviceList
     elif deviceType == DeviceDefine._DeviceTypeNexus:  deviceList = DeviceDefine._NexusDeviceList
     elif deviceType == DeviceDefine._DeviceTypeUCS:    deviceList = DeviceDefine._UCSDeviceList
     elif deviceType == DeviceDefine._DeviceTypeLinux:  deviceList = DeviceDefine._LinuxDeviceList
     elif deviceType == DeviceDefine._DeviceTypeNSVE:   deviceList = DeviceDefine._NSVEDeviceList
     elif deviceType == DeviceDefine._DeviceTypeDSC:    deviceList = DeviceDefine._DSCDeviceList
     
     for hostname, credentials in deviceList.items():
         NsmUtil.printHeadLine1('BEGIN: ' + hostname)
         device = None
         if not credentials:
             if   deviceType == DeviceDefine._DeviceTypeACESM:  device = DeviceACESM(hostname, DeviceDefine._DefaultUsr, DeviceDefine._DefaultPwd)
             elif deviceType == DeviceDefine._DeviceTypeASASM:  device = DeviceASASM(hostname, DeviceDefine._DefaultUsr, DeviceDefine._DefaultPwd)
             elif deviceType == DeviceDefine._DeviceTypeIOS:    device = DeviceIOS(hostname, DeviceDefine._DefaultUsr, DeviceDefine._DefaultPwd)
             elif deviceType == DeviceDefine._DeviceTypeN1K:    device = DeviceN1K(hostname, DeviceDefine._DefaultUsr, DeviceDefine._DefaultPwd)
             elif deviceType == DeviceDefine._DeviceTypeNexus:  device = DeviceNexus(hostname, DeviceDefine._DefaultUsr, DeviceDefine._DefaultPwd)
             elif deviceType == DeviceDefine._DeviceTypeUCS:    device = DeviceUCS(hostname, DeviceDefine._DefaultUsr, DeviceDefine._DefaultPwd)
         else:
             usr = credentials['usr']
             pwd = credentials['pwd']
             if   deviceType == DeviceDefine._DeviceTypeLinux:  device = DeviceLinux(hostname, usr, pwd)
             elif deviceType == DeviceDefine._DeviceTypeNSVE:   device = DeviceNSVE(hostname, usr, pwd)
             elif deviceType == DeviceDefine._DeviceTypeDSC:    device = DeviceDSC(hostname, usr, pwd)
         
         if action == DeviceDefine._DeviceActionReset:
             if deviceType == DeviceDefine._DeviceTypeIOS:
                 archiveName = DeviceDefine._ArchiveNameMap[hostname]
                 device.reset(archiveName)
             else:
                 device.reset()
         elif action == DeviceDefine._DeviceActionCopy:
             device.copy()
         else:
             device.action(action)
             
         device.close()
         NsmUtil.printHeadLine1('END: ' + hostname)
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:45,代码来源:deviceUtil.py

示例4: start1

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine1 [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

示例5: start

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine1 [as 别名]
    def start(self):
        
        Define._PathTestCase = Define._PathTestCase + '-simplified-update'
        
        if (TestSimple.__online1 and TestSimple.__online2 and TestSimple.__online3 and TestSimple.__online4 and TestSimple.__online5): 
            NsmUtil.moveLogResponse()
            NsmUtil.mkPresetDir()
            
            if Define._ResetNSM: Reset.resetNSM()
            
            if not Define._DummyAgent:
                if Define._ResetDevice: 
                    Reset.resetDevice()
                if Define._CopyCleanRunningConfig:
                    Reset.copyRunningConfigToTFTPServer()
                    Reset.copyRunningConfigToTemp('copy-to-tmp-clean')
                if Define._DiffClean:
                    Reset.diffCleanClean()

        test = Test()
        nsmV1 = self.run(None, 'test-nsm-v1.json', TestSimple.__online1)
        nsmV1.getProviderList('301')
        
        catalog = nsmV1.getCatalog()
        top = self.run(catalog, 'test-top.json', TestSimple.__online1)
        
        catalog = top.getCatalog()
        provider = self.run(catalog, 'test-provider.json', TestSimple.__online1)
        
        #sys.exit()
        
        catalog = provider.getCatalog()
        pod = self.run(catalog, 'test-pod-full.json', TestSimple.__online1)        
                                                           
        #sys.exit()
                                                                     
        if TestSimple.__online1: 
            NsmUtil.printHeadLine1('test completed up to Pod')
            if Define._DummyAgent:
                acp = ACP()
                acp.start(Define._UrlHostPortEngine, Define._PathScreenShotFile)
                time.sleep(10)
            else:
                #sys.exit()
                Reset.startController()
                time.sleep(300)
                if Define._SetDSCLoggingDebug:
                    Reset.setDSCLogDebug()
                
        
        catalog = provider.getCatalog()
        tenant = self.run(catalog, 'test-tenant.json', TestSimple.__online2)
        
        catalog = tenant.getCatalog()
        tenantNetworkContainer = self.run(catalog, 'test-tenant-network-container.json', TestSimple.__online2)
        
        
    
        ''' internet zone '''
        catalog = tenant.getCatalog()
        internetExtenalNetwork = self.run(catalog, 'test-internet-external-network.json', TestSimple.__online3)
        
        catalog = tenantNetworkContainer.getCatalog()
        internetEdgeZone = self.run(catalog, 'test-internet-edge-zone.json', TestSimple.__online3, pod)        
        
        catalog = internetEdgeZone.getCatalog()
        internetEdgeZoneLayer3Vlan = self.run(catalog, 'test-internet-edge-zone-layer3-vlan.json', TestSimple.__online3, pod)
        
        catalog = tenantNetworkContainer.getCatalog()
        externalConnection = self.run(catalog, 'test-internet-external-connection.json', TestSimple.__online3, pod)
        
                
        ''' secured internet zone '''
        catalog = tenantNetworkContainer.getCatalog()
        securedInternetEdgeZone = self.run(catalog, 'test-secured-internet-edge-zone.json', TestSimple.__online3, pod)
        
        catalog = securedInternetEdgeZone.getCatalog()
        securedInternetEdgeZoneLayer3Vlan = self.run(catalog, 'test-secured-internet-edge-zone-layer3-vlan.json', TestSimple.__online3, pod)
    
        
        ''' internet zone firewall '''
        catalog = tenant.getCatalog()
        internetFirewallService1 = self.run(catalog, 'test-internet-firewall-service-between-secured-and-unsecured-zone.json', TestSimple.__online3)
        
        catalog = tenant.getCatalog()
        internetFirewallService2 = self.run(catalog, 'test-internet-firewall-service-between-secured-and-external-network.json', TestSimple.__online3)
        
        
        
        ''' private zone '''
        catalog = tenant.getCatalog()
        privateExtenalNetwork = self.run(catalog, 'test-private-external-network.json', TestSimple.__online4)
        
        catalog = tenantNetworkContainer.getCatalog()
        privateEdgeZone = self.run(catalog, 'test-private-edge-zone.json', TestSimple.__online4, pod)
        
        catalog = privateEdgeZone.getCatalog()
        privateEdgeZoneLayer3Vlan = self.run(catalog, 'test-private-edge-zone-layer3-vlan.json', TestSimple.__online4, pod)
        
        catalog = tenantNetworkContainer.getCatalog()
#.........这里部分代码省略.........
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:103,代码来源:test-simple-update.py

示例6: NsmV1

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine1 [as 别名]
    descriptionPrefix = 'This is the description of '
    
    name = 'My Default NSM V1'
    myNsmV1 = NsmV1(None, name)
    myNsmV1.setOnLine()
    myNsmV1.create('001')
    myNsmV1Catalog = myNsmV1.getCatalog('201')
    myNsmV1ProviderList = myNsmV1.getProviderList('301')
    
    firstProviderUidUrl =  Util.getXpathValue(myNsmV1ProviderList, XPath._DetailFirstUidFromList)
    print firstProviderUidUrl
    
    tenantListUrl = firstProviderUidUrl + '/tenant'
    print tenantListUrl

    tenantListXml = NsmUtil.getRequest(tenantListUrl)
    print tenantListXml

    firstTenantUidUrl =  Util.getXpathValue(tenantListXml, XPath._DetailFirstUidFromList)
    print firstTenantUidUrl
    
    name = 'My Default Tenant'
    myTenant = Tenant(None, name, None)
    myTenant.setOnLine()
    myTenant.setUid(firstTenantUidUrl)
    myTenant.delete('501')
    
    NsmUtil.printHeadLine1('Delete tenant completed')
    
    
    
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:30,代码来源:delete-tenant.py

示例7: NsmV1

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine1 [as 别名]
if __name__ == '__main__':
    
    NsmUtil.mkPresetDir()
    
    logger = Util.getLogger(__file__)
    descriptionPrefix = 'This is the description of '
    
    name = 'My Default NSM V1'
    myNsmV1 = NsmV1(None, name)
    myNsmV1.setOnLine()
    myNsmV1.create('001')
    myNsmV1Catalog = myNsmV1.getCatalog('201')
    myNsmV1ProviderList = myNsmV1.getProviderList('301')
    
    firstProviderUidUrl =  Util.getXpathValue(myNsmV1ProviderList, XPath._DetailFirstUidFromList)
    
    name = 'My Default Top'
    myTop = Top(myNsmV1Catalog, name)
    myTop.setOnLine()
    myTop.create('001')
    myTopCatalog = myTop.getCatalog('201')
    
    name = 'My Default Provider'
    myProvider = Provider(myTopCatalog, name, None)
    myProvider.setOnLine()
    myProvider.setUid(firstProviderUidUrl)
    myProvider.delete('501')
    
    NsmUtil.printHeadLine1("Delete provider completed")
    sys.exit()
        
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:32,代码来源:delete-provider.py

示例8: run

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine1 [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

示例9: start

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine1 [as 别名]
    def start(self):
        
        if (TestAll.__online1 and TestAll.__online2 and TestAll.__online3 and TestAll.__online4 and TestAll.__online5): NsmUtil.moveLogResponse()
            
        NsmUtil.mkPresetDir()

        test = Test()
        nsmV1 = self.run(None, 'test-nsm-v1.json', TestAll.__online1)
        nsmV1.getProviderList('301')
        
        catalog = nsmV1.getCatalog()
        top = self.run(catalog, 'test-top.json', TestAll.__online1)
        
        catalog = top.getCatalog()
        provider = self.run(catalog, 'test-provider.json', TestAll.__online1)
                                
        nsmV1.getProviderList('311')
        provider.getPodList('301')
        
        name = 'My Default IP Address Pool of Provider Global'
        ipAddressPoolGlobal         = self.testProviderIpAddressPool(provider, name, 'Global', '101', TestAll.__online1)
        self.testIpReservation('Global', ipAddressPoolGlobal, 'test-ip-reservation-global.json', '111', TestAll.__online1)
        
        catalog = provider.getCatalog()
        pod = self.run(catalog, 'test-pod.json', TestAll.__online1)
        
        provider.getPodList('311')
        
        
        name = 'My Default IP Address Pool of Pod Infrastructure'
        #ipAddressPoolInfrastructure = self.testProviderIpAddressPool(pod, name, 'Infrastructure', '101', TestAll.__online1)
        #self.testIpReservation('Infrastructure', ipAddressPoolInfrastructure, 'test-ip-reservation-infrastructure.json', '111', TestAll.__online1)
        
        
        if TestAll.__online1: 
            NsmUtil.printHeadLine1('test completed up to Pod')
            if Define._DummyAgent:
                acp = ACP()
                acp.start(Define._UrlHostPortEngine, Define._PathScreenShotFile)
                time.sleep(10)
        
        
        catalog = provider.getCatalog()
        tenant = self.run(catalog, 'test-tenant.json', TestAll.__online2)
        
        catalog = tenant.getCatalog()
        tenantNetworkContainer = self.run(catalog, 'test-tenant-network-container.json', TestAll.__online2)
        
        
    
        catalog = tenant.getCatalog()
        internetExtenalNetwork = self.run(catalog, 'test-internet-external-network.json', TestAll.__online3)
        
        catalog = tenantNetworkContainer.getCatalog()
        internetEdgeZone = self.run(catalog, 'test-internet-edge-zone.json', TestAll.__online3, pod)
        
        catalog = internetEdgeZone.getCatalog()
        internetEdgeZoneLayer3Vlan = self.run(catalog, 'test-internet-edge-zone-layer3-vlan.json', TestAll.__online3, pod)
        
        catalog = tenantNetworkContainer.getCatalog()
        externalConnection = self.run(catalog, 'test-internet-external-connection.json', TestAll.__online3, pod)
        
        catalog = tenantNetworkContainer.getCatalog()
        securedInternetEdgeZone = self.run(catalog, 'test-secured-internet-edge-zone.json', TestAll.__online3, pod)
        
        catalog = securedInternetEdgeZone.getCatalog()
        securedInternetEdgeZoneLayer3Vlan = self.run(catalog, 'test-secured-internet-edge-zone-layer3-vlan.json', TestAll.__online3, pod)
        
        
        catalog = tenant.getCatalog()
        internetFirewallService1 = self.run(catalog, 'test-internet-firewall-service-between-secured-and-unsecured-zone.json', TestAll.__online3)
        
        
        catalog = tenant.getCatalog()
        internetFirewallService2 = self.run(catalog, 'test-internet-firewall-service-between-secured-and-external-network.json', TestAll.__online3)
        
        
        catalog = tenant.getCatalog()
        privateExtenalNetwork = self.run(catalog, 'test-private-external-network.json', TestAll.__online4)
        
        catalog = tenantNetworkContainer.getCatalog()
        privateEdgeZone = self.run(catalog, 'test-private-edge-zone.json', TestAll.__online4, pod)
        
        catalog = privateEdgeZone.getCatalog()
        privateEdgeZoneLayer3Vlan = self.run(catalog, 'test-private-edge-zone-layer3-vlan.json', TestAll.__online4, pod)
        
        catalog = tenantNetworkContainer.getCatalog()
        privateMplsConnection = self.run(catalog, 'test-private-mpls-connection.json', TestAll.__online4, pod)
        
        catalog = tenantNetworkContainer.getCatalog()
        securedPrivateEdgeZone = self.run(catalog, 'test-secured-private-edge-zone.json', TestAll.__online4, pod)
        
        catalog = securedPrivateEdgeZone.getCatalog()
        privateEdgeZoneLayer3Vlan = self.run(catalog, 'test-secured-private-edge-zone-layer3-vlan.json', TestAll.__online4, pod)
        
        #sys.exit()
        
        catalog = tenant.getCatalog()
        privateFirewallService1 = self.run(catalog, 'test-private-firewall-service-between-secured-and-unsecured-zone.json', TestAll.__online4)
        
#.........这里部分代码省略.........
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:103,代码来源:test-all.py

示例10: start

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine1 [as 别名]
    def start(self):
        
        #if Define._TenantStartIndex != 1:
        #    TestSimple.__online1 = False
            
        Define._PathTestCase = Define._PathTestCase + '-simplified-fury'
        
        if (TestSimple.__online1 and TestSimple.__online2 and TestSimple.__online3 and TestSimple.__online4 and TestSimple.__online5): 
            NsmUtil.moveLogResponse()
            NsmUtil.mkPresetDir()
            
            if Define._ResetNSM: Reset.resetNSM()
            
            if not Define._DummyAgent:
                if Define._ResetDevice: 
                    Reset.resetDevice()
                if Define._CopyCleanRunningConfig:
                    Reset.copyRunningConfigToTFTPServer()
                    Reset.copyRunningConfigToTemp('copy-to-tmp-clean')
                if Define._DiffClean:
                    Reset.diffCleanClean()
        

        test = Test()
        nsmV1 = self.run(None, 'test-nsm-v1.json', TestSimple.__online1)
        nsmV1.getProviderList('301')
        
        catalog = nsmV1.getCatalog()
        top = self.run(catalog, 'test-top.json', TestSimple.__online1)
        
        catalog = top.getCatalog()
        provider = self.run(catalog, 'test-provider.json', TestSimple.__online1)
        
        catalog = provider.getCatalog()
        pod = self.run(catalog, 'test-pod-full-fury.json', TestSimple.__online1)                                    
                                   
                                                               
        if TestSimple.__online1: 
            NsmUtil.printHeadLine1('test completed up to Pod')
            if Define._DummyAgent:
                ''' acp not working any more because of new firefox upgrade, need to work on it later '''
                sys.exit()
                acp = ACP()
                acp.start(Define._UrlHostPortEngine, Define._PathScreenShotFile)
                time.sleep(10)
            else:
                #sys.exit()
                Reset.startController()
                time.sleep(300)
                if Define._SetDSCLoggingDebug:
                    Reset.setDSCLogDebug()
                
                
        for tenantIndex in range(Define._TenantStartIndex, Define._TenantStartIndex + Define._TenantCount):         
            
            #if tenantIndex != 1: time.sleep(15*60)
            
            if Define._Performance:
                currentPerfTenant = PerfTenant()
                Define._PerformanceData.addCurrentTenant(currentPerfTenant)
                Define._PerformanceData.setCurrentTenantStartTime(datetime.now())
                
            
            Define._TenantIndex = tenantIndex
        
            
            providerNetworkContainer = self.run(catalog, 'test-provider-network-container.json', TestSimple.__online2)
            catalogPNC = providerNetworkContainer.getCatalog()
            
            internetExtenalNetwork = self.run(catalogPNC, 'test-internet-external-network.json', TestSimple.__online2)
            catalog = internetExtenalNetwork.getCatalog()
            
            northZone = self.run(catalogPNC, 'test-north-zone.json', TestSimple.__online2)
            catalog = northZone.getCatalog() 
            
            externalConnection = self.run(catalogPNC, 'test-internet-external-connection-fury.json', TestSimple.__online2, pod)
            catalog = externalConnection.getCatalog()
            
            southZone = self.run(catalogPNC, 'test-south-zone.json', TestSimple.__online2)
            catalog = southZone.getCatalog() 
            
            layer3ExplicitSubnet = self.run(catalog, 'test-south-zone-layer3-explicit-subnet.json', TestSimple.__online2)
            catalog = layer3ExplicitSubnet.getCatalog() 
                                                  
            self._internetEdgeZoneLayer3VlanReservedIpAddressList = self.reserveIpAddress(layer3ExplicitSubnet, 'Layer3ExplicitSubnet', 16, 1, TestSimple.__online4)
            
            #internetFirewallService0 = self.run(catalogPNC, 'test-internet-firewall-service-between-south-zone-and-external-network.json', TestSimple.__online5)
            internetFirewallService1 = self.run(catalogPNC, 'test-internet-firewall-service-between-south-zone-and-external-network-any-1.json', TestSimple.__online5)
            internetFirewallService2 = self.run(catalogPNC, 'test-internet-firewall-service-between-south-zone-and-external-network-any-2.json', TestSimple.__online5)

            if Define._Performance:
                Define._PerformanceData.setCurrentTenantEndTime(datetime.now(), Define._TenantIndex)
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:94,代码来源:test-simple-fury.py

示例11: run

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine1 [as 别名]
 def run(self, catalog, testCaseFileName, online):
     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)
         
         index = 0;
         name = None
         for testCase in testSuite:
             index += 1
             self._totalTestCase += 1
             skip = None
             action = None
             category = None
             requestBodyFileName = None
             description = None
             
             action = testCase['action']
             category = testCase['category']
             if 'skip' in testCase.keys(): skip = testCase['skip']
             if 'request.body.file' in testCase.keys(): requestBodyFileName = testCase['request.body.file']
             if 'name' in testCase.keys(): name = testCase['name']
             if 'description' in testCase.keys(): description = testCase['description']
             if 'uids' in testCase.keys():
                 for oneUid in testCase['uids']:
                     uidVariable = oneUid['variable']
                     uidClassName = oneUid['class']
                     uidObjectName = oneUid['name'] 
                     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']
             
             NsmUtil.printHeadLine2(className + ' [' + name + '] - ' + action + ' - ' + category + ' - test case ' + str(index))
             
             if skip: 
                 self._logger.info('skip this test case')
                 self._resultList.append([className, name, action, category, str(index), 'skipped'])
                 continue
             
             if action == 'create' or action == 'update':
                 if name: thisObject.setCreateName(name)
                 if description: thisObject.setCreateDescription(description)
                 if requestBodyFileName: thisObject.setRequestBodyFile(requestBodyFileName)
                 if testCase: thisObject.setRequestBodyParams(testCase)                    
             
             if action == 'create':
                 if not online: thisObject.setOffLine()
                 result = thisObject.create()
                 name = thisObject.createName
                 result = NsmUtil.printResult(result, category)
                 self._resultList.append([className, name, action, category, str(index), str(result)])
                 self._dataStore[className] = {}
                 self._dataStore[className][name] = {}
                 self._dataStore[className][name]['object'] = thisObject
                 self._thisObject = thisObject
                 
             elif action == 'detail':
                 if not online: thisObject.setOffLine()
                 detail = thisObject.getDetail()
                 name = thisObject.createName
                 result = NsmUtil.printResult(detail, category)
                 self._resultList.append([className, name, action, category, str(index), str(result)])
                 newUid = [thisObject.uid, thisObject.mySubClassName, thisObject.createName]
                 self.addUid(newUid)
                 self._dataStore[className][name]['detail'] = detail
                 
             elif action == 'catalog':
                 if not online: thisObject.setOffLine()
                 catalog = thisObject.getCatalog()
                 name = thisObject.createName
                 result = NsmUtil.printResult(catalog, category)
                 self._resultList.append([className, name, action, category, str(index), str(result)])
                 self._dataStore[className][name]['catalog'] = catalog
                 
             elif action == 'update' and online:
                 result = thisObject.update(className, testCase, category, index)
                 name = thisObject.createName
                 result = NsmUtil.printResult(result, category)
                 self._resultList.append([className, name, action, category, str(index), str(result)])
                 
             elif action == 'delete' and online:
                 result = thisObject.delete()
                 name = thisObject.createName
                 result = NsmUtil.printResult(result, category)
                 self._resultList.append([className, name, action, category, str(index), str(result)])
                 
             elif action == 'list':
                 if not online: thisObject.setOffLine()
                 listUrl = None
                 if className == 'Provider': 
                     listUrl = Define._UrlApiRoot + '/top/provider'
                 elif className == 'Pod':
#.........这里部分代码省略.........
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:103,代码来源:test-devkit.py

示例12:

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine1 [as 别名]
     
     '''
     ipAddressPoolGlobal         = test.testIpAddressPool(provider, 'Global', online1)
     ipAddressPoolInfrastructure = test.testIpAddressPool(provider, 'Infrastructure', online1)
 
     test.testIpReservation('Global', ipAddressPoolGlobal, 'test-ip-reservation-global.json', online1)
     test.testIpReservation('Infrastructure', ipAddressPoolInfrastructure, 'test-ip-reservation-infrastructure.json', online1)
     '''
     
     catalog = provider.getCatalog()
     pod = test.run(catalog, 'test-pod.json', online1)
     
     
     
     if online1: 
         NsmUtil.printHeadLine1('test completed up to Pod')
         sys.exit()
     
     
     
     catalog = provider.getCatalog()
     tenant = test.run(catalog, 'test-tenant.json', online2)
     
     catalog = tenant.getCatalog()
     tenantNetworkContainer = test.run(catalog, 'test-tenant-network-container.json', online2)
     
     
 
     catalog = tenant.getCatalog()
     internetExtenalNetwork = test.run(catalog, 'test-internet-external-network.json', online3)
     
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:32,代码来源:test-devkit.py

示例13: run

# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printHeadLine1 [as 别名]
 def run(self, catalog, testCaseFileName, online):
     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
         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 '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'] 
                     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 name: thisObject.setCreateName(name)
                     if description: thisObject.setCreateDescription(description)
                     if requestBodyFileName: thisObject.setRequestBodyFile(requestBodyFileName)
                     if testCase: thisObject.setRequestBodyParams(testCase)                    
                 
                     result = thisObject.create(testCaseId)
                     name = thisObject.createName
                     result = NsmUtil.printResult(result, category)
                     self._resultList.append([className, name, action, category, str(testCaseId), str(result)])
                     
                     if not className in self._dataStore.keys(): self._dataStore[className] = {}
                     if not name in self._dataStore[className].keys(): self._dataStore[className][name] = {}
                     self._dataStore[className][name]['object'] = thisObject
                     self._thisObject = thisObject
                     
                 elif action == 'detail':
                     if online: thisObject.setOnLine()
                     elif not online: thisObject.setOffLine()
                     
                     detail = thisObject.getDetail(testCaseId)
                     name = thisObject.createName
                     result = NsmUtil.printResult(detail, category)
                     self._resultList.append([className, name, action, category, str(testCaseId), str(result)])
                     
                     self.addUid([thisObject.uid, thisObject.mySubClassName, thisObject.createName])
                     self._dataStore[className][name]['detail'] = detail
                     
                     if className == 'IpReservation' or className == 'IpAddressPool':
#.........这里部分代码省略.........
开发者ID:huhe56,项目名称:nsm-rest-api,代码行数:103,代码来源:test-all-old.py


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