Browse Source

Changes to be committed:

new file:   .zuul.yaml
	modified:   README.rst
	modified:   doc/source/ReleaseNotes.rst
	modified:   doc/source/conf.py
	modified:   networking_infoblox/ipam/driver.py
	modified:   networking_infoblox/neutron/common/context.py
	modified:   networking_infoblox/neutron/common/ea_manager.py
	modified:   networking_infoblox/neutron/common/grid.py
	modified:   networking_infoblox/neutron/common/keystone_manager.py
	modified:   networking_infoblox/neutron/common/notification.py
	modified:   networking_infoblox/neutron/common/utils.py
	modified:   networking_infoblox/tests/unit/common/test_context.py
	modified:   networking_infoblox/tests/unit/common/test_dns.py
	modified:   networking_infoblox/tests/unit/common/test_ea_manager.py
	modified:   networking_infoblox/tests/unit/common/test_grid.py
	modified:   networking_infoblox/tests/unit/common/test_ip_allocator.py
	modified:   networking_infoblox/tests/unit/common/test_keystone_manager.py
	modified:   networking_infoblox/tests/unit/common/test_mapping.py
	modified:   networking_infoblox/tests/unit/common/test_member.py
	modified:   networking_infoblox/tests/unit/common/test_notification.py
	modified:   networking_infoblox/tests/unit/common/test_notification_handler.py
	modified:   networking_infoblox/tests/unit/common/test_pattern.py
	modified:   networking_infoblox/tests/unit/common/test_utils.py
	modified:   networking_infoblox/tests/unit/db/test_infoblox_db.py
	modified:   networking_infoblox/tests/unit/grid_sync_stub.py
	modified:   networking_infoblox/tests/unit/ipam/test_driver.py
	modified:   networking_infoblox/tests/unit/ipam/test_requests.py
	modified:   networking_infoblox/tools/create_ea_defs.py
	modified:   requirements.txt
	modified:   test-requirements.txt
	deleted:    tools/tox_install.sh
	modified:   tox.ini

 Untracked files:
	bindep.txt

Change-Id: I91cde4d759981f16d937820e8a72b994c55e481c
changes/78/795378/6
rav28 4 months ago
parent
commit
3c630cb990
  1. 4
      .zuul.yaml
  2. 9
      README.rst
  3. 5
      doc/source/ReleaseNotes.rst
  4. 10
      doc/source/conf.py
  5. 6
      networking_infoblox/ipam/driver.py
  6. 2
      networking_infoblox/neutron/common/context.py
  7. 6
      networking_infoblox/neutron/common/ea_manager.py
  8. 2
      networking_infoblox/neutron/common/grid.py
  9. 2
      networking_infoblox/neutron/common/keystone_manager.py
  10. 4
      networking_infoblox/neutron/common/notification.py
  11. 18
      networking_infoblox/neutron/common/utils.py
  12. 2
      networking_infoblox/tests/unit/common/test_context.py
  13. 2
      networking_infoblox/tests/unit/common/test_dns.py
  14. 19
      networking_infoblox/tests/unit/common/test_ea_manager.py
  15. 5
      networking_infoblox/tests/unit/common/test_grid.py
  16. 2
      networking_infoblox/tests/unit/common/test_ip_allocator.py
  17. 3
      networking_infoblox/tests/unit/common/test_ipam.py
  18. 2
      networking_infoblox/tests/unit/common/test_keystone_manager.py
  19. 2
      networking_infoblox/tests/unit/common/test_mapping.py
  20. 3
      networking_infoblox/tests/unit/common/test_member.py
  21. 3
      networking_infoblox/tests/unit/common/test_notification.py
  22. 18
      networking_infoblox/tests/unit/common/test_notification_handler.py
  23. 8
      networking_infoblox/tests/unit/common/test_pattern.py
  24. 3
      networking_infoblox/tests/unit/common/test_utils.py
  25. 8
      networking_infoblox/tests/unit/db/test_infoblox_db.py
  26. 2
      networking_infoblox/tests/unit/grid_sync_stub.py
  27. 3
      networking_infoblox/tests/unit/ipam/test_driver.py
  28. 4
      networking_infoblox/tests/unit/ipam/test_requests.py
  29. 48
      networking_infoblox/tools/create_ea_defs.py
  30. 1
      requirements.txt
  31. 4
      test-requirements.txt
  32. 51
      tools/tox_install.sh
  33. 12
      tox.ini

