Add support for Wallaby

Add support for wallaby.
Below were the extra changes needed to support
the wallaby branch:
1. Add new attribute 'remote_address_group_id'
for the security group resource.
2. Handle new standard_attr_id argument for resources.
3. Fix kwargs passed to the alembic migrations
create_foreign_key and create_primary_key.
4. Change CONTEXT_WRITER to CONTEXT_READER in the
get_subnets function.

Change-Id: I3835df151cad2f7ca52afcb701de2bc508c90014
This commit is contained in:
Sayali Naval
2021-06-15 14:34:18 -07:00
parent b18fd4eebd
commit 76d9efb688
23 changed files with 79 additions and 58 deletions

View File

@@ -1,7 +1,7 @@
- project:
name: x/group-based-policy
templates:
- openstack-python3-victoria-jobs
- openstack-python3-wallaby-jobs
- publish-to-pypi
# REVISIT: In the jobs below, the required-projects clause is needed on
# the master branch to select the correct version of the requirements
@@ -15,22 +15,22 @@
nodeset: ubuntu-bionic
required-projects:
- name: openstack/requirements
override-checkout: stable/victoria
override-checkout: stable/wallaby
- openstack-tox-py36:
nodeset: ubuntu-bionic
required-projects:
- name: openstack/requirements
override-checkout: stable/victoria
override-checkout: stable/wallaby
- openstack-tox-py37:
nodeset: ubuntu-bionic
required-projects:
- name: openstack/requirements
override-checkout: stable/victoria
override-checkout: stable/wallaby
- openstack-tox-py38:
nodeset: ubuntu-bionic
required-projects:
- name: openstack/requirements
override-checkout: stable/victoria
override-checkout: stable/wallaby
- legacy-group-based-policy-dsvm-functional:
voting: false
- legacy-group-based-policy-dsvm-aim:
@@ -43,19 +43,19 @@
nodeset: ubuntu-bionic
required-projects:
- name: openstack/requirements
override-checkout: stable/victoria
override-checkout: stable/wallaby
- openstack-tox-py36:
nodeset: ubuntu-bionic
required-projects:
- name: openstack/requirements
override-checkout: stable/victoria
override-checkout: stable/wallaby
- openstack-tox-py37:
nodeset: ubuntu-bionic
required-projects:
- name: openstack/requirements
override-checkout: stable/victoria
override-checkout: stable/wallaby
- openstack-tox-py38:
nodeset: ubuntu-bionic
required-projects:
- name: openstack/requirements
override-checkout: stable/victoria
override-checkout: stable/wallaby

View File

@@ -25,7 +25,7 @@ NEUTRON_CONF_DIR=/etc/neutron
NEUTRON_CONF=$NEUTRON_CONF_DIR/neutron.conf
NFP_CONF_DIR=/etc/nfp
DISKIMAGE_CREATE_DIR=$NFPSERVICE_DIR/gbpservice/contrib/nfp/tools/image_builder
NEUTRON_SRC_BRANCH_FOR_NFP_CONTROLLER=stable/victoria
NEUTRON_SRC_BRANCH_FOR_NFP_CONTROLLER=stable/wallaby
# Save trace setting
XTRACE=$(set +o | grep xtrace)

View File

@@ -43,11 +43,11 @@ if [[ $ENABLE_NFP = True ]]; then
# Make sure that your public interface is not attached to any bridge.
PUBLIC_INTERFACE=
enable_plugin neutron-fwaas http://opendev.org/openstack/neutron-fwaas.git stable/victoria
enable_plugin neutron-lbaas https://opendev.org/openstack/neutron-lbaas.git stable/victoria
enable_plugin neutron https://opendev.org/openstack/neutron.git stable/victoria
enable_plugin neutron-vpnaas https://opendev.org/openstack/neutron-vpnaas.git stable/victoria
enable_plugin octavia https://opendev.org/openstack/octavia.git stable/victoria
enable_plugin neutron-fwaas http://opendev.org/openstack/neutron-fwaas.git stable/wallaby
enable_plugin neutron-lbaas https://opendev.org/openstack/neutron-lbaas.git stable/wallaby
enable_plugin neutron https://opendev.org/openstack/neutron.git stable/wallaby
enable_plugin neutron-vpnaas https://opendev.org/openstack/neutron-vpnaas.git stable/wallaby
enable_plugin octavia https://opendev.org/openstack/octavia.git stable/wallaby
fi
fi

View File

@@ -155,11 +155,15 @@ class LocalAPI(object):
def _get_resource(self, plugin, context, resource, resource_id):
obj_getter = getattr(plugin, 'get_' + resource)
obj = obj_getter(context, resource_id)
if 'standard_attr_id' in obj:
del obj['standard_attr_id']
return obj
def _get_resources(self, plugin, context, resource_plural, filters=None):
obj_getter = getattr(plugin, 'get_' + resource_plural)
obj = obj_getter(context, filters)
if 'standard_attr_id' in obj:
del obj['standard_attr_id']
return obj
# The following methods perform the necessary subset of

