Enable authentication between PLUMgrid Director and Plugin
Implements blueprint plumgrid-plugin-rest-access Change-Id: I0f9a6c39c09f756ee5fc7c9d6993e59b1e6be639
This commit is contained in:
parent
1c2e111a0b
commit
0fd99cba9b
@ -32,7 +32,8 @@ class Plumlib():
|
|||||||
LOG.info('Python PLUMgrid Fake Library Started ')
|
LOG.info('Python PLUMgrid Fake Library Started ')
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def director_conn(self, director_plumgrid, director_port, timeout):
|
def director_conn(self, director_plumgrid, director_port, timeout,
|
||||||
|
director_admin, director_password):
|
||||||
LOG.info('Fake Director: %s', director_plumgrid + ':' + director_port)
|
LOG.info('Fake Director: %s', director_plumgrid + ':' + director_port)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -37,10 +37,13 @@ class Plumlib(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
LOG.info('Python PLUMgrid Library Started ')
|
LOG.info('Python PLUMgrid Library Started ')
|
||||||
|
|
||||||
def director_conn(self, director_plumgrid, director_port, timeout):
|
def director_conn(self, director_plumgrid, director_port, timeout,
|
||||||
|
director_admin, director_password):
|
||||||
self.plumlib = plumlib.Plumlib(director_plumgrid,
|
self.plumlib = plumlib.Plumlib(director_plumgrid,
|
||||||
director_port,
|
director_port,
|
||||||
timeout)
|
timeout,
|
||||||
|
director_admin,
|
||||||
|
director_password)
|
||||||
|
|
||||||
def create_network(self, tenant_id, net_db):
|
def create_network(self, tenant_id, net_db):
|
||||||
self.plumlib.create_network(tenant_id, net_db)
|
self.plumlib.create_network(tenant_id, net_db)
|
||||||
|
@ -78,12 +78,15 @@ class NeutronPluginPLUMgridV2(db_base_plugin_v2.NeutronDbPluginV2,
|
|||||||
"""PLUMgrid initialization."""
|
"""PLUMgrid initialization."""
|
||||||
director_plumgrid = cfg.CONF.PLUMgridDirector.director_server
|
director_plumgrid = cfg.CONF.PLUMgridDirector.director_server
|
||||||
director_port = cfg.CONF.PLUMgridDirector.director_server_port
|
director_port = cfg.CONF.PLUMgridDirector.director_server_port
|
||||||
|
director_admin = cfg.CONF.PLUMgridDirector.username
|
||||||
|
director_password = cfg.CONF.PLUMgridDirector.password
|
||||||
timeout = cfg.CONF.PLUMgridDirector.servertimeout
|
timeout = cfg.CONF.PLUMgridDirector.servertimeout
|
||||||
|
|
||||||
# PLUMgrid Director info validation
|
# PLUMgrid Director info validation
|
||||||
LOG.info(_('Neutron PLUMgrid Director: %s'), director_plumgrid)
|
LOG.info(_('Neutron PLUMgrid Director: %s'), director_plumgrid)
|
||||||
self._plumlib = importutils.import_object(PLUM_DRIVER)
|
self._plumlib = importutils.import_object(PLUM_DRIVER)
|
||||||
self._plumlib.director_conn(director_plumgrid, director_port, timeout)
|
self._plumlib.director_conn(director_plumgrid, director_port, timeout,
|
||||||
|
director_admin, director_password)
|
||||||
|
|
||||||
def create_network(self, context, network):
|
def create_network(self, context, network):
|
||||||
"""Create Neutron network.
|
"""Create Neutron network.
|
||||||
|
@ -32,6 +32,8 @@ from neutron.tests.unit import test_db_plugin as test_plugin
|
|||||||
PLUM_DRIVER = ('neutron.plugins.plumgrid.drivers.fake_plumlib.Plumlib')
|
PLUM_DRIVER = ('neutron.plugins.plumgrid.drivers.fake_plumlib.Plumlib')
|
||||||
FAKE_DIRECTOR = '1.1.1.1'
|
FAKE_DIRECTOR = '1.1.1.1'
|
||||||
FAKE_PORT = '1234'
|
FAKE_PORT = '1234'
|
||||||
|
FAKE_USERNAME = 'fake_admin'
|
||||||
|
FAKE_PASSWORD = 'fake_password'
|
||||||
FAKE_TIMEOUT = '0'
|
FAKE_TIMEOUT = '0'
|
||||||
|
|
||||||
|
|
||||||
@ -43,10 +45,14 @@ class PLUMgridPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
|
|||||||
def mocked_plumlib_init(self):
|
def mocked_plumlib_init(self):
|
||||||
director_plumgrid = FAKE_DIRECTOR
|
director_plumgrid = FAKE_DIRECTOR
|
||||||
director_port = FAKE_PORT
|
director_port = FAKE_PORT
|
||||||
|
director_username = FAKE_USERNAME
|
||||||
|
director_password = FAKE_PASSWORD
|
||||||
timeout = FAKE_TIMEOUT
|
timeout = FAKE_TIMEOUT
|
||||||
self._plumlib = importutils.import_object(PLUM_DRIVER)
|
self._plumlib = importutils.import_object(PLUM_DRIVER)
|
||||||
self._plumlib.director_conn(director_plumgrid,
|
self._plumlib.director_conn(director_plumgrid,
|
||||||
director_port, timeout)
|
director_port, timeout,
|
||||||
|
director_username,
|
||||||
|
director_password)
|
||||||
|
|
||||||
with mock.patch.object(plumgrid_plugin.NeutronPluginPLUMgridV2,
|
with mock.patch.object(plumgrid_plugin.NeutronPluginPLUMgridV2,
|
||||||
'plumgrid_init', new=mocked_plumlib_init):
|
'plumgrid_init', new=mocked_plumlib_init):
|
||||||
|
Loading…
Reference in New Issue
Block a user