From 9c94d3ccc5bc7b4ece9b142c06997170d537d243 Mon Sep 17 00:00:00 2001 From: vikaschoudhary16 Date: Mon, 4 Jul 2016 23:47:30 +0530 Subject: [PATCH] Drop common code and add kuryr_lib as requirement 1. Drop the common(COE agnostic) code such as binding, exceptions 2. Renamed kuryr-libnetwork/kuryr to kuryr-libnetwork/kuryr_libnetwork 3. change default kuryr port from 2377 to 23750 4. Add Kuryr-lib(Kuryr) to requirements.txt: Kuryr-lib(Kuryr) has also been cleaned to remove libnetwork specific code(which is active in this repo such as libnetwork api handlers and test cases). This patch is under review, [1]_. Meanwhile kuryr-lib dependency is being resolved from external repo [2]. Exacltly same changes, as present in under review kuryr-lib patch [1], are there on external repo, [2] [1] https://review.openstack.org/#/c/336784/ [2] https://github.com/vikaschoudhary16/kuryr/tree/drop_libnet_specific_code Implements blueprint common-code-drop Change-Id: If0823791463011dc395cd3390a7f4c187c9c2653 --- .testr.conf | 2 +- README.rst | 17 +- etc/kuryr.json | 2 +- etc/kuryr.spec | 2 +- kuryr/_i18n.py | 42 ---- kuryr/binding.py | 195 ------------------ kuryr/common/exceptions.py | 88 -------- kuryr/opts.py | 55 ----- kuryr/version.py | 17 -- {kuryr => kuryr_libnetwork}/__init__.py | 2 +- .../common/__init__.py | 0 {kuryr => kuryr_libnetwork}/common/config.py | 6 +- .../common/constants.py | 0 {kuryr => kuryr_libnetwork}/controllers.py | 20 +- .../schemata/__init__.py | 20 +- .../schemata/commons.py | 0 .../schemata/endpoint_create.py | 2 +- .../schemata/endpoint_delete.py | 2 +- {kuryr => kuryr_libnetwork}/schemata/join.py | 2 +- {kuryr => kuryr_libnetwork}/schemata/leave.py | 2 +- .../schemata/network_create.py | 2 +- .../schemata/network_delete.py | 2 +- .../schemata/release_address.py | 2 +- .../schemata/release_pool.py | 2 +- .../schemata/request_address.py | 2 +- .../schemata/request_pool.py | 2 +- {kuryr => kuryr_libnetwork}/server.py | 6 +- {kuryr => kuryr_libnetwork}/tests/__init__.py | 0 .../tests/contrib/gate_hook.sh | 0 .../tests/contrib/post_test_hook.sh | 0 .../tests/fullstack/__init__.py | 0 .../tests/fullstack/kuryr_base.py | 0 .../tests/fullstack/test_container.py | 0 .../tests/fullstack/test_network.py | 0 .../tests/unit/__init__.py | 0 .../tests/unit/base.py | 10 +- .../tests/unit/test_config.py | 10 +- .../tests/unit/test_ipam_pool.py | 6 +- .../tests/unit/test_join.py | 12 +- .../tests/unit/test_kuryr.py | 10 +- .../tests/unit/test_kuryr_endpoint.py | 8 +- .../tests/unit/test_kuryr_existing_network.py | 8 +- .../tests/unit/test_kuryr_ipam.py | 10 +- .../tests/unit/test_kuryr_network.py | 8 +- .../tests/unit/test_leave.py | 12 +- .../tests/unit/test_utils.py | 6 +- {kuryr => kuryr_libnetwork}/utils.py | 8 +- requirements.txt | 1 + scripts/run_server.py | 2 +- usr/libexec/kuryr/bridge | 59 ------ usr/libexec/kuryr/iovisor | 42 ---- usr/libexec/kuryr/midonet | 39 ---- usr/libexec/kuryr/ovs | 115 ----------- usr/libexec/kuryr/tap | 47 ----- usr/libexec/kuryr/unbound | 16 -- 55 files changed, 107 insertions(+), 816 deletions(-) delete mode 100644 kuryr/_i18n.py delete mode 100644 kuryr/binding.py delete mode 100644 kuryr/common/exceptions.py delete mode 100644 kuryr/opts.py delete mode 100644 kuryr/version.py rename {kuryr => kuryr_libnetwork}/__init__.py (94%) rename {kuryr => kuryr_libnetwork}/common/__init__.py (100%) rename {kuryr => kuryr_libnetwork}/common/config.py (97%) rename {kuryr => kuryr_libnetwork}/common/constants.py (100%) rename {kuryr => kuryr_libnetwork}/controllers.py (99%) rename {kuryr => kuryr_libnetwork}/schemata/__init__.py (69%) rename {kuryr => kuryr_libnetwork}/schemata/commons.py (100%) rename {kuryr => kuryr_libnetwork}/schemata/endpoint_create.py (97%) rename {kuryr => kuryr_libnetwork}/schemata/endpoint_delete.py (96%) rename {kuryr => kuryr_libnetwork}/schemata/join.py (96%) rename {kuryr => kuryr_libnetwork}/schemata/leave.py (94%) rename {kuryr => kuryr_libnetwork}/schemata/network_create.py (97%) rename {kuryr => kuryr_libnetwork}/schemata/network_delete.py (96%) rename {kuryr => kuryr_libnetwork}/schemata/release_address.py (96%) rename {kuryr => kuryr_libnetwork}/schemata/release_pool.py (96%) rename {kuryr => kuryr_libnetwork}/schemata/request_address.py (97%) rename {kuryr => kuryr_libnetwork}/schemata/request_pool.py (97%) rename {kuryr => kuryr_libnetwork}/server.py (88%) rename {kuryr => kuryr_libnetwork}/tests/__init__.py (100%) rename {kuryr => kuryr_libnetwork}/tests/contrib/gate_hook.sh (100%) rename {kuryr => kuryr_libnetwork}/tests/contrib/post_test_hook.sh (100%) rename {kuryr => kuryr_libnetwork}/tests/fullstack/__init__.py (100%) rename {kuryr => kuryr_libnetwork}/tests/fullstack/kuryr_base.py (100%) rename {kuryr => kuryr_libnetwork}/tests/fullstack/test_container.py (100%) rename {kuryr => kuryr_libnetwork}/tests/fullstack/test_network.py (100%) rename {kuryr => kuryr_libnetwork}/tests/unit/__init__.py (100%) rename {kuryr => kuryr_libnetwork}/tests/unit/base.py (98%) rename {kuryr => kuryr_libnetwork}/tests/unit/test_config.py (91%) rename {kuryr => kuryr_libnetwork}/tests/unit/test_ipam_pool.py (96%) rename {kuryr => kuryr_libnetwork}/tests/unit/test_join.py (95%) rename {kuryr => kuryr_libnetwork}/tests/unit/test_kuryr.py (99%) rename {kuryr => kuryr_libnetwork}/tests/unit/test_kuryr_endpoint.py (98%) rename {kuryr => kuryr_libnetwork}/tests/unit/test_kuryr_existing_network.py (97%) rename {kuryr => kuryr_libnetwork}/tests/unit/test_kuryr_ipam.py (98%) rename {kuryr => kuryr_libnetwork}/tests/unit/test_kuryr_network.py (98%) rename {kuryr => kuryr_libnetwork}/tests/unit/test_leave.py (94%) rename {kuryr => kuryr_libnetwork}/tests/unit/test_utils.py (96%) rename {kuryr => kuryr_libnetwork}/utils.py (97%) delete mode 100755 usr/libexec/kuryr/bridge delete mode 100755 usr/libexec/kuryr/iovisor delete mode 100755 usr/libexec/kuryr/midonet delete mode 100755 usr/libexec/kuryr/ovs delete mode 100755 usr/libexec/kuryr/tap delete mode 100755 usr/libexec/kuryr/unbound diff --git a/.testr.conf b/.testr.conf index bf048698..22ff0ba6 100644 --- a/.testr.conf +++ b/.testr.conf @@ -1,4 +1,4 @@ [DEFAULT] -test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./kuryr/tests/unit} $LISTOPT $IDOPTION | cat +test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./kuryr_libnetwork/tests/unit} $LISTOPT $IDOPTION | cat test_id_option=--load-list $IDFILE test_list_option=--list diff --git a/README.rst b/README.rst index c524196d..d37e87e1 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ =============================== -kuryr +kuryr-libnetwork =============================== .. image:: https://raw.githubusercontent.com/openstack/kuryr/master/doc/images/kuryr_logo.png @@ -9,9 +9,14 @@ kuryr Docker for OpenStack Neutron -Kuryr is a Docker network plugin that uses Neutron to provide networking -services to Docker containers. It provides containerised images for the -common Neutron plugins. +Kuryr-libnetwork is `Kuryr's `_ Docker +libnetwork driver that uses Neutron to provide networking services. It provides +containerised images for the common Neutron plugins. + +This repo provides libnetwork specific functionalities such as handler methods +for libnetwork apis. All the logic/utilities that can be shared among +different container networking frameworks such as Docker's libnetwork, +K8s's cni and so on, is maintained in seperate Kuryr repo as a common library. * Free software: Apache license @@ -69,8 +74,8 @@ Edit keystone section in `/etc/kuryr/kuryr.conf`, replace ADMIN_PASSWORD: admin_password = ADMIN_PASSWORD -In the same file uncomment the `bindir` parameter with the path for the Kuryr vif binding -executables: +In the same file uncomment the `bindir` parameter with the path for the Kuryr +vif binding executables: :: diff --git a/etc/kuryr.json b/etc/kuryr.json index f2fc2f53..a6152d74 100644 --- a/etc/kuryr.json +++ b/etc/kuryr.json @@ -1,4 +1,4 @@ { "Name": "kuryr", - "Addr": "http://127.0.0.1:2377" + "Addr": "http://127.0.0.1:23750" } diff --git a/etc/kuryr.spec b/etc/kuryr.spec index 81fd123b..3244cd75 100644 --- a/etc/kuryr.spec +++ b/etc/kuryr.spec @@ -1 +1 @@ -http://127.0.0.1:2377 +http://127.0.0.1:23750 diff --git a/kuryr/_i18n.py b/kuryr/_i18n.py deleted file mode 100644 index 581d76c3..00000000 --- a/kuryr/_i18n.py +++ /dev/null @@ -1,42 +0,0 @@ -# All Rights Reserved. -# -# 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 oslo_i18n - -DOMAIN = "kuryr" - -_translators = oslo_i18n.TranslatorFactory(domain=DOMAIN) - -# The primary translation function using the well-known name "_" -_ = _translators.primary - -# The contextual translation function using the name "_C" -_C = _translators.contextual_form - -# The plural translation function using the name "_P" -_P = _translators.plural_form - -# Translators for log levels. -# -# The abbreviated names are meant to reflect the usual use of a short -# name like '_'. The "L" is for "log" and the other letter comes from -# the level. -_LI = _translators.log_info -_LW = _translators.log_warning -_LE = _translators.log_error -_LC = _translators.log_critical - - -def get_available_languages(): - return oslo_i18n.get_available_languages(DOMAIN) diff --git a/kuryr/binding.py b/kuryr/binding.py deleted file mode 100644 index 820e1637..00000000 --- a/kuryr/binding.py +++ /dev/null @@ -1,195 +0,0 @@ -# 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 os - -import netaddr -from oslo_concurrency import processutils -from oslo_utils import excutils -import pyroute2 - -from kuryr.common import config -from kuryr.common import exceptions -from kuryr import utils - - -BINDING_SUBCOMMAND = 'bind' -DOWN = 'DOWN' -FALLBACK_VIF_TYPE = 'unbound' -FIXED_IP_KEY = 'fixed_ips' -IFF_UP = 0x1 # The last bit represents if the interface is up -IP_ADDRESS_KEY = 'ip_address' -KIND_VETH = 'veth' -MAC_ADDRESS_KEY = 'mac_address' -SUBNET_ID_KEY = 'subnet_id' -UNBINDING_SUBCOMMAND = 'unbind' -VIF_TYPE_KEY = 'binding:vif_type' -VIF_DETAILS_KEY = 'binding:vif_details' - -_IPDB_CACHE = None -_IPROUTE_CACHE = None - - -def get_ipdb(): - """Returns the already cached or a newly created IPDB instance. - - IPDB reads the Linux specific file when it's instantiated. This behaviour - prevents Mac OSX users from running unit tests. This function makes the - loading IPDB lazyily and therefore it can be mocked after the import of - modules that import this module. - - :returns: The already cached or newly created ``pyroute2.IPDB`` instance - """ - global _IPDB_CACHE - if not _IPDB_CACHE: - _IPDB_CACHE = pyroute2.IPDB() - return _IPDB_CACHE - - -def get_iproute(): - """Returns the already cached or a newly created IPRoute instance. - - IPRoute reads the Linux specific file when it's instantiated. This - behaviour prevents Mac OSX users from running unit tests. This function - makes the loading IPDB lazyily and therefore it can be mocked after the - import of modules that import this module. - - :returns: The already cached or newly created ``pyroute2.IPRoute`` instance - """ - global _IPROUTE_CACHE - if not _IPROUTE_CACHE: - _IPROUTE_CACHE = pyroute2.IPRoute() - return _IPROUTE_CACHE - - -def _is_up(interface): - flags = interface['flags'] - if not flags: - return False - return (flags & IFF_UP) == 1 - - -def cleanup_veth(ifname): - """Cleans the veth passed as an argument up. - - :param ifname: the name of the veth endpoint - :returns: the index of the interface which name is the given ifname if it - exists, otherwise None - :raises: pyroute2.NetlinkError - """ - ipr = get_iproute() - - veths = ipr.link_lookup(ifname=ifname) - if veths: - host_veth_index = veths[0] - ipr.link_remove(host_veth_index) - return host_veth_index - else: - return None - - -def port_bind(endpoint_id, neutron_port, neutron_subnets): - """Binds the Neutron port to the network interface on the host. - - :param endpoint_id: the ID of the endpoint as string - :param neutron_port: a port dictionary returned from - python-neutronclient - :param neutron_subnets: a list of all subnets under network to which this - endpoint is trying to join - :returns: the tuple of the names of the veth pair and the tuple of stdout - and stderr returned by processutils.execute invoked with the - executable script for binding - :raises: kuryr.common.exceptions.VethCreationFailure, - processutils.ProcessExecutionError - """ - ip = get_ipdb() - - port_id = neutron_port['id'] - ifname, peer_name = utils.get_veth_pair_names(port_id) - subnets_dict = {subnet['id']: subnet for subnet in neutron_subnets} - - try: - with ip.create(ifname=ifname, kind=KIND_VETH, - reuse=True, peer=peer_name) as host_veth: - if not _is_up(host_veth): - host_veth.up() - with ip.interfaces[peer_name] as peer_veth: - fixed_ips = neutron_port.get(FIXED_IP_KEY, []) - if not fixed_ips and (IP_ADDRESS_KEY in neutron_port): - peer_veth.add_ip(neutron_port[IP_ADDRESS_KEY]) - for fixed_ip in fixed_ips: - if IP_ADDRESS_KEY in fixed_ip and (SUBNET_ID_KEY in fixed_ip): - subnet_id = fixed_ip[SUBNET_ID_KEY] - subnet = subnets_dict[subnet_id] - cidr = netaddr.IPNetwork(subnet['cidr']) - peer_veth.add_ip(fixed_ip[IP_ADDRESS_KEY], cidr.prefixlen) - peer_veth.address = neutron_port[MAC_ADDRESS_KEY].lower() - if not _is_up(peer_veth): - peer_veth.up() - except pyroute2.CreateException: - raise exceptions.VethCreationFailure( - 'Creating the veth pair was failed.') - except pyroute2.CommitException: - raise exceptions.VethCreationFailure( - 'Could not configure the veth endpoint for the container.') - - vif_type = neutron_port.get(VIF_TYPE_KEY, FALLBACK_VIF_TYPE) - vif_details = utils.string_mappings(neutron_port.get(VIF_DETAILS_KEY)) - binding_exec_path = os.path.join(config.CONF.bindir, vif_type) - if not os.path.exists(binding_exec_path): - cleanup_veth(ifname) - raise exceptions.BindingNotSupportedFailure( - "vif_type({0}) is not supported. A binding script for " - "this type can't be found.".format(vif_type)) - port_id = neutron_port['id'] - network_id = neutron_port['network_id'] - tenant_id = neutron_port['tenant_id'] - mac_address = neutron_port['mac_address'] - try: - stdout, stderr = processutils.execute( - binding_exec_path, BINDING_SUBCOMMAND, port_id, ifname, - endpoint_id, mac_address, network_id, tenant_id, vif_details, - run_as_root=True) - except processutils.ProcessExecutionError: - with excutils.save_and_reraise_exception(): - cleanup_veth(ifname) - - return (ifname, peer_name, (stdout, stderr)) - - -def port_unbind(endpoint_id, neutron_port): - """Unbinds the Neutron port from the network interface on the host. - - :param endpoint_id: the ID of the Docker container as string - :param neutron_port: a port dictionary returned from python-neutronclient - :returns: the tuple of stdout and stderr returned by processutils.execute - invoked with the executable script for unbinding - :raises: processutils.ProcessExecutionError, pyroute2.NetlinkError - """ - - vif_type = neutron_port.get(VIF_TYPE_KEY, FALLBACK_VIF_TYPE) - vif_details = utils.string_mappings(neutron_port.get(VIF_DETAILS_KEY)) - unbinding_exec_path = os.path.join(config.CONF.bindir, vif_type) - - port_id = neutron_port['id'] - ifname, _ = utils.get_veth_pair_names(port_id) - - mac_address = neutron_port['mac_address'] - stdout, stderr = processutils.execute( - unbinding_exec_path, UNBINDING_SUBCOMMAND, port_id, ifname, - endpoint_id, mac_address, vif_details, run_as_root=True) - try: - cleanup_veth(ifname) - except pyroute2.NetlinkError: - raise exceptions.VethDeleteionFailure( - 'Deleting the veth pair failed.') - return (stdout, stderr) diff --git a/kuryr/common/exceptions.py b/kuryr/common/exceptions.py deleted file mode 100644 index 05ef61c0..00000000 --- a/kuryr/common/exceptions.py +++ /dev/null @@ -1,88 +0,0 @@ -# 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. - - -class KuryrException(Exception): - """Default Kuryr exception""" - - -class BindingFailure(KuryrException): - """Exception represents the binding is failed. - - This exception is thrown when the executable script for the binding is - failed and Kuryr can't proceed further. - """ - - -class BindingNotSupportedFailure(KuryrException): - """Exception represents the vif type binding not support. - - This exception is thrown when the executable script for the binding does - not exist and Kuryr can't proceed further. - """ - - -class DuplicatedResourceException(KuryrException): - """Exception represents there're multiple resources for the ID. - - For example, this exception is thrown when you query the Neutron resource - associated with the ID and you get multiple resources. - """ - - -class GatewayConflictFailure(KuryrException): - """Exception represents gateway ip is conflict. - - This exception is thrown when request gateway ip is conflict with the - gateway ip in existed network. - """ - - -class MandatoryApiMissing(KuryrException): - """Exception represents that mandatory api is not found. - - For example, this exception is thrown when expected neutron - extension(subnetpools) APIs are not found. - """ - - -class NoResourceException(KuryrException): - """Exception represents there's no resource for the given query. - - This exception is thrown when you query the Neutron resource associated - with the given query and you get none of them actually. - """ - - -class InactiveResourceException(KuryrException): - """Exception represents the resource for the given query is not active. - - This exception is thrown when you query the Neutron resource associated - with the given query and you get the status of the resource as something - other than ACTIVE. - """ - - -class VethCreationFailure(KuryrException): - """Exception represents the veth pair creation is failed. - - This exception is thrown when the veth pair is not created appropriately - and Kuryr can't proceed the binding further. - """ - - -class VethDeletionFailure(KuryrException): - """Exception represents the veth pair deletion is failed. - - This exception is thrown when the veth pair is not deleted appropriately - and Kuryr can't proceed the unbinding further. - """ diff --git a/kuryr/opts.py b/kuryr/opts.py deleted file mode 100644 index e76a811c..00000000 --- a/kuryr/opts.py +++ /dev/null @@ -1,55 +0,0 @@ -# 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. - -__all__ = [ - 'list_kuryr_opts', -] - -import copy -import itertools - -from oslo_log import _options - -from kuryr.common import config - - -_core_opts_with_logging = config.core_opts -_core_opts_with_logging += _options.common_cli_opts -_core_opts_with_logging += _options.logging_cli_opts -_core_opts_with_logging += _options.generic_log_opts - -_kuryr_opts = [ - (None, list(itertools.chain(_core_opts_with_logging))), - ('neutron_client', config.neutron_opts), - ('keystone_client', config.keystone_opts), - ('binding', config.binding_opts), -] - - -def list_kuryr_opts(): - """Return a list of oslo_config options available in Kuryr service. - - Each element of the list is a tuple. The first element is the name of the - group under which the list of elements in the second element will be - registered. A group name of None corresponds to the [DEFAULT] group in - config files. - - This function is also discoverable via the 'kuryr' entry point under - the 'oslo_config.opts' namespace. - - The purpose of this is to allow tools like the Oslo sample config file - generator to discover the options exposed to users by Kuryr. - - :returns: a list of (group_name, opts) tuples - """ - - return [(k, copy.deepcopy(o)) for k, o in _kuryr_opts] diff --git a/kuryr/version.py b/kuryr/version.py deleted file mode 100644 index f87fa0bc..00000000 --- a/kuryr/version.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2015 OpenStack Foundation -# -# 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 pbr.version - -version_info = pbr.version.VersionInfo('kuryr') diff --git a/kuryr/__init__.py b/kuryr_libnetwork/__init__.py similarity index 94% rename from kuryr/__init__.py rename to kuryr_libnetwork/__init__.py index c577b9cb..39d5f6a5 100644 --- a/kuryr/__init__.py +++ b/kuryr_libnetwork/__init__.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from kuryr import utils +from kuryr_libnetwork import utils app = utils.make_json_app(__name__) diff --git a/kuryr/common/__init__.py b/kuryr_libnetwork/common/__init__.py similarity index 100% rename from kuryr/common/__init__.py rename to kuryr_libnetwork/common/__init__.py diff --git a/kuryr/common/config.py b/kuryr_libnetwork/common/config.py similarity index 97% rename from kuryr/common/config.py rename to kuryr_libnetwork/common/config.py index b7ab51db..a091b6cb 100644 --- a/kuryr/common/config.py +++ b/kuryr_libnetwork/common/config.py @@ -19,8 +19,8 @@ import os from oslo_config import cfg from oslo_log import log -from kuryr._i18n import _ -from kuryr import version +from kuryr.lib._i18n import _ +from kuryr.lib import version core_opts = [ @@ -32,7 +32,7 @@ core_opts = [ default='$pybasedir/usr/libexec/kuryr', help=_('Directory for Kuryr vif binding executables.')), cfg.StrOpt('kuryr_uri', - default='http://127.0.0.1:2377', + default='http://127.0.0.1:23750', help=_('Kuryr URL for accessing Kuryr through json rpc.')), cfg.StrOpt('capability_scope', default=os.environ.get('CAPABILITY_SCOPE', 'local'), diff --git a/kuryr/common/constants.py b/kuryr_libnetwork/common/constants.py similarity index 100% rename from kuryr/common/constants.py rename to kuryr_libnetwork/common/constants.py diff --git a/kuryr/controllers.py b/kuryr_libnetwork/controllers.py similarity index 99% rename from kuryr/controllers.py rename to kuryr_libnetwork/controllers.py index 1cd59695..eb11f470 100755 --- a/kuryr/controllers.py +++ b/kuryr_libnetwork/controllers.py @@ -24,14 +24,14 @@ from oslo_config import cfg from oslo_log import log from oslo_utils import excutils -from kuryr import app -from kuryr import binding -from kuryr.common import config -from kuryr.common import constants as const -from kuryr.common import exceptions -from kuryr._i18n import _LE, _LI, _LW -from kuryr import schemata -from kuryr import utils +from kuryr.lib import binding +from kuryr.lib import exceptions +from kuryr.lib._i18n import _LE, _LI, _LW +from kuryr_libnetwork import app +from kuryr_libnetwork.common import config +from kuryr_libnetwork.common import constants as const +from kuryr_libnetwork import schemata +from kuryr_libnetwork import utils LOG = log.getLogger(__name__) @@ -85,8 +85,8 @@ def get_neutron_client(): return neutron_client except Exception: pass - cfg.CONF.import_group('neutron_client', 'kuryr.common.config') - cfg.CONF.import_group('keystone_client', 'kuryr.common.config') + cfg.CONF.import_group('neutron_client', 'kuryr_libnetwork.common.config') + cfg.CONF.import_group('keystone_client', 'kuryr_libnetwork.common.config') keystone_conf = cfg.CONF.keystone_client username = keystone_conf.admin_user diff --git a/kuryr/schemata/__init__.py b/kuryr_libnetwork/schemata/__init__.py similarity index 69% rename from kuryr/schemata/__init__.py rename to kuryr_libnetwork/schemata/__init__.py index ace6b999..0eeed318 100644 --- a/kuryr/schemata/__init__.py +++ b/kuryr_libnetwork/schemata/__init__.py @@ -10,16 +10,16 @@ # License for the specific language governing permissions and limitations # under the License. -from kuryr.schemata import endpoint_create -from kuryr.schemata import endpoint_delete -from kuryr.schemata import join -from kuryr.schemata import leave -from kuryr.schemata import network_create -from kuryr.schemata import network_delete -from kuryr.schemata import release_address -from kuryr.schemata import release_pool -from kuryr.schemata import request_address -from kuryr.schemata import request_pool +from kuryr_libnetwork.schemata import endpoint_create +from kuryr_libnetwork.schemata import endpoint_delete +from kuryr_libnetwork.schemata import join +from kuryr_libnetwork.schemata import leave +from kuryr_libnetwork.schemata import network_create +from kuryr_libnetwork.schemata import network_delete +from kuryr_libnetwork.schemata import release_address +from kuryr_libnetwork.schemata import release_pool +from kuryr_libnetwork.schemata import request_address +from kuryr_libnetwork.schemata import request_pool # Aliases for schemata in each module diff --git a/kuryr/schemata/commons.py b/kuryr_libnetwork/schemata/commons.py similarity index 100% rename from kuryr/schemata/commons.py rename to kuryr_libnetwork/schemata/commons.py diff --git a/kuryr/schemata/endpoint_create.py b/kuryr_libnetwork/schemata/endpoint_create.py similarity index 97% rename from kuryr/schemata/endpoint_create.py rename to kuryr_libnetwork/schemata/endpoint_create.py index 4a2fc125..ec864b2e 100644 --- a/kuryr/schemata/endpoint_create.py +++ b/kuryr_libnetwork/schemata/endpoint_create.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from kuryr.schemata import commons +from kuryr_libnetwork.schemata import commons ENDPOINT_CREATE_SCHEMA = { u'links': [{ diff --git a/kuryr/schemata/endpoint_delete.py b/kuryr_libnetwork/schemata/endpoint_delete.py similarity index 96% rename from kuryr/schemata/endpoint_delete.py rename to kuryr_libnetwork/schemata/endpoint_delete.py index 94a91069..906c6f7c 100644 --- a/kuryr/schemata/endpoint_delete.py +++ b/kuryr_libnetwork/schemata/endpoint_delete.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from kuryr.schemata import commons +from kuryr_libnetwork.schemata import commons ENDPOINT_DELETE_SCHEMA = { u'links': [{ diff --git a/kuryr/schemata/join.py b/kuryr_libnetwork/schemata/join.py similarity index 96% rename from kuryr/schemata/join.py rename to kuryr_libnetwork/schemata/join.py index b4569dad..7d790828 100644 --- a/kuryr/schemata/join.py +++ b/kuryr_libnetwork/schemata/join.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from kuryr.schemata.commons import COMMONS +from kuryr_libnetwork.schemata.commons import COMMONS JOIN_SCHEMA = { diff --git a/kuryr/schemata/leave.py b/kuryr_libnetwork/schemata/leave.py similarity index 94% rename from kuryr/schemata/leave.py rename to kuryr_libnetwork/schemata/leave.py index c5978aa8..7e9ce0c1 100644 --- a/kuryr/schemata/leave.py +++ b/kuryr_libnetwork/schemata/leave.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from kuryr.schemata import endpoint_delete +from kuryr_libnetwork.schemata import endpoint_delete LEAVE_SCHEMA = endpoint_delete.ENDPOINT_DELETE_SCHEMA diff --git a/kuryr/schemata/network_create.py b/kuryr_libnetwork/schemata/network_create.py similarity index 97% rename from kuryr/schemata/network_create.py rename to kuryr_libnetwork/schemata/network_create.py index 8f7a2cb8..d334cd16 100644 --- a/kuryr/schemata/network_create.py +++ b/kuryr_libnetwork/schemata/network_create.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from kuryr.schemata import commons +from kuryr_libnetwork.schemata import commons NETWORK_CREATE_SCHEMA = { u'links': [{ diff --git a/kuryr/schemata/network_delete.py b/kuryr_libnetwork/schemata/network_delete.py similarity index 96% rename from kuryr/schemata/network_delete.py rename to kuryr_libnetwork/schemata/network_delete.py index c45991c6..304b3baa 100644 --- a/kuryr/schemata/network_delete.py +++ b/kuryr_libnetwork/schemata/network_delete.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from kuryr.schemata import commons +from kuryr_libnetwork.schemata import commons NETWORK_DELETE_SCHEMA = { u'links': [{ diff --git a/kuryr/schemata/release_address.py b/kuryr_libnetwork/schemata/release_address.py similarity index 96% rename from kuryr/schemata/release_address.py rename to kuryr_libnetwork/schemata/release_address.py index 30226d2b..f879ca81 100644 --- a/kuryr/schemata/release_address.py +++ b/kuryr_libnetwork/schemata/release_address.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from kuryr.schemata import commons +from kuryr_libnetwork.schemata import commons RELEASE_ADDRESS_SCHEMA = { u'links': [{ diff --git a/kuryr/schemata/release_pool.py b/kuryr_libnetwork/schemata/release_pool.py similarity index 96% rename from kuryr/schemata/release_pool.py rename to kuryr_libnetwork/schemata/release_pool.py index 2d5f8aa3..7d23e4af 100644 --- a/kuryr/schemata/release_pool.py +++ b/kuryr_libnetwork/schemata/release_pool.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from kuryr.schemata import commons +from kuryr_libnetwork.schemata import commons RELEASE_POOL_SCHEMA = { u'links': [{ diff --git a/kuryr/schemata/request_address.py b/kuryr_libnetwork/schemata/request_address.py similarity index 97% rename from kuryr/schemata/request_address.py rename to kuryr_libnetwork/schemata/request_address.py index 981b2deb..3480af7c 100755 --- a/kuryr/schemata/request_address.py +++ b/kuryr_libnetwork/schemata/request_address.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from kuryr.schemata import commons +from kuryr_libnetwork.schemata import commons REQUEST_ADDRESS_SCHEMA = { u'links': [{ diff --git a/kuryr/schemata/request_pool.py b/kuryr_libnetwork/schemata/request_pool.py similarity index 97% rename from kuryr/schemata/request_pool.py rename to kuryr_libnetwork/schemata/request_pool.py index ed1c1d2a..c5858cf7 100644 --- a/kuryr/schemata/request_pool.py +++ b/kuryr_libnetwork/schemata/request_pool.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from kuryr.schemata import commons +from kuryr_libnetwork.schemata import commons REQUEST_POOL_SCHEMA = { u'links': [{ diff --git a/kuryr/server.py b/kuryr_libnetwork/server.py similarity index 88% rename from kuryr/server.py rename to kuryr_libnetwork/server.py index 4f41c4b6..82e9292c 100644 --- a/kuryr/server.py +++ b/kuryr_libnetwork/server.py @@ -14,9 +14,9 @@ import sys from oslo_log import log -from kuryr import app -from kuryr.common import config -from kuryr import controllers +from kuryr_libnetwork import app +from kuryr_libnetwork.common import config +from kuryr_libnetwork import controllers config.init(sys.argv[1:]) diff --git a/kuryr/tests/__init__.py b/kuryr_libnetwork/tests/__init__.py similarity index 100% rename from kuryr/tests/__init__.py rename to kuryr_libnetwork/tests/__init__.py diff --git a/kuryr/tests/contrib/gate_hook.sh b/kuryr_libnetwork/tests/contrib/gate_hook.sh similarity index 100% rename from kuryr/tests/contrib/gate_hook.sh rename to kuryr_libnetwork/tests/contrib/gate_hook.sh diff --git a/kuryr/tests/contrib/post_test_hook.sh b/kuryr_libnetwork/tests/contrib/post_test_hook.sh similarity index 100% rename from kuryr/tests/contrib/post_test_hook.sh rename to kuryr_libnetwork/tests/contrib/post_test_hook.sh diff --git a/kuryr/tests/fullstack/__init__.py b/kuryr_libnetwork/tests/fullstack/__init__.py similarity index 100% rename from kuryr/tests/fullstack/__init__.py rename to kuryr_libnetwork/tests/fullstack/__init__.py diff --git a/kuryr/tests/fullstack/kuryr_base.py b/kuryr_libnetwork/tests/fullstack/kuryr_base.py similarity index 100% rename from kuryr/tests/fullstack/kuryr_base.py rename to kuryr_libnetwork/tests/fullstack/kuryr_base.py diff --git a/kuryr/tests/fullstack/test_container.py b/kuryr_libnetwork/tests/fullstack/test_container.py similarity index 100% rename from kuryr/tests/fullstack/test_container.py rename to kuryr_libnetwork/tests/fullstack/test_container.py diff --git a/kuryr/tests/fullstack/test_network.py b/kuryr_libnetwork/tests/fullstack/test_network.py similarity index 100% rename from kuryr/tests/fullstack/test_network.py rename to kuryr_libnetwork/tests/fullstack/test_network.py diff --git a/kuryr/tests/unit/__init__.py b/kuryr_libnetwork/tests/unit/__init__.py similarity index 100% rename from kuryr/tests/unit/__init__.py rename to kuryr_libnetwork/tests/unit/__init__.py diff --git a/kuryr/tests/unit/base.py b/kuryr_libnetwork/tests/unit/base.py similarity index 98% rename from kuryr/tests/unit/base.py rename to kuryr_libnetwork/tests/unit/base.py index 80a84210..d95ad069 100644 --- a/kuryr/tests/unit/base.py +++ b/kuryr_libnetwork/tests/unit/base.py @@ -12,11 +12,11 @@ from neutronclient.tests.unit import test_cli20 -from kuryr import app -from kuryr import binding -from kuryr.common import constants as const -from kuryr import controllers -from kuryr import utils +from kuryr.lib import binding +from kuryr_libnetwork import app +from kuryr_libnetwork.common import constants as const +from kuryr_libnetwork import controllers +from kuryr_libnetwork import utils class TestCase(test_cli20.CLITestV20Base): diff --git a/kuryr/tests/unit/test_config.py b/kuryr_libnetwork/tests/unit/test_config.py similarity index 91% rename from kuryr/tests/unit/test_config.py rename to kuryr_libnetwork/tests/unit/test_config.py index d8f13ad4..b122c468 100755 --- a/kuryr/tests/unit/test_config.py +++ b/kuryr_libnetwork/tests/unit/test_config.py @@ -15,10 +15,10 @@ import os from neutronclient.common import exceptions as n_exceptions -from kuryr.common import config -from kuryr.common import exceptions -from kuryr import controllers -from kuryr.tests.unit import base +from kuryr.lib import exceptions +from kuryr_libnetwork.common import config +from kuryr_libnetwork import controllers +from kuryr_libnetwork.tests.unit import base class ConfigurationTest(base.TestKuryrBase): @@ -30,7 +30,7 @@ class ConfigurationTest(base.TestKuryrBase): config.CONF.pybasedir) self.assertEqual(basepath + '/usr/libexec/kuryr', config.CONF.bindir) - self.assertEqual('http://127.0.0.1:2377', + self.assertEqual('http://127.0.0.1:23750', config.CONF.kuryr_uri) self.assertEqual('http://127.0.0.1:9696', diff --git a/kuryr/tests/unit/test_ipam_pool.py b/kuryr_libnetwork/tests/unit/test_ipam_pool.py similarity index 96% rename from kuryr/tests/unit/test_ipam_pool.py rename to kuryr_libnetwork/tests/unit/test_ipam_pool.py index 05341685..dfc62b8c 100644 --- a/kuryr/tests/unit/test_ipam_pool.py +++ b/kuryr_libnetwork/tests/unit/test_ipam_pool.py @@ -14,9 +14,9 @@ import ddt from neutronclient.common import exceptions from oslo_serialization import jsonutils -from kuryr import app -from kuryr.tests.unit import base -from kuryr import utils +from kuryr_libnetwork import app +from kuryr_libnetwork.tests.unit import base +from kuryr_libnetwork import utils @ddt.ddt diff --git a/kuryr/tests/unit/test_join.py b/kuryr_libnetwork/tests/unit/test_join.py similarity index 95% rename from kuryr/tests/unit/test_join.py rename to kuryr_libnetwork/tests/unit/test_join.py index 5c49492f..658d115f 100644 --- a/kuryr/tests/unit/test_join.py +++ b/kuryr_libnetwork/tests/unit/test_join.py @@ -17,12 +17,12 @@ from oslo_concurrency import processutils from oslo_serialization import jsonutils from werkzeug import exceptions as w_exceptions -from kuryr import app -from kuryr import binding -from kuryr.common import constants as const -from kuryr.common import exceptions -from kuryr.tests.unit import base -from kuryr import utils +from kuryr.lib import binding +from kuryr.lib import exceptions +from kuryr_libnetwork import app +from kuryr_libnetwork.common import constants as const +from kuryr_libnetwork.tests.unit import base +from kuryr_libnetwork import utils @ddt.ddt diff --git a/kuryr/tests/unit/test_kuryr.py b/kuryr_libnetwork/tests/unit/test_kuryr.py similarity index 99% rename from kuryr/tests/unit/test_kuryr.py rename to kuryr_libnetwork/tests/unit/test_kuryr.py index 19874886..138b1e31 100644 --- a/kuryr/tests/unit/test_kuryr.py +++ b/kuryr_libnetwork/tests/unit/test_kuryr.py @@ -15,11 +15,11 @@ import uuid import ddt from oslo_serialization import jsonutils -from kuryr import app -from kuryr.common import config -from kuryr.common import constants -from kuryr.tests.unit import base -from kuryr import utils +from kuryr_libnetwork import app +from kuryr_libnetwork.common import config +from kuryr_libnetwork.common import constants +from kuryr_libnetwork.tests.unit import base +from kuryr_libnetwork import utils @ddt.ddt diff --git a/kuryr/tests/unit/test_kuryr_endpoint.py b/kuryr_libnetwork/tests/unit/test_kuryr_endpoint.py similarity index 98% rename from kuryr/tests/unit/test_kuryr_endpoint.py rename to kuryr_libnetwork/tests/unit/test_kuryr_endpoint.py index 48305b17..24f1f211 100644 --- a/kuryr/tests/unit/test_kuryr_endpoint.py +++ b/kuryr_libnetwork/tests/unit/test_kuryr_endpoint.py @@ -16,10 +16,10 @@ import ddt from neutronclient.common import exceptions from oslo_serialization import jsonutils -from kuryr import app -from kuryr.common import constants -from kuryr.tests.unit import base -from kuryr import utils +from kuryr_libnetwork import app +from kuryr_libnetwork.common import constants +from kuryr_libnetwork.tests.unit import base +from kuryr_libnetwork import utils class TestKuryrEndpointFailures(base.TestKuryrFailures): diff --git a/kuryr/tests/unit/test_kuryr_existing_network.py b/kuryr_libnetwork/tests/unit/test_kuryr_existing_network.py similarity index 97% rename from kuryr/tests/unit/test_kuryr_existing_network.py rename to kuryr_libnetwork/tests/unit/test_kuryr_existing_network.py index b3aa2695..164f977c 100644 --- a/kuryr/tests/unit/test_kuryr_existing_network.py +++ b/kuryr_libnetwork/tests/unit/test_kuryr_existing_network.py @@ -15,10 +15,10 @@ import uuid import ddt from oslo_serialization import jsonutils -from kuryr import app -from kuryr.common import constants as const -from kuryr.tests.unit import base -from kuryr import utils +from kuryr_libnetwork import app +from kuryr_libnetwork.common import constants as const +from kuryr_libnetwork.tests.unit import base +from kuryr_libnetwork import utils @ddt.ddt diff --git a/kuryr/tests/unit/test_kuryr_ipam.py b/kuryr_libnetwork/tests/unit/test_kuryr_ipam.py similarity index 98% rename from kuryr/tests/unit/test_kuryr_ipam.py rename to kuryr_libnetwork/tests/unit/test_kuryr_ipam.py index 1e17dc9f..debaa27c 100644 --- a/kuryr/tests/unit/test_kuryr_ipam.py +++ b/kuryr_libnetwork/tests/unit/test_kuryr_ipam.py @@ -14,11 +14,11 @@ import ddt from oslo_serialization import jsonutils import uuid -from kuryr.common import config -from kuryr.common import constants as const -from kuryr.controllers import app -from kuryr.tests.unit import base -from kuryr import utils +from kuryr_libnetwork.common import config +from kuryr_libnetwork.common import constants as const +from kuryr_libnetwork.controllers import app +from kuryr_libnetwork.tests.unit import base +from kuryr_libnetwork import utils FAKE_IP4_CIDR = '10.0.0.0/16' diff --git a/kuryr/tests/unit/test_kuryr_network.py b/kuryr_libnetwork/tests/unit/test_kuryr_network.py similarity index 98% rename from kuryr/tests/unit/test_kuryr_network.py rename to kuryr_libnetwork/tests/unit/test_kuryr_network.py index 00bc8a50..8aaebb29 100644 --- a/kuryr/tests/unit/test_kuryr_network.py +++ b/kuryr_libnetwork/tests/unit/test_kuryr_network.py @@ -15,10 +15,10 @@ from ddt import ddt from neutronclient.common import exceptions from oslo_serialization import jsonutils -from kuryr import app -from kuryr.common import constants as const -from kuryr.tests.unit import base -from kuryr import utils +from kuryr_libnetwork import app +from kuryr_libnetwork.common import constants as const +from kuryr_libnetwork.tests.unit import base +from kuryr_libnetwork import utils class TestKuryrNetworkCreateFailures(base.TestKuryrFailures): diff --git a/kuryr/tests/unit/test_leave.py b/kuryr_libnetwork/tests/unit/test_leave.py similarity index 94% rename from kuryr/tests/unit/test_leave.py rename to kuryr_libnetwork/tests/unit/test_leave.py index a2e1be5d..55bbf6b9 100644 --- a/kuryr/tests/unit/test_leave.py +++ b/kuryr_libnetwork/tests/unit/test_leave.py @@ -17,12 +17,12 @@ from oslo_concurrency import processutils from oslo_serialization import jsonutils from werkzeug import exceptions as w_exceptions -from kuryr import app -from kuryr import binding -from kuryr.common import constants as const -from kuryr.common import exceptions -from kuryr.tests.unit import base -from kuryr import utils +from kuryr.lib import binding +from kuryr.lib import exceptions +from kuryr_libnetwork import app +from kuryr_libnetwork.common import constants as const +from kuryr_libnetwork.tests.unit import base +from kuryr_libnetwork import utils @ddt.ddt diff --git a/kuryr/tests/unit/test_utils.py b/kuryr_libnetwork/tests/unit/test_utils.py similarity index 96% rename from kuryr/tests/unit/test_utils.py rename to kuryr_libnetwork/tests/unit/test_utils.py index 1a1a7249..506b19c2 100644 --- a/kuryr/tests/unit/test_utils.py +++ b/kuryr_libnetwork/tests/unit/test_utils.py @@ -15,9 +15,9 @@ import uuid import ddt from oslo_config import cfg -from kuryr.common import constants as const -from kuryr.tests.unit import base -from kuryr import utils +from kuryr_libnetwork.common import constants as const +from kuryr_libnetwork.tests.unit import base +from kuryr_libnetwork import utils @ddt.ddt diff --git a/kuryr/utils.py b/kuryr_libnetwork/utils.py similarity index 97% rename from kuryr/utils.py rename to kuryr_libnetwork/utils.py index 0eeed724..abefc11b 100644 --- a/kuryr/utils.py +++ b/kuryr_libnetwork/utils.py @@ -9,7 +9,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - +from __future__ import absolute_import import hashlib import os import random @@ -27,9 +27,9 @@ from oslo_concurrency import processutils from oslo_config import cfg from werkzeug import exceptions as w_exceptions -from kuryr._i18n import _LE -from kuryr.common import constants as const -from kuryr.common import exceptions +from kuryr.lib._i18n import _LE +from kuryr.lib import exceptions +from kuryr_libnetwork.common import constants as const DOCKER_NETNS_BASE = '/var/run/docker/netns' PORT_POSTFIX = 'port' diff --git a/requirements.txt b/requirements.txt index e1ba4598..828eec05 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,3 +15,4 @@ python-neutronclient>=4.2.0 # Apache-2.0 pyroute2>=0.4.3 # Apache-2.0 (+ dual licensed GPL2) os-client-config>=1.13.1 # Apache-2.0 neutron-lib>=0.2.0 # Apache-2.0 +-e git+https://github.com/vikaschoudhary16/kuryr.git@drop_libnet_specific_code#egg=kuryr diff --git a/scripts/run_server.py b/scripts/run_server.py index f0b2e5af..9fe3f46e 100755 --- a/scripts/run_server.py +++ b/scripts/run_server.py @@ -12,6 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -from kuryr import server +from kuryr_libnetwork import server server.start() diff --git a/usr/libexec/kuryr/bridge b/usr/libexec/kuryr/bridge deleted file mode 100755 index 8b5347a2..00000000 --- a/usr/libexec/kuryr/bridge +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# 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. - -bind_port() { - echo "plugging veth $2 (Neutron port $1)..." - - # create a linux bridge - br_name="br"${4:0:12} - ip link show $br_name - if [ $? -ne 0 ]; then - echo "Bridge $br_name does not exist, create it" - ip link add name $br_name type bridge - echo 0 > /sys/devices/virtual/net/$br_name/bridge/forward_delay - echo 0 > /sys/devices/virtual/net/$br_name/bridge/stp_state - ip link set $br_name up - else - echo "Bridge $br_name exists" - fi - - # connect the veth outside to linux bridge - ip link set dev $2 master $br_name - ip link set $2 up -} - -unbind_port() { - echo "unplugging veth $1..." - br_name="br"${3:0:12} - - ip link set dev $2 nomaster - ip link set $br_name down - ip link delete $br_name type bridge -} - -case $1 in - "bind") - shift - bind_port "$@" - exit 0 - ;; - "unbind") - shift - unbind_port "$@" - exit 0 - ;; - *) - echo >&2 "$0: Invalid command $1." - exit 1 - ;; -esac diff --git a/usr/libexec/kuryr/iovisor b/usr/libexec/kuryr/iovisor deleted file mode 100755 index acf6f99a..00000000 --- a/usr/libexec/kuryr/iovisor +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# 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. - -bind_port() { - echo "plugging veth $2 (Neutron port $1)..." - /opt/pg/bin/ifc_ctl gateway add_port $2 - /opt/pg/bin/ifc_ctl gateway ifup $2 access_vm $1 $4 pgtag2=$5 pgtag1=$6 -} - -unbind_port() { - echo "unplugging veth $1..." - /opt/pg/bin/ifc_ctl gateway ifdown $2 access_vm $1 $4 - /opt/pg/bin/ifc_ctl gateway del_port $2 - -} - -case $1 in - "bind") - shift - bind_port "$@" - exit 0 - ;; - "unbind") - shift - unbind_port "$@" - exit 0 - ;; - *) - echo >&2 "$0: Invalid command $1." - exit 1 - ;; -esac diff --git a/usr/libexec/kuryr/midonet b/usr/libexec/kuryr/midonet deleted file mode 100755 index cd9da513..00000000 --- a/usr/libexec/kuryr/midonet +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# 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. - -bind_port() { - echo "Binding Neutron port $1 to the veth $2..." - mm-ctl --bind-port $1 $2 -} - -unbind_port() { - echo "Unbinding Neutron port $1..." - mm-ctl --unbind-port $1 -} - -case $1 in - "bind") - shift - bind_port "$@" - exit 0 - ;; - "unbind") - shift - unbind_port "$@" - exit 0 - ;; - *) - echo >&2 "$0: Invalid command $1." - exit 1 - ;; -esac diff --git a/usr/libexec/kuryr/ovs b/usr/libexec/kuryr/ovs deleted file mode 100755 index bf92f164..00000000 --- a/usr/libexec/kuryr/ovs +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/bash -# 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. - -INT_BRIDGE="br-int" -HYBRID_PLUG="'ovs_hybrid_plug': True" - -OPERATION=$1 -PORT=$2 -VETH=$3 -CONTAINER_UUID=$4 -MAC_ADDRESS=$5 - -ovs_bind_port() { - echo "plugging veth $VETH (Neutron port $PORT)..." - ovs-vsctl -- --may-exist add-port $INT_BRIDGE $VETH -- \ - set interface $VETH external_ids:attached-mac=$MAC_ADDRESS \ - external_ids:iface-id=$PORT external_ids:vm-uuid=$CONTAINER_UUID \ - external_ids:iface-status=active external_ids:owner=kuryr -} - -ovs_unbind_port() { - echo "unplugging port $PORT..." - MYPORT=`ovs-vsctl --data=bare --no-heading --columns=name \ - find interface external_ids:iface-id=$PORT \ - external_ids:owner=kuryr` - if [ -z "$MYPORT" ]; then - echo >&2 "Failed to find port $PORT." - exit 1 - fi - ovs-vsctl del-port $INT_BRIDGE $MYPORT -} - -ovs_hybrid_bind_port() { - echo "... plugging veth $VETH (Neutron port $PORT) ..." - # create a linux bridge - br_name="qbr"${PORT:0:11} - ip link add name $br_name type bridge - # Using brctl allows containerized usage not to need privileged mode - # as sysfs is mounted read-only when running with just CAP_NET_ADMIN - brctl setfd $br_name 0 - brctl stp $br_name off - - # connect the veth outside to linux bridge - ip link set $VETH up - ip link set dev $VETH master $br_name - # create a veth pair to connect linux bridge and the integration bridge - veth_lb="qvb"${PORT:0:11} - veth_ovs="qvo"${PORT:0:11} - ip link add $veth_lb type veth peer name $veth_ovs - - # connect one end to the linux bridge - ip link set dev $veth_lb master $br_name - ip link set $br_name up - - # connect one end to the ovs integration bridge - ovs-vsctl add-port $INT_BRIDGE $veth_ovs -- \ - set interface $veth_ovs external_ids:attached-mac=$MAC_ADDRESS \ - external_ids:iface-id=$PORT external_ids:vm-id=$CONTAINER_UUID \ - external_ids:iface-status=active external_ids:owner=kuryr - - ip link set $veth_lb up - ip link set $veth_ovs up -} - -ovs_hybrid_unbind_port() { - echo "unplugging port $PORT ..." - br_name="qbr"${PORT:0:11} - veth_lb="qvb"${PORT:0:11} - veth_ovs="qvo"${PORT:0:11} - - ip link set dev $veth_lb nomaster - ovs-vsctl del-port $veth_ovs - ip link delete $veth_lb type veth - - ip link set $br_name down - ip link delete $br_name type bridge -} - - -case $OPERATION in - "bind") - shift - if [ "${7/$HYBRID_PLUG}" = "$7" ] - then - ovs_bind_port - else - ovs_hybrid_bind_port - fi - exit 0 - ;; - "unbind") - shift - if [ "${5/$HYBRID_PLUG}" = "$5" ] - then - ovs_unbind_port - else - ovs_hybrid_unbind_port - fi - exit 0 - ;; - *) - echo >&2 "$0: Invalid command $OPERATION." - exit 1 - ;; -esac diff --git a/usr/libexec/kuryr/tap b/usr/libexec/kuryr/tap deleted file mode 100755 index d4c5a9c7..00000000 --- a/usr/libexec/kuryr/tap +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# 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. - -bind_port() { - echo "Binding VIF_TYPE_TAP Neutron port $1 / veth $2..." - # - # No real code is needed here, because VIF_TYPE_TAP means that the - # host-side TAP or veth device should be left unbridged. The core Kuryr - # code has already created the Linux TAP/veth device on the host side, so - # there is nothing further for this script to do. -} - -unbind_port() { - echo "Unbinding VIF_TYPE_TAP Neutron port $1..." - # - # As with bind_port(), there is actually nothing to do here. The core - # Kuryr code will delete the Linux TAP/veth device on the host side after - # this script returns, and for VIF_TYPE_TAP we don't need to do anything to - # 'unbind' before that happens. -} - -case $1 in - "bind") - shift - bind_port "$@" - exit 0 - ;; - "unbind") - shift - unbind_port "$@" - exit 0 - ;; - *) - echo >&2 "$0: Invalid command $1." - exit 1 - ;; -esac diff --git a/usr/libexec/kuryr/unbound b/usr/libexec/kuryr/unbound deleted file mode 100755 index e88745c8..00000000 --- a/usr/libexec/kuryr/unbound +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# 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. - - -echo "binding:vif_type is invalid." -exit 1