View File

@@ -78,9 +78,10 @@ def upgrade():
)
op.create_unique_constraint(None, 'gp_policy_targets', ['port_id'])
op.create_foreign_key('gp_policy_targets_ibfk_2',
source='gp_policy_targets', referent='ports',
local_cols=['port_id'], remote_cols=['id'],
ondelete='SET NULL')
source_table='gp_policy_targets',
referent_table='ports',
local_cols=['port_id'],
remote_cols=['id'], ondelete='SET NULL')
op.add_column(
'gp_l2_policies',
@@ -88,8 +89,10 @@ def upgrade():
)
op.create_unique_constraint(None, 'gp_l2_policies', ['network_id'])
op.create_foreign_key('gp_l2_policies_ibfk_2',
source='gp_l2_policies', referent='networks',
local_cols=['network_id'], remote_cols=['id'])
source_table='gp_l2_policies',
referent_table='networks',
local_cols=['network_id'],
remote_cols=['id'])
def downgrade():

View File

@@ -62,8 +62,8 @@ def upgrade():
['network_service_policy_id'])
op.create_foreign_key('gp_policy_target_groups_ibfk_nsp',
source='gp_policy_target_groups',
referent='gp_network_service_policies',
source_table='gp_policy_target_groups',
referent_table='gp_network_service_policies',
local_cols=['network_service_policy_id'],
remote_cols=['id'], ondelete='CASCADE')

View File

@@ -40,7 +40,8 @@ def upgrade():
)
op.create_unique_constraint(None, 'gp_external_segments', ['subnet_id'])
op.create_foreign_key('gp_external_segment_ibfk_2',
source='gp_external_segments', referent='subnets',
source_table='gp_external_segments',
referent_table='subnets',
local_cols=['subnet_id'], remote_cols=['id'])

View File

@@ -40,7 +40,8 @@ def upgrade():
)
op.create_unique_constraint(None, 'gp_nat_pools', ['subnet_id'])
op.create_foreign_key('gp_nat_pool_ibfk_2',
source='gp_nat_pools', referent='subnets',
source_table='gp_nat_pools',
referent_table='subnets',
local_cols=['subnet_id'], remote_cols=['id'])

View File

@@ -43,8 +43,9 @@ def upgrade():
sa.Column('service_profile_id', sa.String(36), nullable=True)
)
op.create_foreign_key('sc_nodes_ibfk_profile', source='sc_nodes',
referent='service_profiles',
op.create_foreign_key('sc_nodes_ibfk_profile',
source_table='sc_nodes',
referent_table='service_profiles',
local_cols=['service_profile_id'],
remote_cols=['id'])

View File

@@ -40,8 +40,8 @@ def upgrade(active_plugins=None, options=None):
'unique')
break
op.create_foreign_key('gp_policy_target_groups_ibfk_nsp',
source='gp_policy_target_groups',
referent='gp_network_service_policies',
source_table='gp_policy_target_groups',
referent_table='gp_network_service_policies',
local_cols=['network_service_policy_id'],
remote_cols=['id'])
with migration.remove_fks_from_table(
@@ -53,9 +53,9 @@ def upgrade(active_plugins=None, options=None):
table_name='gpm_service_policy_ipaddress_mappings',
type_='primary')
op.create_primary_key(
name='pk_policytargetgroup_servicepolicyid',
constraint_name='pk_policytargetgroup_servicepolicyid',
table_name='gpm_service_policy_ipaddress_mappings',
cols=['policy_target_group', 'service_policy_id'])
columns=['policy_target_group', 'service_policy_id'])
def downgrade(active_plugins=None, options=None):

View File

@@ -45,8 +45,8 @@ def upgrade():
nullable=True))
op.create_foreign_key('gp_application_policy_group_ibfk_1',
source='gp_policy_target_groups',
referent='gp_application_policy_groups',
source_table='gp_policy_target_groups',
referent_table='gp_application_policy_groups',
local_cols=['application_policy_group_id'],
remote_cols=['id'])

View File

@@ -65,11 +65,13 @@ def upgrade():
op.create_unique_constraint('gpm_l3p_addr_scope_v6_uq',
'gp_l3_policies', ['address_scope_v6_id'])
op.create_foreign_key('gpm_l3p_addr_scope_v4_fk',
source='gp_l3_policies', referent='address_scopes',
source_table='gp_l3_policies',
referent_table='address_scopes',
local_cols=['address_scope_v4_id'],
remote_cols=['id'])
op.create_foreign_key('gpm_l3p_addr_scope_v6_fk',
source='gp_l3_policies', referent='address_scopes',
source_table='gp_l3_policies',
referent_table='address_scopes',
local_cols=['address_scope_v6_id'],
remote_cols=['id'])

