Removed registration of keystone authentication with CVX
There is a CLI in CVX which configures keystone Authentication and no need to rely on ML2 driver to send the authentication information to CVX. Change-Id: I9c3526ae0bc19873361c7fa8b49e9a92be5f1954changes/36/487236/2
parent
6673921476
commit
2e68823da0
|
@ -79,7 +79,6 @@ class AristaRPCWrapperBase(object):
|
|||
self._ndb = neutron_db
|
||||
self._validate_config()
|
||||
self._server_ip = None
|
||||
self.keystone_conf = cfg.CONF.keystone_authtoken
|
||||
self.region = cfg.CONF.ml2_arista.region_name
|
||||
self.sync_interval = cfg.CONF.ml2_arista.sync_interval
|
||||
self.conn_timeout = cfg.CONF.ml2_arista.conn_timeout
|
||||
|
@ -118,17 +117,6 @@ class AristaRPCWrapperBase(object):
|
|||
LOG.error(msg)
|
||||
raise arista_exc.AristaConfigError(msg=msg)
|
||||
|
||||
def _keystone_url(self):
|
||||
if self.keystone_conf.auth_uri:
|
||||
auth_uri = self.keystone_conf.auth_uri.rstrip('/')
|
||||
else:
|
||||
auth_uri = (
|
||||
'%(protocol)s://%(host)s:%(port)s' %
|
||||
{'protocol': self.keystone_conf.auth_protocol,
|
||||
'host': self.keystone_conf.auth_host,
|
||||
'port': self.keystone_conf.auth_port})
|
||||
return '%s/v3/' % auth_uri
|
||||
|
||||
def _api_username(self):
|
||||
return cfg.CONF.ml2_arista.eapi_username
|
||||
|
||||
|
@ -607,20 +595,6 @@ class AristaRPCWrapperJSON(AristaRPCWrapperBase):
|
|||
self.set_cvx_available()
|
||||
return self._send_request(host, path, method, data, sanitized_data)
|
||||
|
||||
def _create_keystone_endpoint(self):
|
||||
path = 'region/%s/service-end-point' % self.region
|
||||
data = {
|
||||
'name': 'keystone',
|
||||
'authUrl': self._keystone_url(),
|
||||
'user': self.keystone_conf.admin_user or "",
|
||||
'password': self.keystone_conf.admin_password or "",
|
||||
'tenant': self.keystone_conf.admin_tenant_name or ""
|
||||
}
|
||||
# Hide the password
|
||||
sanitized_data = data.copy()
|
||||
sanitized_data['password'] = "*****"
|
||||
self._send_api_request(path, 'POST', [data], [sanitized_data])
|
||||
|
||||
def _set_region_update_interval(self):
|
||||
path = 'region/%s' % self.region
|
||||
data = {
|
||||
|
@ -631,7 +605,6 @@ class AristaRPCWrapperJSON(AristaRPCWrapperBase):
|
|||
|
||||
def register_with_eos(self, sync=False):
|
||||
self.create_region(self.region)
|
||||
self._create_keystone_endpoint()
|
||||
self._set_region_update_interval()
|
||||
|
||||
def check_supported_features(self):
|
||||
|
@ -1786,23 +1759,8 @@ class AristaRPCWrapperEapi(AristaRPCWrapperBase):
|
|||
self._run_eos_cmds(cmds)
|
||||
|
||||
def register_with_eos(self, sync=False):
|
||||
cmds = ['auth url %s user %s password %s tenant %s' % (
|
||||
self._keystone_url(),
|
||||
self.keystone_conf.admin_user,
|
||||
self.keystone_conf.admin_password,
|
||||
self.keystone_conf.admin_tenant_name)]
|
||||
|
||||
log_cmds = ['auth url %s user %s password %s tenant %s' % (
|
||||
self._keystone_url(),
|
||||
self.keystone_conf.admin_user,
|
||||
'******',
|
||||
self.keystone_conf.admin_tenant_name)]
|
||||
|
||||
sync_interval_cmd = 'sync interval %d' % self.sync_interval
|
||||
cmds.append(sync_interval_cmd)
|
||||
log_cmds.append(sync_interval_cmd)
|
||||
|
||||
self._run_openstack_cmds(cmds, commands_to_log=log_cmds, sync=sync)
|
||||
self._run_openstack_cmds(['sync interval %d' % self.sync_interval],
|
||||
sync=sync)
|
||||
|
||||
def get_region_updated_time(self):
|
||||
timestamp_cmd = self.cli_commands['timestamp']
|
||||
|
|
|
@ -286,14 +286,7 @@ class TestAristaJSONRPCWrapper(testlib_api.SqlTestCase):
|
|||
@patch(JSON_SEND_FUNC)
|
||||
def test_register_with_eos(self, mock_send_api_req):
|
||||
self.drv.register_with_eos()
|
||||
post_data = {'name': 'keystone', 'password': 'fun',
|
||||
'tenant': 'tenant_name', 'user': 'neutron',
|
||||
'authUrl': 'abc://host:5000/v3/'}
|
||||
clean_data = post_data.copy()
|
||||
clean_data['password'] = "*****"
|
||||
calls = [
|
||||
('region/RegionOne/service-end-point', 'POST', [post_data],
|
||||
[clean_data]),
|
||||
('region/RegionOne', 'PUT',
|
||||
[{'name': 'RegionOne', 'syncInterval': 10}])
|
||||
]
|
||||
|
@ -1287,34 +1280,18 @@ class PositiveRPCWrapperValidConfigTestCase(testlib_api.SqlTestCase):
|
|||
@patch(EAPI_SEND_FUNC)
|
||||
def test_register_with_eos(self, mock_send_eapi_req):
|
||||
self.drv.register_with_eos()
|
||||
auth = utils.fake_keystone_info_class()
|
||||
keystone_url = '%s://%s:%s/v3/' % (auth.auth_protocol,
|
||||
auth.auth_host,
|
||||
auth.auth_port)
|
||||
auth_cmd = ('auth url %s user %s password %s tenant %s' % (
|
||||
keystone_url,
|
||||
auth.admin_user,
|
||||
auth.admin_password,
|
||||
auth.admin_tenant_name))
|
||||
cmd1 = ['show openstack agent uuid']
|
||||
cmd2 = ['enable',
|
||||
'configure',
|
||||
'cvx',
|
||||
'service openstack',
|
||||
'region %s' % self.region,
|
||||
auth_cmd,
|
||||
'sync interval %d' % cfg.CONF.ml2_arista.sync_interval,
|
||||
]
|
||||
|
||||
clean_cmd2 = list(cmd2)
|
||||
idx = clean_cmd2.index(auth_cmd)
|
||||
clean_cmd2[idx] = clean_cmd2[idx].replace(auth.admin_password,
|
||||
'******')
|
||||
|
||||
self._verify_send_eapi_request_calls(
|
||||
mock_send_eapi_req,
|
||||
[cmd1, cmd2],
|
||||
commands_to_log=[cmd1, clean_cmd2])
|
||||
commands_to_log=[cmd1, cmd2])
|
||||
|
||||
def _enable_sync_cmds(self):
|
||||
self.drv.cli_commands[
|
||||
|
|
|
@ -15,25 +15,9 @@
|
|||
|
||||
|
||||
def setup_arista_wrapper_config(cfg, host='host', user='user'):
|
||||
cfg.CONF.keystone_authtoken = fake_keystone_info_class()
|
||||
cfg.CONF.set_override('eapi_host', host, "ml2_arista")
|
||||
cfg.CONF.set_override('eapi_username', user, "ml2_arista")
|
||||
cfg.CONF.set_override('sync_interval', 10, "ml2_arista")
|
||||
cfg.CONF.set_override('conn_timeout', 20, "ml2_arista")
|
||||
cfg.CONF.set_override('switch_info', ['switch1:user:pass'], "ml2_arista")
|
||||
cfg.CONF.set_override('sec_group_support', False, "ml2_arista")
|
||||
|
||||
|
||||
class fake_keystone_info_class(object):
|
||||
"""To generate fake Keystone Authentication token information
|
||||
|
||||
Arista Driver expects Keystone auth info. This fake information
|
||||
is for testing only
|
||||
"""
|
||||
auth_uri = False
|
||||
auth_protocol = 'abc'
|
||||
auth_host = 'host'
|
||||
auth_port = 5000
|
||||
admin_user = 'neutron'
|
||||
admin_password = 'fun'
|
||||
admin_tenant_name = 'tenant_name'
|
||||
|
|
Loading…
Reference in New Issue