4
.zuul.yaml

@ -0,0 +1,4 @@
- project:
templates:
- openstack-python36-jobs-neutron
- publish-to-pypi

9
README.rst

@ -4,11 +4,12 @@ networking-infoblox
Contains Neutron drivers for integration with Infoblox grids for IPAM and DNS.
* Free software: Apache license
* Source: http://git.openstack.org/cgit/openstack/networking-infoblox
* Bugs: http://bugs.launchpad.net/networking-infoblox
* Installation: https://github.com/openstack/networking-infoblox/blob/master/doc/source/installation.rst
* Configuration Guide: https://github.com/openstack/networking-infoblox/blob/master/doc/source/configuration_guide.rst
* Installation: https://opendev.org/x/networking-infoblox/src/branch/master/doc/source/installation.rst
* Configuration Guide: https://opendev.org/x/networking-infoblox/src/branch/master/doc/source/configuration_guide.rst
Features
--------
@ -23,7 +24,7 @@ This release of the driver supports:
* Support for GM and CP members and Cloud API
* Flexible mapping of OpenStack entities to network view
* Set EAs to populate the Cloud tab in the Infoblox UI
* Support for Neutron Rocky release (release 14.0.0 of the Driver)
* Support for Neutron Wallaby release (release 19.0.0 of the Driver)
* Authentication:
- Support for keystone v3 configuration:
@ -33,7 +34,7 @@ This release of the driver supports:
- Support for keystone SSL configuration
* Dropped support for OpenStack Ocata
* Dropped support for OpenStack Pike
Overview
--------

5
doc/source/ReleaseNotes.rst

@ -1,7 +1,8 @@
Release Notes
-------------
14.0.0 (2019-07-18)
18.0.0 (2019-07-18)
___________________
* Support for Openstack stable/rocky release
* Support for python2 dropped and refactoring done for python3
* Support for Openstack stable/wallaby release

10
doc/source/conf.py

@ -37,8 +37,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'networking-infoblox'
copyright = u'2015, Infoblox Inc.'
project = 'networking-infoblox'
copyright = '2015, Infoblox Inc.'
# If true, '()' will be appended to :func: etc. cross-reference text.
add_function_parentheses = True
@ -67,9 +67,9 @@ htmlhelp_basename = '%sdoc' % project
latex_documents = [
('index',
'%s.tex' % project,
u'%s Documentation' % project,
u'OpenStack Foundation', 'manual'),
'%s Documentation' % project,
'OpenStack Foundation', 'manual'),
]
# Example configuration for intersphinx: refer to the Python standard library.
#intersphinx_mapping = {'http://docs.python.org/': None}
#intersphinx_mapping = {'http://docs.python.org/': None}

6
networking_infoblox/ipam/driver.py

@ -50,9 +50,11 @@ def catch_ib_client_exception(f):
try:
return f(*args, **kwargs)
except ib_exc.InfobloxException as e:
raise exc.InfobloxClientException(msg=e), None, sys.exc_info()[2]
raise exc.InfobloxClientException(
msg=e).with_traceback(sys.exc_info()[2])
except ValueError as e:
raise exc.InfobloxValueError(msg=e), None, sys.exc_info()[2]
raise exc.InfobloxValueError(msg=e).with_traceback(
sys.exc_info()[2])
return func

2
networking_infoblox/neutron/common/context.py