View File

@@ -4761,6 +4761,10 @@ class ApicMechanismDriver(api_plus.MechanismDriver,
port = self.plugin.get_port(plugin_context.elevated(), port_id)
if self._is_port_bound(port):
LOG.debug("Enqueing notify for port %s", port['id'])
# REVISIT: Check to see if the standard_attr_id
# should be leveraged by the plugin.
if 'standard_attr_id' in port:
del port['standard_attr_id']
self.notifier.port_update(plugin_context, port)
def _notify_port_update_for_fip(self, plugin_context, port_id):

View File

@@ -637,7 +637,7 @@ class Ml2PlusPlugin(ml2_plugin.Ml2Plugin,
sorts=None, limit=None, marker=None,
page_reverse=False):
with db_api.CONTEXT_WRITER.using(context):
with db_api.CONTEXT_READER.using(context):
plugin = directory.get_plugin()
marker_obj = db_api.get_marker_obj(plugin, context,
'subnet', limit, marker)

View File

@@ -252,7 +252,8 @@ class ImplicitResourceOperations(local_api.LocalAPI,
'port_range_min': port_min,
'port_range_max': port_max,
'remote_ip_prefix': cidr,
'remote_group_id': None}
'remote_group_id': None,
'remote_address_group_id': None}
filters = {}
for key in attrs:
value = attrs[key]

View File

