From 129534730e80b5992d094126c9cd2a38a9e57289 Mon Sep 17 00:00:00 2001 From: Qin Zhao Date: Wed, 31 Oct 2018 16:30:45 +0800 Subject: [PATCH 1/2] Support CMCC Kilo --- f5lbaasdriver/v2/bigip/disconnected_service.py | 5 ++--- f5lbaasdriver/v2/bigip/driver_v2.py | 2 +- f5lbaasdriver/v2/bigip/exceptions.py | 2 +- f5lbaasdriver/v2/bigip/neutron_client.py | 5 +++-- f5lbaasdriver/v2/bigip/plugin_rpc.py | 9 +++++---- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/f5lbaasdriver/v2/bigip/disconnected_service.py b/f5lbaasdriver/v2/bigip/disconnected_service.py index c34a9690..9bfe0f3c 100644 --- a/f5lbaasdriver/v2/bigip/disconnected_service.py +++ b/f5lbaasdriver/v2/bigip/disconnected_service.py @@ -13,7 +13,6 @@ # limitations under the License. # -from neutron.db import segments_db from neutron.plugins.ml2 import db from neutron.plugins.ml2 import models @@ -52,8 +51,8 @@ def get_network_segment(self, context, agent_configuration, network): agent_configuration.get('tunnel_types', []) ] # look up segment details in the ml2_network_segments table - segments = segments_db.get_network_segments(context, network['id'], - filter_dynamic=None) + segments = db.get_network_segments(context, network['id'], + filter_dynamic=None) for segment in segments: LOG.debug("F5 disconnected service check segment: %s" % segment) diff --git a/f5lbaasdriver/v2/bigip/driver_v2.py b/f5lbaasdriver/v2/bigip/driver_v2.py index be817135..ae3d2da8 100644 --- a/f5lbaasdriver/v2/bigip/driver_v2.py +++ b/f5lbaasdriver/v2/bigip/driver_v2.py @@ -25,9 +25,9 @@ from neutron.callbacks import events from neutron.callbacks import registry from neutron.callbacks import resources +from neutron.common import constants as q_const from neutron.extensions import portbindings from neutron.plugins.common import constants as plugin_constants -from neutron_lib import constants as q_const from neutron_lbaas.db.loadbalancer import models from neutron_lbaas.extensions import lbaas_agentschedulerv2 diff --git a/f5lbaasdriver/v2/bigip/exceptions.py b/f5lbaasdriver/v2/bigip/exceptions.py index ad574f25..9e9c67a9 100644 --- a/f5lbaasdriver/v2/bigip/exceptions.py +++ b/f5lbaasdriver/v2/bigip/exceptions.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from neutron_lib import exceptions as q_exc +from neutron.common import exceptions as q_exc class F5LBaaSv2DriverException(q_exc.NeutronException): diff --git a/f5lbaasdriver/v2/bigip/neutron_client.py b/f5lbaasdriver/v2/bigip/neutron_client.py index 995d3746..4da0b02f 100644 --- a/f5lbaasdriver/v2/bigip/neutron_client.py +++ b/f5lbaasdriver/v2/bigip/neutron_client.py @@ -17,7 +17,8 @@ from neutron.extensions import portbindings -from neutron_lib import constants as neutron_const +from neutron.api.v2 import attributes as attrs +from neutron.common import constants as neutron_const from oslo_log import helpers as log_helpers from oslo_log import log as logging @@ -38,7 +39,7 @@ def create_port_on_subnet(self, context, subnet_id=None, port = None if not mac_address: - mac_address = neutron_const.ATTR_NOT_SPECIFIED + mac_address = attrs.ATTR_NOT_SPECIFIED if subnet_id: try: diff --git a/f5lbaasdriver/v2/bigip/plugin_rpc.py b/f5lbaasdriver/v2/bigip/plugin_rpc.py index 3d07a55d..81f1f03f 100644 --- a/f5lbaasdriver/v2/bigip/plugin_rpc.py +++ b/f5lbaasdriver/v2/bigip/plugin_rpc.py @@ -25,7 +25,8 @@ from neutron_lbaas.db.loadbalancer import models from neutron_lbaas.services.loadbalancer import constants as nlb_constant -from neutron_lib import constants as neutron_const +from neutron.api.v2 import attributes as attrs +from neutron.common import constants as neutron_const from oslo_log import helpers as log_helpers from oslo_log import log as logging @@ -512,7 +513,7 @@ def create_port_on_subnet(self, context, subnet_id=None, subnet_id ) if not mac_address: - mac_address = neutron_const.ATTR_NOT_SPECIFIED + mac_address = attrs.ATTR_NOT_SPECIFIED fixed_ip = {'subnet_id': subnet['id']} if fixed_address_count > 1: fixed_ips = [] @@ -680,7 +681,7 @@ def create_port_on_network(self, context, network_id=None, ) if not mac_address: - mac_address = neutron_const.ATTR_NOT_SPECIFIED + mac_address = attrs.ATTR_NOT_SPECIFIED if not host: host = '' if not name: @@ -694,7 +695,7 @@ def create_port_on_network(self, context, network_id=None, 'admin_state_up': True, 'device_owner': 'network:f5lbaasv2', 'status': neutron_const.PORT_STATUS_ACTIVE, - 'fixed_ips': neutron_const.ATTR_NOT_SPECIFIED + 'fixed_ips': attrs.ATTR_NOT_SPECIFIED } if device_id: port_data['device_id'] = device_id From 8a0c9b48da2b8931838531ddfd31e34300e51335 Mon Sep 17 00:00:00 2001 From: Qin Zhao Date: Thu, 1 Nov 2018 14:31:35 +0800 Subject: [PATCH 2/2] Run test with Kilo source --- .travis.yml | 9 +++++++++ f5lbaasdriver/v2/bigip/test/test_driver_v2.py | 2 +- f5lbaasdriver/v2/bigip/test/test_plugin_rpc.py | 2 +- requirements.test.txt | 8 ++++---- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0d47b715..ecb9fa08 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,15 @@ before_install: install: - pip install hacking pytest coverage - pip install -r requirements.test.txt +before_script: +# Workaround +- SITE=$(pip --version | awk '{ print $4 }') +- sed -i "/^VALID = (/i PROCESS = 'process'" ${SITE}/neutron/callbacks/resources.py +- sed -i "/^VALID = (/a PROCESS," ${SITE}/neutron/callbacks/resources.py +- cat ${SITE}/neutron/callbacks/resources.py +- sed -i "/^VALID = (/i AFTER_INIT = 'after_init'" ${SITE}/neutron/callbacks/events.py +- sed -i "/^VALID = (/a AFTER_INIT," ${SITE}/neutron/callbacks/events.py +- cat ${SITE}/neutron/callbacks/events.py script: - flake8 ./f5lbaasdriver - coverage run --source f5lbaasdriver -m py.test f5lbaasdriver/v2/bigip/ diff --git a/f5lbaasdriver/v2/bigip/test/test_driver_v2.py b/f5lbaasdriver/v2/bigip/test/test_driver_v2.py index d8542d1e..087d48a9 100644 --- a/f5lbaasdriver/v2/bigip/test/test_driver_v2.py +++ b/f5lbaasdriver/v2/bigip/test/test_driver_v2.py @@ -23,7 +23,7 @@ class FakeNoEligibleAgentExc(lbaas_agentschedulerv2.NoEligibleLbaasAgent): - msg = 'test exception' + message = 'test exception' class FakeLB(object): diff --git a/f5lbaasdriver/v2/bigip/test/test_plugin_rpc.py b/f5lbaasdriver/v2/bigip/test/test_plugin_rpc.py index deb38c2a..501752cf 100644 --- a/f5lbaasdriver/v2/bigip/test/test_plugin_rpc.py +++ b/f5lbaasdriver/v2/bigip/test/test_plugin_rpc.py @@ -16,7 +16,7 @@ import pytest import neutron.api.v2.attributes -from neutron_lib import constants as neutron_const +from neutron.common import constants as neutron_const import f5lbaasdriver.v2.bigip.plugin_rpc diff --git a/requirements.test.txt b/requirements.test.txt index 340df62c..627a64f3 100644 --- a/requirements.test.txt +++ b/requirements.test.txt @@ -1,7 +1,7 @@ -e . -git+https://github.com/openstack/neutron.git@stable/ocata -git+https://github.com/F5Networks/neutron-lbaas.git@stable/ocata +git+https://github.com/openstack/neutron.git@kilo-eol +git+https://github.com/F5Networks/neutron-lbaas.git@stable/kilo git+https://github.com/F5Networks/pytest-symbols.git git+https://github.com/F5Networks/f5-openstack-test.git@stable/newton @@ -16,10 +16,10 @@ f5-sdk==2.3.3 -c https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/ocata mock==IGNORED # See section comment -pytest==IGNORED # See section comment +pytest==3.0.6 # See section comment decorator==IGNORED # See section comment paramiko==IGNORED # See section comment python-glanceclient==IGNORED python-heatclient==IGNORED -tempest==IGNORED # See section comment +tempest==10.0.0 # See section comment pytest-cov==2.2.1