def setUp(self): self.authInfo = AuthInfo() pass
#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)
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):