@@ -2154,6 +2154,8 @@ class TestL2PolicyWithAutoPTG(TestL2PolicyBase):
policy_target_group_id=ptg['id'])['policy_target']
self._bind_port_to_host(pt['port_id'], 'h1')
port = self._plugin.get_port(self._context, pt['port_id'])
if 'standard_attr_id' in port:
del port['standard_attr_id']
mapping = self.mech_driver.get_gbp_details(
self._neutron_admin_context, device='tap%s' % pt['port_id'],
host='h1')
@@ -3007,6 +3009,8 @@ class TestPolicyTarget(AIMBaseTestCase,
segmentation_labels=segmentation_labels)['policy_target']
self.assertItemsEqual(segmentation_labels, pt['segmentation_labels'])
port = self._plugin.get_port(self._context, pt['port_id'])
if 'standard_attr_id' in port:
del port['standard_attr_id']
mock_notif.assert_called_once_with(mock.ANY, port)
mock_notif.reset_mock()
pt = self.update_policy_target(

View File

@@ -5251,7 +5251,7 @@ class TestNatPool(ResourceMappingTestCase):
def test_delete_with_fip_allocated(self):
with self.network(router__external=True) as net:
with self.subnet(cidr='192.168.0.0/31', enable_dhcp=False,
with self.subnet(cidr='192.168.0.0/30', enable_dhcp=False,
network=net) as sub:
es = self.create_external_segment(
name="default",

View File

@@ -13,11 +13,11 @@ SKIP_EXERCISES=volumes,trove,swift,sahara,euca,bundle,boot_from_volume,aggregate
enable_plugin group-based-policy https://opendev.org/x/group-based-policy.git master
enable_plugin networking-sfc https://opendev.org/openstack/networking-sfc.git stable/victoria
enable_plugin networking-sfc https://opendev.org/openstack/networking-sfc.git stable/wallaby
ENABLE_APIC_AIM_GATE=True
AIM_BRANCH=master
OPFLEX_BRANCH=stable/victoria
OPFLEX_BRANCH=stable/wallaby
APICAPI_BRANCH=master
ACITOOLKIT_BRANCH=noiro-lite

View File

@@ -20,7 +20,7 @@ GBPSERVICE_BRANCH=master
#GBPSERVICE_BRANCH=refs/changes/85/298385/154
GBPCLIENT_REPO=${GIT_BASE}/x/python-group-based-policy-client.git
GBPCLIENT_BRANCH=stable/victoria
GBPCLIENT_BRANCH=stable/wallaby
GBPUI_REPO=${GIT_BASE}/x/group-based-policy-ui.git
GBPUI_BRANCH=master
@@ -43,13 +43,13 @@ enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_plugin neutron-fwaas https://opendev.org/openstack/neutron-fwaas.git stable/victoria
enable_plugin neutron-lbaas https://opendev.org/openstack/neutron-lbaas.git stable/victoria
enable_plugin neutron https://opendev.org/openstack/neutron.git stable/victoria
enable_plugin neutron-fwaas https://opendev.org/openstack/neutron-fwaas.git stable/wallaby
enable_plugin neutron-lbaas https://opendev.org/openstack/neutron-lbaas.git stable/wallaby
enable_plugin neutron https://opendev.org/openstack/neutron.git stable/wallaby
#ENBALE OCTAVIA
enable_plugin octavia https://opendev.org/openstack/octavia stable/victoria
enable_plugin octavia https://opendev.org/openstack/octavia stable/wallaby
#ENABLED_SERVICES+=,octavia,o-cw,o-hk,o-hm,o-api
enable_service q-fwaas-v1

View File

@@ -20,7 +20,7 @@ GBPSERVICE_BRANCH=master
#GBPSERVICE_BRANCH=refs/changes/54/240954/47
GBPCLIENT_REPO=${GIT_BASE}/x/python-group-based-policy-client.git
GBPCLIENT_BRANCH=stable/victoria
GBPCLIENT_BRANCH=stable/wallaby
GBPUI_REPO=${GIT_BASE}/x/group-based-policy-ui.git
GBPUI_BRANCH=master

View File

@@ -16,7 +16,7 @@ XTRACE=$(set +o | grep xtrace)
function prepare_gbp_devstack_pre {
cd $TOP_DIR
sudo git checkout stable/victoria
sudo git checkout stable/wallaby
sudo sed -i 's/DEST=\/opt\/stack/DEST=\/opt\/stack\/new/g' $TOP_DIR/stackrc
sudo sed -i 's/source $TOP_DIR\/lib\/neutron/source $TOP_DIR\/lib\/neutron\nsource $TOP_DIR\/lib\/neutron-legacy/g' $TOP_DIR/stack.sh
}
@@ -25,15 +25,15 @@ function prepare_gbp_devstack_post {
# The following should updated when master moves to a new release
# We need to do the following since the infra job clones these repos and
# checks out the master branch (as this is the master branch) and later
# does not switch to the stable/victoria branch when installing devstack
# does not switch to the stable/wallaby branch when installing devstack
# since the repo is already present.
# This can be worked around by changing the job description in
# project-config to set BRANCH_OVERRIDE to use the stable/victoria branch
sudo git --git-dir=/opt/stack/new/neutron/.git --work-tree=/opt/stack/new/neutron checkout stable/victoria
sudo git --git-dir=/opt/stack/new/nova/.git --work-tree=/opt/stack/new/nova checkout stable/victoria
sudo git --git-dir=/opt/stack/new/keystone/.git --work-tree=/opt/stack/new/keystone checkout stable/victoria
sudo git --git-dir=/opt/stack/new/cinder/.git --work-tree=/opt/stack/new/cinder checkout stable/victoria
sudo git --git-dir=/opt/stack/new/requirements/.git --work-tree=/opt/stack/new/requirements checkout stable/victoria
# project-config to set BRANCH_OVERRIDE to use the stable/wallaby branch
sudo git --git-dir=/opt/stack/new/neutron/.git --work-tree=/opt/stack/new/neutron checkout stable/wallaby
sudo git --git-dir=/opt/stack/new/nova/.git --work-tree=/opt/stack/new/nova checkout stable/wallaby
sudo git --git-dir=/opt/stack/new/keystone/.git --work-tree=/opt/stack/new/keystone checkout stable/wallaby
sudo git --git-dir=/opt/stack/new/cinder/.git --work-tree=/opt/stack/new/cinder checkout stable/wallaby
sudo git --git-dir=/opt/stack/new/requirements/.git --work-tree=/opt/stack/new/requirements checkout stable/wallaby
source $TOP_DIR/functions
source $TOP_DIR/functions-common

View File

@@ -4,19 +4,19 @@
hacking>=1.1.0,<1.2.0 # Apache-2.0
# Since version numbers for these are specified in
# https://releases.openstack.org/constraints/upper/victoria, they cannot be
# https://releases.openstack.org/constraints/upper/wallaby, they cannot be
# referenced as GIT URLs.
neutron
python-heatclient
python-keystoneclient
-e git+https://opendev.org/openstack/networking-sfc.git@stable/victoria#egg=networking-sfc
-e git+https://opendev.org/openstack/networking-sfc.git@stable/wallaby#egg=networking-sfc
-e git+https://github.com/noironetworks/apicapi.git@master#egg=apicapi
-e git+https://github.com/noironetworks/python-opflex-agent.git@stable/victoria#egg=neutron-opflex-agent
-e git+https://github.com/noironetworks/python-opflex-agent.git@stable/wallaby#egg=neutron-opflex-agent
-e git+https://opendev.org/x/python-group-based-policy-client.git@stable/victoria#egg=python-group-based-policy-client
-e git+https://opendev.org/x/python-group-based-policy-client.git@stable/wallaby#egg=python-group-based-policy-client
coverage!=4.4,>=4.0 # Apache-2.0
flake8-import-order==0.12 # LGPLv3

View File

@@ -16,7 +16,7 @@ usedevelop = True
install_command =
pip install {opts} {packages}
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/victoria}
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/wallaby}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
whitelist_externals = sh