[coreycb,r=james-page] Add deploy from source support.
This commit is contained in:
commit
84df1598d1
@ -1,2 +1,3 @@
|
||||
bin
|
||||
.coverage
|
||||
tags
|
||||
|
6
Makefile
6
Makefile
@ -2,7 +2,7 @@
|
||||
PYTHON := /usr/bin/env python
|
||||
|
||||
lint:
|
||||
@flake8 --exclude hooks/charmhelpers hooks unit_tests tests
|
||||
@flake8 --exclude hooks/charmhelpers actions hooks unit_tests tests
|
||||
@charm proof
|
||||
|
||||
unit_test:
|
||||
@ -24,7 +24,9 @@ test:
|
||||
# raise_status() messages to stderr:
|
||||
# https://bugs.launchpad.net/amulet/+bug/1320357
|
||||
@juju test -v -p AMULET_HTTP_PROXY --timeout 900 \
|
||||
00-setup 14-basic-precise-icehouse 15-basic-trusty-icehouse
|
||||
00-setup 14-basic-precise-icehouse 15-basic-trusty-icehouse \
|
||||
16-basic-trusty-icehouse-git 17-basic-trusty-juno \
|
||||
18-basic-trusty-juno-git
|
||||
|
||||
publish: lint unit_test
|
||||
bzr push lp:charms/quantum-gateway
|
||||
|
88
README.md
88
README.md
@ -109,6 +109,94 @@ OpenStack upstream documentation recomments a MTU value of 1400:
|
||||
|
||||
Note that this option was added in Havana and will be ignored in older releases.
|
||||
|
||||
Deploying from source
|
||||
=====================
|
||||
|
||||
The minimum openstack-origin-git config required to deploy from source is:
|
||||
|
||||
openstack-origin-git:
|
||||
"repositories:
|
||||
- {name: requirements,
|
||||
repository: 'git://git.openstack.org/openstack/requirements',
|
||||
branch: stable/juno}
|
||||
- {name: neutron,
|
||||
repository: 'git://git.openstack.org/openstack/neutron',
|
||||
branch: stable/juno}"
|
||||
|
||||
Note that there are only two 'name' values the charm knows about: 'requirements'
|
||||
and 'neutron'. These repositories must correspond to these 'name' values.
|
||||
Additionally, the requirements repository must be specified first and the
|
||||
neutron repository must be specified last. All other repostories are installed
|
||||
in the order in which they are specified.
|
||||
|
||||
The following is a full list of current tip repos (may not be up-to-date):
|
||||
|
||||
openstack-origin-git:
|
||||
"repositories:
|
||||
- {name: requirements,
|
||||
repository: 'git://git.openstack.org/openstack/requirements',
|
||||
branch: master}
|
||||
- {name: oslo-concurrency,
|
||||
repository: 'git://git.openstack.org/openstack/oslo.concurrency',
|
||||
branch: master}
|
||||
- {name: oslo-config,
|
||||
repository: 'git://git.openstack.org/openstack/oslo.config',
|
||||
branch: master}
|
||||
- {name: oslo-context,
|
||||
repository: 'git://git.openstack.org/openstack/oslo.context.git',
|
||||
branch: master}
|
||||
- {name: oslo-db,
|
||||
repository: 'git://git.openstack.org/openstack/oslo.db',
|
||||
branch: master}
|
||||
- {name: oslo-i18n,
|
||||
repository: 'git://git.openstack.org/openstack/oslo.i18n',
|
||||
branch: master}
|
||||
- {name: oslo-messaging,
|
||||
repository: 'git://git.openstack.org/openstack/oslo.messaging.git',
|
||||
branch: master}
|
||||
- {name: oslo-middleware,
|
||||
repository': 'git://git.openstack.org/openstack/oslo.middleware.git',
|
||||
branch: master}
|
||||
- {name: oslo-rootwrap',
|
||||
repository: 'git://git.openstack.org/openstack/oslo.rootwrap.git',
|
||||
branch: master}
|
||||
- {name: oslo-serialization,
|
||||
repository: 'git://git.openstack.org/openstack/oslo.serialization',
|
||||
branch: master}
|
||||
- {name: oslo-utils,
|
||||
repository: 'git://git.openstack.org/openstack/oslo.utils',
|
||||
branch: master}
|
||||
- {name: pbr,
|
||||
repository: 'git://git.openstack.org/openstack-dev/pbr',
|
||||
branch: master}
|
||||
- {name: stevedore,
|
||||
repository: 'git://git.openstack.org/openstack/stevedore.git',
|
||||
branch: 'master'}
|
||||
- {name: python-keystoneclient,
|
||||
repository: 'git://git.openstack.org/openstack/python-keystoneclient',
|
||||
branch: master}
|
||||
- {name: python-neutronclient,
|
||||
repository: 'git://git.openstack.org/openstack/python-neutronclient.git',
|
||||
branch: master}
|
||||
- {name: python-novaclient,
|
||||
repository': 'git://git.openstack.org/openstack/python-novaclient.git',
|
||||
branch: master}
|
||||
- {name: keystonemiddleware,
|
||||
repository: 'git://git.openstack.org/openstack/keystonemiddleware',
|
||||
branch: master}
|
||||
- {name: neutron-fwaas,
|
||||
repository': 'git://git.openstack.org/openstack/neutron-fwaas.git',
|
||||
branch: master}
|
||||
- {name: neutron-lbaas,
|
||||
repository: 'git://git.openstack.org/openstack/neutron-lbaas.git',
|
||||
branch: master}
|
||||
- {name: neutron-vpnaas,
|
||||
repository: 'git://git.openstack.org/openstack/neutron-vpnaas.git',
|
||||
branch: master}
|
||||
- {name: neutron,
|
||||
repository: 'git://git.openstack.org/openstack/neutron',
|
||||
branch: master}"
|
||||
|
||||
TODO
|
||||
----
|
||||
|
||||
|
2
actions.yaml
Normal file
2
actions.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
git-reinstall:
|
||||
description: Reinstall quantum-gateway from the openstack-origin-git repositories.
|
1
actions/git-reinstall
Symbolic link
1
actions/git-reinstall
Symbolic link
@ -0,0 +1 @@
|
||||
git_reinstall.py
|
45
actions/git_reinstall.py
Executable file
45
actions/git_reinstall.py
Executable file
@ -0,0 +1,45 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
sys.path.append('hooks/')
|
||||
|
||||
from charmhelpers.contrib.openstack.utils import (
|
||||
git_install_requested,
|
||||
)
|
||||
|
||||
from charmhelpers.core.hookenv import (
|
||||
action_set,
|
||||
action_fail,
|
||||
config,
|
||||
)
|
||||
|
||||
from quantum_utils import (
|
||||
git_install,
|
||||
)
|
||||
|
||||
from quantum_hooks import (
|
||||
config_changed,
|
||||
)
|
||||
|
||||
|
||||
def git_reinstall():
|
||||
"""Reinstall from source and restart services.
|
||||
|
||||
If the openstack-origin-git config option was used to install openstack
|
||||
from source git repositories, then this action can be used to reinstall
|
||||
from updated git repositories, followed by a restart of services."""
|
||||
if not git_install_requested():
|
||||
action_fail('openstack-origin-git is not configured')
|
||||
return
|
||||
|
||||
try:
|
||||
git_install(config('openstack-origin-git'))
|
||||
config_changed()
|
||||
except:
|
||||
action_set({'traceback': traceback.format_exc()})
|
||||
action_fail('git-reinstall resulted in an unexpected error')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
git_reinstall()
|
16
config.yaml
16
config.yaml
@ -37,6 +37,22 @@ options:
|
||||
- deb http://my.archive.com/ubuntu main|KEYID
|
||||
.
|
||||
Note that quantum/neutron is only supported >= Folsom.
|
||||
|
||||
Note that when openstack-origin-git is specified, openstack
|
||||
specific packages will be installed from source rather than
|
||||
from the openstack-origin repository.
|
||||
openstack-origin-git:
|
||||
default:
|
||||
type: string
|
||||
description: |
|
||||
Specifies a YAML-formatted dictionary listing the git
|
||||
repositories and branches from which to install OpenStack and
|
||||
its dependencies.
|
||||
|
||||
Note that the installed config files will be determined based on
|
||||
the OpenStack release of the openstack-origin option.
|
||||
|
||||
For more details see README.md.
|
||||
run-internal-router:
|
||||
type: string
|
||||
default: all
|
||||
|
@ -101,7 +101,8 @@ class OpenStackAmuletDeployment(AmuletDeployment):
|
||||
"""
|
||||
(self.precise_essex, self.precise_folsom, self.precise_grizzly,
|
||||
self.precise_havana, self.precise_icehouse,
|
||||
self.trusty_icehouse, self.trusty_juno, self.trusty_kilo) = range(8)
|
||||
self.trusty_icehouse, self.trusty_juno, self.trusty_kilo,
|
||||
self.utopic_juno, self.vivid_kilo) = range(10)
|
||||
releases = {
|
||||
('precise', None): self.precise_essex,
|
||||
('precise', 'cloud:precise-folsom'): self.precise_folsom,
|
||||
@ -110,7 +111,9 @@ class OpenStackAmuletDeployment(AmuletDeployment):
|
||||
('precise', 'cloud:precise-icehouse'): self.precise_icehouse,
|
||||
('trusty', None): self.trusty_icehouse,
|
||||
('trusty', 'cloud:trusty-juno'): self.trusty_juno,
|
||||
('trusty', 'cloud:trusty-kilo'): self.trusty_kilo}
|
||||
('trusty', 'cloud:trusty-kilo'): self.trusty_kilo,
|
||||
('utopic', None): self.utopic_juno,
|
||||
('vivid', None): self.vivid_kilo}
|
||||
return releases[(self.series, self.openstack)]
|
||||
|
||||
def _get_openstack_release_string(self):
|
||||
|
@ -524,9 +524,10 @@ def git_clone_and_install(projects_yaml, core_project):
|
||||
projects = yaml.load(projects_yaml)
|
||||
_git_validate_projects_yaml(projects, core_project)
|
||||
|
||||
old_environ = dict(os.environ)
|
||||
|
||||
if 'http_proxy' in projects.keys():
|
||||
os.environ['http_proxy'] = projects['http_proxy']
|
||||
|
||||
if 'https_proxy' in projects.keys():
|
||||
os.environ['https_proxy'] = projects['https_proxy']
|
||||
|
||||
@ -544,6 +545,8 @@ def git_clone_and_install(projects_yaml, core_project):
|
||||
repo_dir = _git_clone_and_install_single(repo, branch, parent_dir,
|
||||
update_requirements=True)
|
||||
|
||||
os.environ = old_environ
|
||||
|
||||
|
||||
def _git_validate_projects_yaml(projects, core_project):
|
||||
"""
|
||||
|
@ -30,6 +30,7 @@ from charmhelpers.contrib.hahelpers.apache import(
|
||||
install_ca_cert
|
||||
)
|
||||
from charmhelpers.contrib.openstack.utils import (
|
||||
config_value_changed,
|
||||
configure_installation_source,
|
||||
openstack_upgrade_available,
|
||||
os_requires_version,
|
||||
@ -50,6 +51,8 @@ from quantum_utils import (
|
||||
get_early_packages,
|
||||
get_common_package,
|
||||
get_topics,
|
||||
git_install,
|
||||
git_install_requested,
|
||||
valid_plugin,
|
||||
configure_ovs,
|
||||
stop_services,
|
||||
@ -82,6 +85,7 @@ def install():
|
||||
fatal=True)
|
||||
apt_install(filter_installed_packages(get_packages()),
|
||||
fatal=True)
|
||||
git_install(config('openstack-origin-git'))
|
||||
else:
|
||||
log('Please provide a valid plugin config', level=ERROR)
|
||||
sys.exit(1)
|
||||
@ -94,8 +98,15 @@ def install():
|
||||
@restart_on_change(restart_map())
|
||||
def config_changed():
|
||||
global CONFIGS
|
||||
if git_install_requested():
|
||||
if config_value_changed('openstack-origin-git'):
|
||||
git_install(config('openstack-origin-git'))
|
||||
CONFIGS.write_all()
|
||||
else:
|
||||
if openstack_upgrade_available(get_common_package()):
|
||||
CONFIGS = do_openstack_upgrade()
|
||||
do_openstack_upgrade()
|
||||
CONFIGS.write_all()
|
||||
|
||||
update_nrpe_config()
|
||||
|
||||
sysctl_dict = config('sysctl')
|
||||
@ -120,6 +131,7 @@ def config_changed():
|
||||
log('Please provide a valid plugin config', level=ERROR)
|
||||
sys.exit(1)
|
||||
if config('plugin') == 'n1kv':
|
||||
if not git_install_requested():
|
||||
if config('enable-l3-agent'):
|
||||
apt_install(filter_installed_packages('neutron-l3-agent'))
|
||||
else:
|
||||
|
@ -1,14 +1,20 @@
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
from shutil import copy2
|
||||
from charmhelpers.core.host import (
|
||||
adduser,
|
||||
add_group,
|
||||
add_user_to_group,
|
||||
lsb_release,
|
||||
mkdir,
|
||||
service_running,
|
||||
service_stop,
|
||||
service_restart,
|
||||
lsb_release,
|
||||
write_file,
|
||||
)
|
||||
from charmhelpers.core.hookenv import (
|
||||
charm_dir,
|
||||
log,
|
||||
DEBUG,
|
||||
INFO,
|
||||
@ -18,6 +24,7 @@ from charmhelpers.core.hookenv import (
|
||||
unit_private_ip,
|
||||
is_relation_made,
|
||||
)
|
||||
from charmhelpers.core.templating import render
|
||||
from charmhelpers.fetch import (
|
||||
apt_upgrade,
|
||||
apt_update,
|
||||
@ -32,6 +39,9 @@ from charmhelpers.contrib.openstack.utils import (
|
||||
configure_installation_source,
|
||||
get_os_codename_install_source,
|
||||
get_os_codename_package,
|
||||
git_install_requested,
|
||||
git_clone_and_install,
|
||||
git_src_dir,
|
||||
get_hostname
|
||||
)
|
||||
|
||||
@ -174,6 +184,39 @@ LEGACY_FILES_MAP = {
|
||||
LEGACY_RES_MAP = ['res_monitor']
|
||||
L3HA_PACKAGES = ['keepalived']
|
||||
|
||||
BASE_GIT_PACKAGES = [
|
||||
'dnsmasq',
|
||||
'libxml2-dev',
|
||||
'libxslt1-dev',
|
||||
'python-dev',
|
||||
'python-pip',
|
||||
'python-setuptools',
|
||||
'zlib1g-dev',
|
||||
]
|
||||
|
||||
# ubuntu packages that should not be installed when deploying from git
|
||||
GIT_PACKAGE_BLACKLIST = [
|
||||
'nova-api-metadata',
|
||||
'neutron-common',
|
||||
'neutron-dhcp-agent',
|
||||
'neutron-l3-agent',
|
||||
'neutron-lbaas-agent',
|
||||
'neutron-metadata-agent',
|
||||
'neutron-metering-agent',
|
||||
'neutron-plugin-cisco',
|
||||
'neutron-plugin-metering-agent',
|
||||
'neutron-plugin-openvswitch-agent',
|
||||
'neutron-plugin-vpn-agent',
|
||||
'neutron-vpn-agent',
|
||||
'python-neutron-fwaas',
|
||||
'python-oslo.config',
|
||||
'quantum-common',
|
||||
'quantum-dhcp-agent',
|
||||
'quantum-l3-agent',
|
||||
'quantum-metadata-agent',
|
||||
'quantum-plugin-openvswitch-agent',
|
||||
]
|
||||
|
||||
|
||||
def get_early_packages():
|
||||
'''Return a list of package for pre-install based on configured plugin'''
|
||||
@ -204,6 +247,15 @@ def get_packages():
|
||||
if source >= 'kilo':
|
||||
packages.append('python-neutron-fwaas')
|
||||
packages.extend(determine_l3ha_packages())
|
||||
|
||||
if git_install_requested():
|
||||
packages = list(set(packages))
|
||||
packages.extend(BASE_GIT_PACKAGES)
|
||||
# don't include packages that will be installed from git
|
||||
for p in GIT_PACKAGE_BLACKLIST:
|
||||
if p in packages:
|
||||
packages.remove(p)
|
||||
|
||||
return packages
|
||||
|
||||
|
||||
@ -612,12 +664,6 @@ def do_openstack_upgrade():
|
||||
apt_install(get_early_packages(), fatal=True)
|
||||
apt_install(get_packages(), fatal=True)
|
||||
|
||||
# set CONFIGS to load templates from new release
|
||||
configs = register_configs()
|
||||
configs.write_all()
|
||||
[service_restart(s) for s in services()]
|
||||
return configs
|
||||
|
||||
|
||||
def configure_ovs():
|
||||
if config('plugin') == OVS:
|
||||
@ -760,3 +806,348 @@ def get_topics():
|
||||
topics.append('q-agent-notifier-dvr-update')
|
||||
topics.append('q-agent-notifier-l2population-update')
|
||||
return topics
|
||||
|
||||
|
||||
def git_install(projects_yaml):
|
||||
"""Perform setup, and install git repos specified in yaml parameter."""
|
||||
if git_install_requested():
|
||||
git_pre_install()
|
||||
git_clone_and_install(projects_yaml, core_project='neutron')
|
||||
git_post_install(projects_yaml)
|
||||
|
||||
|
||||
def git_pre_install():
|
||||
"""Perform pre-install setup."""
|
||||
dirs = [
|
||||
'/etc/neutron',
|
||||
'/etc/neutron/rootwrap.d',
|
||||
'/etc/neutron/plugins',
|
||||
'/etc/nova',
|
||||
'/var/lib/neutron',
|
||||
'/var/lib/neutron/lock',
|
||||
'/var/log/neutron',
|
||||
]
|
||||
|
||||
logs = [
|
||||
'/var/log/neutron/bigswitch-agent.log',
|
||||
'/var/log/neutron/dhcp-agent.log',
|
||||
'/var/log/neutron/l3-agent.log',
|
||||
'/var/log/neutron/lbaas-agent.log',
|
||||
'/var/log/neutron/ibm-agent.log',
|
||||
'/var/log/neutron/linuxbridge-agent.log',
|
||||
'/var/log/neutron/metadata-agent.log',
|
||||
'/var/log/neutron/metering_agent.log',
|
||||
'/var/log/neutron/mlnx-agent.log',
|
||||
'/var/log/neutron/nec-agent.log',
|
||||
'/var/log/neutron/nvsd-agent.log',
|
||||
'/var/log/neutron/openflow-agent.log',
|
||||
'/var/log/neutron/openvswitch-agent.log',
|
||||
'/var/log/neutron/ovs-cleanup.log',
|
||||
'/var/log/neutron/ryu-agent.log',
|
||||
'/var/log/neutron/server.log',
|
||||
'/var/log/neutron/sriov-agent.log',
|
||||
'/var/log/neutron/vpn_agent.log',
|
||||
]
|
||||
|
||||
adduser('neutron', shell='/bin/bash', system_user=True)
|
||||
add_group('neutron', system_group=True)
|
||||
add_user_to_group('neutron', 'neutron')
|
||||
|
||||
for d in dirs:
|
||||
mkdir(d, owner='neutron', group='neutron', perms=0700, force=False)
|
||||
|
||||
for l in logs:
|
||||
write_file(l, '', owner='neutron', group='neutron', perms=0644)
|
||||
|
||||
|
||||
def git_post_install(projects_yaml):
|
||||
"""Perform post-install setup."""
|
||||
src_etc = os.path.join(git_src_dir(projects_yaml, 'neutron'), 'etc')
|
||||
configs = [
|
||||
{'src': src_etc,
|
||||
'dest': '/etc/neutron'},
|
||||
{'src': os.path.join(src_etc, 'neutron/plugins'),
|
||||
'dest': '/etc/neutron/plugins'},
|
||||
{'src': os.path.join(src_etc, 'neutron/rootwrap.d'),
|
||||
'dest': '/etc/neutron/rootwrap.d'},
|
||||
]
|
||||
|
||||
for c in configs:
|
||||
if os.path.exists(c['dest']):
|
||||
shutil.rmtree(c['dest'])
|
||||
shutil.copytree(c['src'], c['dest'])
|
||||
|
||||
symlinks = [
|
||||
{'src': '/usr/local/bin/neutron-rootwrap',
|
||||
'link': '/usr/bin/neutron-rootwrap'},
|
||||
]
|
||||
|
||||
for s in symlinks:
|
||||
if os.path.lexists(s['link']):
|
||||
os.remove(s['link'])
|
||||
os.symlink(s['src'], s['link'])
|
||||
|
||||
render('git/neutron_sudoers',
|
||||
'/etc/sudoers.d/neutron_sudoers', {}, perms=0o440)
|
||||
render('git/cron.d/neutron-dhcp-agent-netns-cleanup',
|
||||
'/etc/cron.d/neutron-dhcp-agent-netns-cleanup', {}, perms=0o755)
|
||||
render('git/cron.d/neutron-l3-agent-netns-cleanup',
|
||||
'/etc/cron.d/neutron-l3-agent-netns-cleanup', {}, perms=0o755)
|
||||
render('git/cron.d/neutron-lbaas-agent-netns-cleanup',
|
||||
'/etc/cron.d/neutron-lbaas-agent-netns-cleanup', {}, perms=0o755)
|
||||
|
||||
service_name = 'quantum-gateway'
|
||||
user_name = 'neutron'
|
||||
neutron_api_context = {
|
||||
'service_description': 'Neutron API server',
|
||||
'service_name': service_name,
|
||||
'process_name': 'neutron-server',
|
||||
}
|
||||
neutron_dhcp_agent_context = {
|
||||
'service_description': 'Neutron DHCP Agent',
|
||||
'service_name': service_name,
|
||||
'process_name': 'neutron-dhcp-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/dhcp_agent.ini'],
|
||||
'log_file': '/var/log/neutron/dhcp-agent.log',
|
||||
}
|
||||
neutron_l3_agent_context = {
|
||||
'service_description': 'Neutron L3 Agent',
|
||||
'service_name': service_name,
|
||||
'process_name': 'neutron-l3-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/l3_agent.ini',
|
||||
'/etc/neutron/fwaas_driver.ini'],
|
||||
'log_file': '/var/log/neutron/l3-agent.log',
|
||||
}
|
||||
neutron_lbaas_agent_context = {
|
||||
'service_description': 'Neutron LBaaS Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-lbaas-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-lbaas-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/lbaas_agent.ini'],
|
||||
'log_file': '/var/log/neutron/lbaas-agent.log',
|
||||
}
|
||||
neutron_metadata_agent_context = {
|
||||
'service_description': 'Neutron Metadata Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-metadata-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-metadata-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/metadata_agent.ini'],
|
||||
'log_file': '/var/log/neutron/metadata-agent.log',
|
||||
}
|
||||
neutron_metering_agent_context = {
|
||||
'service_description': 'Neutron Metering Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-metering-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-metering-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/metering_agent.ini'],
|
||||
'log_file': '/var/log/neutron/metering-agent.log',
|
||||
}
|
||||
neutron_ovs_cleanup_context = {
|
||||
'service_description': 'Neutron OVS cleanup',
|
||||
'service_name': service_name,
|
||||
'process_name': 'neutron-ovs-cleanup',
|
||||
'config_file': '/etc/neutron/neutron.conf',
|
||||
'log_file': '/var/log/neutron/ovs-cleanup.log',
|
||||
}
|
||||
neutron_plugin_bigswitch_context = {
|
||||
'service_description': 'Neutron BigSwitch Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-restproxy-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-restproxy-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/bigswitch/restproxy.ini'],
|
||||
'log_file': '/var/log/neutron/bigswitch-agent.log',
|
||||
}
|
||||
neutron_plugin_ibm_context = {
|
||||
'service_description': 'Neutron IBM SDN Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-ibm-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-ibm-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/ibm/sdnve_neutron_plugin.ini'],
|
||||
'log_file': '/var/log/neutron/ibm-agent.log',
|
||||
}
|
||||
neutron_plugin_linuxbridge_context = {
|
||||
'service_description': 'Neutron Linux Bridge Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-linuxbridge-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-linuxbridge-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/ml2/ml2_conf.ini'],
|
||||
'log_file': '/var/log/neutron/linuxbridge-agent.log',
|
||||
}
|
||||
neutron_plugin_mlnx_context = {
|
||||
'service_description': 'Neutron MLNX Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-mlnx-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-mlnx-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/mlnx/mlnx_conf.ini'],
|
||||
'log_file': '/var/log/neutron/mlnx-agent.log',
|
||||
}
|
||||
neutron_plugin_nec_context = {
|
||||
'service_description': 'Neutron NEC Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-nec-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-nec-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/nec/nec.ini'],
|
||||
'log_file': '/var/log/neutron/nec-agent.log',
|
||||
}
|
||||
neutron_plugin_oneconvergence_context = {
|
||||
'service_description': 'Neutron One Convergence Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-nvsd-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-nvsd-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/oneconvergence/nvsdplugin.ini'],
|
||||
'log_file': '/var/log/neutron/nvsd-agent.log',
|
||||
}
|
||||
neutron_plugin_openflow_context = {
|
||||
'service_description': 'Neutron OpenFlow Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-ofagent-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-ofagent-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/ml2/ml2_conf_ofa.ini'],
|
||||
'log_file': '/var/log/neutron/openflow-agent.log',
|
||||
}
|
||||
neutron_plugin_openvswitch_context = {
|
||||
'service_description': 'Neutron OpenvSwitch Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-openvswitch-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-openvswitch-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/ml2/ml2_conf.ini'],
|
||||
'log_file': '/var/log/neutron/openvswitch-agent.log',
|
||||
}
|
||||
neutron_plugin_ryu_context = {
|
||||
'service_description': 'Neutron RYU Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-ryu-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-ryu-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/ryu/ryu.ini'],
|
||||
'log_file': '/var/log/neutron/ryu-agent.log',
|
||||
}
|
||||
neutron_plugin_sriov_context = {
|
||||
'service_description': 'Neutron SRIOV SDN Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-sriov-nic-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-sriov-nic-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/ml2/ml2_conf_sriov'],
|
||||
'log_file': '/var/log/neutron/sriov-agent.log',
|
||||
}
|
||||
neutron_vpn_agent_context = {
|
||||
'service_description': 'Neutron VPN Agent',
|
||||
'service_name': service_name,
|
||||
'process_name': 'neutron-vpn-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/vpn_agent.ini',
|
||||
'/etc/neutron/l3_agent.ini',
|
||||
'/etc/neutron/fwaas_driver.ini'],
|
||||
'log_file': '/var/log/neutron/vpn_agent.log',
|
||||
}
|
||||
|
||||
# NOTE(coreycb): Needs systemd support
|
||||
templates_dir = 'hooks/charmhelpers/contrib/openstack/templates'
|
||||
templates_dir = os.path.join(charm_dir(), templates_dir)
|
||||
render('git/upstart/neutron-agent.upstart',
|
||||
'/etc/init/neutron-dhcp-agent.conf',
|
||||
neutron_dhcp_agent_context, perms=0o644)
|
||||
render('git/upstart/neutron-agent.upstart',
|
||||
'/etc/init/neutron-l3-agent.conf',
|
||||
neutron_l3_agent_context, perms=0o644)
|
||||
render('git.upstart',
|
||||
'/etc/init/neutron-lbaas-agent.conf',
|
||||
neutron_lbaas_agent_context, perms=0o644,
|
||||
templates_dir=templates_dir)
|
||||
render('git.upstart',
|
||||
'/etc/init/neutron-metadata-agent.conf',
|
||||
neutron_metadata_agent_context, perms=0o644,
|
||||
templates_dir=templates_dir)
|
||||
render('git.upstart',
|
||||
'/etc/init/neutron-metering-agent.conf',
|
||||
neutron_metering_agent_context, perms=0o644,
|
||||
templates_dir=templates_dir)
|
||||
render('git.upstart',
|
||||
'/etc/init/neutron-ovs-cleanup.conf',
|
||||
neutron_ovs_cleanup_context, perms=0o644,
|
||||
templates_dir=templates_dir)
|
||||
render('git.upstart',
|
||||
'/etc/init/neutron-plugin-bigswitch-agent.conf',
|
||||
neutron_plugin_bigswitch_context, perms=0o644,
|
||||
templates_dir=templates_dir)
|
||||
render('git.upstart',
|
||||
'/etc/init/neutron-plugin-ibm-agent.conf',
|
||||
neutron_plugin_ibm_context, perms=0o644,
|
||||
templates_dir=templates_dir)
|
||||
render('git.upstart',
|
||||
'/etc/init/neutron-plugin-linuxbridge-agent.conf',
|
||||
neutron_plugin_linuxbridge_context, perms=0o644,
|
||||
templates_dir=templates_dir)
|
||||
render('git.upstart',
|
||||
'/etc/init/neutron-plugin-mlnx-agent.conf',
|
||||
neutron_plugin_mlnx_context, perms=0o644,
|
||||
templates_dir=templates_dir)
|
||||
render('git.upstart',
|
||||
'/etc/init/neutron-plugin-nec-agent.conf',
|
||||
neutron_plugin_nec_context, perms=0o644,
|
||||
templates_dir=templates_dir)
|
||||
render('git.upstart',
|
||||
'/etc/init/neutron-plugin-oneconvergence-agent.conf',
|
||||
neutron_plugin_oneconvergence_context, perms=0o644,
|
||||
templates_dir=templates_dir)
|
||||
render('git.upstart',
|
||||
'/etc/init/neutron-plugin-openflow-agent.conf',
|
||||
neutron_plugin_openflow_context, perms=0o644,
|
||||
templates_dir=templates_dir)
|
||||
render('git.upstart',
|
||||
'/etc/init/neutron-plugin-openvswitch-agent.conf',
|
||||
neutron_plugin_openvswitch_context, perms=0o644,
|
||||
templates_dir=templates_dir)
|
||||
render('git.upstart',
|
||||
'/etc/init/neutron-plugin-ryu-agent.conf',
|
||||
neutron_plugin_ryu_context, perms=0o644,
|
||||
templates_dir=templates_dir)
|
||||
render('git.upstart',
|
||||
'/etc/init/neutron-plugin-sriov-agent.conf',
|
||||
neutron_plugin_sriov_context, perms=0o644,
|
||||
templates_dir=templates_dir)
|
||||
render('git/upstart/neutron-server.upstart',
|
||||
'/etc/init/neutron-server.conf',
|
||||
neutron_api_context, perms=0o644)
|
||||
render('git/upstart/neutron-agent.upstart',
|
||||
'/etc/init/neutron-vpn-agent.conf',
|
||||
neutron_vpn_agent_context, perms=0o644)
|
||||
|
4
templates/git/cron.d/neutron-dhcp-agent-netns-cleanup
Normal file
4
templates/git/cron.d/neutron-dhcp-agent-netns-cleanup
Normal file
@ -0,0 +1,4 @@
|
||||
# vim: set filetype=crontab:
|
||||
# Periodically cleans Neutron's network namespaces on behalf of the Neutron
|
||||
# DHCP agent.
|
||||
30 * * * * neutron if [ -x /usr/local/bin/neutron-netns-cleanup ] ; then /usr/local/bin/neutron-netns-cleanup --config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/dhcp_agent.ini >/dev/null 2>&1; fi
|
4
templates/git/cron.d/neutron-l3-agent-netns-cleanup
Normal file
4
templates/git/cron.d/neutron-l3-agent-netns-cleanup
Normal file
@ -0,0 +1,4 @@
|
||||
# vim: set filetype=crontab:
|
||||
# Periodically cleans Neutron's network namespaces on behalf of the Neutron
|
||||
# L3 agent.
|
||||
0 * * * * neutron if [ -x /usr/local/bin/neutron-netns-cleanup ] ; then /usr/local/bin/neutron-netns-cleanup --config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/l3_agent.ini >/dev/null 2>&1; fi
|
4
templates/git/cron.d/neutron-lbaas-agent-netns-cleanup
Normal file
4
templates/git/cron.d/neutron-lbaas-agent-netns-cleanup
Normal file
@ -0,0 +1,4 @@
|
||||
# vim: set filetype=crontab:
|
||||
# Periodically cleans Neutron's network namespaces on behalf of the Neutron
|
||||
# L3 agent.
|
||||
0 * * * * neutron if [ -x /usr/local/bin/neutron-netns-cleanup ] ; then /usr/local/bin/neutron-netns-cleanup --config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/lbaas_agent.ini >/dev/null 2>&1; fi
|
4
templates/git/neutron_sudoers
Normal file
4
templates/git/neutron_sudoers
Normal file
@ -0,0 +1,4 @@
|
||||
Defaults:neutron !requiretty
|
||||
|
||||
neutron ALL = (root) NOPASSWD: /usr/local/bin/neutron-rootwrap /etc/neutron/rootwrap.conf *
|
||||
|
25
templates/git/upstart/neutron-agent.upstart
Normal file
25
templates/git/upstart/neutron-agent.upstart
Normal file
@ -0,0 +1,25 @@
|
||||
description "{{ service_description }}"
|
||||
author "Juju {{ service_name }} Charm <juju@localhost>"
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [!2345]
|
||||
|
||||
respawn
|
||||
|
||||
chdir /var/run
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/run/neutron
|
||||
chown neutron:root /var/run/neutron
|
||||
# Check to see if openvswitch plugin in use by checking
|
||||
# status of cleanup upstart configuration
|
||||
if status neutron-ovs-cleanup; then
|
||||
start wait-for-state WAIT_FOR=neutron-ovs-cleanup WAIT_STATE=running WAITER={{ process_name }}
|
||||
fi
|
||||
end script
|
||||
|
||||
exec start-stop-daemon --start --chuid neutron --exec /usr/local/bin/{{ process_name }} -- \
|
||||
{% for config_file in config_files -%}
|
||||
--config-file={{ config_file }} \
|
||||
{% endfor -%}
|
||||
--log-file={{ log_file }}
|
13
templates/git/upstart/neutron-ovs-cleanup.upstart
Normal file
13
templates/git/upstart/neutron-ovs-cleanup.upstart
Normal file
@ -0,0 +1,13 @@
|
||||
description "{{ service_description }}"
|
||||
author "Juju {{ service_name }} Charm <juju@localhost>"
|
||||
|
||||
start on started openvswitch-switch
|
||||
stop on runlevel [!2345]
|
||||
|
||||
pre-start script
|
||||
[ ! -x /usr/local/bin/{{ process_name }} ] && exit 0
|
||||
start-stop-daemon --start --chuid neutron \
|
||||
--exec /usr/local/bin/{{ process_name }} -- \
|
||||
--log-file {{ log_file }} \
|
||||
--config-file {{ config_file }} --verbose
|
||||
end script
|
22
templates/git/upstart/neutron-server.upstart
Normal file
22
templates/git/upstart/neutron-server.upstart
Normal file
@ -0,0 +1,22 @@
|
||||
description "{{ service_description }}"
|
||||
author "Juju {{ service_name }} Charm <juju@localhost>"
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [!2345]
|
||||
|
||||
respawn
|
||||
|
||||
chdir /var/run
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/run/neutron
|
||||
chown neutron:root /var/run/neutron
|
||||
end script
|
||||
|
||||
script
|
||||
[ -r /etc/default/{{ process_name }} ] && . /etc/default/{{ process_name }}
|
||||
[ -r "$NEUTRON_PLUGIN_CONFIG" ] && CONF_ARG="--config-file $NEUTRON_PLUGIN_CONFIG"
|
||||
exec start-stop-daemon --start --chuid neutron --exec /usr/local/bin/neutron-server -- \
|
||||
--config-file /etc/neutron/neutron.conf \
|
||||
--log-file /var/log/neutron/server.log $CONF_ARG
|
||||
end script
|
@ -1,11 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
"""Amulet tests on a basic quantum-gateway deployment on precise-grizzly."""
|
||||
|
||||
from basic_deployment import QuantumGatewayBasicDeployment
|
||||
|
||||
if __name__ == '__main__':
|
||||
deployment = QuantumGatewayBasicDeployment(series='precise',
|
||||
openstack='cloud:precise-grizzly',
|
||||
source='cloud:precise-updates/grizzly')
|
||||
deployment.run_tests()
|
@ -1,11 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
"""Amulet tests on a basic quantum-gateway deployment on precise-havana."""
|
||||
|
||||
from basic_deployment import QuantumGatewayBasicDeployment
|
||||
|
||||
if __name__ == '__main__':
|
||||
deployment = QuantumGatewayBasicDeployment(series='precise',
|
||||
openstack='cloud:precise-havana',
|
||||
source='cloud:precise-updates/havana')
|
||||
deployment.run_tests()
|
9
tests/16-basic-trusty-icehouse-git
Executable file
9
tests/16-basic-trusty-icehouse-git
Executable file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
"""Amulet tests on a basic quantum-gateway git deployment on trusty-icehouse."""
|
||||
|
||||
from basic_deployment import QuantumGatewayBasicDeployment
|
||||
|
||||
if __name__ == '__main__':
|
||||
deployment = QuantumGatewayBasicDeployment(series='trusty', git=True)
|
||||
deployment.run_tests()
|
11
tests/17-basic-trusty-juno
Executable file
11
tests/17-basic-trusty-juno
Executable file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
"""Amulet tests on a basic quantum-gateway deployment on trusty-juno."""
|
||||
|
||||
from basic_deployment import QuantumGatewayBasicDeployment
|
||||
|
||||
if __name__ == '__main__':
|
||||
deployment = QuantumGatewayBasicDeployment(series='trusty',
|
||||
openstack='cloud:trusty-juno',
|
||||
source='cloud:trusty-updates/juno')
|
||||
deployment.run_tests()
|
12
tests/18-basic-trusty-juno-git
Executable file
12
tests/18-basic-trusty-juno-git
Executable file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
"""Amulet tests on a basic quantum-gateway git deployment on trusty-juno."""
|
||||
|
||||
from basic_deployment import QuantumGatewayBasicDeployment
|
||||
|
||||
if __name__ == '__main__':
|
||||
deployment = QuantumGatewayBasicDeployment(series='trusty',
|
||||
openstack='cloud:trusty-juno',
|
||||
source='cloud:trusty-updates/juno',
|
||||
git=True)
|
||||
deployment.run_tests()
|
@ -1,7 +1,9 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import amulet
|
||||
import os
|
||||
import time
|
||||
import yaml
|
||||
try:
|
||||
from quantumclient.v2_0 import client as neutronclient
|
||||
except ImportError:
|
||||
@ -18,16 +20,18 @@ from charmhelpers.contrib.openstack.amulet.utils import (
|
||||
)
|
||||
|
||||
# Use DEBUG to turn on debug logging
|
||||
u = OpenStackAmuletUtils(ERROR)
|
||||
u = OpenStackAmuletUtils(DEBUG)
|
||||
|
||||
|
||||
class QuantumGatewayBasicDeployment(OpenStackAmuletDeployment):
|
||||
"""Amulet tests on a basic quantum-gateway deployment."""
|
||||
|
||||
def __init__(self, series, openstack=None, source=None, stable=False):
|
||||
def __init__(self, series, openstack=None, source=None, git=False,
|
||||
stable=False):
|
||||
"""Deploy the entire test environment."""
|
||||
super(QuantumGatewayBasicDeployment, self).__init__(series, openstack,
|
||||
source, stable)
|
||||
self.git = git
|
||||
self._add_services()
|
||||
self._add_relations()
|
||||
self._configure_services()
|
||||
@ -64,11 +68,30 @@ class QuantumGatewayBasicDeployment(OpenStackAmuletDeployment):
|
||||
|
||||
def _configure_services(self):
|
||||
"""Configure all of the services."""
|
||||
quantum_gateway_config = {}
|
||||
if self.git:
|
||||
branch = 'stable/' + self._get_openstack_release_string()
|
||||
amulet_http_proxy = os.environ.get('AMULET_HTTP_PROXY')
|
||||
openstack_origin_git = {
|
||||
'repositories': [
|
||||
{'name': 'requirements',
|
||||
'repository': 'git://git.openstack.org/openstack/requirements',
|
||||
'branch': branch},
|
||||
{'name': 'neutron',
|
||||
'repository': 'git://git.openstack.org/openstack/neutron',
|
||||
'branch': branch},
|
||||
],
|
||||
'directory': '/mnt/openstack-git',
|
||||
'http_proxy': amulet_http_proxy,
|
||||
'https_proxy': amulet_http_proxy,
|
||||
}
|
||||
quantum_gateway_config['openstack-origin-git'] = yaml.dump(openstack_origin_git)
|
||||
keystone_config = {'admin-password': 'openstack',
|
||||
'admin-token': 'ubuntutesting'}
|
||||
nova_cc_config = {'network-manager': 'Quantum',
|
||||
'quantum-security-groups': 'yes'}
|
||||
configs = {'keystone': keystone_config,
|
||||
configs = {'quantum-gateway': quantum_gateway_config,
|
||||
'keystone': keystone_config,
|
||||
'nova-cloud-controller': nova_cc_config}
|
||||
super(QuantumGatewayBasicDeployment, self)._configure_services(configs)
|
||||
|
||||
@ -269,7 +292,7 @@ class QuantumGatewayBasicDeployment(OpenStackAmuletDeployment):
|
||||
|
||||
self.d.configure('quantum-gateway', {'debug': 'True'})
|
||||
|
||||
time = 20
|
||||
time = 40
|
||||
for s in services:
|
||||
if not u.service_restarted(self.quantum_gateway_sentry, s, conf,
|
||||
pgrep_full=True, sleep_time=time):
|
||||
|
@ -101,7 +101,8 @@ class OpenStackAmuletDeployment(AmuletDeployment):
|
||||
"""
|
||||
(self.precise_essex, self.precise_folsom, self.precise_grizzly,
|
||||
self.precise_havana, self.precise_icehouse,
|
||||
self.trusty_icehouse, self.trusty_juno, self.trusty_kilo) = range(8)
|
||||
self.trusty_icehouse, self.trusty_juno, self.trusty_kilo,
|
||||
self.utopic_juno, self.vivid_kilo) = range(10)
|
||||
releases = {
|
||||
('precise', None): self.precise_essex,
|
||||
('precise', 'cloud:precise-folsom'): self.precise_folsom,
|
||||
@ -110,7 +111,9 @@ class OpenStackAmuletDeployment(AmuletDeployment):
|
||||
('precise', 'cloud:precise-icehouse'): self.precise_icehouse,
|
||||
('trusty', None): self.trusty_icehouse,
|
||||
('trusty', 'cloud:trusty-juno'): self.trusty_juno,
|
||||
('trusty', 'cloud:trusty-kilo'): self.trusty_kilo}
|
||||
('trusty', 'cloud:trusty-kilo'): self.trusty_kilo,
|
||||
('utopic', None): self.utopic_juno,
|
||||
('vivid', None): self.vivid_kilo}
|
||||
return releases[(self.series, self.openstack)]
|
||||
|
||||
def _get_openstack_release_string(self):
|
||||
|
@ -1,2 +1,4 @@
|
||||
import sys
|
||||
|
||||
sys.path.append('actions')
|
||||
sys.path.append('hooks')
|
||||
|
105
unit_tests/test_actions_git_reinstall.py
Normal file
105
unit_tests/test_actions_git_reinstall.py
Normal file
@ -0,0 +1,105 @@
|
||||
from mock import patch, MagicMock
|
||||
|
||||
with patch('charmhelpers.core.hookenv.config') as config:
|
||||
config.return_value = 'neutron'
|
||||
import quantum_utils as utils # noqa
|
||||
|
||||
# Need to do some early patching to get the module loaded.
|
||||
_register_configs = utils.register_configs
|
||||
_restart_map = utils.restart_map
|
||||
|
||||
utils.register_configs = MagicMock()
|
||||
utils.restart_map = MagicMock()
|
||||
|
||||
import git_reinstall
|
||||
|
||||
# Unpatch it now that its loaded.
|
||||
utils.register_configs = _register_configs
|
||||
utils.restart_map = _restart_map
|
||||
|
||||
from test_utils import (
|
||||
CharmTestCase
|
||||
)
|
||||
|
||||
TO_PATCH = [
|
||||
'config',
|
||||
]
|
||||
|
||||
|
||||
openstack_origin_git = \
|
||||
"""repositories:
|
||||
- {name: requirements,
|
||||
repository: 'git://git.openstack.org/openstack/requirements',
|
||||
branch: stable/juno}
|
||||
- {name: neutron,
|
||||
repository: 'git://git.openstack.org/openstack/neutron',
|
||||
branch: stable/juno}"""
|
||||
|
||||
|
||||
class TestNeutronAPIActions(CharmTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestNeutronAPIActions, self).setUp(git_reinstall, TO_PATCH)
|
||||
self.config.side_effect = self.test_config.get
|
||||
|
||||
@patch.object(git_reinstall, 'action_set')
|
||||
@patch.object(git_reinstall, 'action_fail')
|
||||
@patch.object(git_reinstall, 'git_install')
|
||||
@patch.object(git_reinstall, 'config_changed')
|
||||
def test_git_reinstall(self, config_changed, git_install, action_fail,
|
||||
action_set):
|
||||
self.test_config.set('openstack-origin-git', openstack_origin_git)
|
||||
|
||||
git_reinstall.git_reinstall()
|
||||
|
||||
git_install.assert_called_with(openstack_origin_git)
|
||||
self.assertTrue(git_install.called)
|
||||
self.assertTrue(config_changed.called)
|
||||
self.assertFalse(action_set.called)
|
||||
self.assertFalse(action_fail.called)
|
||||
|
||||
@patch.object(git_reinstall, 'action_set')
|
||||
@patch.object(git_reinstall, 'action_fail')
|
||||
@patch.object(git_reinstall, 'git_install')
|
||||
@patch.object(git_reinstall, 'config_changed')
|
||||
@patch('charmhelpers.contrib.openstack.utils.config')
|
||||
def test_git_reinstall_not_configured(self, _config, config_changed,
|
||||
git_install, action_fail,
|
||||
action_set):
|
||||
_config.return_value = None
|
||||
|
||||
git_reinstall.git_reinstall()
|
||||
|
||||
msg = 'openstack-origin-git is not configured'
|
||||
action_fail.assert_called_with(msg)
|
||||
self.assertFalse(git_install.called)
|
||||
self.assertFalse(action_set.called)
|
||||
|
||||
@patch.object(git_reinstall, 'action_set')
|
||||
@patch.object(git_reinstall, 'action_fail')
|
||||
@patch.object(git_reinstall, 'git_install')
|
||||
@patch.object(git_reinstall, 'config_changed')
|
||||
@patch('traceback.format_exc')
|
||||
@patch('charmhelpers.contrib.openstack.utils.config')
|
||||
def test_git_reinstall_exception(self, _config, format_exc,
|
||||
config_changed, git_install, action_fail,
|
||||
action_set):
|
||||
_config.return_value = openstack_origin_git
|
||||
e = OSError('something bad happened')
|
||||
git_install.side_effect = e
|
||||
traceback = (
|
||||
"Traceback (most recent call last):\n"
|
||||
" File \"actions/git_reinstall.py\", line 37, in git_reinstall\n"
|
||||
" git_install(config(\'openstack-origin-git\'))\n"
|
||||
" File \"/usr/lib/python2.7/dist-packages/mock.py\", line 964, in __call__\n" # noqa
|
||||
" return _mock_self._mock_call(*args, **kwargs)\n"
|
||||
" File \"/usr/lib/python2.7/dist-packages/mock.py\", line 1019, in _mock_call\n" # noqa
|
||||
" raise effect\n"
|
||||
"OSError: something bad happened\n")
|
||||
format_exc.return_value = traceback
|
||||
|
||||
git_reinstall.git_reinstall()
|
||||
|
||||
msg = 'git-reinstall resulted in an unexpected error'
|
||||
action_fail.assert_called_with(msg)
|
||||
action_set.assert_called_with({'traceback': traceback})
|
@ -1,4 +1,5 @@
|
||||
from mock import MagicMock, patch, call
|
||||
import yaml
|
||||
import charmhelpers.core.hookenv as hookenv
|
||||
hookenv.config = MagicMock()
|
||||
import quantum_utils as utils
|
||||
@ -23,6 +24,7 @@ TO_PATCH = [
|
||||
'filter_installed_packages',
|
||||
'get_early_packages',
|
||||
'get_packages',
|
||||
'git_install',
|
||||
'log',
|
||||
'do_openstack_upgrade',
|
||||
'openstack_upgrade_available',
|
||||
@ -103,9 +105,46 @@ class TestQuantumHooks(CharmTestCase):
|
||||
self.assertTrue(self.log.called)
|
||||
_exit.assert_called_with(1)
|
||||
|
||||
def test_config_changed(self):
|
||||
@patch.object(utils, 'git_install_requested')
|
||||
def test_install_hook_git(self, git_requested):
|
||||
git_requested.return_value = True
|
||||
self.valid_plugin.return_value = True
|
||||
_pkgs = ['foo', 'bar']
|
||||
self.filter_installed_packages.return_value = _pkgs
|
||||
repo = 'cloud:trusty-juno'
|
||||
openstack_origin_git = {
|
||||
'repositories': [
|
||||
{'name': 'requirements',
|
||||
'repository': 'git://git.openstack.org/openstack/requirements', # noqa
|
||||
'branch': 'stable/juno'},
|
||||
{'name': 'neutron',
|
||||
'repository': 'git://git.openstack.org/openstack/neutron',
|
||||
'branch': 'stable/juno'}
|
||||
],
|
||||
'directory': '/mnt/openstack-git',
|
||||
}
|
||||
projects_yaml = yaml.dump(openstack_origin_git)
|
||||
self.test_config.set('openstack-origin', repo)
|
||||
self.test_config.set('openstack-origin-git', projects_yaml)
|
||||
self._call_hook('install')
|
||||
self.configure_installation_source.assert_called_with(
|
||||
'cloud:trusty-juno'
|
||||
)
|
||||
self.apt_update.assert_called_with(fatal=True)
|
||||
self.apt_install.assert_has_calls([
|
||||
call(_pkgs, fatal=True),
|
||||
call(_pkgs, fatal=True),
|
||||
])
|
||||
self.assertTrue(self.get_early_packages.called)
|
||||
self.assertTrue(self.get_packages.called)
|
||||
self.git_install.assert_called_with(projects_yaml)
|
||||
self.assertTrue(self.execd_preinstall.called)
|
||||
|
||||
@patch.object(hooks, 'git_install_requested')
|
||||
def test_config_changed(self, git_requested):
|
||||
def mock_relids(rel):
|
||||
return ['relid']
|
||||
git_requested.return_value = False
|
||||
self.test_config.set('sysctl', '{ kernel.max_pid: "1337"}')
|
||||
self.openstack_upgrade_available.return_value = True
|
||||
self.valid_plugin.return_value = True
|
||||
@ -125,14 +164,18 @@ class TestQuantumHooks(CharmTestCase):
|
||||
self.assertTrue(_zmq_joined.called)
|
||||
self.create_sysctl.assert_called()
|
||||
|
||||
def test_config_changed_upgrade(self):
|
||||
@patch.object(hooks, 'git_install_requested')
|
||||
def test_config_changed_upgrade(self, git_requested):
|
||||
git_requested.return_value = False
|
||||
self.openstack_upgrade_available.return_value = True
|
||||
self.valid_plugin.return_value = True
|
||||
self._call_hook('config-changed')
|
||||
self.assertTrue(self.do_openstack_upgrade.called)
|
||||
self.assertTrue(self.configure_ovs.called)
|
||||
|
||||
def test_config_changed_n1kv(self):
|
||||
@patch.object(hooks, 'git_install_requested')
|
||||
def test_config_changed_n1kv(self, git_requested):
|
||||
git_requested.return_value = False
|
||||
self.openstack_upgrade_available.return_value = False
|
||||
self.valid_plugin.return_value = True
|
||||
self.filter_installed_packages.side_effect = lambda p: p
|
||||
@ -144,12 +187,56 @@ class TestQuantumHooks(CharmTestCase):
|
||||
self.apt_purge.assert_called_with('neutron-l3-agent')
|
||||
|
||||
@patch('sys.exit')
|
||||
def test_config_changed_invalid_plugin(self, _exit):
|
||||
@patch.object(hooks, 'git_install_requested')
|
||||
def test_config_changed_invalid_plugin(self, git_requested, _exit):
|
||||
git_requested.return_value = False
|
||||
self.valid_plugin.return_value = False
|
||||
self._call_hook('config-changed')
|
||||
self.assertTrue(self.log.called)
|
||||
_exit.assert_called_with(1)
|
||||
|
||||
@patch.object(hooks, 'git_install_requested')
|
||||
@patch.object(hooks, 'config_value_changed')
|
||||
def test_config_changed_git(self, config_val_changed, git_requested):
|
||||
def mock_relids(rel):
|
||||
return ['relid']
|
||||
git_requested.return_value = True
|
||||
self.test_config.set('sysctl', '{ kernel.max_pid: "1337"}')
|
||||
self.openstack_upgrade_available.return_value = True
|
||||
self.valid_plugin.return_value = True
|
||||
self.relation_ids.side_effect = mock_relids
|
||||
_db_joined = self.patch('db_joined')
|
||||
_pgsql_db_joined = self.patch('pgsql_db_joined')
|
||||
_amqp_joined = self.patch('amqp_joined')
|
||||
_amqp_nova_joined = self.patch('amqp_nova_joined')
|
||||
_zmq_joined = self.patch('zeromq_configuration_relation_joined')
|
||||
repo = 'cloud:trusty-juno'
|
||||
openstack_origin_git = {
|
||||
'repositories': [
|
||||
{'name': 'requirements',
|
||||
'repository':
|
||||
'git://git.openstack.org/openstack/requirements',
|
||||
'branch': 'stable/juno'},
|
||||
{'name': 'neutron',
|
||||
'repository': 'git://git.openstack.org/openstack/neutron',
|
||||
'branch': 'stable/juno'}
|
||||
],
|
||||
'directory': '/mnt/openstack-git',
|
||||
}
|
||||
projects_yaml = yaml.dump(openstack_origin_git)
|
||||
self.test_config.set('openstack-origin', repo)
|
||||
self.test_config.set('openstack-origin-git', projects_yaml)
|
||||
self._call_hook('config-changed')
|
||||
self.git_install.assert_called_with(projects_yaml)
|
||||
self.assertFalse(self.do_openstack_upgrade.called)
|
||||
self.assertTrue(self.configure_ovs.called)
|
||||
self.assertTrue(_db_joined.called)
|
||||
self.assertTrue(_pgsql_db_joined.called)
|
||||
self.assertTrue(_amqp_joined.called)
|
||||
self.assertTrue(_amqp_nova_joined.called)
|
||||
self.assertTrue(_zmq_joined.called)
|
||||
self.create_sysctl.assert_called()
|
||||
|
||||
def test_upgrade_charm(self):
|
||||
_install = self.patch('install')
|
||||
_config_changed = self.patch('config_changed')
|
||||
|
@ -49,6 +49,15 @@ TO_PATCH = [
|
||||
'NeutronAPIContext',
|
||||
]
|
||||
|
||||
openstack_origin_git = \
|
||||
"""repositories:
|
||||
- {name: requirements,
|
||||
repository: 'git://git.openstack.org/openstack/requirements',
|
||||
branch: stable/juno}
|
||||
- {name: neutron,
|
||||
repository: 'git://git.openstack.org/openstack/neutron',
|
||||
branch: stable/juno}"""
|
||||
|
||||
|
||||
class TestQuantumUtils(CharmTestCase):
|
||||
|
||||
@ -110,36 +119,48 @@ class TestQuantumUtils(CharmTestCase):
|
||||
self.assertEquals(quantum_utils.get_early_packages(),
|
||||
[])
|
||||
|
||||
def test_get_packages_ovs(self):
|
||||
@patch.object(quantum_utils, 'git_install_requested')
|
||||
def test_get_packages_ovs(self, git_requested):
|
||||
git_requested.return_value = False
|
||||
self.config.return_value = 'ovs'
|
||||
self.get_os_codename_install_source.return_value = 'havana'
|
||||
self.assertNotEqual(quantum_utils.get_packages(), [])
|
||||
|
||||
def test_get_packages_ovs_icehouse(self):
|
||||
@patch.object(quantum_utils, 'git_install_requested')
|
||||
def test_get_packages_ovs_icehouse(self, git_requested):
|
||||
git_requested.return_value = False
|
||||
self.config.return_value = 'ovs'
|
||||
self.get_os_codename_install_source.return_value = 'icehouse'
|
||||
self.assertTrue('neutron-vpn-agent' in quantum_utils.get_packages())
|
||||
self.assertFalse('neutron-l3-agent' in quantum_utils.get_packages())
|
||||
|
||||
def test_get_packages_ovs_juno_utopic(self):
|
||||
@patch.object(quantum_utils, 'git_install_requested')
|
||||
def test_get_packages_ovs_juno_utopic(self, git_requested):
|
||||
git_requested.return_value = False
|
||||
self.config.return_value = 'ovs'
|
||||
self.get_os_codename_install_source.return_value = 'juno'
|
||||
self._set_distrib_codename('utopic')
|
||||
self.assertFalse('neutron-vpn-agent' in quantum_utils.get_packages())
|
||||
self.assertTrue('neutron-l3-agent' in quantum_utils.get_packages())
|
||||
|
||||
def test_get_packages_ovs_juno_trusty(self):
|
||||
@patch.object(quantum_utils, 'git_install_requested')
|
||||
def test_get_packages_ovs_juno_trusty(self, git_requested):
|
||||
git_requested.return_value = False
|
||||
self.config.return_value = 'ovs'
|
||||
self.get_os_codename_install_source.return_value = 'juno'
|
||||
self.assertTrue('neutron-vpn-agent' in quantum_utils.get_packages())
|
||||
self.assertFalse('neutron-l3-agent' in quantum_utils.get_packages())
|
||||
|
||||
def test_get_packages_ovs_kilo(self):
|
||||
@patch.object(quantum_utils, 'git_install_requested')
|
||||
def test_get_packages_ovs_kilo(self, git_requested):
|
||||
git_requested.return_value = False
|
||||
self.config.return_value = 'ovs'
|
||||
self.get_os_codename_install_source.return_value = 'kilo'
|
||||
self.assertTrue('python-neutron-fwaas' in quantum_utils.get_packages())
|
||||
|
||||
def test_get_packages_l3ha(self):
|
||||
@patch.object(quantum_utils, 'git_install_requested')
|
||||
def test_get_packages_l3ha(self, git_requested):
|
||||
git_requested.return_value = False
|
||||
self.config.return_value = 'ovs'
|
||||
self.get_os_codename_install_source.return_value = 'juno'
|
||||
self.assertTrue('keepalived' in quantum_utils.get_packages())
|
||||
@ -204,7 +225,9 @@ class TestQuantumUtils(CharmTestCase):
|
||||
# Not called since we have a bogus bridge in data-ports
|
||||
self.assertFalse(self.add_bridge_port.called)
|
||||
|
||||
def test_do_openstack_upgrade(self):
|
||||
@patch.object(quantum_utils, 'git_install_requested')
|
||||
def test_do_openstack_upgrade(self, git_requested):
|
||||
git_requested.return_value = False
|
||||
self.config.side_effect = self.test_config.get
|
||||
self.is_relation_made.return_value = False
|
||||
self.test_config.set('openstack-origin', 'cloud:precise-havana')
|
||||
@ -671,3 +694,383 @@ class TestQuantumAgentReallocation(CharmTestCase):
|
||||
self.assertTrue(self.log.called)
|
||||
assert not dummy_client.remove_router_from_l3_agent.called
|
||||
assert not dummy_client.remove_network_from_dhcp_agent.called
|
||||
|
||||
@patch.object(quantum_utils, 'git_install_requested')
|
||||
@patch.object(quantum_utils, 'git_clone_and_install')
|
||||
@patch.object(quantum_utils, 'git_post_install')
|
||||
@patch.object(quantum_utils, 'git_pre_install')
|
||||
def test_git_install(self, git_pre, git_post, git_clone_and_install,
|
||||
git_requested):
|
||||
projects_yaml = openstack_origin_git
|
||||
git_requested.return_value = True
|
||||
quantum_utils.git_install(projects_yaml)
|
||||
self.assertTrue(git_pre.called)
|
||||
git_clone_and_install.assert_called_with(openstack_origin_git,
|
||||
core_project='neutron')
|
||||
self.assertTrue(git_post.called)
|
||||
|
||||
@patch.object(quantum_utils, 'mkdir')
|
||||
@patch.object(quantum_utils, 'write_file')
|
||||
@patch.object(quantum_utils, 'add_user_to_group')
|
||||
@patch.object(quantum_utils, 'add_group')
|
||||
@patch.object(quantum_utils, 'adduser')
|
||||
def test_git_pre_install(self, adduser, add_group, add_user_to_group,
|
||||
write_file, mkdir):
|
||||
quantum_utils.git_pre_install()
|
||||
adduser.assert_called_with('neutron', shell='/bin/bash',
|
||||
system_user=True)
|
||||
add_group.assert_called_with('neutron', system_group=True)
|
||||
add_user_to_group.assert_called_with('neutron', 'neutron')
|
||||
expected = [
|
||||
call('/etc/neutron', owner='neutron',
|
||||
group='neutron', perms=0700, force=False),
|
||||
call('/etc/neutron/rootwrap.d', owner='neutron',
|
||||
group='neutron', perms=0700, force=False),
|
||||
call('/etc/neutron/plugins', owner='neutron',
|
||||
group='neutron', perms=0700, force=False),
|
||||
call('/etc/nova', owner='neutron',
|
||||
group='neutron', perms=0700, force=False),
|
||||
call('/var/lib/neutron', owner='neutron',
|
||||
group='neutron', perms=0700, force=False),
|
||||
call('/var/lib/neutron/lock', owner='neutron',
|
||||
group='neutron', perms=0700, force=False),
|
||||
call('/var/log/neutron', owner='neutron',
|
||||
group='neutron', perms=0700, force=False),
|
||||
]
|
||||
self.assertEquals(mkdir.call_args_list, expected)
|
||||
expected = [
|
||||
call('/var/log/neutron/bigswitch-agent.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/dhcp-agent.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/l3-agent.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/lbaas-agent.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/ibm-agent.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/linuxbridge-agent.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/metadata-agent.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/metering_agent.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/mlnx-agent.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/nec-agent.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/nvsd-agent.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/openflow-agent.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/openvswitch-agent.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/ovs-cleanup.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/ryu-agent.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/server.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/sriov-agent.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
call('/var/log/neutron/vpn_agent.log', '', owner='neutron',
|
||||
group='neutron', perms=0644),
|
||||
]
|
||||
self.assertEquals(write_file.call_args_list, expected)
|
||||
|
||||
@patch.object(quantum_utils, 'git_src_dir')
|
||||
@patch.object(quantum_utils, 'render')
|
||||
@patch('os.path.join')
|
||||
@patch('os.path.exists')
|
||||
@patch('os.symlink')
|
||||
@patch('shutil.rmtree')
|
||||
@patch('shutil.copyfile')
|
||||
@patch('shutil.copytree')
|
||||
def test_git_post_install(self, copytree, copyfile, rmtree, symlink,
|
||||
exists, join, render, git_src_dir):
|
||||
projects_yaml = openstack_origin_git
|
||||
join.return_value = 'joined-string'
|
||||
quantum_utils.git_post_install(projects_yaml)
|
||||
expected = [
|
||||
call('joined-string', '/etc/neutron'),
|
||||
call('joined-string', '/etc/neutron/plugins'),
|
||||
call('joined-string', '/etc/neutron/rootwrap.d'),
|
||||
]
|
||||
copytree.assert_has_calls(expected)
|
||||
expected = [
|
||||
call('/usr/local/bin/neutron-rootwrap',
|
||||
'/usr/bin/neutron-rootwrap'),
|
||||
]
|
||||
symlink.assert_has_calls(expected)
|
||||
service_name = 'quantum-gateway'
|
||||
user_name = 'neutron'
|
||||
neutron_api_context = {
|
||||
'service_description': 'Neutron API server',
|
||||
'charm_name': 'neutron-api',
|
||||
'process_name': 'neutron-server',
|
||||
}
|
||||
neutron_dhcp_agent_context = {
|
||||
'service_description': 'Neutron DHCP Agent',
|
||||
'service_name': service_name,
|
||||
'process_name': 'neutron-dhcp-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/dhcp_agent.ini'],
|
||||
'log_file': '/var/log/neutron/dhcp-agent.log',
|
||||
}
|
||||
neutron_l3_agent_context = {
|
||||
'service_description': 'Neutron L3 Agent',
|
||||
'service_name': service_name,
|
||||
'process_name': 'neutron-l3-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/l3_agent.ini',
|
||||
'/etc/neutron/fwaas_driver.ini'],
|
||||
'log_file': '/var/log/neutron/l3-agent.log',
|
||||
}
|
||||
neutron_lbaas_agent_context = {
|
||||
'service_description': 'Neutron LBaaS Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-lbaas-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-lbaas-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/lbaas_agent.ini'],
|
||||
'log_file': '/var/log/neutron/lbaas-agent.log',
|
||||
}
|
||||
neutron_metadata_agent_context = {
|
||||
'service_description': 'Neutron Metadata Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-metadata-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-metadata-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/metadata_agent.ini'],
|
||||
'log_file': '/var/log/neutron/metadata-agent.log',
|
||||
}
|
||||
neutron_metering_agent_context = {
|
||||
'service_description': 'Neutron Metering Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-metering-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-metering-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/metering_agent.ini'],
|
||||
'log_file': '/var/log/neutron/metering-agent.log',
|
||||
}
|
||||
neutron_ovs_cleanup_context = {
|
||||
'service_description': 'Neutron OVS cleanup',
|
||||
'service_name': service_name,
|
||||
'process_name': 'neutron-ovs-cleanup',
|
||||
'config_file': '/etc/neutron/neutron.conf',
|
||||
'log_file': '/var/log/neutron/ovs-cleanup.log',
|
||||
}
|
||||
neutron_plugin_bigswitch_context = {
|
||||
'service_description': 'Neutron BigSwitch Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-restproxy-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-restproxy-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/bigswitch/restproxy.ini'],
|
||||
'log_file': '/var/log/neutron/bigswitch-agent.log',
|
||||
}
|
||||
neutron_plugin_ibm_context = {
|
||||
'service_description': 'Neutron IBM SDN Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-ibm-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-ibm-agent',
|
||||
'config_files':
|
||||
['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/ibm/sdnve_neutron_plugin.ini'],
|
||||
'log_file': '/var/log/neutron/ibm-agent.log',
|
||||
}
|
||||
neutron_plugin_linuxbridge_context = {
|
||||
'service_description': 'Neutron Linux Bridge Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-linuxbridge-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-linuxbridge-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/ml2/ml2_conf.ini'],
|
||||
'log_file': '/var/log/neutron/linuxbridge-agent.log',
|
||||
}
|
||||
neutron_plugin_mlnx_context = {
|
||||
'service_description': 'Neutron MLNX Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-mlnx-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-mlnx-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/mlnx/mlnx_conf.ini'],
|
||||
'log_file': '/var/log/neutron/mlnx-agent.log',
|
||||
}
|
||||
neutron_plugin_nec_context = {
|
||||
'service_description': 'Neutron NEC Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-nec-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-nec-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/nec/nec.ini'],
|
||||
'log_file': '/var/log/neutron/nec-agent.log',
|
||||
}
|
||||
neutron_plugin_oneconvergence_context = {
|
||||
'service_description': 'Neutron One Convergence Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-nvsd-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-nvsd-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/oneconvergence/nvsdplugin.ini'],
|
||||
'log_file': '/var/log/neutron/nvsd-agent.log',
|
||||
}
|
||||
neutron_plugin_openflow_context = {
|
||||
'service_description': 'Neutron OpenFlow Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-ofagent-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-ofagent-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/ml2/ml2_conf_ofa.ini'],
|
||||
'log_file': '/var/log/neutron/openflow-agent.log',
|
||||
}
|
||||
neutron_plugin_openvswitch_context = {
|
||||
'service_description': 'Neutron OpenvSwitch Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-openvswitch-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-openvswitch-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/ml2/ml2_conf.ini'],
|
||||
'log_file': '/var/log/neutron/openvswitch-agent.log',
|
||||
}
|
||||
neutron_plugin_ryu_context = {
|
||||
'service_description': 'Neutron RYU Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-ryu-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-ryu-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/ryu/ryu.ini'],
|
||||
'log_file': '/var/log/neutron/ryu-agent.log',
|
||||
}
|
||||
neutron_plugin_sriov_context = {
|
||||
'service_description': 'Neutron SRIOV SDN Plugin Agent',
|
||||
'service_name': service_name,
|
||||
'user_name': user_name,
|
||||
'start_dir': '/var/lib/neutron',
|
||||
'process_name': 'neutron-sriov-nic-agent',
|
||||
'executable_name': '/usr/local/bin/neutron-sriov-nic-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/plugins/ml2/ml2_conf_sriov'],
|
||||
'log_file': '/var/log/neutron/sriov-agent.log',
|
||||
}
|
||||
neutron_api_context = {
|
||||
'service_description': 'Neutron API server',
|
||||
'service_name': service_name,
|
||||
'process_name': 'neutron-server',
|
||||
}
|
||||
neutron_vpn_agent_context = {
|
||||
'service_description': 'Neutron VPN Agent',
|
||||
'service_name': service_name,
|
||||
'process_name': 'neutron-vpn-agent',
|
||||
'config_files': ['/etc/neutron/neutron.conf',
|
||||
'/etc/neutron/vpn_agent.ini',
|
||||
'/etc/neutron/l3_agent.ini',
|
||||
'/etc/neutron/fwaas_driver.ini'],
|
||||
'log_file': '/var/log/neutron/vpn_agent.log',
|
||||
}
|
||||
expected = [
|
||||
call('git/neutron_sudoers',
|
||||
'/etc/sudoers.d/neutron_sudoers',
|
||||
{}, perms=0o440),
|
||||
call('git/cron.d/neutron-dhcp-agent-netns-cleanup',
|
||||
'/etc/cron.d/neutron-dhcp-agent-netns-cleanup',
|
||||
{}, perms=0o755),
|
||||
call('git/cron.d/neutron-l3-agent-netns-cleanup',
|
||||
'/etc/cron.d/neutron-l3-agent-netns-cleanup',
|
||||
{}, perms=0o755),
|
||||
call('git/cron.d/neutron-lbaas-agent-netns-cleanup',
|
||||
'/etc/cron.d/neutron-lbaas-agent-netns-cleanup',
|
||||
{}, perms=0o755),
|
||||
call('git/upstart/neutron-agent.upstart',
|
||||
'/etc/init/neutron-dhcp-agent.conf',
|
||||
neutron_dhcp_agent_context, perms=0o644),
|
||||
call('git/upstart/neutron-agent.upstart',
|
||||
'/etc/init/neutron-l3-agent.conf',
|
||||
neutron_l3_agent_context, perms=0o644),
|
||||
call('git.upstart',
|
||||
'/etc/init/neutron-lbaas-agent.conf',
|
||||
neutron_lbaas_agent_context, perms=0o644,
|
||||
templates_dir='joined-string'),
|
||||
call('git.upstart',
|
||||
'/etc/init/neutron-metadata-agent.conf',
|
||||
neutron_metadata_agent_context, perms=0o644,
|
||||
templates_dir='joined-string'),
|
||||
call('git.upstart',
|
||||
'/etc/init/neutron-metering-agent.conf',
|
||||
neutron_metering_agent_context, perms=0o644,
|
||||
templates_dir='joined-string'),
|
||||
call('git.upstart',
|
||||
'/etc/init/neutron-ovs-cleanup.conf',
|
||||
neutron_ovs_cleanup_context, perms=0o644,
|
||||
templates_dir='joined-string'),
|
||||
call('git.upstart',
|
||||
'/etc/init/neutron-plugin-bigswitch-agent.conf',
|
||||
neutron_plugin_bigswitch_context, perms=0o644,
|
||||
templates_dir='joined-string'),
|
||||
call('git.upstart',
|
||||
'/etc/init/neutron-plugin-ibm-agent.conf',
|
||||
neutron_plugin_ibm_context, perms=0o644,
|
||||
templates_dir='joined-string'),
|
||||
call('git.upstart',
|
||||
'/etc/init/neutron-plugin-linuxbridge-agent.conf',
|
||||
neutron_plugin_linuxbridge_context, perms=0o644,
|
||||
templates_dir='joined-string'),
|
||||
call('git.upstart',
|
||||
'/etc/init/neutron-plugin-mlnx-agent.conf',
|
||||
neutron_plugin_mlnx_context, perms=0o644,
|
||||
templates_dir='joined-string'),
|
||||
call('git.upstart',
|
||||
'/etc/init/neutron-plugin-nec-agent.conf',
|
||||
neutron_plugin_nec_context, perms=0o644,
|
||||
templates_dir='joined-string'),
|
||||
call('git.upstart',
|
||||
'/etc/init/neutron-plugin-oneconvergence-agent.conf',
|
||||
neutron_plugin_oneconvergence_context, perms=0o644,
|
||||
templates_dir='joined-string'),
|
||||
call('git.upstart',
|
||||
'/etc/init/neutron-plugin-openflow-agent.conf',
|
||||
neutron_plugin_openflow_context, perms=0o644,
|
||||
templates_dir='joined-string'),
|
||||
call('git.upstart',
|
||||
'/etc/init/neutron-plugin-openvswitch-agent.conf',
|
||||
neutron_plugin_openvswitch_context, perms=0o644,
|
||||
templates_dir='joined-string'),
|
||||
call('git.upstart',
|
||||
'/etc/init/neutron-plugin-ryu-agent.conf',
|
||||
neutron_plugin_ryu_context, perms=0o644,
|
||||
templates_dir='joined-string'),
|
||||
call('git.upstart',
|
||||
'/etc/init/neutron-plugin-sriov-agent.conf',
|
||||
neutron_plugin_sriov_context, perms=0o644,
|
||||
templates_dir='joined-string'),
|
||||
call('git/upstart/neutron-server.upstart',
|
||||
'/etc/init/neutron-server.conf',
|
||||
neutron_api_context, perms=0o644),
|
||||
call('git/upstart/neutron-agent.upstart',
|
||||
'/etc/init/neutron-vpn-agent.conf',
|
||||
neutron_vpn_agent_context, perms=0o644),
|
||||
]
|
||||
self.assertEquals(render.call_args_list, expected)
|
||||
|
Loading…
Reference in New Issue
Block a user