Пример #1
0
 def __init__(self,
              host='127.0.0.1',
              version='2',
              port=None,
              user='******',
              password=None,
              debug=False,
              project=None,
              domain='Default',
              auth_url=None,
              ca_file=None,
              external_network=None):
     self.debug = debug
     self.host = host
     loader = loading.get_plugin_loader('password')
     auth = loader.load_from_options(auth_url=auth_url,
                                     username=user,
                                     password=password,
                                     project_name=project,
                                     user_domain_name=domain,
                                     project_domain_name=domain)
     if ca_file is not None:
         sess = session.Session(auth=auth,
                                verify=os.path.expanduser(ca_file))
     else:
         sess = session.Session(auth=auth)
     self.nova = novaclient.Client(version, session=sess)
     self.glance = glanceclient(version, session=sess)
     self.cinder = cinderclient.Client(version, session=sess)
     self.neutron = neutronclient(session=sess)
     self.conn = self.nova
     self.project = project
     self.external_network = external_network
     return
Пример #2
0
 def __init__(self,
              host='127.0.0.1',
              version='2',
              port=None,
              user='******',
              password=None,
              debug=False,
              project=None,
              domain='Default',
              auth_url=None):
     self.debug = debug
     self.host = host
     loader = loading.get_plugin_loader('password')
     auth = loader.load_from_options(auth_url=auth_url,
                                     username=user,
                                     password=password,
                                     project_name=project,
                                     user_domain_name=domain,
                                     project_domain_name=domain)
     sess = session.Session(auth=auth)
     self.nova = novaclient.Client(version, session=sess)
     self.glance = glanceclient(version, session=sess)
     self.cinder = cinderclient.Client(version, session=sess)
     self.neutron = neutronclient(session=sess)
     self.conn = self.nova
     self.project = project
     return
Пример #3
0
 def __init__(self, openrc=None, keystone='v3'):
     self.creds = Credentials(openrc)
     if keystone == 'v2':
         from keystoneauth1.identity import v2
         self.auth = v2.Password(auth_url="%s/%s" %
                                 (self.creds.osp_auth_url, "/v2.0"),
                                 username=self.creds.osp_username,
                                 password=self.creds.osp_password,
                                 tenant_name=self.creds.osp_tenant)
     if keystone == 'v3':
         from keystoneauth1.identity import v3
         self.auth = v3.Password(
             auth_url=self.creds.osp_auth_url,
             project_id=self.creds.osp_project_id,
             project_name=self.creds.osp_project_name,
             user_domain_name=self.creds.osp_user_domain_name,
             project_domain_id=self.creds.osp_project_domain_id,
             username=self.creds.osp_username,
             password=self.creds.osp_password)
     self.session = session.Session(auth=self.auth)
     self.nova = Client('2', session=self.session)
     self.glance = glclient.Client('2', session=self.session)
     self.neutron = neutronclient(session=self.session)
     self.cinder = cinderclient(session=self.session)
Пример #4
0
def neutron_client(key):
    key_session = keystone_session(key)
    client = neutronclient(session=key_session)
    return client
Пример #5
0
 def __init__(self, config_path, debug=False, log=None, region=None):
     super(Neutron, self).__init__(config_path, debug, log, region)
     self.logger.debug('=> init neutron client for region %s' % self.region)
     self.client = neutronclient(session=self.sess, region_name=self.region)
Пример #6
0
 def __init__(self, auth):
     self.neutron = neutronclient(**auth)
     self.ceilometer = get_client(version=2, **auth)
     self.cinder = cinderclient(username=auth['username'], api_key=auth['password'], project_id=auth['tenant_name'],
                                auth_url=auth['auth_url'])
Пример #7
0
 def __init__(self, config_path, debug=False, log=None, region=None):
     super(Neutron, self).__init__(config_path, debug, log, region)
     self.logger.debug('=> init neutron client for region %s' % self.region)
     self.client = neutronclient(session=self.sess,
                                 region_name=self.region)