From 1a68612a713d68cbacae15777ad5ccda8312de58 Mon Sep 17 00:00:00 2001 From: Mark McClain Date: Wed, 2 Dec 2015 16:19:14 -0500 Subject: [PATCH] Rename Akanda to Astara Change-Id: Id5b7509a64cd274696f6bdd63a1133c25505f01b --- MANIFEST.in | 2 +- README.md | 6 +-- akanda/__init__.py | 18 --------- ansible/main.yml | 2 +- ansible/tasks/{akanda.yml => astara.yml} | 38 +++++++++--------- ansible/tasks/base.yml | 2 +- ansible/templates/gunicorn.j2 | 4 +- ansible/templates/logrotate.j2 | 2 +- ansible/templates/motd.j2 | 16 ++++---- {akanda/router => astara_router}/__init__.py | 0 .../router => astara_router}/api/__init__.py | 0 .../router => astara_router}/api/server.py | 8 ++-- .../api/v1/__init__.py | 0 .../router => astara_router}/api/v1/base.py | 4 +- .../api/v1/firewall.py | 4 +- .../router => astara_router}/api/v1/status.py | 4 +- .../router => astara_router}/api/v1/system.py | 10 ++--- .../commands/__init__.py | 0 .../commands/management.py | 10 ++--- {akanda/router => astara_router}/debug.py | 0 {akanda/router => astara_router}/defaults.py | 0 .../drivers/__init__.py | 0 .../router => astara_router}/drivers/arp.py | 16 ++++---- .../router => astara_router}/drivers/base.py | 2 +- .../router => astara_router}/drivers/bird.py | 24 +++++------ .../drivers/dnsmasq.py | 4 +- .../drivers/hostname.py | 4 +- .../router => astara_router}/drivers/ip.py | 28 ++++++------- .../drivers/iptables.py | 28 ++++++------- .../drivers/loadbalancer/__init__.py | 2 +- .../drivers/loadbalancer/nginx.conf.template | 0 .../drivers/loadbalancer/nginx.py | 7 ++-- .../drivers/metadata.py | 18 ++++----- .../router => astara_router}/drivers/ping.py | 4 +- {akanda/router => astara_router}/manager.py | 6 +-- .../metadata_proxy.py | 4 +- {akanda/router => astara_router}/models.py | 0 {akanda/router => astara_router}/settings.py | 6 +-- {akanda/router => astara_router}/utils.py | 2 +- diskimage-builder/README.md | 6 +-- diskimage-builder/elements/astara/README.rst | 6 +-- .../elements/debug-user/README.md | 4 +- scripts/build_dib_appliance.sh | 4 +- scripts/debug-config.py | 2 +- ...er-api-server => astara-router-api-server} | 14 +++---- scripts/etc/init.d/metadata | 8 ++-- scripts/etc/init.d/ssh | 10 ++--- setup.cfg | 21 +++++----- test/unit/api/v1/fakes.py | 4 +- test/unit/api/v1/test_base.py | 4 +- test/unit/api/v1/test_firewall.py | 2 +- test/unit/api/v1/test_system.py | 40 +++++++++---------- test/unit/drivers/test_arp.py | 14 +++---- test/unit/drivers/test_bird.py | 8 ++-- test/unit/drivers/test_dnsmasq.py | 8 ++-- test/unit/drivers/test_hostname.py | 12 +++--- test/unit/drivers/test_ip.py | 14 +++---- test/unit/drivers/test_iptables.py | 8 ++-- test/unit/drivers/test_route.py | 4 +- test/unit/test_metadata_proxy.py | 2 +- test/unit/test_models.py | 2 +- test/unit/test_utils.py | 4 +- tox.ini | 2 +- 63 files changed, 236 insertions(+), 252 deletions(-) delete mode 100644 akanda/__init__.py rename ansible/tasks/{akanda.yml => astara.yml} (52%) rename {akanda/router => astara_router}/__init__.py (100%) rename {akanda/router => astara_router}/api/__init__.py (100%) rename {akanda/router => astara_router}/api/server.py (87%) rename {akanda/router => astara_router}/api/v1/__init__.py (100%) rename {akanda/router => astara_router}/api/v1/base.py (90%) rename {akanda/router => astara_router}/api/v1/firewall.py (92%) rename {akanda/router => astara_router}/api/v1/status.py (94%) rename {akanda/router => astara_router}/api/v1/system.py (95%) rename {akanda/router => astara_router}/commands/__init__.py (100%) rename {akanda/router => astara_router}/commands/management.py (92%) rename {akanda/router => astara_router}/debug.py (100%) rename {akanda/router => astara_router}/defaults.py (100%) rename {akanda/router => astara_router}/drivers/__init__.py (100%) rename {akanda/router => astara_router}/drivers/arp.py (92%) rename {akanda/router => astara_router}/drivers/base.py (98%) rename {akanda/router => astara_router}/drivers/bird.py (93%) rename {akanda/router => astara_router}/drivers/dnsmasq.py (98%) rename {akanda/router => astara_router}/drivers/hostname.py (95%) rename {akanda/router => astara_router}/drivers/ip.py (96%) rename {akanda/router => astara_router}/drivers/iptables.py (95%) rename {akanda/router => astara_router}/drivers/loadbalancer/__init__.py (95%) rename {akanda/router => astara_router}/drivers/loadbalancer/nginx.conf.template (100%) rename {akanda/router => astara_router}/drivers/loadbalancer/nginx.py (96%) rename {akanda/router => astara_router}/drivers/metadata.py (87%) rename {akanda/router => astara_router}/drivers/ping.py (95%) rename {akanda/router => astara_router}/manager.py (98%) rename {akanda/router => astara_router}/metadata_proxy.py (98%) rename {akanda/router => astara_router}/models.py (100%) rename {akanda/router => astara_router}/settings.py (58%) rename {akanda/router => astara_router}/utils.py (98%) rename scripts/etc/init.d/{akanda-router-api-server => astara-router-api-server} (61%) diff --git a/MANIFEST.in b/MANIFEST.in index 87fceb3..63d3772 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1 @@ -include akanda/router/drivers/loadbalancer/nginx.conf.template +include astara/router/drivers/loadbalancer/nginx.conf.template diff --git a/README.md b/README.md index ef72fa7..4713355 100644 --- a/README.md +++ b/README.md @@ -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, 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 virtualization. diff --git a/akanda/__init__.py b/akanda/__init__.py deleted file mode 100644 index 7121898..0000000 --- a/akanda/__init__.py +++ /dev/null @@ -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 diff --git a/ansible/main.yml b/ansible/main.yml index de8f2ca..ca3f688 100644 --- a/ansible/main.yml +++ b/ansible/main.yml @@ -19,7 +19,7 @@ - include: tasks/update_kernel.yml when: update_kernel and ansible_distribution_release == "wheezy" - include: tasks/base.yml - - include: tasks/akanda.yml + - include: tasks/astara.yml - include: tasks/bird.yml - include: tasks/dnsmasq.yml - include: tasks/extras.yml diff --git a/ansible/tasks/akanda.yml b/ansible/tasks/astara.yml similarity index 52% rename from ansible/tasks/akanda.yml rename to ansible/tasks/astara.yml index 29158db..0ee3de1 100644 --- a/ansible/tasks/akanda.yml +++ b/ansible/tasks/astara.yml @@ -7,47 +7,47 @@ - python-dev - logrotate -- name: copy akanda-appliance code - synchronize: src={{ playbook_dir }}/.. dest=/tmp/akanda-appliance +- name: copy astara-appliance code + synchronize: src={{ playbook_dir }}/.. dest=/tmp/astara-appliance - name: ensure latest setuptools pip: name=setuptools state=latest - name: install required files - pip: requirements=/tmp/akanda-appliance/requirements.txt + pip: requirements=/tmp/astara-appliance/requirements.txt -- name: install akanda-appliance - command: python setup.py install chdir=/tmp/akanda-appliance +- name: install astara-appliance + command: python setup.py install chdir=/tmp/astara-appliance -- name: install akanda gunicorn logging directory - file: path=/var/log/akanda state=directory +- name: install astara gunicorn logging directory + file: path=/var/log/astara state=directory -- name: install akanda logrotate config - template: src=logrotate.j2 dest=/etc/logrotate.d/akanda +- name: install astara logrotate config + template: src=logrotate.j2 dest=/etc/logrotate.d/astara - 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 copy: src={{playbook_dir}}/../scripts/etc/init.d/{{item}} dest=/etc/init.d/{{item}} mode=0555 with_items: - metadata - - akanda-router-api-server + - astara-router-api-server -- name: create /usr/local/share/akanda/ - file: path=/usr/local/share/akanda state=directory +- name: create /usr/local/share/astara/ + file: path=/usr/local/share/astara state=directory -- name: make /usr/local/share/akanda/ importable - copy: dest=/usr/local/share/akanda/__init__.py content='' +- name: make /usr/local/share/astara/ importable + copy: dest=/usr/local/share/astara/__init__.py content='' -- name: install akanda_local_settings.py - copy: dest=/usr/local/share/akanda/akanda_local_settings.py content='ENABLED_SERVICES = {{enabled_advanced_services.split(',')}}\n' +- name: install astara_local_settings.py + copy: dest=/usr/local/share/astara/astara_local_settings.py content='ENABLED_SERVICES = {{enabled_advanced_services.split(',')}}\n' - name: update-rc - command: update-rc.d akanda-router-api-server start + command: update-rc.d astara-router-api-server start - name: add timestamp - shell: date > arg1 creates=/etc/akanda-release + shell: date > arg1 creates=/etc/astara-release - name: enable forwarding sysctl: name={{item}} value=1 sysctl_set=yes state=present reload=yes diff --git a/ansible/tasks/base.yml b/ansible/tasks/base.yml index 5e6e1c3..df009a8 100644 --- a/ansible/tasks/base.yml +++ b/ansible/tasks/base.yml @@ -21,7 +21,7 @@ command: ln -s /usr/share/zoneinfo/UTC arg1 creates=/etc/localtime - name: setting hostname - copy: content="akanda-linux" dest=/etc/hostname + copy: content="astara-linux" dest=/etc/hostname - name: set default nameserver copy: content="nameserver 8.8.8.8" dest=/etc/resolv.conf diff --git a/ansible/templates/gunicorn.j2 b/ansible/templates/gunicorn.j2 index 6098faa..861965d 100644 --- a/ansible/templates/gunicorn.j2 +++ b/ansible/templates/gunicorn.j2 @@ -8,5 +8,5 @@ worker_class ="sync" debug = False daemon = True pidfile = "/var/run/gunicorn.pid" -errorlog = "/var/log/akanda/gunicorn_error.log" -accesslog = "/var/log/akanda/gunicorn_access.log" +errorlog = "/var/log/astara/gunicorn_error.log" +accesslog = "/var/log/astara/gunicorn_access.log" diff --git a/ansible/templates/logrotate.j2 b/ansible/templates/logrotate.j2 index 74053cf..f26a6cc 100644 --- a/ansible/templates/logrotate.j2 +++ b/ansible/templates/logrotate.j2 @@ -1,4 +1,4 @@ -/var/log/akanda/*.log { +/var/log/astara/*.log { weekly rotate 7 compress diff --git a/ansible/templates/motd.j2 b/ansible/templates/motd.j2 index e3eeef4..20e3fc5 100644 --- a/ansible/templates/motd.j2 +++ b/ansible/templates/motd.j2 @@ -1,8 +1,8 @@ - ___ ___ .___ - / \\ \\ | - L3 for OpenStack - | _/ - / _ \\ | | _______ ____ __| | ____ - / /_\\ \\| |/ /\\__ \\ / \\ / __ |\\__ \\ -/ | \\ < / __ \\| | \\/ /_/ | / __ \\_ -\\____|__ /__|_ \\(____ /___| /\\____ |(____ / - \\/ \\/ \\/ \\/ \\/ \\/ -Welcome to Akanda: Powered by Unicorns. + ___ _ + / _ \ | | L3 for OpenStack +/ /_\ \___| |_ __ _ _ __ __ _ +| _ / __| __/ _` | '__/ _` | +| | | \__ \ || (_| | | | (_| | +\_| |_/___/\__\__,_|_| \__,_| + +Welcome to Astara: Powered by Unicorns. diff --git a/akanda/router/__init__.py b/astara_router/__init__.py similarity index 100% rename from akanda/router/__init__.py rename to astara_router/__init__.py diff --git a/akanda/router/api/__init__.py b/astara_router/api/__init__.py similarity index 100% rename from akanda/router/api/__init__.py rename to astara_router/api/__init__.py diff --git a/akanda/router/api/server.py b/astara_router/api/server.py similarity index 87% rename from akanda/router/api/server.py rename to astara_router/api/server.py index 9a44a6b..ae531ac 100644 --- a/akanda/router/api/server.py +++ b/astara_router/api/server.py @@ -19,9 +19,9 @@ """ import flask -from akanda.router.api import v1 -from akanda.router.debug import handle_traceback -from akanda.router.manager import manager +from astara_router.api import v1 +from astara_router.debug import handle_traceback +from astara_router.manager import manager app = flask.Flask(__name__) app.register_blueprint(v1.base.blueprint) @@ -41,7 +41,7 @@ def attach_config(): def main(): # 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'] app.run(host=manager.management_address(ensure_configuration=True), diff --git a/akanda/router/api/v1/__init__.py b/astara_router/api/v1/__init__.py similarity index 100% rename from akanda/router/api/v1/__init__.py rename to astara_router/api/v1/__init__.py diff --git a/akanda/router/api/v1/base.py b/astara_router/api/v1/base.py similarity index 90% rename from akanda/router/api/v1/base.py rename to astara_router/api/v1/base.py index 2cfecdb..3c10b13 100644 --- a/akanda/router/api/v1/base.py +++ b/astara_router/api/v1/base.py @@ -18,7 +18,7 @@ """ 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__) @@ -29,4 +29,4 @@ def welcome(): ''' Show welcome message ''' - return 'Akanda appliance API service is active' + return 'Astara appliance API service is active' diff --git a/akanda/router/api/v1/firewall.py b/astara_router/api/v1/firewall.py similarity index 92% rename from akanda/router/api/v1/firewall.py rename to astara_router/api/v1/firewall.py index 03c0b03..21ab03e 100644 --- a/akanda/router/api/v1/firewall.py +++ b/astara_router/api/v1/firewall.py @@ -21,8 +21,8 @@ Blueprint for version 1 of the firewall API. from flask import request -from akanda.router import utils -from akanda.router.drivers import iptables +from astara_router import utils +from astara_router.drivers import iptables blueprint = utils.blueprint_factory(__name__) diff --git a/akanda/router/api/v1/status.py b/astara_router/api/v1/status.py similarity index 94% rename from akanda/router/api/v1/status.py rename to astara_router/api/v1/status.py index d1456ac..3dfe3bb 100644 --- a/akanda/router/api/v1/status.py +++ b/astara_router/api/v1/status.py @@ -20,8 +20,8 @@ Blueprint for the "status" portion of the version 1 of the API. """ from flask import request -from akanda.router import utils -from akanda.router.drivers import ping +from astara_router import utils +from astara_router.drivers import ping blueprint = utils.blueprint_factory(__name__) diff --git a/akanda/router/api/v1/system.py b/astara_router/api/v1/system.py similarity index 95% rename from akanda/router/api/v1/system.py rename to astara_router/api/v1/system.py index 1139c36..c68e50d 100644 --- a/akanda/router/api/v1/system.py +++ b/astara_router/api/v1/system.py @@ -22,10 +22,10 @@ from flask import Response from flask import abort, request from dogpile.cache import make_region -from akanda.router import models -from akanda.router import utils -from akanda.router import settings -from akanda.router.manager import manager +from astara_router import models +from astara_router import utils +from astara_router import settings +from astara_router.manager import manager blueprint = utils.blueprint_factory(__name__) @@ -42,7 +42,7 @@ def _get_cache(): _cache = make_region().configure( 'dogpile.cache.dbm', arguments={ - "filename": "/etc/akanda-state" + "filename": "/etc/astara-state" } ) return _cache diff --git a/akanda/router/commands/__init__.py b/astara_router/commands/__init__.py similarity index 100% rename from akanda/router/commands/__init__.py rename to astara_router/commands/__init__.py diff --git a/akanda/router/commands/management.py b/astara_router/commands/management.py similarity index 92% rename from akanda/router/commands/management.py rename to astara_router/commands/management.py index f351276..781b8c5 100644 --- a/akanda/router/commands/management.py +++ b/astara_router/commands/management.py @@ -20,9 +20,9 @@ import sys import netaddr -from akanda.router import defaults -from akanda.router import utils -from akanda.router.drivers import ip +from astara_router import defaults +from astara_router import utils +from astara_router.drivers import ip def configure_ssh(listen_ip): @@ -56,11 +56,11 @@ def configure_gunicorn(listen_ip): else: 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) 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) except: sys.stderr.write('Unable to write gunicorn configuration file.') diff --git a/akanda/router/debug.py b/astara_router/debug.py similarity index 100% rename from akanda/router/debug.py rename to astara_router/debug.py diff --git a/akanda/router/defaults.py b/astara_router/defaults.py similarity index 100% rename from akanda/router/defaults.py rename to astara_router/defaults.py diff --git a/akanda/router/drivers/__init__.py b/astara_router/drivers/__init__.py similarity index 100% rename from akanda/router/drivers/__init__.py rename to astara_router/drivers/__init__.py diff --git a/akanda/router/drivers/arp.py b/astara_router/drivers/arp.py similarity index 92% rename from akanda/router/drivers/arp.py rename to astara_router/drivers/arp.py index b844751..fde29ba 100644 --- a/akanda/router/drivers/arp.py +++ b/astara_router/drivers/arp.py @@ -20,9 +20,9 @@ import re import socket import struct -from akanda.router import utils -from akanda.router.drivers import base -from akanda.router.models import Network +from astara_router import utils +from astara_router.drivers import base +from astara_router.models import Network LOG = logging.getLogger(__name__) @@ -92,8 +92,8 @@ class ARPManager(base.Manager): def send_gratuitous_arp_for_floating_ips(self, config, generic_to_host): """ Send a gratuitous ARP for every Floating IP. - :type config: akanda.router.models.Configuration - :param config: An akanda.router.models.Configuration object containing + :type config: astara_router.models.Configuration + :param config: An astara_router.models.Configuration object containing configuration information for the system's network setup. :type generic_to_host: callable @@ -108,7 +108,7 @@ class ARPManager(base.Manager): for net in external_nets: for fip in net.floating_ips: utils.execute([ - 'akanda-gratuitous-arp', + 'astara-gratuitous-arp', generic_to_host(net.interface.ifname), str(fip.floating_ip) ], self.root_helper) @@ -121,8 +121,8 @@ class ARPManager(base.Manager): deletion and makes calls to _mac_address_for_ip to match arp entries to network interface IPs. - :type config: akanda.router.models.Configuration - :param config: An akanda.router.models.Configuration object containing + :type config: astara_router.models.Configuration + :param config: An astara_router.models.Configuration object containing configuration information for the system's network setup. """ diff --git a/akanda/router/drivers/base.py b/astara_router/drivers/base.py similarity index 98% rename from akanda/router/drivers/base.py rename to astara_router/drivers/base.py index 0a3bed3..439db74 100644 --- a/akanda/router/drivers/base.py +++ b/astara_router/drivers/base.py @@ -15,7 +15,7 @@ # under the License. -from akanda.router import utils +from astara_router import utils class Manager(object): diff --git a/akanda/router/drivers/bird.py b/astara_router/drivers/bird.py similarity index 93% rename from akanda/router/drivers/bird.py rename to astara_router/drivers/bird.py index f38e144..2a0073e 100644 --- a/akanda/router/drivers/bird.py +++ b/astara_router/drivers/bird.py @@ -19,8 +19,8 @@ import logging import random import textwrap -from akanda.router.drivers import base -from akanda.router import utils +from astara_router.drivers import base +from astara_router import utils LOG = logging.getLogger(__name__) @@ -45,7 +45,7 @@ class BirdManager(base.Manager): """ Writes config file for bird daemon. - :type config: akanda.router.models.Configuration + :type config: astara_router.models.Configuration :param config: :type if_map: dict :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. - :type config: akanda.router.models.Configuration + :type config: astara_router.models.Configuration :param config: :rtype: str """ @@ -112,7 +112,7 @@ def _build_global_config(config): """ Generate the "global" section of the BIRD daemon configuration. - :type config: akanda.router.models.Configuration + :type config: astara_router.models.Configuration :param config: :rtype: str """ @@ -127,7 +127,7 @@ def _build_kernel_config(): """ Generate the "kernel" section of the BIRD daemon configuration. - :type config: akanda.router.models.Configuration + :type config: astara_router.models.Configuration :param config: :rtype: str """ @@ -146,7 +146,7 @@ def _build_device_config(): """ Generate the "device" section of the BIRD daemon configuration. - :type config: akanda.router.models.Configuration + :type config: astara_router.models.Configuration :param config: :rtype: str """ @@ -157,7 +157,7 @@ def _build_static_config(config): """ Generate the "static" section of the BIRD daemon configuration. - :type config: akanda.router.models.Configuration + :type config: astara_router.models.Configuration :param config: :rtype: """ @@ -170,7 +170,7 @@ def _build_direct_config(config, interface_map): """ Generate the "direct" section of the BIRD daemon configuration. - :type config: akanda.router.models.Configuration + :type config: astara_router.models.Configuration :param config: :type interface_map: dict :param interface_map: @@ -187,7 +187,7 @@ def _build_ospf_config(config, interface_map): """ Generate the "ospf" section of the BIRD daemon configuration. - :type config: akanda.router.models.Configuration + :type config: astara_router.models.Configuration :param config: :type interface_map: dict :param interface_map: @@ -227,7 +227,7 @@ def _build_bgp_config(config, interface_map): """ Generate the "BGP" section of the BIRD daemon configuration. - :type config: akanda.router.models.Configuration + :type config: astara_router.models.Configuration :param config: :type interface_map: dict :param interface_map: @@ -286,7 +286,7 @@ def _build_radv_config(config, interface_map): """ Generate the "radv" section of the BIRD daemon configuration. - :type config: akanda.router.models.Configuration + :type config: astara_router.models.Configuration :param config: :type interface_map: dict :param interface_map: diff --git a/akanda/router/drivers/dnsmasq.py b/astara_router/drivers/dnsmasq.py similarity index 98% rename from akanda/router/drivers/dnsmasq.py rename to astara_router/drivers/dnsmasq.py index 9b688e9..c6682e4 100644 --- a/akanda/router/drivers/dnsmasq.py +++ b/astara_router/drivers/dnsmasq.py @@ -19,8 +19,8 @@ import logging import os import time -from akanda.router.drivers import base -from akanda.router import utils +from astara_router.drivers import base +from astara_router import utils LOG = logging.getLogger(__name__) diff --git a/akanda/router/drivers/hostname.py b/astara_router/drivers/hostname.py similarity index 95% rename from akanda/router/drivers/hostname.py rename to astara_router/drivers/hostname.py index db33044..6c2f8b1 100644 --- a/akanda/router/drivers/hostname.py +++ b/astara_router/drivers/hostname.py @@ -16,8 +16,8 @@ import logging -from akanda.router.drivers import base -from akanda.router import utils +from astara_router.drivers import base +from astara_router import utils LOG = logging.getLogger(__name__) diff --git a/akanda/router/drivers/ip.py b/astara_router/drivers/ip.py similarity index 96% rename from akanda/router/drivers/ip.py rename to astara_router/drivers/ip.py index 77b16c3..538f287 100644 --- a/akanda/router/drivers/ip.py +++ b/astara_router/drivers/ip.py @@ -21,9 +21,9 @@ import re import netaddr -from akanda.router import models -from akanda.router.drivers import base -from akanda.router import utils +from astara_router import models +from astara_router.drivers import base +from astara_router import utils LOG = logging.getLogger(__name__) @@ -86,7 +86,7 @@ class IPManager(base.Manager): :param ifname: the name of the interface to retrieve, e.g., `eth1` :type ifname: str - :rtype: akanda.router.model.Interface + :rtype: astara_router.model.Interface """ real_ifname = self.generic_to_host(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 to "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) 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 to "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) self.sudo('link', 'set', real_ifname, 'down') @@ -161,7 +161,7 @@ class IPManager(base.Manager): """ Updates a network interface, particularly its addresses :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 added/removed :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: str :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 - :type old_interface: akanda.router.models.Interface + :type old_interface: astara_router.models.Interface """ 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`. - :type config: akanda.router.models.Configuration + :type config: astara_router.models.Configuration """ # Track whether we have set the default gateways, by IP # version. @@ -285,7 +285,7 @@ class IPManager(base.Manager): Update the network routes. This is primarily used to support static 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". Because Linux does not differentiate user-provided routes 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. - :type network: akanda.models.Network + :type network: astara.models.Network """ # For non-external networks, duplicate address detection isn't # necessary (and it sometimes results in race conditions for services @@ -472,7 +472,7 @@ def _parse_interfaces(data, filters=None): :type data: str :param filter: a list of valid interface names to match on :type data: list of str - :rtype: list of akanda.router.models.Interface + :rtype: list of astara_router.models.Interface """ retval = [] 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 ` - :rtype: akanda.router.models.Interface + :rtype: astara_router.models.Interface """ retval = dict(addresses=[]) for line in data.split('\n'): diff --git a/akanda/router/drivers/iptables.py b/astara_router/drivers/iptables.py similarity index 95% rename from akanda/router/drivers/iptables.py rename to astara_router/drivers/iptables.py index 30eba79..ffabbef 100644 --- a/akanda/router/drivers/iptables.py +++ b/astara_router/drivers/iptables.py @@ -18,9 +18,9 @@ import re import itertools import os -from akanda.router.drivers import base -from akanda.router.models import Network -from akanda.router import defaults, utils +from astara_router.drivers import base +from astara_router.models import Network +from astara_router import defaults, utils class Rule(object): @@ -49,8 +49,8 @@ class IPTablesManager(base.Manager): ''' Save iptables-persistent firewall rules to disk. - :param config: The akanda configuration to save to disk - :type config: akanda.rug.models.Configuration + :param config: The astara configuration to save to disk + :type config: astara.rug.models.Configuration :param interface_map: A mapping of virtual ('ge0') to physical ('eth0') interface names :type interface_map: dict @@ -103,8 +103,8 @@ class IPTablesManager(base.Manager): def get_rules(self): ''' Return the output of `iptables` and `ip6tables`. - This function is used by akanda-rug -> HTTP as a test for "router - aliveness". + This function is used by astara orchestrator -> HTTP as a test for + "router aliveness". :rtype: str ''' @@ -116,7 +116,7 @@ class IPTablesManager(base.Manager): ''' Returns the external network - :rtype: akanda.router.models.Network + :rtype: astara_router.models.Network ''' return self.networks_by_type(config, Network.TYPE_EXTERNAL)[0] @@ -124,7 +124,7 @@ class IPTablesManager(base.Manager): ''' Returns the management network - :rtype: akanda.router.models.Network + :rtype: astara_router.models.Network ''' return self.networks_by_type(config, Network.TYPE_MANAGEMENT)[0] @@ -132,7 +132,7 @@ class IPTablesManager(base.Manager): ''' Returns the internal networks - :rtype: [akanda.router.models.Network] + :rtype: [astara_router.models.Network] ''' return self.networks_by_type(config, Network.TYPE_INTERNAL) @@ -140,7 +140,7 @@ class IPTablesManager(base.Manager): ''' Returns the external network - :rtype: akanda.router.models.Interface + :rtype: astara_router.models.Interface ''' 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. - :param config: the akanda configuration object: - :type config: akanda.router.models.Configuration + :param config: the astara configuration object: + :type config: astara_router.models.Configuration :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( self._build_default_filter_rules(), diff --git a/akanda/router/drivers/loadbalancer/__init__.py b/astara_router/drivers/loadbalancer/__init__.py similarity index 95% rename from akanda/router/drivers/loadbalancer/__init__.py rename to astara_router/drivers/loadbalancer/__init__.py index eb1e520..6711a7a 100644 --- a/akanda/router/drivers/loadbalancer/__init__.py +++ b/astara_router/drivers/loadbalancer/__init__.py @@ -13,7 +13,7 @@ # under the License. -from akanda.router.drivers.loadbalancer import nginx +from astara_router.drivers.loadbalancer import nginx # XXX move to config CONFIGURED_LB_DRIVER = 'nginx' diff --git a/akanda/router/drivers/loadbalancer/nginx.conf.template b/astara_router/drivers/loadbalancer/nginx.conf.template similarity index 100% rename from akanda/router/drivers/loadbalancer/nginx.conf.template rename to astara_router/drivers/loadbalancer/nginx.conf.template diff --git a/akanda/router/drivers/loadbalancer/nginx.py b/astara_router/drivers/loadbalancer/nginx.py similarity index 96% rename from akanda/router/drivers/loadbalancer/nginx.py rename to astara_router/drivers/loadbalancer/nginx.py index 1e74819..fdf71fb 100644 --- a/akanda/router/drivers/loadbalancer/nginx.py +++ b/astara_router/drivers/loadbalancer/nginx.py @@ -12,11 +12,12 @@ # License for the specific language governing permissions and limitations # under the License. -import jinja2 import os -from akanda.router.drivers import base -from akanda.router.utils import execute +import jinja2 + +from astara_router.drivers import base +from astara_router.utils import execute class NginxTemplateNotFound(Exception): diff --git a/akanda/router/drivers/metadata.py b/astara_router/drivers/metadata.py similarity index 87% rename from akanda/router/drivers/metadata.py rename to astara_router/drivers/metadata.py index c9879db..cb298df 100644 --- a/akanda/router/drivers/metadata.py +++ b/astara_router/drivers/metadata.py @@ -18,9 +18,9 @@ import json import logging -from akanda.router.defaults import internal_metadata_port -from akanda.router.drivers import base -from akanda.router.utils import execute, replace_file +from astara_router.defaults import internal_metadata_port +from astara_router.drivers import base +from astara_router.utils import execute, replace_file LOG = logging.getLogger(__name__) @@ -46,8 +46,8 @@ class MetadataManager(base.Manager): This function determines if the networks have changed since was initialized. - :type config: akanda.router.models.Configuration - :param config: An akanda.router.models.Configuration object containing + :type config: astara_router.models.Configuration + :param config: An astara_router.models.Configuration object containing the current configuration of the system's networks. :rtype: bool """ @@ -66,8 +66,8 @@ class MetadataManager(base.Manager): """ Writes to the metadata configuration file (). - :type config: akanda.router.models.Configuration - :param config: An akanda.router.models.Configuration object containing + :type config: astara_router.models.Configuration + :param config: An astara_router.models.Configuration object containing the configuration of metadata service. """ config_data = build_config(config) @@ -104,9 +104,9 @@ def build_config(config): """ Determines the configuration of the metadata service. - :type config: akanda.router.models.Configuration + :type config: astara_router.models.Configuration :param config: - :rtype: akanda.router.models.Configuration + :rtype: astara_router.models.Configuration """ config_data = {} diff --git a/akanda/router/drivers/ping.py b/astara_router/drivers/ping.py similarity index 95% rename from akanda/router/drivers/ping.py rename to astara_router/drivers/ping.py index 00e3493..69631b3 100644 --- a/akanda/router/drivers/ping.py +++ b/astara_router/drivers/ping.py @@ -19,8 +19,8 @@ import logging import netaddr -from akanda.router.drivers import base -from akanda.router import utils +from astara_router.drivers import base +from astara_router import utils LOG = logging.getLogger(__name__) diff --git a/akanda/router/manager.py b/astara_router/manager.py similarity index 98% rename from akanda/router/manager.py rename to astara_router/manager.py index 2a1eb9d..786fe94 100644 --- a/akanda/router/manager.py +++ b/astara_router/manager.py @@ -18,9 +18,9 @@ import os import re -from akanda.router import models -from akanda.router import settings -from akanda.router.drivers import (bird, dnsmasq, ip, metadata, +from astara_router import models +from astara_router import settings +from astara_router.drivers import (bird, dnsmasq, ip, metadata, iptables, arp, hostname, loadbalancer) diff --git a/akanda/router/metadata_proxy.py b/astara_router/metadata_proxy.py similarity index 98% rename from akanda/router/metadata_proxy.py rename to astara_router/metadata_proxy.py index 9f5f50e..7dc1e73 100644 --- a/akanda/router/metadata_proxy.py +++ b/astara_router/metadata_proxy.py @@ -31,8 +31,8 @@ import requests from werkzeug import exceptions from werkzeug import wrappers -from akanda.router import defaults -from akanda.router.drivers import ip +from astara_router import defaults +from astara_router.drivers import ip LOG = logging.getLogger(__name__) diff --git a/akanda/router/models.py b/astara_router/models.py similarity index 100% rename from akanda/router/models.py rename to astara_router/models.py diff --git a/akanda/router/settings.py b/astara_router/settings.py similarity index 58% rename from akanda/router/settings.py rename to astara_router/settings.py index 90ec9f0..9ebd27b 100644 --- a/akanda/router/settings.py +++ b/astara_router/settings.py @@ -3,11 +3,11 @@ # instance of the appliance. 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 -# 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. try: - from akanda_local_settings import * # noqa + from astara_local_settings import * # noqa except ImportError: pass diff --git a/akanda/router/utils.py b/astara_router/utils.py similarity index 98% rename from akanda/router/utils.py rename to astara_router/utils.py index 82b069d..7ce6854 100644 --- a/akanda/router/utils.py +++ b/astara_router/utils.py @@ -24,7 +24,7 @@ import tempfile import flask import netaddr -from akanda.router import models +from astara_router import models DEFAULT_ENABLED_SERVICES = ['router'] VALID_SERVICES = ['router', 'loadbalancer'] diff --git a/diskimage-builder/README.md b/diskimage-builder/README.md index 44269ed..8b24fba 100644 --- a/diskimage-builder/README.md +++ b/diskimage-builder/README.md @@ -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. 1) Install diskimage-builder via: @@ -12,10 +12,10 @@ the diskimage-builder from the OpenStack project. - qemu-utils 3) Add elements to path - $ export ELEMENTS_PATH=~/akanda-appliance/diskimage-builder/elements + $ export ELEMENTS_PATH=~/astara-appliance/diskimage-builder/elements 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 diff --git a/diskimage-builder/elements/astara/README.rst b/diskimage-builder/elements/astara/README.rst index 0d5a188..796311f 100644 --- a/diskimage-builder/elements/astara/README.rst +++ b/diskimage-builder/elements/astara/README.rst @@ -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. 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: -DIB_AKANDA_ADVANCED_SERVICES=router,loadbalancer +DIB_ASTARA_ADVANCED_SERVICES=router,loadbalancer diff --git a/diskimage-builder/elements/debug-user/README.md b/diskimage-builder/elements/debug-user/README.md index b2d9cb8..3db28f6 100644 --- a/diskimage-builder/elements/debug-user/README.md +++ b/diskimage-builder/elements/debug-user/README.md @@ -1,10 +1,10 @@ Creates a sudo privileged user in the appliance VM that can be used for 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 when building images for develoment environments. The username and password can be set in the build environment as $DIB_ASTARA_APPLIANCE_DEBUG_USER and $DIB_ASTARA_APPLIANCE_DEBUG_PASSWORD -The defaults are akanda-debug/akanda. +The defaults are astara-debug/astara. diff --git a/scripts/build_dib_appliance.sh b/scripts/build_dib_appliance.sh index 6cab3d5..3247901 100755 --- a/scripts/build_dib_appliance.sh +++ b/scripts/build_dib_appliance.sh @@ -22,7 +22,7 @@ SRC_ROOT="$(dirname $0)/.." 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" EXTRA_ELEMENTS="$@" @@ -31,6 +31,6 @@ GIT_HEAD="$(cd $SRC_ROOT && git rev-parse HEAD^)" DIB_REPOLOCATION_astara=$SRC_ROOT \ DIB_REPOREF_astara=$GIT_HEAD \ 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" \ disk-image-create $BASE_ELEMENTS $EXTRA_ELEMENTS -o $IMG_OUT diff --git a/scripts/debug-config.py b/scripts/debug-config.py index b1cd67c..089882b 100644 --- a/scripts/debug-config.py +++ b/scripts/debug-config.py @@ -17,7 +17,7 @@ import sys import pdb -from akanda.router.models import Configuration +from astara_router.models import Configuration if __name__ == '__main__': # Simple script that helps debug faulty configurations diff --git a/scripts/etc/init.d/akanda-router-api-server b/scripts/etc/init.d/astara-router-api-server similarity index 61% rename from scripts/etc/init.d/akanda-router-api-server rename to scripts/etc/init.d/astara-router-api-server index 8051075..de97e4f 100755 --- a/scripts/etc/init.d/akanda-router-api-server +++ b/scripts/etc/init.d/astara-router-api-server @@ -1,19 +1,19 @@ #! /bin/sh ### BEGIN INIT INFO -# Provides: akanda-router-api-server +# Provides: astara-router-api-server # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: -# Short-Description: Akanda Router API Server +# Short-Description: Astara Router API Server ### END INIT INFO PATH=/bin:/usr/bin:/sbin:/usr/sbin DAEMON="/usr/local/bin/gunicorn" -NAME="akanda-router-api-server" -OPTIONS="--pythonpath /usr/local/share/akanda -c /etc/akanda_gunicorn_config akanda.router.api.server:app" +NAME="astara-router-api-server" +OPTIONS="--pythonpath /usr/local/share/astara -c /etc/astara_gunicorn_config astara_router.api.server:app" PIDFILE=/var/run/gunicorn.pid test -x $DAEMON || exit 0 @@ -22,12 +22,12 @@ test -x $DAEMON || exit 0 case "$1" in 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 log_end_msg $? ;; stop) - log_daemon_msg "Stopping akanda-router-api-server" $NAME + log_daemon_msg "Stopping astara-router-api-server" $NAME killproc -p $PIDFILE $DAEMON log_end_msg $? ;; @@ -39,7 +39,7 @@ case "$1" in 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 ;; esac diff --git a/scripts/etc/init.d/metadata b/scripts/etc/init.d/metadata index a288dc9..72c9205 100755 --- a/scripts/etc/init.d/metadata +++ b/scripts/etc/init.d/metadata @@ -6,13 +6,13 @@ # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: -# Short-Description: Akanda OpenStack Metadata Service +# Short-Description: Astara OpenStack Metadata Service ### END INIT INFO PATH=/bin:/usr/bin:/sbin:/usr/sbin -DAEMON="/usr/local/bin/akanda-metadata-proxy" -NAME="akanda-metadata-proxy" +DAEMON="/usr/local/bin/astara-metadata-proxy" +NAME="astara-metadata-proxy" OPTIONS="/etc/metadata.conf" PIDFILE=/var/run/metadata.pid @@ -39,7 +39,7 @@ case "$1" in 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 ;; esac diff --git a/scripts/etc/init.d/ssh b/scripts/etc/init.d/ssh index b0b988c..6886bc5 100755 --- a/scripts/etc/init.d/ssh +++ b/scripts/etc/init.d/ssh @@ -33,13 +33,13 @@ run_by_init() { ([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ] } -akanda_configure_ssh() { - /usr/local/bin/akanda-configure-ssh +astara_configure_ssh() { + /usr/local/bin/astara-configure-ssh } check_for_no_start() { # 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 log_end_msg 0 || true fi @@ -83,7 +83,7 @@ case "$1" in check_privsep_dir check_for_no_start check_dev_null - akanda_configure_ssh + astara_configure_ssh 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 log_end_msg 0 || true @@ -114,7 +114,7 @@ case "$1" in restart) check_privsep_dir check_config - akanda_configure_ssh + astara_configure_ssh log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd" || true start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/sshd.pid check_for_no_start log_end_msg diff --git a/setup.cfg b/setup.cfg index ed5b5f1..4dfd888 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,7 +6,7 @@ description-file = README.md author = OpenStack author-email = openstack-dev@lists.openstack.org -home-page = http://github.com/openstack/akanda-appliance +home-page = http://github.com/openstack/astara-appliance classifier = Environment :: OpenStack Intended Audience :: Developers @@ -21,10 +21,7 @@ classifier = [files] packages = - akanda - akanda.router -namespace_packages = - akanda + astara_router [global] setup-hooks = @@ -32,10 +29,14 @@ setup-hooks = [entry_points] console_scripts = - akanda-configure-management=akanda.router.commands.management:configure_management - akanda-api-dev-server=akanda.router.api.server:main - akanda-metadata-proxy=akanda.router.metadata_proxy:main - akanda-gratuitous-arp=akanda.router.drivers.arp:send_gratuitous_arp + akanda-configure-management=astara_router.commands.management:configure_management + akanda-api-dev-server=astara_router.api.server:main + akanda-metadata-proxy=astara_router.metadata_proxy:main + 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] all_files = 1 @@ -46,4 +47,4 @@ source-dir = doc/source where = test verbosity = 2 detailed-errors = 1 -cover-package = akanda +cover-package = astara_router diff --git a/test/unit/api/v1/fakes.py b/test/unit/api/v1/fakes.py index df09040..5da3024 100644 --- a/test/unit/api/v1/fakes.py +++ b/test/unit/api/v1/fakes.py @@ -15,14 +15,14 @@ # under the License. -from akanda.router import models +from astara_router import models class FakeIFManager(object): """ 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. - 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. """ @classmethod diff --git a/test/unit/api/v1/test_base.py b/test/unit/api/v1/test_base.py index c233036..b08a83e 100644 --- a/test/unit/api/v1/test_base.py +++ b/test/unit/api/v1/test_base.py @@ -22,7 +22,7 @@ from unittest import TestCase import flask -from akanda.router.api import v1 +from astara_router.api import v1 class BaseAPITestCase(TestCase): @@ -38,5 +38,5 @@ class BaseAPITestCase(TestCase): def test_root(self): 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) diff --git a/test/unit/api/v1/test_firewall.py b/test/unit/api/v1/test_firewall.py index 7142c4b..ea17ce0 100644 --- a/test/unit/api/v1/test_firewall.py +++ b/test/unit/api/v1/test_firewall.py @@ -23,7 +23,7 @@ import json import mock from unittest2 import TestCase -from akanda.router.api import v1 +from astara_router.api import v1 class FirewallAPITestCase(TestCase): diff --git a/test/unit/api/v1/test_system.py b/test/unit/api/v1/test_system.py index d88b7fd..c66eed6 100644 --- a/test/unit/api/v1/test_system.py +++ b/test/unit/api/v1/test_system.py @@ -26,8 +26,8 @@ import flask import json import mock -from akanda.router import manager -from akanda.router.api import v1 +from astara_router import manager +from astara_router.api import v1 SYSTEM_CONFIG = { @@ -123,7 +123,7 @@ class SystemAPITestCase(unittest.TestCase): self.assertEqual(result.status_code, 415) 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 result = self.test_app.put( '/v1/system/config', @@ -133,7 +133,7 @@ class SystemAPITestCase(unittest.TestCase): self.assertEqual(result.status_code, 422) 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'] result = self.test_app.put( '/v1/system/config', @@ -152,8 +152,8 @@ class SystemAPITestCase(unittest.TestCase): ) - @mock.patch('akanda.router.api.v1.system._get_cache') - @mock.patch('akanda.router.models.SystemConfiguration') + @mock.patch('astara_router.api.v1.system._get_cache') + @mock.patch('astara_router.models.SystemConfiguration') @mock.patch.object(v1.system.manager, 'update_config') def test_put_configuration_returns_200(self, mock_update, fake_system_config, fake_cache): @@ -177,11 +177,11 @@ class SystemAPITestCase(unittest.TestCase): mock_update.assert_called_with( 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={}) - @mock.patch('akanda.router.api.v1.system._get_cache') - @mock.patch('akanda.router.models.RouterConfiguration') - @mock.patch('akanda.router.models.SystemConfiguration') + @mock.patch('astara_router.api.v1.system._get_cache') + @mock.patch('astara_router.models.RouterConfiguration') + @mock.patch('astara_router.models.SystemConfiguration') @mock.patch.object(v1.system.manager, 'update_config') def test_put_configuration_with_router(self, mock_update, 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], 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(v1.system, 'settings') - @mock.patch('akanda.router.manager.Manager.config', + @mock.patch('astara_router.manager.Manager.config', new_callable=mock.PropertyMock, return_value={}) - @mock.patch('akanda.router.api.v1.system._get_cache') - @mock.patch('akanda.router.models.LoadBalancerConfiguration') - @mock.patch('akanda.router.models.SystemConfiguration') + @mock.patch('astara_router.api.v1.system._get_cache') + @mock.patch('astara_router.models.LoadBalancerConfiguration') + @mock.patch('astara_router.models.SystemConfiguration') @mock.patch.object(v1.system.manager, 'update_config') def test_put_configuration_with_adv_services(self, mock_update, 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], 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(v1.system, 'settings') - @mock.patch('akanda.router.manager.Manager.config', + @mock.patch('astara_router.manager.Manager.config', new_callable=mock.PropertyMock, return_value={}) - @mock.patch('akanda.router.api.v1.system._get_cache') - @mock.patch('akanda.router.models.LoadBalancerConfiguration') - @mock.patch('akanda.router.models.SystemConfiguration') + @mock.patch('astara_router.api.v1.system._get_cache') + @mock.patch('astara_router.models.LoadBalancerConfiguration') + @mock.patch('astara_router.models.SystemConfiguration') @mock.patch.object(v1.system.manager, 'update_config') def test_put_configuration_with_disabled_svc_returns_400(self, mock_update, fake_system_config, fake_lb_config, fake_cache, fake_config, diff --git a/test/unit/drivers/test_arp.py b/test/unit/drivers/test_arp.py index c8002bb..7f95c31 100644 --- a/test/unit/drivers/test_arp.py +++ b/test/unit/drivers/test_arp.py @@ -19,8 +19,8 @@ import mock import socket import unittest2 -from akanda.router import models -from akanda.router.drivers import arp +from astara_router import models +from astara_router.drivers import arp config = 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( config, lambda x: x.replace('ge', 'eth') ) assert execute.call_args_list == [ mock.call( - ['akanda-gratuitous-arp', 'eth1', '172.16.77.50'], 'sudo' + ['astara-gratuitous-arp', 'eth1', '172.16.77.50'], 'sudo' ), mock.call( - ['akanda-gratuitous-arp', 'eth1', '172.16.77.51'], 'sudo' + ['astara-gratuitous-arp', 'eth1', '172.16.77.51'], 'sudo' ), mock.call( - ['akanda-gratuitous-arp', 'eth1', '172.16.77.52'], 'sudo' + ['astara-gratuitous-arp', 'eth1', '172.16.77.52'], 'sudo' ), mock.call( - ['akanda-gratuitous-arp', 'eth1', '172.16.77.53'], 'sudo' + ['astara-gratuitous-arp', 'eth1', '172.16.77.53'], 'sudo' ) ] diff --git a/test/unit/drivers/test_bird.py b/test/unit/drivers/test_bird.py index 4535217..c0fd0c3 100644 --- a/test/unit/drivers/test_bird.py +++ b/test/unit/drivers/test_bird.py @@ -22,7 +22,7 @@ import netaddr import re import textwrap -from akanda.router.drivers import bird +from astara_router.drivers import bird ext_subnet = mock.Mock() ext_subnet.gateway_ip = netaddr.IPAddress('dead:beef::1') ext_subnet.cidr = netaddr.IPNetwork('dead:beef::/64') @@ -65,9 +65,9 @@ class BirdTestCase(TestCase): """ """ 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( - 'akanda.router.utils.replace_file' + 'astara_router.utils.replace_file' ).start() self.addCleanup(mock.patch.stopall) @@ -101,7 +101,7 @@ class BirdTestCase(TestCase): ]) 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] self.mgr.restart() execute.assert_has_calls([ diff --git a/test/unit/drivers/test_dnsmasq.py b/test/unit/drivers/test_dnsmasq.py index c6eb568..8848519 100644 --- a/test/unit/drivers/test_dnsmasq.py +++ b/test/unit/drivers/test_dnsmasq.py @@ -21,8 +21,8 @@ import mock import netaddr from collections import OrderedDict -from akanda.router import models -from akanda.router.drivers import dnsmasq +from astara_router import models +from astara_router.drivers import dnsmasq ext_subnet = mock.Mock() ext_subnet.gateway_ip = netaddr.IPAddress('dead:beef::1') @@ -85,9 +85,9 @@ class DnsmasqTestCase(TestCase): """ """ 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( - 'akanda.router.utils.replace_file' + 'astara_router.utils.replace_file' ).start() self.addCleanup(mock.patch.stopall) diff --git a/test/unit/drivers/test_hostname.py b/test/unit/drivers/test_hostname.py index e63c568..596f917 100644 --- a/test/unit/drivers/test_hostname.py +++ b/test/unit/drivers/test_hostname.py @@ -19,10 +19,10 @@ from unittest2 import TestCase import mock -from akanda.router.drivers import hostname, ip +from astara_router.drivers import hostname, ip CONFIG = mock.Mock() -CONFIG.hostname = 'akanda' +CONFIG.hostname = 'astara' CONFIG.management_address = 'fdca:3ba5:a17a:acda:f816:3eff:fe66:33b6' @@ -30,9 +30,9 @@ class HostnameTestCase(TestCase): """ """ 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( - 'akanda.router.utils.replace_file' + 'astara_router.utils.replace_file' ).start() self.addCleanup(mock.patch.stopall) @@ -41,7 +41,7 @@ class HostnameTestCase(TestCase): def test_update_hostname(self): self.mgr.update_hostname(CONFIG) 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') ]) @@ -49,7 +49,7 @@ class HostnameTestCase(TestCase): expected = mock.call('/tmp/hosts', '\n'.join([ '127.0.0.1 localhost', '::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.mock_execute.assert_has_calls([ diff --git a/test/unit/drivers/test_ip.py b/test/unit/drivers/test_ip.py index b713c9b..3a85b16 100644 --- a/test/unit/drivers/test_ip.py +++ b/test/unit/drivers/test_ip.py @@ -22,8 +22,8 @@ from unittest2 import TestCase import mock import netaddr -from akanda.router import models -from akanda.router.drivers import ip +from astara_router import models +from astara_router.drivers import ip SAMPLE_OUTPUT = """1: lo: mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 @@ -50,7 +50,7 @@ SAMPLE_SINGLE_OUTPUT = """3: eth1: mtu 1500 qd class IPTestCase(TestCase): 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() def tearDown(self): @@ -66,7 +66,7 @@ class IPTestCase(TestCase): iface_b = mock.Mock() iface_b.ifname = 'em1' - ifaces = 'akanda.router.drivers.ip._parse_interfaces' + ifaces = 'astara_router.drivers.ip._parse_interfaces' with mock.patch(ifaces) as parse: parse.return_value = [iface_a, iface_b] mgr = ip.IPManager() @@ -79,8 +79,8 @@ class IPTestCase(TestCase): def test_get_interface(self): iface_a = mock.Mock() iface_a.ifname = 'em0' - iface = 'akanda.router.drivers.ip._parse_interface' - ifaces = 'akanda.router.drivers.ip._parse_interfaces' + iface = 'astara_router.drivers.ip._parse_interface' + ifaces = 'astara_router.drivers.ip._parse_interfaces' with mock.patch(iface) as parse: with mock.patch(ifaces) as pi: pi.return_value = [iface_a] @@ -343,7 +343,7 @@ class TestDisableDAD(TestCase): """ 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() def tearDown(self): diff --git a/test/unit/drivers/test_iptables.py b/test/unit/drivers/test_iptables.py index c5d06d1..ad6a9c1 100644 --- a/test/unit/drivers/test_iptables.py +++ b/test/unit/drivers/test_iptables.py @@ -4,8 +4,8 @@ from unittest import TestCase import mock import netaddr -from akanda.router import models -from akanda.router.drivers import iptables +from astara_router import models +from astara_router.drivers import iptables CONFIG = models.RouterConfiguration({ 'networks': [{ @@ -131,8 +131,8 @@ class TestIPTablesRouterConfiguration(TestCase): def setUp(self): super(TestIPTablesRouterConfiguration, self).setUp() - self.execute = mock.patch('akanda.router.utils.execute').start() - self.replace = mock.patch('akanda.router.utils.replace_file').start() + self.execute = mock.patch('astara_router.utils.execute').start() + self.replace = mock.patch('astara_router.utils.replace_file').start() self.patches = [self.execute, self.replace] def tearDown(self): diff --git a/test/unit/drivers/test_route.py b/test/unit/drivers/test_route.py index fbe3b32..8e7e9e1 100644 --- a/test/unit/drivers/test_route.py +++ b/test/unit/drivers/test_route.py @@ -21,8 +21,8 @@ import unittest2 import netaddr from dogpile.cache import make_region -from akanda.router import models -from akanda.router.drivers import ip +from astara_router import models +from astara_router.drivers import ip class RouteTest(unittest2.TestCase): diff --git a/test/unit/test_metadata_proxy.py b/test/unit/test_metadata_proxy.py index 00c5998..ca76f92 100644 --- a/test/unit/test_metadata_proxy.py +++ b/test/unit/test_metadata_proxy.py @@ -7,7 +7,7 @@ from collections import OrderedDict import eventlet import mock -from akanda.router import metadata_proxy +from astara_router import metadata_proxy config = json.dumps({ "tenant_id": "ABC123", diff --git a/test/unit/test_models.py b/test/unit/test_models.py index f022dbb..23fe82c 100644 --- a/test/unit/test_models.py +++ b/test/unit/test_models.py @@ -23,7 +23,7 @@ import netaddr from unittest2 import TestCase -from akanda.router import models +from astara_router import models from test.unit import fakes diff --git a/test/unit/test_utils.py b/test/unit/test_utils.py index 7d79654..23be051 100644 --- a/test/unit/test_utils.py +++ b/test/unit/test_utils.py @@ -23,8 +23,8 @@ import flask import mock import netaddr -from akanda.router import models -from akanda.router import utils +from astara_router import models +from astara_router import utils class ModelSerializerTestCase(TestCase): diff --git a/tox.ini b/tox.ini index 5ce5922..71b4344 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ commands = {posargs} [testenv:pep8] deps = flake8 -commands = flake8 setup.py akanda +commands = flake8 setup.py astara_router [flake8] show-source = True