@ -615,7 +615,7 @@ class InfobloxContext(object):
# find mapping matches on common cases
mapping_filters = self._get_mapping_filters(mapping_attrs)
for mf in mapping_filters:
if mf.values()[0] is None:
if list(mf.values())[0] is None:
continue
matches = utils.find_in_list_by_condition(
mf, self.discovered_mapping_conditions)

6
networking_infoblox/neutron/common/ea_manager.py

@ -102,7 +102,7 @@ def reset_ea_for_network(ib_network):
eas = ib_network.extattrs
ea_dict = eas.to_dict()
map(lambda ea: ea_dict.pop(ea, None), const.NETWORK_EA_LIST)
list(map(lambda ea: ea_dict.pop(ea, None), const.NETWORK_EA_LIST))
ib_network.extattrs = ib_objects.EA.from_dict(ea_dict)
@ -119,7 +119,7 @@ def reset_ea_for_range(ib_range):
eas = ib_range.extattrs
ea_dict = eas.to_dict()
map(lambda ea: ea_dict.pop(ea, None), const.RANGE_EA_LIST)
list(map(lambda ea: ea_dict.pop(ea, None), const.RANGE_EA_LIST))
ib_range.extattrs = ib_objects.EA.from_dict(ea_dict)
@ -182,7 +182,7 @@ def reset_ea_for_zone(ib_zone):
eas = ib_zone.extattrs
ea_dict = eas.to_dict()
map(lambda ea: ea_dict.pop(ea, None), const.ZONE_EA_LIST)
list(map(lambda ea: ea_dict.pop(ea, None), const.ZONE_EA_LIST))
ib_zone.extattrs = ib_objects.EA.from_dict(ea_dict)

2
networking_infoblox/neutron/common/grid.py

@ -299,7 +299,7 @@ class GridConfiguration(object):
return config[0] if config and config[0].get('extattrs') else None
def _set_default_values(self):
for prop, key in self.property_to_ea_mapping.items():
for prop, key in list(self.property_to_ea_mapping.items()):
if key in const.GRID_CONFIG_DEFAULTS:
setattr(self, prop, const.GRID_CONFIG_DEFAULTS[key])

2
networking_infoblox/neutron/common/keystone_manager.py

