Rename Akanda to Astara
Change-Id: Id5b7509a64cd274696f6bdd63a1133c25505f01b
This commit is contained in:
parent
bca6b74eb7
commit
1a68612a71
|
@ -1 +1 @@
|
||||||
include akanda/router/drivers/loadbalancer/nginx.conf.template
|
include astara/router/drivers/loadbalancer/nginx.conf.template
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# Akanda Appliance
|
# Astara Appliance
|
||||||
|
|
||||||
*Part of the [Akanda Project](https://github.com/stackforge/akanda).*
|
*Part of the [Astara Project](https://github.com/openstack/astara).*
|
||||||
|
|
||||||
A Linux-based L3 software router. Includes a REST API to monitor, configure,
|
A Linux-based L3 software router. Includes a REST API to monitor, configure,
|
||||||
and manage the router.
|
and manage the router.
|
||||||
|
|
||||||
Akanda routers are recommended to run with 512 MB of RAM and a single vCPU, and
|
Astara routers are recommended to run with 512 MB of RAM and a single vCPU, and
|
||||||
are intended to run within an virtualized L2 overlay to provide complete network
|
are intended to run within an virtualized L2 overlay to provide complete network
|
||||||
virtualization.
|
virtualization.
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
# Copyright 2014 DreamHost, LLC
|
|
||||||
#
|
|
||||||
# Author: DreamHost, LLC
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
|
|
||||||
__import__('pkg_resources').declare_namespace(__name__) # pragma: nocover
|
|
|
@ -19,7 +19,7 @@
|
||||||
- include: tasks/update_kernel.yml
|
- include: tasks/update_kernel.yml
|
||||||
when: update_kernel and ansible_distribution_release == "wheezy"
|
when: update_kernel and ansible_distribution_release == "wheezy"
|
||||||
- include: tasks/base.yml
|
- include: tasks/base.yml
|
||||||
- include: tasks/akanda.yml
|
- include: tasks/astara.yml
|
||||||
- include: tasks/bird.yml
|
- include: tasks/bird.yml
|
||||||
- include: tasks/dnsmasq.yml
|
- include: tasks/dnsmasq.yml
|
||||||
- include: tasks/extras.yml
|
- include: tasks/extras.yml
|
||||||
|
|
|
@ -7,47 +7,47 @@
|
||||||
- python-dev
|
- python-dev
|
||||||
- logrotate
|
- logrotate
|
||||||
|
|
||||||
- name: copy akanda-appliance code
|
- name: copy astara-appliance code
|
||||||
synchronize: src={{ playbook_dir }}/.. dest=/tmp/akanda-appliance
|
synchronize: src={{ playbook_dir }}/.. dest=/tmp/astara-appliance
|
||||||
|
|
||||||
- name: ensure latest setuptools
|
- name: ensure latest setuptools
|
||||||
pip: name=setuptools state=latest
|
pip: name=setuptools state=latest
|
||||||
|
|
||||||
- name: install required files
|
- name: install required files
|
||||||
pip: requirements=/tmp/akanda-appliance/requirements.txt
|
pip: requirements=/tmp/astara-appliance/requirements.txt
|
||||||
|
|
||||||
- name: install akanda-appliance
|
- name: install astara-appliance
|
||||||
command: python setup.py install chdir=/tmp/akanda-appliance
|
command: python setup.py install chdir=/tmp/astara-appliance
|
||||||
|
|
||||||
- name: install akanda gunicorn logging directory
|
- name: install astara gunicorn logging directory
|
||||||
file: path=/var/log/akanda state=directory
|
file: path=/var/log/astara state=directory
|
||||||
|
|
||||||
- name: install akanda logrotate config
|
- name: install astara logrotate config
|
||||||
template: src=logrotate.j2 dest=/etc/logrotate.d/akanda
|
template: src=logrotate.j2 dest=/etc/logrotate.d/astara
|
||||||
|
|
||||||
- name: install gunicorn config file
|
- name: install gunicorn config file
|
||||||
template: src=gunicorn.j2 dest=/etc/akanda_gunicorn_config
|
template: src=gunicorn.j2 dest=/etc/astara_gunicorn_config
|
||||||
|
|
||||||
- name: install init.d files
|
- name: install init.d files
|
||||||
copy: src={{playbook_dir}}/../scripts/etc/init.d/{{item}} dest=/etc/init.d/{{item}} mode=0555
|
copy: src={{playbook_dir}}/../scripts/etc/init.d/{{item}} dest=/etc/init.d/{{item}} mode=0555
|
||||||
with_items:
|
with_items:
|
||||||
- metadata
|
- metadata
|
||||||
- akanda-router-api-server
|
- astara-router-api-server
|
||||||
|
|
||||||
- name: create /usr/local/share/akanda/
|
- name: create /usr/local/share/astara/
|
||||||
file: path=/usr/local/share/akanda state=directory
|
file: path=/usr/local/share/astara state=directory
|
||||||
|
|
||||||
- name: make /usr/local/share/akanda/ importable
|
- name: make /usr/local/share/astara/ importable
|
||||||
copy: dest=/usr/local/share/akanda/__init__.py content=''
|
copy: dest=/usr/local/share/astara/__init__.py content=''
|
||||||
|
|
||||||
- name: install akanda_local_settings.py
|
- name: install astara_local_settings.py
|
||||||
copy: dest=/usr/local/share/akanda/akanda_local_settings.py content='ENABLED_SERVICES = {{enabled_advanced_services.split(',')}}\n'
|
copy: dest=/usr/local/share/astara/astara_local_settings.py content='ENABLED_SERVICES = {{enabled_advanced_services.split(',')}}\n'
|
||||||
|
|
||||||
- name: update-rc
|
- name: update-rc
|
||||||
command: update-rc.d akanda-router-api-server start
|
command: update-rc.d astara-router-api-server start
|
||||||
|
|
||||||
- name: add timestamp
|
- name: add timestamp
|
||||||
shell: date > arg1 creates=/etc/akanda-release
|
shell: date > arg1 creates=/etc/astara-release
|
||||||
|
|
||||||
- name: enable forwarding
|
- name: enable forwarding
|
||||||
sysctl: name={{item}} value=1 sysctl_set=yes state=present reload=yes
|
sysctl: name={{item}} value=1 sysctl_set=yes state=present reload=yes
|
|
@ -21,7 +21,7 @@
|
||||||
command: ln -s /usr/share/zoneinfo/UTC arg1 creates=/etc/localtime
|
command: ln -s /usr/share/zoneinfo/UTC arg1 creates=/etc/localtime
|
||||||
|
|
||||||
- name: setting hostname
|
- name: setting hostname
|
||||||
copy: content="akanda-linux" dest=/etc/hostname
|
copy: content="astara-linux" dest=/etc/hostname
|
||||||
|
|
||||||
- name: set default nameserver
|
- name: set default nameserver
|
||||||
copy: content="nameserver 8.8.8.8" dest=/etc/resolv.conf
|
copy: content="nameserver 8.8.8.8" dest=/etc/resolv.conf
|
||||||
|
|
|
@ -8,5 +8,5 @@ worker_class ="sync"
|
||||||
debug = False
|
debug = False
|
||||||
daemon = True
|
daemon = True
|
||||||
pidfile = "/var/run/gunicorn.pid"
|
pidfile = "/var/run/gunicorn.pid"
|
||||||
errorlog = "/var/log/akanda/gunicorn_error.log"
|
errorlog = "/var/log/astara/gunicorn_error.log"
|
||||||
accesslog = "/var/log/akanda/gunicorn_access.log"
|
accesslog = "/var/log/astara/gunicorn_access.log"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/var/log/akanda/*.log {
|
/var/log/astara/*.log {
|
||||||
weekly
|
weekly
|
||||||
rotate 7
|
rotate 7
|
||||||
compress
|
compress
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
___ ___ .___
|
___ _
|
||||||
/ \\ \\ | - L3 for OpenStack - | _/
|
/ _ \ | | L3 for OpenStack
|
||||||
/ _ \\ | | _______ ____ __| | ____
|
/ /_\ \___| |_ __ _ _ __ __ _
|
||||||
/ /_\\ \\| |/ /\\__ \\ / \\ / __ |\\__ \\
|
| _ / __| __/ _` | '__/ _` |
|
||||||
/ | \\ < / __ \\| | \\/ /_/ | / __ \\_
|
| | | \__ \ || (_| | | | (_| |
|
||||||
\\____|__ /__|_ \\(____ /___| /\\____ |(____ /
|
\_| |_/___/\__\__,_|_| \__,_|
|
||||||
\\/ \\/ \\/ \\/ \\/ \\/
|
|
||||||
Welcome to Akanda: Powered by Unicorns.
|
Welcome to Astara: Powered by Unicorns.
|
||||||
|
|
|
@ -19,9 +19,9 @@
|
||||||
"""
|
"""
|
||||||
import flask
|
import flask
|
||||||
|
|
||||||
from akanda.router.api import v1
|
from astara_router.api import v1
|
||||||
from akanda.router.debug import handle_traceback
|
from astara_router.debug import handle_traceback
|
||||||
from akanda.router.manager import manager
|
from astara_router.manager import manager
|
||||||
|
|
||||||
app = flask.Flask(__name__)
|
app = flask.Flask(__name__)
|
||||||
app.register_blueprint(v1.base.blueprint)
|
app.register_blueprint(v1.base.blueprint)
|
||||||
|
@ -41,7 +41,7 @@ def attach_config():
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# TODO(mark): make this use a config file ie
|
# TODO(mark): make this use a config file ie
|
||||||
# app.config.from_object('akanda.router.config.Default')
|
# app.config.from_object('astara_router.config.Default')
|
||||||
# manager.state_path = app.config['STATE_PATH']
|
# manager.state_path = app.config['STATE_PATH']
|
||||||
|
|
||||||
app.run(host=manager.management_address(ensure_configuration=True),
|
app.run(host=manager.management_address(ensure_configuration=True),
|
|
@ -18,7 +18,7 @@
|
||||||
"""
|
"""
|
||||||
Blueprint for the "base" portion of the version 1 of the API.
|
Blueprint for the "base" portion of the version 1 of the API.
|
||||||
"""
|
"""
|
||||||
from akanda.router import utils
|
from astara_router import utils
|
||||||
|
|
||||||
|
|
||||||
blueprint = utils.blueprint_factory(__name__)
|
blueprint = utils.blueprint_factory(__name__)
|
||||||
|
@ -29,4 +29,4 @@ def welcome():
|
||||||
'''
|
'''
|
||||||
Show welcome message
|
Show welcome message
|
||||||
'''
|
'''
|
||||||
return 'Akanda appliance API service is active'
|
return 'Astara appliance API service is active'
|
|
@ -21,8 +21,8 @@ Blueprint for version 1 of the firewall API.
|
||||||
|
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
from akanda.router import utils
|
from astara_router import utils
|
||||||
from akanda.router.drivers import iptables
|
from astara_router.drivers import iptables
|
||||||
|
|
||||||
|
|
||||||
blueprint = utils.blueprint_factory(__name__)
|
blueprint = utils.blueprint_factory(__name__)
|
|
@ -20,8 +20,8 @@ Blueprint for the "status" portion of the version 1 of the API.
|
||||||
"""
|
"""
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
from akanda.router import utils
|
from astara_router import utils
|
||||||
from akanda.router.drivers import ping
|
from astara_router.drivers import ping
|
||||||
|
|
||||||
blueprint = utils.blueprint_factory(__name__)
|
blueprint = utils.blueprint_factory(__name__)
|
||||||
|
|
|
@ -22,10 +22,10 @@ from flask import Response
|
||||||
from flask import abort, request
|
from flask import abort, request
|
||||||
from dogpile.cache import make_region
|
from dogpile.cache import make_region
|
||||||
|
|
||||||
from akanda.router import models
|
from astara_router import models
|
||||||
from akanda.router import utils
|
from astara_router import utils
|
||||||
from akanda.router import settings
|
from astara_router import settings
|
||||||
from akanda.router.manager import manager
|
from astara_router.manager import manager
|
||||||
|
|
||||||
blueprint = utils.blueprint_factory(__name__)
|
blueprint = utils.blueprint_factory(__name__)
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ def _get_cache():
|
||||||
_cache = make_region().configure(
|
_cache = make_region().configure(
|
||||||
'dogpile.cache.dbm',
|
'dogpile.cache.dbm',
|
||||||
arguments={
|
arguments={
|
||||||
"filename": "/etc/akanda-state"
|
"filename": "/etc/astara-state"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
return _cache
|
return _cache
|
|
@ -20,9 +20,9 @@ import sys
|
||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
|
|
||||||
from akanda.router import defaults
|
from astara_router import defaults
|
||||||
from akanda.router import utils
|
from astara_router import utils
|
||||||
from akanda.router.drivers import ip
|
from astara_router.drivers import ip
|
||||||
|
|
||||||
|
|
||||||
def configure_ssh(listen_ip):
|
def configure_ssh(listen_ip):
|
||||||
|
@ -56,11 +56,11 @@ def configure_gunicorn(listen_ip):
|
||||||
else:
|
else:
|
||||||
bind = "'%s:%d'" % (listen_ip, defaults.API_SERVICE)
|
bind = "'%s:%d'" % (listen_ip, defaults.API_SERVICE)
|
||||||
|
|
||||||
config = open('/etc/akanda_gunicorn_config', 'r').read()
|
config = open('/etc/astara_gunicorn_config', 'r').read()
|
||||||
config = re.sub('\nbind(\s)?\=(\s)?.*', '\nbind = %s' % bind, config)
|
config = re.sub('\nbind(\s)?\=(\s)?.*', '\nbind = %s' % bind, config)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
open('/etc/akanda_gunicorn_config', 'w+').write(config)
|
open('/etc/astara_gunicorn_config', 'w+').write(config)
|
||||||
sys.stderr.write('http configured to listen on %s\n' % listen_ip)
|
sys.stderr.write('http configured to listen on %s\n' % listen_ip)
|
||||||
except:
|
except:
|
||||||
sys.stderr.write('Unable to write gunicorn configuration file.')
|
sys.stderr.write('Unable to write gunicorn configuration file.')
|
|
@ -20,9 +20,9 @@ import re
|
||||||
import socket
|
import socket
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
from akanda.router import utils
|
from astara_router import utils
|
||||||
from akanda.router.drivers import base
|
from astara_router.drivers import base
|
||||||
from akanda.router.models import Network
|
from astara_router.models import Network
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
@ -92,8 +92,8 @@ class ARPManager(base.Manager):
|
||||||
def send_gratuitous_arp_for_floating_ips(self, config, generic_to_host):
|
def send_gratuitous_arp_for_floating_ips(self, config, generic_to_host):
|
||||||
"""
|
"""
|
||||||
Send a gratuitous ARP for every Floating IP.
|
Send a gratuitous ARP for every Floating IP.
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param config: An akanda.router.models.Configuration object containing
|
:param config: An astara_router.models.Configuration object containing
|
||||||
configuration information for the system's network
|
configuration information for the system's network
|
||||||
setup.
|
setup.
|
||||||
:type generic_to_host: callable
|
:type generic_to_host: callable
|
||||||
|
@ -108,7 +108,7 @@ class ARPManager(base.Manager):
|
||||||
for net in external_nets:
|
for net in external_nets:
|
||||||
for fip in net.floating_ips:
|
for fip in net.floating_ips:
|
||||||
utils.execute([
|
utils.execute([
|
||||||
'akanda-gratuitous-arp',
|
'astara-gratuitous-arp',
|
||||||
generic_to_host(net.interface.ifname),
|
generic_to_host(net.interface.ifname),
|
||||||
str(fip.floating_ip)
|
str(fip.floating_ip)
|
||||||
], self.root_helper)
|
], self.root_helper)
|
||||||
|
@ -121,8 +121,8 @@ class ARPManager(base.Manager):
|
||||||
deletion and makes calls to _mac_address_for_ip to match arp entries
|
deletion and makes calls to _mac_address_for_ip to match arp entries
|
||||||
to network interface IPs.
|
to network interface IPs.
|
||||||
|
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param config: An akanda.router.models.Configuration object containing
|
:param config: An astara_router.models.Configuration object containing
|
||||||
configuration information for the system's network
|
configuration information for the system's network
|
||||||
setup.
|
setup.
|
||||||
"""
|
"""
|
|
@ -15,7 +15,7 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
from akanda.router import utils
|
from astara_router import utils
|
||||||
|
|
||||||
|
|
||||||
class Manager(object):
|
class Manager(object):
|
|
@ -19,8 +19,8 @@ import logging
|
||||||
import random
|
import random
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
from akanda.router.drivers import base
|
from astara_router.drivers import base
|
||||||
from akanda.router import utils
|
from astara_router import utils
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
@ -45,7 +45,7 @@ class BirdManager(base.Manager):
|
||||||
"""
|
"""
|
||||||
Writes config file for bird daemon.
|
Writes config file for bird daemon.
|
||||||
|
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param config:
|
:param config:
|
||||||
:type if_map: dict
|
:type if_map: dict
|
||||||
:param if_map: A (dict) mapping of generic to physical hostname, e.g.:
|
:param if_map: A (dict) mapping of generic to physical hostname, e.g.:
|
||||||
|
@ -96,7 +96,7 @@ def _find_external_v4_ip(config):
|
||||||
"""
|
"""
|
||||||
Determines the external IPv4 address.
|
Determines the external IPv4 address.
|
||||||
|
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param config:
|
:param config:
|
||||||
:rtype: str
|
:rtype: str
|
||||||
"""
|
"""
|
||||||
|
@ -112,7 +112,7 @@ def _build_global_config(config):
|
||||||
"""
|
"""
|
||||||
Generate the "global" section of the BIRD daemon configuration.
|
Generate the "global" section of the BIRD daemon configuration.
|
||||||
|
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param config:
|
:param config:
|
||||||
:rtype: str
|
:rtype: str
|
||||||
"""
|
"""
|
||||||
|
@ -127,7 +127,7 @@ def _build_kernel_config():
|
||||||
"""
|
"""
|
||||||
Generate the "kernel" section of the BIRD daemon configuration.
|
Generate the "kernel" section of the BIRD daemon configuration.
|
||||||
|
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param config:
|
:param config:
|
||||||
:rtype: str
|
:rtype: str
|
||||||
"""
|
"""
|
||||||
|
@ -146,7 +146,7 @@ def _build_device_config():
|
||||||
"""
|
"""
|
||||||
Generate the "device" section of the BIRD daemon configuration.
|
Generate the "device" section of the BIRD daemon configuration.
|
||||||
|
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param config:
|
:param config:
|
||||||
:rtype: str
|
:rtype: str
|
||||||
"""
|
"""
|
||||||
|
@ -157,7 +157,7 @@ def _build_static_config(config):
|
||||||
"""
|
"""
|
||||||
Generate the "static" section of the BIRD daemon configuration.
|
Generate the "static" section of the BIRD daemon configuration.
|
||||||
|
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param config:
|
:param config:
|
||||||
:rtype:
|
:rtype:
|
||||||
"""
|
"""
|
||||||
|
@ -170,7 +170,7 @@ def _build_direct_config(config, interface_map):
|
||||||
"""
|
"""
|
||||||
Generate the "direct" section of the BIRD daemon configuration.
|
Generate the "direct" section of the BIRD daemon configuration.
|
||||||
|
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param config:
|
:param config:
|
||||||
:type interface_map: dict
|
:type interface_map: dict
|
||||||
:param interface_map:
|
:param interface_map:
|
||||||
|
@ -187,7 +187,7 @@ def _build_ospf_config(config, interface_map):
|
||||||
"""
|
"""
|
||||||
Generate the "ospf" section of the BIRD daemon configuration.
|
Generate the "ospf" section of the BIRD daemon configuration.
|
||||||
|
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param config:
|
:param config:
|
||||||
:type interface_map: dict
|
:type interface_map: dict
|
||||||
:param interface_map:
|
:param interface_map:
|
||||||
|
@ -227,7 +227,7 @@ def _build_bgp_config(config, interface_map):
|
||||||
"""
|
"""
|
||||||
Generate the "BGP" section of the BIRD daemon configuration.
|
Generate the "BGP" section of the BIRD daemon configuration.
|
||||||
|
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param config:
|
:param config:
|
||||||
:type interface_map: dict
|
:type interface_map: dict
|
||||||
:param interface_map:
|
:param interface_map:
|
||||||
|
@ -286,7 +286,7 @@ def _build_radv_config(config, interface_map):
|
||||||
"""
|
"""
|
||||||
Generate the "radv" section of the BIRD daemon configuration.
|
Generate the "radv" section of the BIRD daemon configuration.
|
||||||
|
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param config:
|
:param config:
|
||||||
:type interface_map: dict
|
:type interface_map: dict
|
||||||
:param interface_map:
|
:param interface_map:
|
|
@ -19,8 +19,8 @@ import logging
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from akanda.router.drivers import base
|
from astara_router.drivers import base
|
||||||
from akanda.router import utils
|
from astara_router import utils
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
|
@ -16,8 +16,8 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from akanda.router.drivers import base
|
from astara_router.drivers import base
|
||||||
from akanda.router import utils
|
from astara_router import utils
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
|
@ -21,9 +21,9 @@ import re
|
||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
|
|
||||||
from akanda.router import models
|
from astara_router import models
|
||||||
from akanda.router.drivers import base
|
from astara_router.drivers import base
|
||||||
from akanda.router import utils
|
from astara_router import utils
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class IPManager(base.Manager):
|
||||||
|
|
||||||
:param ifname: the name of the interface to retrieve, e.g., `eth1`
|
:param ifname: the name of the interface to retrieve, e.g., `eth1`
|
||||||
:type ifname: str
|
:type ifname: str
|
||||||
:rtype: akanda.router.model.Interface
|
:rtype: astara_router.model.Interface
|
||||||
"""
|
"""
|
||||||
real_ifname = self.generic_to_host(ifname)
|
real_ifname = self.generic_to_host(ifname)
|
||||||
retval = _parse_interface(self.do('addr', 'show', real_ifname))
|
retval = _parse_interface(self.do('addr', 'show', real_ifname))
|
||||||
|
@ -141,7 +141,7 @@ class IPManager(base.Manager):
|
||||||
Sets the administrative mode for the network link on interface
|
Sets the administrative mode for the network link on interface
|
||||||
<interface> to "up".
|
<interface> to "up".
|
||||||
:param interface: the interface to mark up
|
:param interface: the interface to mark up
|
||||||
:type interface: akanda.router.models.Interface
|
:type interface: astara_router.models.Interface
|
||||||
"""
|
"""
|
||||||
real_ifname = self.generic_to_host(interface.ifname)
|
real_ifname = self.generic_to_host(interface.ifname)
|
||||||
self.sudo('link', 'set', real_ifname, 'up')
|
self.sudo('link', 'set', real_ifname, 'up')
|
||||||
|
@ -152,7 +152,7 @@ class IPManager(base.Manager):
|
||||||
Sets the administrative mode for the network link on interface
|
Sets the administrative mode for the network link on interface
|
||||||
<interface> to "down".
|
<interface> to "down".
|
||||||
:param interface: the interface to mark down
|
:param interface: the interface to mark down
|
||||||
:type interface: akanda.router.models.Interface
|
:type interface: astara_router.models.Interface
|
||||||
"""
|
"""
|
||||||
real_ifname = self.generic_to_host(interface.ifname)
|
real_ifname = self.generic_to_host(interface.ifname)
|
||||||
self.sudo('link', 'set', real_ifname, 'down')
|
self.sudo('link', 'set', real_ifname, 'down')
|
||||||
|
@ -161,7 +161,7 @@ class IPManager(base.Manager):
|
||||||
"""
|
"""
|
||||||
Updates a network interface, particularly its addresses
|
Updates a network interface, particularly its addresses
|
||||||
:param interface: the interface to update
|
:param interface: the interface to update
|
||||||
:type interface: akanda.router.models.Interface
|
:type interface: astara_router.models.Interface
|
||||||
:param ignore_link_local: When True, link local addresses will not be
|
:param ignore_link_local: When True, link local addresses will not be
|
||||||
added/removed
|
added/removed
|
||||||
:type ignore_link_local: bool
|
:type ignore_link_local: bool
|
||||||
|
@ -185,9 +185,9 @@ class IPManager(base.Manager):
|
||||||
:param real_ifname: the name of the interface to modify
|
:param real_ifname: the name of the interface to modify
|
||||||
:param real_ifname: str
|
:param real_ifname: str
|
||||||
:param interface: the new interface reference
|
:param interface: the new interface reference
|
||||||
:type interface: akanda.router.models.Interface
|
:type interface: astara_router.models.Interface
|
||||||
:param old_interface: the reference to the current network interface
|
:param old_interface: the reference to the current network interface
|
||||||
:type old_interface: akanda.router.models.Interface
|
:type old_interface: astara_router.models.Interface
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _gen_cmd(cmd, address):
|
def _gen_cmd(cmd, address):
|
||||||
|
@ -238,7 +238,7 @@ class IPManager(base.Manager):
|
||||||
"""
|
"""
|
||||||
Sets the default gateway for v4 and v6 via the use of `ip route add`.
|
Sets the default gateway for v4 and v6 via the use of `ip route add`.
|
||||||
|
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
"""
|
"""
|
||||||
# Track whether we have set the default gateways, by IP
|
# Track whether we have set the default gateways, by IP
|
||||||
# version.
|
# version.
|
||||||
|
@ -285,7 +285,7 @@ class IPManager(base.Manager):
|
||||||
Update the network routes. This is primarily used to support static
|
Update the network routes. This is primarily used to support static
|
||||||
routes that users provide to neutron.
|
routes that users provide to neutron.
|
||||||
|
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param cache: a dbm cache for storing the "last applied routes".
|
:param cache: a dbm cache for storing the "last applied routes".
|
||||||
Because Linux does not differentiate user-provided routes
|
Because Linux does not differentiate user-provided routes
|
||||||
from, for example, the default gateway, this is necessary
|
from, for example, the default gateway, this is necessary
|
||||||
|
@ -417,7 +417,7 @@ class IPManager(base.Manager):
|
||||||
"""
|
"""
|
||||||
Disabled duplicate address detection for a specific interface.
|
Disabled duplicate address detection for a specific interface.
|
||||||
|
|
||||||
:type network: akanda.models.Network
|
:type network: astara.models.Network
|
||||||
"""
|
"""
|
||||||
# For non-external networks, duplicate address detection isn't
|
# For non-external networks, duplicate address detection isn't
|
||||||
# necessary (and it sometimes results in race conditions for services
|
# necessary (and it sometimes results in race conditions for services
|
||||||
|
@ -472,7 +472,7 @@ def _parse_interfaces(data, filters=None):
|
||||||
:type data: str
|
:type data: str
|
||||||
:param filter: a list of valid interface names to match on
|
:param filter: a list of valid interface names to match on
|
||||||
:type data: list of str
|
:type data: list of str
|
||||||
:rtype: list of akanda.router.models.Interface
|
:rtype: list of astara_router.models.Interface
|
||||||
"""
|
"""
|
||||||
retval = []
|
retval = []
|
||||||
for iface_data in re.split('(^|\n)(?=[0-9]+: \w+\d{0,3}:)', data):
|
for iface_data in re.split('(^|\n)(?=[0-9]+: \w+\d{0,3}:)', data):
|
||||||
|
@ -497,7 +497,7 @@ def _parse_interface(data):
|
||||||
"""
|
"""
|
||||||
Parse details for an interface, given its data from `ip addr show <ifname>`
|
Parse details for an interface, given its data from `ip addr show <ifname>`
|
||||||
|
|
||||||
:rtype: akanda.router.models.Interface
|
:rtype: astara_router.models.Interface
|
||||||
"""
|
"""
|
||||||
retval = dict(addresses=[])
|
retval = dict(addresses=[])
|
||||||
for line in data.split('\n'):
|
for line in data.split('\n'):
|
|
@ -18,9 +18,9 @@ import re
|
||||||
import itertools
|
import itertools
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from akanda.router.drivers import base
|
from astara_router.drivers import base
|
||||||
from akanda.router.models import Network
|
from astara_router.models import Network
|
||||||
from akanda.router import defaults, utils
|
from astara_router import defaults, utils
|
||||||
|
|
||||||
|
|
||||||
class Rule(object):
|
class Rule(object):
|
||||||
|
@ -49,8 +49,8 @@ class IPTablesManager(base.Manager):
|
||||||
'''
|
'''
|
||||||
Save iptables-persistent firewall rules to disk.
|
Save iptables-persistent firewall rules to disk.
|
||||||
|
|
||||||
:param config: The akanda configuration to save to disk
|
:param config: The astara configuration to save to disk
|
||||||
:type config: akanda.rug.models.Configuration
|
:type config: astara.rug.models.Configuration
|
||||||
:param interface_map: A mapping of virtual ('ge0') to physical ('eth0')
|
:param interface_map: A mapping of virtual ('ge0') to physical ('eth0')
|
||||||
interface names
|
interface names
|
||||||
:type interface_map: dict
|
:type interface_map: dict
|
||||||
|
@ -103,8 +103,8 @@ class IPTablesManager(base.Manager):
|
||||||
def get_rules(self):
|
def get_rules(self):
|
||||||
'''
|
'''
|
||||||
Return the output of `iptables` and `ip6tables`.
|
Return the output of `iptables` and `ip6tables`.
|
||||||
This function is used by akanda-rug -> HTTP as a test for "router
|
This function is used by astara orchestrator -> HTTP as a test for
|
||||||
aliveness".
|
"router aliveness".
|
||||||
|
|
||||||
:rtype: str
|
:rtype: str
|
||||||
'''
|
'''
|
||||||
|
@ -116,7 +116,7 @@ class IPTablesManager(base.Manager):
|
||||||
'''
|
'''
|
||||||
Returns the external network
|
Returns the external network
|
||||||
|
|
||||||
:rtype: akanda.router.models.Network
|
:rtype: astara_router.models.Network
|
||||||
'''
|
'''
|
||||||
return self.networks_by_type(config, Network.TYPE_EXTERNAL)[0]
|
return self.networks_by_type(config, Network.TYPE_EXTERNAL)[0]
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ class IPTablesManager(base.Manager):
|
||||||
'''
|
'''
|
||||||
Returns the management network
|
Returns the management network
|
||||||
|
|
||||||
:rtype: akanda.router.models.Network
|
:rtype: astara_router.models.Network
|
||||||
'''
|
'''
|
||||||
return self.networks_by_type(config, Network.TYPE_MANAGEMENT)[0]
|
return self.networks_by_type(config, Network.TYPE_MANAGEMENT)[0]
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ class IPTablesManager(base.Manager):
|
||||||
'''
|
'''
|
||||||
Returns the internal networks
|
Returns the internal networks
|
||||||
|
|
||||||
:rtype: [akanda.router.models.Network]
|
:rtype: [astara_router.models.Network]
|
||||||
'''
|
'''
|
||||||
return self.networks_by_type(config, Network.TYPE_INTERNAL)
|
return self.networks_by_type(config, Network.TYPE_INTERNAL)
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ class IPTablesManager(base.Manager):
|
||||||
'''
|
'''
|
||||||
Returns the external network
|
Returns the external network
|
||||||
|
|
||||||
:rtype: akanda.router.models.Interface
|
:rtype: astara_router.models.Interface
|
||||||
'''
|
'''
|
||||||
return filter(lambda n: n.network_type == type, config.networks)
|
return filter(lambda n: n.network_type == type, config.networks)
|
||||||
|
|
||||||
|
@ -148,10 +148,10 @@ class IPTablesManager(base.Manager):
|
||||||
'''
|
'''
|
||||||
Build a list of iptables and ip6tables rules to be written to disk.
|
Build a list of iptables and ip6tables rules to be written to disk.
|
||||||
|
|
||||||
:param config: the akanda configuration object:
|
:param config: the astara configuration object:
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param rules: the list of rules to append to
|
:param rules: the list of rules to append to
|
||||||
:type rules: a list of akanda.router.drivers.iptables.Rule objects
|
:type rules: a list of astara_router.drivers.iptables.Rule objects
|
||||||
'''
|
'''
|
||||||
return itertools.chain(
|
return itertools.chain(
|
||||||
self._build_default_filter_rules(),
|
self._build_default_filter_rules(),
|
|
@ -13,7 +13,7 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
from akanda.router.drivers.loadbalancer import nginx
|
from astara_router.drivers.loadbalancer import nginx
|
||||||
|
|
||||||
# XXX move to config
|
# XXX move to config
|
||||||
CONFIGURED_LB_DRIVER = 'nginx'
|
CONFIGURED_LB_DRIVER = 'nginx'
|
|
@ -12,11 +12,12 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import jinja2
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from akanda.router.drivers import base
|
import jinja2
|
||||||
from akanda.router.utils import execute
|
|
||||||
|
from astara_router.drivers import base
|
||||||
|
from astara_router.utils import execute
|
||||||
|
|
||||||
|
|
||||||
class NginxTemplateNotFound(Exception):
|
class NginxTemplateNotFound(Exception):
|
|
@ -18,9 +18,9 @@
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from akanda.router.defaults import internal_metadata_port
|
from astara_router.defaults import internal_metadata_port
|
||||||
from akanda.router.drivers import base
|
from astara_router.drivers import base
|
||||||
from akanda.router.utils import execute, replace_file
|
from astara_router.utils import execute, replace_file
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
@ -46,8 +46,8 @@ class MetadataManager(base.Manager):
|
||||||
This function determines if the networks have changed since <config>
|
This function determines if the networks have changed since <config>
|
||||||
was initialized.
|
was initialized.
|
||||||
|
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param config: An akanda.router.models.Configuration object containing
|
:param config: An astara_router.models.Configuration object containing
|
||||||
the current configuration of the system's networks.
|
the current configuration of the system's networks.
|
||||||
:rtype: bool
|
:rtype: bool
|
||||||
"""
|
"""
|
||||||
|
@ -66,8 +66,8 @@ class MetadataManager(base.Manager):
|
||||||
"""
|
"""
|
||||||
Writes <config> to the metadata configuration file (<CONF_PATH>).
|
Writes <config> to the metadata configuration file (<CONF_PATH>).
|
||||||
|
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param config: An akanda.router.models.Configuration object containing
|
:param config: An astara_router.models.Configuration object containing
|
||||||
the configuration of metadata service.
|
the configuration of metadata service.
|
||||||
"""
|
"""
|
||||||
config_data = build_config(config)
|
config_data = build_config(config)
|
||||||
|
@ -104,9 +104,9 @@ def build_config(config):
|
||||||
"""
|
"""
|
||||||
Determines the configuration of the metadata service.
|
Determines the configuration of the metadata service.
|
||||||
|
|
||||||
:type config: akanda.router.models.Configuration
|
:type config: astara_router.models.Configuration
|
||||||
:param config:
|
:param config:
|
||||||
:rtype: akanda.router.models.Configuration
|
:rtype: astara_router.models.Configuration
|
||||||
"""
|
"""
|
||||||
config_data = {}
|
config_data = {}
|
||||||
|
|
|
@ -19,8 +19,8 @@ import logging
|
||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
|
|
||||||
from akanda.router.drivers import base
|
from astara_router.drivers import base
|
||||||
from akanda.router import utils
|
from astara_router import utils
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
|
@ -18,9 +18,9 @@
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from akanda.router import models
|
from astara_router import models
|
||||||
from akanda.router import settings
|
from astara_router import settings
|
||||||
from akanda.router.drivers import (bird, dnsmasq, ip, metadata,
|
from astara_router.drivers import (bird, dnsmasq, ip, metadata,
|
||||||
iptables, arp, hostname, loadbalancer)
|
iptables, arp, hostname, loadbalancer)
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@ import requests
|
||||||
from werkzeug import exceptions
|
from werkzeug import exceptions
|
||||||
from werkzeug import wrappers
|
from werkzeug import wrappers
|
||||||
|
|
||||||
from akanda.router import defaults
|
from astara_router import defaults
|
||||||
from akanda.router.drivers import ip
|
from astara_router.drivers import ip
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
# instance of the appliance.
|
# instance of the appliance.
|
||||||
ENABLED_SERVICES = ['router']
|
ENABLED_SERVICES = ['router']
|
||||||
|
|
||||||
# If akanda_local_settings.py is located in your python path,
|
# If astara_local_settings.py is located in your python path,
|
||||||
# it can be used to override the defaults. DIB will install this
|
# it can be used to override the defaults. DIB will install this
|
||||||
# into /usr/local/share/akanda and append that path to the gunicorn's
|
# into /usr/local/share/astara and append that path to the gunicorn's
|
||||||
# python path.
|
# python path.
|
||||||
try:
|
try:
|
||||||
from akanda_local_settings import * # noqa
|
from astara_local_settings import * # noqa
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
|
@ -24,7 +24,7 @@ import tempfile
|
||||||
import flask
|
import flask
|
||||||
import netaddr
|
import netaddr
|
||||||
|
|
||||||
from akanda.router import models
|
from astara_router import models
|
||||||
|
|
||||||
DEFAULT_ENABLED_SERVICES = ['router']
|
DEFAULT_ENABLED_SERVICES = ['router']
|
||||||
VALID_SERVICES = ['router', 'loadbalancer']
|
VALID_SERVICES = ['router', 'loadbalancer']
|
|
@ -1,4 +1,4 @@
|
||||||
This directory contains elements necessary to build the Akanda appliance with
|
This directory contains elements necessary to build the Astara appliance with
|
||||||
the diskimage-builder from the OpenStack project.
|
the diskimage-builder from the OpenStack project.
|
||||||
|
|
||||||
1) Install diskimage-builder via:
|
1) Install diskimage-builder via:
|
||||||
|
@ -12,10 +12,10 @@ the diskimage-builder from the OpenStack project.
|
||||||
- qemu-utils
|
- qemu-utils
|
||||||
|
|
||||||
3) Add elements to path
|
3) Add elements to path
|
||||||
$ export ELEMENTS_PATH=~/akanda-appliance/diskimage-builder/elements
|
$ export ELEMENTS_PATH=~/astara-appliance/diskimage-builder/elements
|
||||||
|
|
||||||
4) Build image
|
4) Build image
|
||||||
$ DIB_RELEASE=jessie DIB_EXTLINUX=1 disk-image-create debian vm akanda
|
$ DIB_RELEASE=jessie DIB_EXTLINUX=1 disk-image-create debian vm astara
|
||||||
|
|
||||||
5) If you're testing with kvm, don't forget to build the nocloud iso image
|
5) If you're testing with kvm, don't forget to build the nocloud iso image
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
This is the base element for building an Akanda appliance image.
|
This is the base element for building an Astara appliance image.
|
||||||
|
|
||||||
Ansible is required on the local system.
|
Ansible is required on the local system.
|
||||||
|
|
||||||
Advanced service drivers may be enabled in the appliance by setting
|
Advanced service drivers may be enabled in the appliance by setting
|
||||||
``DIB_AKANDA_ADVANCED_SERVICES``. This defaults to enabling only the
|
``DIB_ASTARA_ADVANCED_SERVICES``. This defaults to enabling only the
|
||||||
router driver, but you may enabled other avialable drivers ie:
|
router driver, but you may enabled other avialable drivers ie:
|
||||||
|
|
||||||
DIB_AKANDA_ADVANCED_SERVICES=router,loadbalancer
|
DIB_ASTARA_ADVANCED_SERVICES=router,loadbalancer
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
|
|
||||||
Creates a sudo privileged user in the appliance VM that can be used for
|
Creates a sudo privileged user in the appliance VM that can be used for
|
||||||
debugging connectivity issues via the console, when SSH connectivity is
|
debugging connectivity issues via the console, when SSH connectivity is
|
||||||
not possible. Note that an 'akanda' user is created by the RUG and setup
|
not possible. Note that an 'astara' user is created by the RUG and setup
|
||||||
to authenticate using a SSH public key. This element should only be included
|
to authenticate using a SSH public key. This element should only be included
|
||||||
when building images for develoment environments.
|
when building images for develoment environments.
|
||||||
|
|
||||||
The username and password can be set in the build environment as
|
The username and password can be set in the build environment as
|
||||||
$DIB_ASTARA_APPLIANCE_DEBUG_USER and $DIB_ASTARA_APPLIANCE_DEBUG_PASSWORD
|
$DIB_ASTARA_APPLIANCE_DEBUG_USER and $DIB_ASTARA_APPLIANCE_DEBUG_PASSWORD
|
||||||
The defaults are akanda-debug/akanda.
|
The defaults are astara-debug/astara.
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
SRC_ROOT="$(dirname $0)/.."
|
SRC_ROOT="$(dirname $0)/.."
|
||||||
IMG_OUT=$SRC_ROOT/build/astara_appliance
|
IMG_OUT=$SRC_ROOT/build/astara_appliance
|
||||||
|
|
||||||
AKANDA_DEBIAN_RELEASE=${AKANDA_DEBIAN_RELEASE:-"jessie"}
|
ASTARA_DEBIAN_RELEASE=${ASTARA_DEBIAN_RELEASE:-"jessie"}
|
||||||
BASE_ELEMENTS="vm debian astara nginx"
|
BASE_ELEMENTS="vm debian astara nginx"
|
||||||
EXTRA_ELEMENTS="$@"
|
EXTRA_ELEMENTS="$@"
|
||||||
|
|
||||||
|
@ -31,6 +31,6 @@ GIT_HEAD="$(cd $SRC_ROOT && git rev-parse HEAD^)"
|
||||||
DIB_REPOLOCATION_astara=$SRC_ROOT \
|
DIB_REPOLOCATION_astara=$SRC_ROOT \
|
||||||
DIB_REPOREF_astara=$GIT_HEAD \
|
DIB_REPOREF_astara=$GIT_HEAD \
|
||||||
ELEMENTS_PATH=$SRC_ROOT/diskimage-builder/elements \
|
ELEMENTS_PATH=$SRC_ROOT/diskimage-builder/elements \
|
||||||
DIB_RELEASE=$AKANDA_DEBIAN_RELEASE DIB_EXTLINUX=1 \
|
DIB_RELEASE=$ASTARA_DEBIAN_RELEASE DIB_EXTLINUX=1 \
|
||||||
DIB_ASTARA_ADVANCED_SERVICES="router,loadbalancer" \
|
DIB_ASTARA_ADVANCED_SERVICES="router,loadbalancer" \
|
||||||
disk-image-create $BASE_ELEMENTS $EXTRA_ELEMENTS -o $IMG_OUT
|
disk-image-create $BASE_ELEMENTS $EXTRA_ELEMENTS -o $IMG_OUT
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import pdb
|
import pdb
|
||||||
from akanda.router.models import Configuration
|
from astara_router.models import Configuration
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Simple script that helps debug faulty configurations
|
# Simple script that helps debug faulty configurations
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: akanda-router-api-server
|
# Provides: astara-router-api-server
|
||||||
# Required-Start: $all
|
# Required-Start: $all
|
||||||
# Required-Stop: $all
|
# Required-Stop: $all
|
||||||
# Default-Start: 2 3 4 5
|
# Default-Start: 2 3 4 5
|
||||||
# Default-Stop:
|
# Default-Stop:
|
||||||
# Short-Description: Akanda Router API Server
|
# Short-Description: Astara Router API Server
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
|
|
||||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||||
DAEMON="/usr/local/bin/gunicorn"
|
DAEMON="/usr/local/bin/gunicorn"
|
||||||
NAME="akanda-router-api-server"
|
NAME="astara-router-api-server"
|
||||||
OPTIONS="--pythonpath /usr/local/share/akanda -c /etc/akanda_gunicorn_config akanda.router.api.server:app"
|
OPTIONS="--pythonpath /usr/local/share/astara -c /etc/astara_gunicorn_config astara_router.api.server:app"
|
||||||
PIDFILE=/var/run/gunicorn.pid
|
PIDFILE=/var/run/gunicorn.pid
|
||||||
|
|
||||||
test -x $DAEMON || exit 0
|
test -x $DAEMON || exit 0
|
||||||
|
@ -22,12 +22,12 @@ test -x $DAEMON || exit 0
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
log_daemon_msg "Starting akanda-router-api-server" $NAME
|
log_daemon_msg "Starting astara-router-api-server" $NAME
|
||||||
start_daemon -p $PIDFILE $DAEMON $OPTIONS
|
start_daemon -p $PIDFILE $DAEMON $OPTIONS
|
||||||
log_end_msg $?
|
log_end_msg $?
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
log_daemon_msg "Stopping akanda-router-api-server" $NAME
|
log_daemon_msg "Stopping astara-router-api-server" $NAME
|
||||||
killproc -p $PIDFILE $DAEMON
|
killproc -p $PIDFILE $DAEMON
|
||||||
log_end_msg $?
|
log_end_msg $?
|
||||||
;;
|
;;
|
||||||
|
@ -39,7 +39,7 @@ case "$1" in
|
||||||
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
|
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: /etc/init.d/akanda-router-api-server {start|stop|restart|force-reload|status}"
|
echo "Usage: /etc/init.d/astara-router-api-server {start|stop|restart|force-reload|status}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
|
@ -6,13 +6,13 @@
|
||||||
# Required-Stop: $all
|
# Required-Stop: $all
|
||||||
# Default-Start: 2 3 4 5
|
# Default-Start: 2 3 4 5
|
||||||
# Default-Stop:
|
# Default-Stop:
|
||||||
# Short-Description: Akanda OpenStack Metadata Service
|
# Short-Description: Astara OpenStack Metadata Service
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
|
|
||||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||||
DAEMON="/usr/local/bin/akanda-metadata-proxy"
|
DAEMON="/usr/local/bin/astara-metadata-proxy"
|
||||||
NAME="akanda-metadata-proxy"
|
NAME="astara-metadata-proxy"
|
||||||
OPTIONS="/etc/metadata.conf"
|
OPTIONS="/etc/metadata.conf"
|
||||||
PIDFILE=/var/run/metadata.pid
|
PIDFILE=/var/run/metadata.pid
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ case "$1" in
|
||||||
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
|
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: /etc/init.d/akanda-metadata-proxy {start|stop|restart|force-reload|status}"
|
echo "Usage: /etc/init.d/astara-metadata-proxy {start|stop|restart|force-reload|status}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -33,13 +33,13 @@ run_by_init() {
|
||||||
([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
|
([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
|
||||||
}
|
}
|
||||||
|
|
||||||
akanda_configure_ssh() {
|
astara_configure_ssh() {
|
||||||
/usr/local/bin/akanda-configure-ssh
|
/usr/local/bin/astara-configure-ssh
|
||||||
}
|
}
|
||||||
|
|
||||||
check_for_no_start() {
|
check_for_no_start() {
|
||||||
# forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
|
# forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
|
||||||
if [ -e /etc/ssh/sshd_not_to_be_run ]; then
|
if [ -e /etc/ssh/sshd_not_to_be_run ]; then
|
||||||
if [ "$1" = log_end_msg ]; then
|
if [ "$1" = log_end_msg ]; then
|
||||||
log_end_msg 0 || true
|
log_end_msg 0 || true
|
||||||
fi
|
fi
|
||||||
|
@ -83,7 +83,7 @@ case "$1" in
|
||||||
check_privsep_dir
|
check_privsep_dir
|
||||||
check_for_no_start
|
check_for_no_start
|
||||||
check_dev_null
|
check_dev_null
|
||||||
akanda_configure_ssh
|
astara_configure_ssh
|
||||||
log_daemon_msg "Starting OpenBSD Secure Shell server" "sshd" || true
|
log_daemon_msg "Starting OpenBSD Secure Shell server" "sshd" || true
|
||||||
if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
|
if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
|
||||||
log_end_msg 0 || true
|
log_end_msg 0 || true
|
||||||
|
@ -114,7 +114,7 @@ case "$1" in
|
||||||
restart)
|
restart)
|
||||||
check_privsep_dir
|
check_privsep_dir
|
||||||
check_config
|
check_config
|
||||||
akanda_configure_ssh
|
astara_configure_ssh
|
||||||
log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd" || true
|
log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd" || true
|
||||||
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/sshd.pid
|
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/sshd.pid
|
||||||
check_for_no_start log_end_msg
|
check_for_no_start log_end_msg
|
||||||
|
|
21
setup.cfg
21
setup.cfg
|
@ -6,7 +6,7 @@ description-file =
|
||||||
README.md
|
README.md
|
||||||
author = OpenStack
|
author = OpenStack
|
||||||
author-email = openstack-dev@lists.openstack.org
|
author-email = openstack-dev@lists.openstack.org
|
||||||
home-page = http://github.com/openstack/akanda-appliance
|
home-page = http://github.com/openstack/astara-appliance
|
||||||
classifier =
|
classifier =
|
||||||
Environment :: OpenStack
|
Environment :: OpenStack
|
||||||
Intended Audience :: Developers
|
Intended Audience :: Developers
|
||||||
|
@ -21,10 +21,7 @@ classifier =
|
||||||
|
|
||||||
[files]
|
[files]
|
||||||
packages =
|
packages =
|
||||||
akanda
|
astara_router
|
||||||
akanda.router
|
|
||||||
namespace_packages =
|
|
||||||
akanda
|
|
||||||
|
|
||||||
[global]
|
[global]
|
||||||
setup-hooks =
|
setup-hooks =
|
||||||
|
@ -32,10 +29,14 @@ setup-hooks =
|
||||||
|
|
||||||
[entry_points]
|
[entry_points]
|
||||||
console_scripts =
|
console_scripts =
|
||||||
akanda-configure-management=akanda.router.commands.management:configure_management
|
akanda-configure-management=astara_router.commands.management:configure_management
|
||||||
akanda-api-dev-server=akanda.router.api.server:main
|
akanda-api-dev-server=astara_router.api.server:main
|
||||||
akanda-metadata-proxy=akanda.router.metadata_proxy:main
|
akanda-metadata-proxy=astara_router.metadata_proxy:main
|
||||||
akanda-gratuitous-arp=akanda.router.drivers.arp:send_gratuitous_arp
|
akanda-gratuitous-arp=astara_router.drivers.arp:send_gratuitous_arp
|
||||||
|
astara-configure-management=astara_router.commands.management:configure_management
|
||||||
|
astara-api-dev-server=astara_router.api.server:main
|
||||||
|
astara-metadata-proxy=astara_router.metadata_proxy:main
|
||||||
|
astara-gratuitous-arp=astara_router.drivers.arp:send_gratuitous_arp
|
||||||
|
|
||||||
[build_sphinx]
|
[build_sphinx]
|
||||||
all_files = 1
|
all_files = 1
|
||||||
|
@ -46,4 +47,4 @@ source-dir = doc/source
|
||||||
where = test
|
where = test
|
||||||
verbosity = 2
|
verbosity = 2
|
||||||
detailed-errors = 1
|
detailed-errors = 1
|
||||||
cover-package = akanda
|
cover-package = astara_router
|
||||||
|
|
|
@ -15,14 +15,14 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
from akanda.router import models
|
from astara_router import models
|
||||||
|
|
||||||
|
|
||||||
class FakeIFManager(object):
|
class FakeIFManager(object):
|
||||||
"""
|
"""
|
||||||
The methods implemented here in the fake interface manager should not be
|
The methods implemented here in the fake interface manager should not be
|
||||||
built using the payloads, since that's what we're using to verify the data.
|
built using the payloads, since that's what we're using to verify the data.
|
||||||
Instead, each method should create akanda objects as needed that will
|
Instead, each method should create astara objects as needed that will
|
||||||
serialize to the appropriate data to return the proper payload.
|
serialize to the appropriate data to return the proper payload.
|
||||||
"""
|
"""
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -22,7 +22,7 @@ from unittest import TestCase
|
||||||
|
|
||||||
import flask
|
import flask
|
||||||
|
|
||||||
from akanda.router.api import v1
|
from astara_router.api import v1
|
||||||
|
|
||||||
|
|
||||||
class BaseAPITestCase(TestCase):
|
class BaseAPITestCase(TestCase):
|
||||||
|
@ -38,5 +38,5 @@ class BaseAPITestCase(TestCase):
|
||||||
|
|
||||||
def test_root(self):
|
def test_root(self):
|
||||||
rv = self.test_app.get('/v1/base', follow_redirects=True)
|
rv = self.test_app.get('/v1/base', follow_redirects=True)
|
||||||
self.assertEqual(rv.data, 'Akanda appliance API service is active')
|
self.assertEqual(rv.data, 'Astara appliance API service is active')
|
||||||
self.assertEqual(rv.status_code, 200)
|
self.assertEqual(rv.status_code, 200)
|
||||||
|
|
|
@ -23,7 +23,7 @@ import json
|
||||||
import mock
|
import mock
|
||||||
from unittest2 import TestCase
|
from unittest2 import TestCase
|
||||||
|
|
||||||
from akanda.router.api import v1
|
from astara_router.api import v1
|
||||||
|
|
||||||
|
|
||||||
class FirewallAPITestCase(TestCase):
|
class FirewallAPITestCase(TestCase):
|
||||||
|
|
|
@ -26,8 +26,8 @@ import flask
|
||||||
import json
|
import json
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from akanda.router import manager
|
from astara_router import manager
|
||||||
from akanda.router.api import v1
|
from astara_router.api import v1
|
||||||
|
|
||||||
|
|
||||||
SYSTEM_CONFIG = {
|
SYSTEM_CONFIG = {
|
||||||
|
@ -123,7 +123,7 @@ class SystemAPITestCase(unittest.TestCase):
|
||||||
self.assertEqual(result.status_code, 415)
|
self.assertEqual(result.status_code, 415)
|
||||||
|
|
||||||
def test_put_configuration_returns_422_for_ValueError(self):
|
def test_put_configuration_returns_422_for_ValueError(self):
|
||||||
with mock.patch('akanda.router.models.RouterConfiguration') as Config:
|
with mock.patch('astara_router.models.RouterConfiguration') as Config:
|
||||||
Config.side_effect = ValueError
|
Config.side_effect = ValueError
|
||||||
result = self.test_app.put(
|
result = self.test_app.put(
|
||||||
'/v1/system/config',
|
'/v1/system/config',
|
||||||
|
@ -133,7 +133,7 @@ class SystemAPITestCase(unittest.TestCase):
|
||||||
self.assertEqual(result.status_code, 422)
|
self.assertEqual(result.status_code, 422)
|
||||||
|
|
||||||
def test_put_configuration_returns_422_for_errors(self):
|
def test_put_configuration_returns_422_for_errors(self):
|
||||||
with mock.patch('akanda.router.models.SystemConfiguration') as Config:
|
with mock.patch('astara_router.models.SystemConfiguration') as Config:
|
||||||
Config.return_value.validate.return_value = ['error1']
|
Config.return_value.validate.return_value = ['error1']
|
||||||
result = self.test_app.put(
|
result = self.test_app.put(
|
||||||
'/v1/system/config',
|
'/v1/system/config',
|
||||||
|
@ -152,8 +152,8 @@ class SystemAPITestCase(unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@mock.patch('akanda.router.api.v1.system._get_cache')
|
@mock.patch('astara_router.api.v1.system._get_cache')
|
||||||
@mock.patch('akanda.router.models.SystemConfiguration')
|
@mock.patch('astara_router.models.SystemConfiguration')
|
||||||
@mock.patch.object(v1.system.manager, 'update_config')
|
@mock.patch.object(v1.system.manager, 'update_config')
|
||||||
def test_put_configuration_returns_200(self, mock_update,
|
def test_put_configuration_returns_200(self, mock_update,
|
||||||
fake_system_config, fake_cache):
|
fake_system_config, fake_cache):
|
||||||
|
@ -177,11 +177,11 @@ class SystemAPITestCase(unittest.TestCase):
|
||||||
mock_update.assert_called_with(
|
mock_update.assert_called_with(
|
||||||
cache='fake_cache', service_configs=[], system_config=sys_config_obj)
|
cache='fake_cache', service_configs=[], system_config=sys_config_obj)
|
||||||
|
|
||||||
@mock.patch('akanda.router.manager.Manager.config',
|
@mock.patch('astara_router.manager.Manager.config',
|
||||||
new_callable=mock.PropertyMock, return_value={})
|
new_callable=mock.PropertyMock, return_value={})
|
||||||
@mock.patch('akanda.router.api.v1.system._get_cache')
|
@mock.patch('astara_router.api.v1.system._get_cache')
|
||||||
@mock.patch('akanda.router.models.RouterConfiguration')
|
@mock.patch('astara_router.models.RouterConfiguration')
|
||||||
@mock.patch('akanda.router.models.SystemConfiguration')
|
@mock.patch('astara_router.models.SystemConfiguration')
|
||||||
@mock.patch.object(v1.system.manager, 'update_config')
|
@mock.patch.object(v1.system.manager, 'update_config')
|
||||||
def test_put_configuration_with_router(self, mock_update,
|
def test_put_configuration_with_router(self, mock_update,
|
||||||
fake_system_config, fake_router_config, fake_cache, fake_config):
|
fake_system_config, fake_router_config, fake_cache, fake_config):
|
||||||
|
@ -213,14 +213,14 @@ class SystemAPITestCase(unittest.TestCase):
|
||||||
cache='fake_cache', service_configs=[router_config_obj],
|
cache='fake_cache', service_configs=[router_config_obj],
|
||||||
system_config=sys_config_obj)
|
system_config=sys_config_obj)
|
||||||
|
|
||||||
@mock.patch('akanda.router.models.get_config_model')
|
@mock.patch('astara_router.models.get_config_model')
|
||||||
@mock.patch.object(manager, 'settings')
|
@mock.patch.object(manager, 'settings')
|
||||||
@mock.patch.object(v1.system, 'settings')
|
@mock.patch.object(v1.system, 'settings')
|
||||||
@mock.patch('akanda.router.manager.Manager.config',
|
@mock.patch('astara_router.manager.Manager.config',
|
||||||
new_callable=mock.PropertyMock, return_value={})
|
new_callable=mock.PropertyMock, return_value={})
|
||||||
@mock.patch('akanda.router.api.v1.system._get_cache')
|
@mock.patch('astara_router.api.v1.system._get_cache')
|
||||||
@mock.patch('akanda.router.models.LoadBalancerConfiguration')
|
@mock.patch('astara_router.models.LoadBalancerConfiguration')
|
||||||
@mock.patch('akanda.router.models.SystemConfiguration')
|
@mock.patch('astara_router.models.SystemConfiguration')
|
||||||
@mock.patch.object(v1.system.manager, 'update_config')
|
@mock.patch.object(v1.system.manager, 'update_config')
|
||||||
def test_put_configuration_with_adv_services(self, mock_update,
|
def test_put_configuration_with_adv_services(self, mock_update,
|
||||||
fake_system_config, fake_lb_config, fake_cache, fake_config,
|
fake_system_config, fake_lb_config, fake_cache, fake_config,
|
||||||
|
@ -257,14 +257,14 @@ class SystemAPITestCase(unittest.TestCase):
|
||||||
cache='fake_cache', service_configs=[lb_config_obj],
|
cache='fake_cache', service_configs=[lb_config_obj],
|
||||||
system_config=sys_config_obj)
|
system_config=sys_config_obj)
|
||||||
|
|
||||||
@mock.patch('akanda.router.models.get_config_model')
|
@mock.patch('astara_router.models.get_config_model')
|
||||||
@mock.patch.object(manager, 'settings')
|
@mock.patch.object(manager, 'settings')
|
||||||
@mock.patch.object(v1.system, 'settings')
|
@mock.patch.object(v1.system, 'settings')
|
||||||
@mock.patch('akanda.router.manager.Manager.config',
|
@mock.patch('astara_router.manager.Manager.config',
|
||||||
new_callable=mock.PropertyMock, return_value={})
|
new_callable=mock.PropertyMock, return_value={})
|
||||||
@mock.patch('akanda.router.api.v1.system._get_cache')
|
@mock.patch('astara_router.api.v1.system._get_cache')
|
||||||
@mock.patch('akanda.router.models.LoadBalancerConfiguration')
|
@mock.patch('astara_router.models.LoadBalancerConfiguration')
|
||||||
@mock.patch('akanda.router.models.SystemConfiguration')
|
@mock.patch('astara_router.models.SystemConfiguration')
|
||||||
@mock.patch.object(v1.system.manager, 'update_config')
|
@mock.patch.object(v1.system.manager, 'update_config')
|
||||||
def test_put_configuration_with_disabled_svc_returns_400(self, mock_update,
|
def test_put_configuration_with_disabled_svc_returns_400(self, mock_update,
|
||||||
fake_system_config, fake_lb_config, fake_cache, fake_config,
|
fake_system_config, fake_lb_config, fake_cache, fake_config,
|
||||||
|
|
|
@ -19,8 +19,8 @@ import mock
|
||||||
import socket
|
import socket
|
||||||
import unittest2
|
import unittest2
|
||||||
|
|
||||||
from akanda.router import models
|
from astara_router import models
|
||||||
from akanda.router.drivers import arp
|
from astara_router.drivers import arp
|
||||||
|
|
||||||
config = mock.Mock()
|
config = mock.Mock()
|
||||||
network = mock.Mock()
|
network = mock.Mock()
|
||||||
|
@ -124,23 +124,23 @@ class ARPTest(unittest2.TestCase):
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
with mock.patch('akanda.router.utils.execute') as execute:
|
with mock.patch('astara_router.utils.execute') as execute:
|
||||||
self.mgr.send_gratuitous_arp_for_floating_ips(
|
self.mgr.send_gratuitous_arp_for_floating_ips(
|
||||||
config,
|
config,
|
||||||
lambda x: x.replace('ge', 'eth')
|
lambda x: x.replace('ge', 'eth')
|
||||||
)
|
)
|
||||||
assert execute.call_args_list == [
|
assert execute.call_args_list == [
|
||||||
mock.call(
|
mock.call(
|
||||||
['akanda-gratuitous-arp', 'eth1', '172.16.77.50'], 'sudo'
|
['astara-gratuitous-arp', 'eth1', '172.16.77.50'], 'sudo'
|
||||||
),
|
),
|
||||||
mock.call(
|
mock.call(
|
||||||
['akanda-gratuitous-arp', 'eth1', '172.16.77.51'], 'sudo'
|
['astara-gratuitous-arp', 'eth1', '172.16.77.51'], 'sudo'
|
||||||
),
|
),
|
||||||
mock.call(
|
mock.call(
|
||||||
['akanda-gratuitous-arp', 'eth1', '172.16.77.52'], 'sudo'
|
['astara-gratuitous-arp', 'eth1', '172.16.77.52'], 'sudo'
|
||||||
),
|
),
|
||||||
mock.call(
|
mock.call(
|
||||||
['akanda-gratuitous-arp', 'eth1', '172.16.77.53'], 'sudo'
|
['astara-gratuitous-arp', 'eth1', '172.16.77.53'], 'sudo'
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import netaddr
|
||||||
import re
|
import re
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
from akanda.router.drivers import bird
|
from astara_router.drivers import bird
|
||||||
ext_subnet = mock.Mock()
|
ext_subnet = mock.Mock()
|
||||||
ext_subnet.gateway_ip = netaddr.IPAddress('dead:beef::1')
|
ext_subnet.gateway_ip = netaddr.IPAddress('dead:beef::1')
|
||||||
ext_subnet.cidr = netaddr.IPNetwork('dead:beef::/64')
|
ext_subnet.cidr = netaddr.IPNetwork('dead:beef::/64')
|
||||||
|
@ -65,9 +65,9 @@ class BirdTestCase(TestCase):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.mock_execute = mock.patch('akanda.router.utils.execute').start()
|
self.mock_execute = mock.patch('astara_router.utils.execute').start()
|
||||||
self.mock_replace_file = mock.patch(
|
self.mock_replace_file = mock.patch(
|
||||||
'akanda.router.utils.replace_file'
|
'astara_router.utils.replace_file'
|
||||||
).start()
|
).start()
|
||||||
self.addCleanup(mock.patch.stopall)
|
self.addCleanup(mock.patch.stopall)
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class BirdTestCase(TestCase):
|
||||||
])
|
])
|
||||||
|
|
||||||
def test_restart_failure(self):
|
def test_restart_failure(self):
|
||||||
with mock.patch('akanda.router.utils.execute') as execute:
|
with mock.patch('astara_router.utils.execute') as execute:
|
||||||
execute.side_effect = [Exception('status failed!'), None]
|
execute.side_effect = [Exception('status failed!'), None]
|
||||||
self.mgr.restart()
|
self.mgr.restart()
|
||||||
execute.assert_has_calls([
|
execute.assert_has_calls([
|
||||||
|
|
|
@ -21,8 +21,8 @@ import mock
|
||||||
import netaddr
|
import netaddr
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from akanda.router import models
|
from astara_router import models
|
||||||
from akanda.router.drivers import dnsmasq
|
from astara_router.drivers import dnsmasq
|
||||||
ext_subnet = mock.Mock()
|
ext_subnet = mock.Mock()
|
||||||
ext_subnet.gateway_ip = netaddr.IPAddress('dead:beef::1')
|
ext_subnet.gateway_ip = netaddr.IPAddress('dead:beef::1')
|
||||||
|
|
||||||
|
@ -85,9 +85,9 @@ class DnsmasqTestCase(TestCase):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.mock_execute = mock.patch('akanda.router.utils.execute').start()
|
self.mock_execute = mock.patch('astara_router.utils.execute').start()
|
||||||
self.mock_replace_file = mock.patch(
|
self.mock_replace_file = mock.patch(
|
||||||
'akanda.router.utils.replace_file'
|
'astara_router.utils.replace_file'
|
||||||
).start()
|
).start()
|
||||||
self.addCleanup(mock.patch.stopall)
|
self.addCleanup(mock.patch.stopall)
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,10 @@ from unittest2 import TestCase
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from akanda.router.drivers import hostname, ip
|
from astara_router.drivers import hostname, ip
|
||||||
|
|
||||||
CONFIG = mock.Mock()
|
CONFIG = mock.Mock()
|
||||||
CONFIG.hostname = 'akanda'
|
CONFIG.hostname = 'astara'
|
||||||
CONFIG.management_address = 'fdca:3ba5:a17a:acda:f816:3eff:fe66:33b6'
|
CONFIG.management_address = 'fdca:3ba5:a17a:acda:f816:3eff:fe66:33b6'
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,9 +30,9 @@ class HostnameTestCase(TestCase):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.mock_execute = mock.patch('akanda.router.utils.execute').start()
|
self.mock_execute = mock.patch('astara_router.utils.execute').start()
|
||||||
self.mock_replace_file = mock.patch(
|
self.mock_replace_file = mock.patch(
|
||||||
'akanda.router.utils.replace_file'
|
'astara_router.utils.replace_file'
|
||||||
).start()
|
).start()
|
||||||
self.addCleanup(mock.patch.stopall)
|
self.addCleanup(mock.patch.stopall)
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class HostnameTestCase(TestCase):
|
||||||
def test_update_hostname(self):
|
def test_update_hostname(self):
|
||||||
self.mgr.update_hostname(CONFIG)
|
self.mgr.update_hostname(CONFIG)
|
||||||
self.mock_execute.assert_has_calls([
|
self.mock_execute.assert_has_calls([
|
||||||
mock.call(['/bin/hostname', 'akanda'], 'sudo'),
|
mock.call(['/bin/hostname', 'astara'], 'sudo'),
|
||||||
mock.call(['mv', '/tmp/hostname', '/etc/hostname'], 'sudo')
|
mock.call(['mv', '/tmp/hostname', '/etc/hostname'], 'sudo')
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class HostnameTestCase(TestCase):
|
||||||
expected = mock.call('/tmp/hosts', '\n'.join([
|
expected = mock.call('/tmp/hosts', '\n'.join([
|
||||||
'127.0.0.1 localhost',
|
'127.0.0.1 localhost',
|
||||||
'::1 localhost ip6-localhost ip6-loopback',
|
'::1 localhost ip6-localhost ip6-loopback',
|
||||||
'fdca:3ba5:a17a:acda:f816:3eff:fe66:33b6 akanda'
|
'fdca:3ba5:a17a:acda:f816:3eff:fe66:33b6 astara'
|
||||||
]))
|
]))
|
||||||
self.mgr.update_hosts(CONFIG)
|
self.mgr.update_hosts(CONFIG)
|
||||||
self.mock_execute.assert_has_calls([
|
self.mock_execute.assert_has_calls([
|
||||||
|
|
|
@ -22,8 +22,8 @@ from unittest2 import TestCase
|
||||||
import mock
|
import mock
|
||||||
import netaddr
|
import netaddr
|
||||||
|
|
||||||
from akanda.router import models
|
from astara_router import models
|
||||||
from akanda.router.drivers import ip
|
from astara_router.drivers import ip
|
||||||
|
|
||||||
SAMPLE_OUTPUT = """1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
|
SAMPLE_OUTPUT = """1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
|
||||||
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
||||||
|
@ -50,7 +50,7 @@ SAMPLE_SINGLE_OUTPUT = """3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qd
|
||||||
class IPTestCase(TestCase):
|
class IPTestCase(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.execute_patch = mock.patch('akanda.router.utils.execute')
|
self.execute_patch = mock.patch('astara_router.utils.execute')
|
||||||
self.mock_execute = self.execute_patch.start()
|
self.mock_execute = self.execute_patch.start()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
@ -66,7 +66,7 @@ class IPTestCase(TestCase):
|
||||||
|
|
||||||
iface_b = mock.Mock()
|
iface_b = mock.Mock()
|
||||||
iface_b.ifname = 'em1'
|
iface_b.ifname = 'em1'
|
||||||
ifaces = 'akanda.router.drivers.ip._parse_interfaces'
|
ifaces = 'astara_router.drivers.ip._parse_interfaces'
|
||||||
with mock.patch(ifaces) as parse:
|
with mock.patch(ifaces) as parse:
|
||||||
parse.return_value = [iface_a, iface_b]
|
parse.return_value = [iface_a, iface_b]
|
||||||
mgr = ip.IPManager()
|
mgr = ip.IPManager()
|
||||||
|
@ -79,8 +79,8 @@ class IPTestCase(TestCase):
|
||||||
def test_get_interface(self):
|
def test_get_interface(self):
|
||||||
iface_a = mock.Mock()
|
iface_a = mock.Mock()
|
||||||
iface_a.ifname = 'em0'
|
iface_a.ifname = 'em0'
|
||||||
iface = 'akanda.router.drivers.ip._parse_interface'
|
iface = 'astara_router.drivers.ip._parse_interface'
|
||||||
ifaces = 'akanda.router.drivers.ip._parse_interfaces'
|
ifaces = 'astara_router.drivers.ip._parse_interfaces'
|
||||||
with mock.patch(iface) as parse:
|
with mock.patch(iface) as parse:
|
||||||
with mock.patch(ifaces) as pi:
|
with mock.patch(ifaces) as pi:
|
||||||
pi.return_value = [iface_a]
|
pi.return_value = [iface_a]
|
||||||
|
@ -343,7 +343,7 @@ class TestDisableDAD(TestCase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.execute_patch = mock.patch('akanda.router.utils.execute')
|
self.execute_patch = mock.patch('astara_router.utils.execute')
|
||||||
self.mock_execute = self.execute_patch.start()
|
self.mock_execute = self.execute_patch.start()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
|
|
@ -4,8 +4,8 @@ from unittest import TestCase
|
||||||
import mock
|
import mock
|
||||||
import netaddr
|
import netaddr
|
||||||
|
|
||||||
from akanda.router import models
|
from astara_router import models
|
||||||
from akanda.router.drivers import iptables
|
from astara_router.drivers import iptables
|
||||||
|
|
||||||
CONFIG = models.RouterConfiguration({
|
CONFIG = models.RouterConfiguration({
|
||||||
'networks': [{
|
'networks': [{
|
||||||
|
@ -131,8 +131,8 @@ class TestIPTablesRouterConfiguration(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestIPTablesRouterConfiguration, self).setUp()
|
super(TestIPTablesRouterConfiguration, self).setUp()
|
||||||
self.execute = mock.patch('akanda.router.utils.execute').start()
|
self.execute = mock.patch('astara_router.utils.execute').start()
|
||||||
self.replace = mock.patch('akanda.router.utils.replace_file').start()
|
self.replace = mock.patch('astara_router.utils.replace_file').start()
|
||||||
self.patches = [self.execute, self.replace]
|
self.patches = [self.execute, self.replace]
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
|
|
@ -21,8 +21,8 @@ import unittest2
|
||||||
import netaddr
|
import netaddr
|
||||||
from dogpile.cache import make_region
|
from dogpile.cache import make_region
|
||||||
|
|
||||||
from akanda.router import models
|
from astara_router import models
|
||||||
from akanda.router.drivers import ip
|
from astara_router.drivers import ip
|
||||||
|
|
||||||
|
|
||||||
class RouteTest(unittest2.TestCase):
|
class RouteTest(unittest2.TestCase):
|
||||||
|
|
|
@ -7,7 +7,7 @@ from collections import OrderedDict
|
||||||
import eventlet
|
import eventlet
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from akanda.router import metadata_proxy
|
from astara_router import metadata_proxy
|
||||||
|
|
||||||
config = json.dumps({
|
config = json.dumps({
|
||||||
"tenant_id": "ABC123",
|
"tenant_id": "ABC123",
|
||||||
|
|
|
@ -23,7 +23,7 @@ import netaddr
|
||||||
|
|
||||||
from unittest2 import TestCase
|
from unittest2 import TestCase
|
||||||
|
|
||||||
from akanda.router import models
|
from astara_router import models
|
||||||
from test.unit import fakes
|
from test.unit import fakes
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ import flask
|
||||||
import mock
|
import mock
|
||||||
import netaddr
|
import netaddr
|
||||||
|
|
||||||
from akanda.router import models
|
from astara_router import models
|
||||||
from akanda.router import utils
|
from astara_router import utils
|
||||||
|
|
||||||
|
|
||||||
class ModelSerializerTestCase(TestCase):
|
class ModelSerializerTestCase(TestCase):
|
||||||
|
|
Loading…
Reference in New Issue