Example #1
0
class Test000AuthInfo(unittest.TestCase):
    '''
    这个测试最先被执行,并产生auth_token
    '''
    def setUp(self):
        self.authInfo = AuthInfo()
        pass

    def tearDown(self):
        self.authInfo = None

    #def test_get_token(self):
    #    global auth_token
    #    auth_token=self.authInfo.get_token()
    #    self.assertIsNotNone(auth_token)
    #    print u'获得token为{ }'.format(auth_token)

    #def test_service_list(self):
    #   serviceList=self.authInfo.get_service_list()
    #   print u'有如下服务注册在keystone中'
    #    for service in serviceList:
    #        print service['name']
    def test_get_token(self):
        global auth_token
        auth_token = self.authInfo.get_token()
        print auth_token

    def test_get_service_list(self):
        service_list = self.authInfo.get_service_list()
        return service_list
class Test000AuthInfo(unittest.TestCase):
    '''
    这个测试最先被执行,并产生auth_token
    '''
    def setUp(self):
        self.authInfo=AuthInfo()
        pass

    def tearDown(self):
        self.authInfo=None

    #def test_get_token(self):
    #    global auth_token
    #    auth_token=self.authInfo.get_token()
    #    self.assertIsNotNone(auth_token)
    #    print u'获得token为{ }'.format(auth_token)

    #def test_service_list(self):
    #   serviceList=self.authInfo.get_service_list()
    #   print u'有如下服务注册在keystone中'
    #    for service in serviceList:
    #        print service['name']
    def test_get_token(self):
        global auth_token
        auth_token=self.authInfo.get_token()
        print auth_token

    def test_get_service_list(self):
        service_list=self.authInfo.get_service_list()
        return service_list
Example #3
0
#coding=utf-8
__author__ = 'cy-openstack'
import unittest
import json
from pprint import pprint

from cinder.volumeUtil import VolumeUtil
from glance.imageUtil import ImageUtil
from neutron.networkUtil import NetworkUtil,SubnetUtil,PortsUtil
from nova.computeUtil import ComputeUtil,FlavorUtil
from openstackClient import AuthInfo

authInfo=AuthInfo()
auth_token=authInfo.get_token()
tenant_id=authInfo.get_tenant_id()

volumeUtil=VolumeUtil(auth_token)
imageUtil=ImageUtil(auth_token)
networkUtil=NetworkUtil(auth_token)
subnetUtil=SubnetUtil(auth_token)
portsUtil=PortsUtil(auth_token)
computeUtil=ComputeUtil(auth_token,tenant_id)
flavorUtil=FlavorUtil(auth_token,tenant_id)
Example #4
0
 def setUp(self):
     self.authInfo = AuthInfo()
     pass
gconf = ConfigParser()
gconf.read('./global.ini')
blog = logging.getLogger('builder')

print gconf.sections()

#日志
logging.config.fileConfig('logger.ini')
uuidtag = uuid.uuid1()

#认证
from openstackClient import AuthInfo

authInfo = AuthInfo(auth_host=str(gconf.get('auth', 'host')),
                    auth_port=str(gconf.get('auth', 'port')),
                    auth_path=str(gconf.get('auth', 'path')),
                    tenantName=str(gconf.get('auth', 'tenant')),
                    username=str(gconf.get('auth', 'user_name')),
                    password=str(gconf.get('auth', 'password')))

auth_token = authInfo.get_token()
tenant_id = authInfo.get_tenant_id()
print u'uuid : {}'.format(uuidtag)
blog.info(u'auth_token : {} uuid : {}'.format(auth_token, uuidtag))


#数据结构的公共基类
class Structure:
    _fields = []

    def __init__(self, *args):
        if len(args) != len(self._fields):
__author__ = 'cy-openstack'
print u'这个文件现在还没有用到,还没有更改现在的bug'
from . import authInfo

import pprint
from openstackClient import AuthInfo
if __name__=="__main__":
    authInfo=AuthInfo()
    service_list=authInfo.get_service_list()
    print service_list


 def setUp(self):
     self.authInfo=AuthInfo()
     pass