Beispiel #1
0
    def _initResource(self):
        """
        公共资源初始化
        :return:
        """
        self._loggers.stabilityLoadbalancerLogger.info('初始化命令行客户端')
        self._openstackClient = OpenstackClient(self._os_tenant_name,
                                                self._os_project_name,
                                                self._os_username,
                                                self._os_password)
        self._novaClient = NovaClient(self._os_project_name, self._os_username,
                                      self._os_password)
        self._cinderClient = CinderClient(self._os_tenant_name,
                                          self._os_project_name,
                                          self._os_username, self._os_password)
        self._loadbalancerClient = LoadbalancerClient(self._os_tenant_name,
                                                      self._os_project_name,
                                                      self._os_username,
                                                      self._os_password)

        self._loggers.stabilityLoadbalancerLogger.info('初始化默认安全组、测试镜像、测试镜像')
        self._default_secgroup_id = getDefaultSecGroupId(
            self._accountResource.get_secgroups(),
            self._readConfig.base.default_secgroup_name)
        self._admin_float_net_id = getAdminFloatNetId(
            self._accountResource.get_adminNets(),
            self._readConfig.base.admin_float_net_name)
        self._test_image_id = getTestImageId(
            self._accountResource.get_images(),
            self._readConfig.base.test_image_name)

        self._zone_names = self._readConfig.base.zone_names.split('||')

        #判断需要测试的类型
        if self._readConfig.executeTest.is_stability_test_loadbalancer.lower(
        ) == 'true':
            self._loggers.stabilityLoadbalancerLogger.info(
                '===开始初始化稳定性测试loadbalancer资源===')
            self._initLoadbalancer()

        self._loggers.stabilityLoadbalancerLogger.info(
            '将测试初始化资源写入到文件dbs/stabilityLoadbalancerTestAccountResource.dbs')
        FileTool.writeObjectIntoFile(
            self._accountResource,
            'dbs/stabilityLoadbalancerTestAccountResource.dbs')
Beispiel #2
0
    def __init__(self, os_tenant_name, os_project_name, os_username,
                 os_password, logger):
        self._readConfig = ReadConfig()
        self._logger = logger
        self._logger.info('===开始初始化账号' + os_username + '公共资源===')
        self._os_tenant_name = os_tenant_name
        self._os_project_name = os_project_name
        self._os_username = os_username
        self._os_password = os_password

        self._accountResource = AccountResource()

        self._openstackClient = OpenstackClient(self._os_tenant_name,
                                                self._os_project_name,
                                                self._os_username,
                                                self._os_password)
        self._novaClient = NovaClient(self._os_project_name, self._os_username,
                                      self._os_password)
        self._cinderClient = CinderClient(self._os_tenant_name,
                                          self._os_project_name,
                                          self._os_username, self._os_password)
        self._keystoneClient = KeystoneClient()