snap-neutron/tests/neutron.sh
Pete Vander Giessen 26d6bcb315 Added config files to snap.
This is part of a transition to storing the config files in the snap,
rather than in snapstack.

Also updated .gitignore to ignore emacs temp files and snapcraft
cruft.

Change-Id: I2542bf23435d3dbe5e399f1c938f3c9d879ed9ba
2017-08-10 19:55:43 +00:00

45 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -ex
sudo mysql -u root << EOF
CREATE DATABASE IF NOT EXISTS neutron;
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' \
IDENTIFIED BY 'neutron';
EOF
source $BASE_DIR/admin-openrc
openstack user show neutron || {
openstack user create --domain default --password neutron neutron
openstack role add --project service --user neutron admin
}
openstack service show network || {
openstack service create --name neutron \
--description "OpenStack Network" network
for endpoint in public internal admin; do
openstack endpoint create --region RegionOne \
network $endpoint http://localhost:9696 || :
done
}
while sudo [ ! -d /var/snap/neutron/common/etc/neutron/ ]; do sleep 0.1; done;
sudo cp -r $BASE_DIR/etc/snap-neutron/* /var/snap/neutron/common/etc/
# Manually define alias if snap isn't installed from snap store.
# Otherwise, snap store defines this alias automatically.
snap aliases neutron | grep neutron-db-manage || sudo snap alias neutron.manage neutron-db-manage
sudo neutron-db-manage upgrade head
sudo systemctl restart snap.neutron.*
while ! nc -z localhost 9696; do sleep 0.1; done;
neutron net-show test || {
neutron net-create test
neutron subnet-create --name test_subnet test 192.168.222.0/24
}