Create a neutron client

Creates a neutron_client property using token and endpoint from
keystone session.

Change-Id: I07199a272969c53610347f3ff05e60b0b3b8d317
This commit is contained in:
Adam Gandelman 2015-01-15 15:02:12 -08:00 committed by David Shrewsbury
parent d3daf5b896
commit fcc108626b
2 changed files with 15 additions and 4 deletions

View File

@ -7,7 +7,7 @@ python-novaclient
python-keystoneclient>=0.11.0
python-glanceclient
python-cinderclient
python-neutronclient
python-neutronclient>=2.3.10
python-troveclient
python-ironicclient
python-swiftclient

View File

@ -25,6 +25,7 @@ from keystoneclient import auth as ksc_auth
from keystoneclient import session as ksc_session
from novaclient import client as nova_client
from novaclient.v1_1 import floating_ips
from neutronclient.v2_0 import client as neutron_client
import os_client_config
import pbr.version
import swiftclient.client as swift_client
@ -138,13 +139,14 @@ class OpenStackCloud(object):
self._keystone_session = None
self._nova_client = None
self._cinder_client = None
self._glance_client = None
self._glance_endpoint = None
self._ironic_client = None
self._cinder_client = None
self._trove_client = None
self._neutron_client = None
self._nova_client = None
self._swift_client = None
self._trove_client = None
self.log = logging.getLogger('shade')
log_level = logging.INFO
@ -324,6 +326,15 @@ class OpenStackCloud(object):
return self._trove_client
@property
def neutron_client(self):
if self._neutron_client is None:
self._neutron_client = neutron_client.Client(
token=self.auth_token,
session=self.keystone_session,
region_name=self.region_name)
return self._neutron_client
def get_name(self):
return self.name