keystone_service_endpoint: working with neutron, tests added
This commit is contained in:
parent
86471e839f
commit
efdae06f7c
@ -60,7 +60,7 @@ def deploy():
|
||||
neutron_keystone_user = vr.create('neutron_keystone_user', 'resources/keystone_user', {'user_name': 'neutron', 'user_password': 'neutron'})[0]
|
||||
neutron_keystone_role = vr.create('neutron_keystone_role', 'resources/keystone_role', {'role_name': 'neutron'})[0]
|
||||
|
||||
#neutron_keystone_service_endpoint = vr.create('neutron_keystone_service_endpoint', 'resources/keystone_service_endpoint', {'adminurl': 'http://{{ip}}:{{admin_port}}', 'internalurl': 'http://{{ip}}:{{port}}', 'publicurl': 'http://{{ip}}:{{port}}', 'description': 'OpenStack Network Service', 'type': 'network', 'port': 9696, 'admin_port': 9696})[0]
|
||||
neutron_keystone_service_endpoint = vr.create('neutron_keystone_service_endpoint', 'resources/keystone_service_endpoint', {'adminurl': 'http://{{admin_ip}}:{{admin_port}}', 'internalurl': 'http://{{internal_ip}}:{{internal_port}}', 'publicurl': 'http://{{public_ip}}:{{public_port}}', 'description': 'OpenStack Network Service', 'type': 'network'})[0]
|
||||
|
||||
# #cinder_puppet = vr.create('cinder_puppet', GitProvider(GIT_PUPPET_LIBS_URL, 'cinder'), {})[0]
|
||||
# cinder_puppet = vr.create('cinder_puppet', 'resources/cinder_puppet', {})[0]
|
||||
@ -115,9 +115,11 @@ def deploy():
|
||||
signals.connect(admin_user, neutron_puppet, {'user_name': 'keystone_user', 'user_password': 'keystone_password', 'tenant_name': 'keystone_tenant'})
|
||||
signals.connect(keystone_puppet, neutron_puppet, {'ip': 'keystone_host', 'port': 'keystone_port'})
|
||||
|
||||
#signals.connect(neutron_puppet, neutron_keystone_service_endpoint, {'ip': 'ip', 'ssh_key': 'ssh_key', 'ssh_user': 'ssh_user'})
|
||||
#signals.connect(neutron_puppet, neutron_keystone_service_endpoint, {'port': 'admin_port'})
|
||||
#signals.connect(keystone_puppet, neutron_keystone_service_endpoint, {'ip': 'keystone_host', 'admin_port': 'keystone_port', 'admin_token': 'admin_token'})
|
||||
signals.connect(neutron_puppet, neutron_keystone_service_endpoint, {'ip': 'ip', 'ssh_key': 'ssh_key', 'ssh_user': 'ssh_user'})
|
||||
signals.connect(neutron_puppet, neutron_keystone_service_endpoint, {'ip': 'admin_ip', 'port': 'admin_port'})
|
||||
signals.connect(neutron_puppet, neutron_keystone_service_endpoint, {'ip': 'internal_ip', 'port': 'internal_port'})
|
||||
signals.connect(neutron_puppet, neutron_keystone_service_endpoint, {'ip': 'public_ip', 'port': 'public_port'})
|
||||
signals.connect(keystone_puppet, neutron_keystone_service_endpoint, {'ip': 'keystone_host', 'admin_port': 'keystone_admin_port', 'admin_token': 'admin_token'})
|
||||
|
||||
# CINDER
|
||||
# signals.connect(node1, cinder_puppet)
|
||||
@ -176,7 +178,7 @@ def deploy():
|
||||
actions.resource_action(neutron_keystone_role, 'run')
|
||||
|
||||
actions.resource_action(neutron_puppet, 'run')
|
||||
#actions.resource_action(neutron_keystone_service_endpoint, 'run')
|
||||
actions.resource_action(neutron_keystone_service_endpoint, 'run')
|
||||
|
||||
# actions.resource_action(cinder_keystone_user, 'run')
|
||||
# actions.resource_action(cinder_keystone_role, 'run')
|
||||
@ -207,7 +209,7 @@ def undeploy():
|
||||
|
||||
# actions.resource_action(resources['cinder_puppet'], 'remove' )
|
||||
|
||||
#actions.resource_action(resources['neutron_keystone_service_endpoint'], 'remove' )
|
||||
actions.resource_action(resources['neutron_keystone_service_endpoint'], 'remove' )
|
||||
actions.resource_action(resources['neutron_puppet'], 'remove' )
|
||||
|
||||
# actions.resource_action(resources['cinder_keystone_role'], 'remove')
|
||||
|
@ -11,6 +11,7 @@ input:
|
||||
admin_token:
|
||||
schema: str!
|
||||
value:
|
||||
|
||||
type:
|
||||
schema: str!
|
||||
value:
|
||||
@ -28,6 +29,7 @@ input:
|
||||
value: http://{{public_ip}}:{{public_port}}/v2.0
|
||||
internal_ip:
|
||||
schema: str!
|
||||
value:
|
||||
internal_port:
|
||||
schema: int!
|
||||
value:
|
||||
@ -43,6 +45,7 @@ input:
|
||||
adminurl:
|
||||
schema: str!
|
||||
value: http://{{ip}}:{{admin_port}}/v2.0
|
||||
|
||||
ip:
|
||||
schema: str!
|
||||
value:
|
||||
|
29
resources/keystone_service_endpoint/test.py
Normal file
29
resources/keystone_service_endpoint/test.py
Normal file
@ -0,0 +1,29 @@
|
||||
import jinja2
|
||||
import json
|
||||
import requests
|
||||
|
||||
from solar.core.log import log
|
||||
|
||||
|
||||
def test(resource):
|
||||
log.debug('Testing keystone_service_endpoint %s', resource.name)
|
||||
resp = requests.get(
|
||||
'http://%s:%s/v3/endpoints' % (resource.args['ip'].value, resource.args['keystone_admin_port'].value),
|
||||
headers={
|
||||
'X-Auth-Token': resource.args['admin_token'].value,
|
||||
}
|
||||
)
|
||||
|
||||
resp_json = resp.json()
|
||||
assert 'endpoints' in resp_json
|
||||
|
||||
endpoints = {}
|
||||
|
||||
for endpoint in resp_json['endpoints']:
|
||||
endpoints[endpoint['interface']] = endpoint['url']
|
||||
|
||||
assert jinja2.Template(resource.args['adminurl'].value).render(**resource.args_dict()) == endpoints['admin']
|
||||
assert jinja2.Template(resource.args['internalurl'].value).render(**resource.args_dict()) == endpoints['internal']
|
||||
assert jinja2.Template(resource.args['publicurl'].value).render(**resource.args_dict()) == endpoints['public']
|
||||
|
||||
log.debug('%s endpoints: %s', resource.name, json.dumps(resp_json, indent=2))
|
@ -29,6 +29,10 @@ input:
|
||||
schema: {repository: str!, branch: str!}
|
||||
value: {repository: 'https://github.com/openstack/puppet-neutron', branch: 'master'}
|
||||
|
||||
port:
|
||||
schema: int!
|
||||
value: 9696
|
||||
|
||||
keystone_host:
|
||||
schema: str!
|
||||
value: ''
|
||||
|
Loading…
x
Reference in New Issue
Block a user