@ -108,7 +108,7 @@ def update_tenant_mapping(context, networks, tenant_id,
def _get_unknown_ids_from_dict(tenant_ids):
return [id for id, unknown in tenant_ids.items()
return [id for id, unknown in list(tenant_ids.items())
if unknown is True]

4
networking_infoblox/neutron/common/notification.py

@ -83,7 +83,7 @@ class NotificationService(service.Service):
super(NotificationService, self).__init__()
self.report_thread = None
self.event_listener = None
self.executor = "blocking"
self.executor = "threading"
if report_interval:
self.report_interval = report_interval
else:
@ -185,7 +185,7 @@ class NotificationService(service.Service):
def get_notification_listener(transport, targets, endpoints,
allow_requeue=False, pool=None,
executor='blocking'):
executor='threading'):
"""Return a configured oslo_messaging notification listener."""
return oslo_messaging.get_notification_listener(
transport, targets, endpoints, executor=executor,

18
networking_infoblox/neutron/common/utils.py

@ -1,4 +1,4 @@
# Copyright 2015 Infoblox Inc.
# Copyright 2021 Infoblox Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -20,7 +20,10 @@ import netaddr
import re
import six
import time
import urllib
import urllib.error
import urllib.parse
import urllib.request
from oslo_serialization import jsonutils
@ -322,10 +325,11 @@ def find_in_list_by_value(search_value, search_list,
return None
if isinstance(search_list[0], dict):
found_list = [m for m in search_list if search_value in m.values()]
found_list = [m for m in search_list if search_value in list(
m.values())]
else:
found_list = [m for m in search_list
if search_value in m.__dict__.values()]
if search_value in list(m.__dict__.values())]
if first_occurrence_only:
return found_list[0] if found_list else None
@ -371,7 +375,7 @@ def get_hash(text=None):
if text and isinstance(text, six.string_types):
text = text.encode('utf-8')
return hashlib.md5(text).hexdigest()
return hashlib.md5(str(time.time())).hexdigest()
return hashlib.md5(str(time.time()).encode('utf-8')).hexdigest()
def get_oid_from_nios_ref(obj_ref):
@ -396,7 +400,7 @@ def get_network_info_from_nios_ref(network_ref):
if match:
cidr = match.group(3) + '/' + match.group(4)
if match.group(1) == 'ipv6network':
cidr = urllib.unquote(cidr)
cidr = urllib.parse.unquote(cidr)
return {'object_id': match.group(2),
'network_view': match.group(5),
'cidr': cidr}
@ -493,7 +497,7 @@ def get_ipv4_network_prefix(cidr, subnet_name):
if subnet_name and len(subnet_name) > 0:
prefix = subnet_name
else:
prefix = '-'.join(filter(None, re.split(r'[.:/]', cidr)))
prefix = '-'.join([_f for _f in re.split(r'[.:/]', cidr) if _f])
return prefix

2
networking_infoblox/tests/unit/common/test_context.py

@ -16,7 +16,7 @@
import eventlet
eventlet.monkey_patch()
import mock
import unittest.mock as mock
from neutron.tests.unit import testlib_api
from neutron_lib import context

2
networking_infoblox/tests/unit/common/test_dns.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import unittest.mock as mock
from neutron.tests.unit import testlib_api
from neutron_lib import constants as n_const

19
networking_infoblox/tests/unit/common/test_ea_manager.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import unittest.mock as mock
from neutron_lib import constants as n_const
from infoblox_client import objects as ib_objects
@ -137,7 +138,7 @@ class EaManagerTestCase(base.TestCase):
'Cloud API Owned': str(False)}
ea = ea_manager.get_ea_for_network(self.user_id, self.tenant_id,
self.tenant_name, network, subnet)
for key, value in mapping.items():
for key, value in list(mapping.items()):
self.assertEqual(mapping[key], ea.get(key))
def test_get_ea_for_range(self):
@ -163,7 +164,7 @@ class EaManagerTestCase(base.TestCase):
'VM ID': None}
ea = ea_manager.get_default_ea_for_ip(self.user_id, self.tenant_id,
self.tenant_name)
for key, value in expected_ea.items():
for key, value in list(expected_ea.items()):
self.assertEqual(value, ea.get(key))
def test_get_ea_for_ip(self):
@ -185,7 +186,7 @@ class EaManagerTestCase(base.TestCase):
ea = ea_manager.get_ea_for_ip(self.user_id, self.tenant_id,
self.tenant_name, network,
port_id, device_id, device_owner)
for key, value in expected_ea.items():
for key, value in list(expected_ea.items()):
self.assertEqual(value, ea.get(key))
def test_get_ea_for_ip_with_router_gateway_ip(self):
@ -207,7 +208,7 @@ class EaManagerTestCase(base.TestCase):
ea = ea_manager.get_ea_for_ip(self.user_id, self.tenant_id,
self.tenant_name, network,
port_id, device_id, device_owner)
for key, value in expected_ea.items():
for key, value in list(expected_ea.items()):
self.assertEqual(value, ea.get(key))
def test_get_ea_for_ip_with_floatingip_creation(self):
@ -229,7 +230,7 @@ class EaManagerTestCase(base.TestCase):
ea = ea_manager.get_ea_for_ip(self.user_id, self.tenant_id,
self.tenant_name, network, port_id,
device_id, device_owner)
for key, value in expected_ea.items():
for key, value in list(expected_ea.items()):
self.assertEqual(value, ea.get(key))
def test_get_ea_for_ip_with_floatingip_association(self):
@ -253,7 +254,7 @@ class EaManagerTestCase(base.TestCase):
self.tenant_name,
network, port_id, device_id,
device_owner, is_floating_ip)
for key, value in expected_ea.items():
for key, value in list(expected_ea.items()):
self.assertEqual(value, ea.get(key))
def test_get_ea_for_ip_with_floatingip_dissociation(self):
@ -276,7 +277,7 @@ class EaManagerTestCase(base.TestCase):
self.tenant_name,
network, port_id, device_id,
device_owner)
for key, value in expected_ea.items():
for key, value in list(expected_ea.items()):
self.assertEqual(value, ea.get(key))
def test_get_ea_for_zones_without_net(self):
@ -344,7 +345,7 @@ class EaManagerTestCase(base.TestCase):
ea = ea_manager.get_ea_for_forward_zone(self.user_id, self.tenant_id,
self.tenant_name, network,
subnet, template)
expected_ea = {key: value for key, value in verified_ea.items()
expected_ea = {key: value for key, value in list(verified_ea.items())
if key not in skip_eas}
self.assertEqual(expected_ea, ea.ea_dict)

5
networking_infoblox/tests/unit/common/test_grid.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import unittest.mock as mock
from neutron.tests.unit import testlib_api
from neutron_lib import context
@ -229,6 +229,7 @@ class GridTestCase(base.TestCase, testlib_api.SqlTestCase):
def test__set_default_values(self):
# validate that default values are set as member properties
for prop, key in self.test_grid_config.property_to_ea_mapping.items():
for prop, key in list(
self.test_grid_config.property_to_ea_mapping.items()):
self.assertEqual(const.GRID_CONFIG_DEFAULTS[key],
getattr(self.test_grid_config, prop))

2
networking_infoblox/tests/unit/common/test_ip_allocator.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import unittest.mock as mock
from infoblox_client import objects as ib_objects

3
networking_infoblox/tests/unit/common/test_ipam.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import unittest.mock as mock
import netaddr
from neutron.ipam import utils as ipam_utils

2
networking_infoblox/tests/unit/common/test_keystone_manager.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import unittest.mock as mock
from networking_infoblox.neutron.common import keystone_manager

2
networking_infoblox/tests/unit/common/test_mapping.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import unittest.mock as mock
from neutron.tests.unit import testlib_api
from neutron_lib import context

3
networking_infoblox/tests/unit/common/test_member.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import unittest.mock as mock
from oslo_serialization import jsonutils
from neutron.tests.unit import testlib_api

3
networking_infoblox/tests/unit/common/test_notification.py

@ -16,7 +16,8 @@
import eventlet
eventlet.monkey_patch()
import mock
import unittest.mock as mock
import time
from neutron.tests.unit import testlib_api

18
networking_infoblox/tests/unit/common/test_notification_handler.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import unittest.mock as mock
from infoblox_client import objects as ib_objects
@ -187,15 +187,15 @@ class TestIpamEventHandler(base.TestCase):
self.plugin.get_subnet.assert_not_called()
def _prepare_context(self):
message_context = {'project_name': u'admin',
'user_id': u'9510723b6555473cb735ce6640e680cb',
message_context = {'project_name': 'admin',
'user_id': '9510723b6555473cb735ce6640e680cb',
'show_deleted': False,
'roles': [u'admin'],
'tenant_name': u'admin',
'auth_token': u'dd7257d2e02f41c2908ffdc197af9061',
'tenant_id': u'bf0806763e32436bbdb8fd9b6ebfac93',
'tenant': u'bf0806763e32436bbdb8fd9b6ebfac93',
'user_name': u'admin'}
'roles': ['admin'],
'tenant_name': 'admin',
'auth_token': 'dd7257d2e02f41c2908ffdc197af9061',
'tenant_id': 'bf0806763e32436bbdb8fd9b6ebfac93',
'tenant': 'bf0806763e32436bbdb8fd9b6ebfac93',
'user_name': 'admin'}
self.ipam_handler.ctxt = message_context
def test_create_network_sync_same_tenant(self):

8
networking_infoblox/tests/unit/common/test_pattern.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import unittest.mock as mock
from neutron_lib import constants as n_const
@ -107,7 +107,8 @@ class TestPatternBuilder(base.TestCase):
external=True)
def test_get_hostname_for_other_device_owners(self):
for dev, patt in const.NEUTRON_DEVICE_OWNER_TO_PATTERN_MAP.items():
for dev, patt in list(
const.NEUTRON_DEVICE_OWNER_TO_PATTERN_MAP.items()):
expected_hostname = str.format(
"{}.{}", patt.replace('{ip_address}',
self.expected_ip),
@ -121,7 +122,8 @@ class TestPatternBuilder(base.TestCase):
'{instance_name}')
self.pattern_builder.grid_config.external_domain_name_pattern = (
'external.infoblox.com')
for dev, patt in const.NEUTRON_DEVICE_OWNER_TO_PATTERN_MAP.items():
for dev, patt in list(
const.NEUTRON_DEVICE_OWNER_TO_PATTERN_MAP.items()):
expected_hostname = str.format(
"{}.{}", patt.replace('{ip_address}',
self.expected_ip),

3
networking_infoblox/tests/unit/common/test_utils.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
import netaddr
import six

8
networking_infoblox/tests/unit/db/test_infoblox_db.py

@ -37,7 +37,7 @@ class InfobloxDbTestCase(testlib_api.SqlTestCase):
self.grid_status = "ON"
def _create_tenants(self, tenants):
for id, name in tenants.items():
for id, name in list(tenants.items()):
infoblox_db.add_tenant(self.ctx.session, id, name)
def test_add_and_get_tenant(self):
@ -310,7 +310,7 @@ class InfobloxDbTestCase(testlib_api.SqlTestCase):
db_network_views = infoblox_db.get_network_views(self.ctx.session)
actual_rows = utils.get_values_from_records('network_view',
db_network_views)
self.assertEqual(netview_dict.keys(), actual_rows)
self.assertEqual(list(netview_dict.keys()), actual_rows)
# test network view removals
# - remove 'hs-view-1', 'hs-view-2'
@ -870,7 +870,7 @@ class InfobloxDbTestCase(testlib_api.SqlTestCase):
self.assertIsNone(m2m_dhcp_member)
def _create_instances(self, instances):
for id, name in instances.items():
for id, name in list(instances.items()):
infoblox_db.add_instance(self.ctx.session, id, name)
def test_add_and_get_instance(self):
@ -903,7 +903,7 @@ class InfobloxDbTestCase(testlib_api.SqlTestCase):
self.assertEqual('instance-name2', instance.instance_name)
def _create_networks(self, networks):
for id, name in networks.items():
for id, name in list(networks.items()):
infoblox_db.add_network(self.ctx.session, id, name)
def test_add_and_get_network(self):

2
networking_infoblox/tests/unit/grid_sync_stub.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import unittest.mock as mock
from oslo_config import cfg

3
networking_infoblox/tests/unit/ipam/test_driver.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import unittest.mock as mock
import netaddr
from infoblox_client import exceptions as ib_exc

4
networking_infoblox/tests/unit/ipam/test_requests.py

@ -13,8 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import unittest.mock as mock
import netaddr
from neutron_lib import constants as n_const
from networking_infoblox.ipam import requests

48
networking_infoblox/tools/create_ea_defs.py

@ -98,7 +98,7 @@ def get_credentias():
print("privilege, just hit <ENTER> when prompted for user name.\n")
print("Otherwise, please enter user name and password of a user that "
"has superuser privilege.\n")
username = raw_input("Enter user name: ")
username = input("Enter user name: ")
if len(username) > 0:
password = getpass.getpass("Enter password: ")
credentials = {'username': username, 'password': password}
@ -108,7 +108,7 @@ def get_credentias():
def create_ea_defs(grid_id):
print("\nCreating EA definitions...")
print("-" * PRINT_LINE)
print(("-" * PRINT_LINE))
print("")
credentials = get_credentias()
@ -123,8 +123,8 @@ def create_ea_defs(grid_id):
ea_defs_created = mgr.create_required_ea_definitions(
const.REQUIRED_EA_DEFS, reraise=True)
if ea_defs_created:
print("The following EA Definitions have been created: '%s'" %
[ea_def['name'] for ea_def in ea_defs_created])
print(("The following EA Definitions have been created: '%s'" %
[ea_def['name'] for ea_def in ea_defs_created]))
else:
print("All the EAs has been already created.")
print("\n")
@ -139,19 +139,19 @@ def create_ea_defs(grid_id):
exit(1)
print("Adding grid configuration EAs to the grid master...")
print("-" * PRINT_LINE)
print(("-" * PRINT_LINE))
print("")
ea_set = {}
if member.extattrs is None:
member.extattrs = objects.EA({})
for ea, val in const.GRID_CONFIG_DEFAULTS.items():
for ea, val in list(const.GRID_CONFIG_DEFAULTS.items()):
if (member.extattrs.get(ea) is None and
not (val is None or val == [])):
ea_set[ea] = val
member.extattrs.set(ea, val)
if ea_set:
print("Grid configurations: '%s'" % ea_set)
print(("Grid configurations: '%s'" % ea_set))
member.update()
else:
print("All the grid configurations have been already added.")
@ -160,7 +160,7 @@ def create_ea_defs(grid_id):
def participate_network_views(grid_id):
print("Associating/Unassociating network views for OpenStack...")
print("-" * PRINT_LINE)
print(("-" * PRINT_LINE))
print("")
netview_input = None
@ -178,7 +178,7 @@ def participate_network_views(grid_id):
return
netview_names = [ib_netview.name for ib_netview in ib_netviews]
print("Found %s network views from the grid.\n" % len(netview_names))
print(("Found %s network views from the grid.\n" % len(netview_names)))
operation = 'ASSOCIATION'
if not netview_input and not cfg.CONF.script:
@ -193,10 +193,10 @@ def participate_network_views(grid_id):
question = "Do you want to list network views?"
choice = ask_question(question, expected_answers_yes_no)
if choice == 'y':
print(', '.join(netview_names))
print((', '.join(netview_names)))
print("")
question = "Please provide a comma separated list of network views: "
netview_input = raw_input(question)
netview_input = input(question)
if (not netview_input or
not isinstance(netview_input, six.string_types)):
@ -219,7 +219,7 @@ def participate_network_views(grid_id):
ib_netview_found = [ib_net for ib_net in ib_netviews
if ib_net.name == nv]
if not ib_netview_found:
print("'%s' is not found." % nv)
print(("'%s' is not found." % nv))
continue
ib_netview = ib_netview_found[0]
@ -237,7 +237,7 @@ def participate_network_views(grid_id):
found_ids = [id for id in cloud_adapter_ids
if id == grid_id_str]
if found_ids:
print("'%s' already associated." % nv)
print(("'%s' already associated." % nv))
continue
cloud_adapter_ids.append(grid_id_str)
@ -250,15 +250,15 @@ def participate_network_views(grid_id):
ib_netview.update()
except ib_ex.InfobloxCannotUpdateObject as e:
if 'Write permission' in e.msg:
print("'%s' has no write permission." % nv)
print(("'%s' has no write permission." % nv))
continue
else:
print("'%s' failed to associate: %s" % (nv, e.msg))
print(("'%s' failed to associate: %s" % (nv, e.msg)))
continue
print("'%s' is now associated." % nv)
print(("'%s' is now associated." % nv))
else:
if ib_netview.extattrs is None:
print("'%s' not associated." % nv)
print(("'%s' not associated." % nv))
continue
cloud_adapter_ids = ib_netview.extattrs.get(
@ -277,17 +277,17 @@ def participate_network_views(grid_id):
ib_netview.update()
except ib_ex.InfobloxCannotUpdateObject as e:
if 'Write permission' in e.msg:
print("'%s' has no write permission." % nv)
print(("'%s' has no write permission." % nv))
continue
else:
print("'%s' failed to unassociated: %s" %
(nv, e.msg))
print(("'%s' failed to unassociated: %s" %
(nv, e.msg)))
continue
print("'%s' is now unassociated." % nv)
print(("'%s' is now unassociated." % nv))
else:
print("'%s' not associated." % nv)
print(("'%s' not associated." % nv))
else:
print("'%s' not associated." % nv)
print(("'%s' not associated." % nv))
print("\n")
@ -297,7 +297,7 @@ def ask_question(question, expected_answers):
prompt_choice = " or ".join(prompt_choice)
while True:
choice = raw_input("%s Enter %s: " % (question, prompt_choice))
choice = input("%s Enter %s: " % (question, prompt_choice))
if choice not in expected_answers:
print("Enter a valid choice. Please try again.\n")
continue

1
requirements.txt

@ -4,3 +4,4 @@
Babel>=1.3
infoblox-client==0.4.21
neutron>=12.0.0

4
test-requirements.txt

@ -6,9 +6,9 @@ hacking<0.11,>=0.10.0
coverage>=3.6
discover
kombu<4.0.0
kombu
python-subunit>=0.0.18
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
sphinx
oslosphinx>=2.2.0 # Apache-2.0
oslotest>=1.2.0 # Apache-2.0
testrepository>=0.0.18

51
tools/tox_install.sh

@ -1,51 +0,0 @@
#!/bin/sh
# Many of neutron's repos suffer from the problem of depending on neutron,
# but it not existing on pypi.
# This wrapper for tox's package installer will use the existing package
# if it exists, else use zuul-cloner if that program exists, else grab it
# from neutron master via a hard-coded URL. That last case should only
# happen with devs running unit tests locally.
# From the tox.ini config page:
# install_command=ARGV
# default:
# pip install {opts} {packages}
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
UPPER_CONSTRAINTS_FILE=${UPPER_CONSTRAINTS_FILE:-unconstrained}
neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?)
install_cmd="pip install"
if [ "$UPPER_CONSTRAINTS_FILE" != "unconstrained" ]; then
install_cmd="$install_cmd -c$UPPER_CONSTRAINTS_FILE"
fi
set -ex
cwd=$(/bin/pwd)
if [ $neutron_installed -eq 0 ]; then
echo "ALREADY INSTALLED" > /tmp/tox_install.txt
echo "Neutron already installed; using existing package"
elif [ -x "$ZUUL_CLONER" ]; then
echo "ZUUL CLONER" > /tmp/tox_install.txt
cd /tmp
$ZUUL_CLONER --cache-dir \
/opt/git \
--branch $BRANCH_NAME \
https://git.openstack.org \
openstack/neutron
cd openstack/neutron
$install_cmd -e .
cd "$cwd"
else
echo "PIP HARDCODE" > /tmp/tox_install.txt
$install_cmd -U -egit+https://git.openstack.org/openstack/neutron@$BRANCH_NAME#egg=neutron
$install_cmd -U -e $VIRTUAL_ENV/src/neutron
fi
$install_cmd -U $*
exit $?

12
tox.ini

@ -1,18 +1,16 @@
[tox]
minversion = 1.6
envlist = py27,py34,pep8
minversion = 2.0
envlist = py36,pep8
skipsdist = True
[testenv]
usedevelop = True
install_command = {toxinidir}/tools/tox_install.sh {opts} {packages}
install_command = pip install {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
UPPER_CONSTRAINTS_FILE=https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/rocky
BRANCH_NAME=stable/rocky
deps = -r{toxinidir}/requirements.txt
deps = -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/wallaby}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = python setup.py test --slowest --testr-args='{posargs}'

Loading…
Cancel
Save