Skip to content

Synchronise master with upstream #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: stackhpc/master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion devstack/plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,13 @@ function configure_generic_switch {
done
fi
fi
# NOTE(TheJulia): This is not respected presently with uwsgi launched
# neutron as it auto-identifies it's configuration files.
neutron_server_config_add $GENERIC_SWITCH_INI_FILE

if [ -f /etc/neutron/neutron-api-uwsgi.ini ]; then
iniset -sudo /etc/neutron/neutron-api-uwsgi.ini uwsgi env OS_NEUTRON_CONFIG_FILES='/etc/neutron/neutron.conf;/etc/neutron/plugins/ml2/ml2_conf.ini;/etc/neutron/plugins/ml2/ml2_conf_genericswitch.ini'
fi
}

function add_generic_switch_to_ml2_config {
Expand Down Expand Up @@ -241,6 +246,26 @@ function ngs_configure_tempest {
fi
}

function ngs_restart_neutron {
echo_summary "NGS doing required neutron restart. Stopping neutron."
# NOTE(JayF) In practice restarting OVN causes problems, I'm not sure why.
# This avoids the restart.
local existing_skip_stop_ovn
SKIP_STOP_OVN=True
# We are changing the base config, and need ot restart the neutron services
stop_neutron
# NOTE(JayF): Neutron services are initialized in a particular order, this appears to
# match that order as currently defined in stack.sh (2025-05-22).
# TODO(JayF): Introduce a function in upstream devstack that documents this order so
# ironic won't break anytime initialization steps are rearranged.
echo_summary "NGS starting neutron service"
start_neutron_service_and_check
echo_summary "NGS started neutron service, now launch neutron agents"
start_neutron
echo_summary "NGS required neutron restart completed."
SKIP_STOP_OVN=False
}

# check for service enabled
if is_service_enabled generic_switch; then

Expand All @@ -250,7 +275,7 @@ if is_service_enabled generic_switch; then
install_generic_switch

elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
# Configure after the other layer 1 and 2 services have been configured
# Configure after the other layer 1 and 2 services have been started
echo_summary "Configuring Generic_switch ML2"

# Source ml2 plugin, set default config
Expand All @@ -262,7 +287,22 @@ if is_service_enabled generic_switch; then
Q_PLUGIN_CLASS="ml2"
fi

# TODO(JayF): This currently relies on winning a race, as many of the
# files modified by this method are created during this
# phase. In practice it works, but moving forward we likely
# need a supported-by-devstack/neutron-upstream method to
# ensure this is done at the right moment.
configure_generic_switch

if is_service_enabled neutron; then
# TODO(JayF): Similarly, we'd like to restart neutron to ensure
# our config changes have taken effect; we can't do
# that reliably here because it may not be fully
# configured, and extra phase is too late.
echo_summary "Skipping ngs_restart_neutron"
#ngs_restart_neutron
fi

elif [[ "$1" == "stack" && "$2" == "test-config" ]]; then
if is_service_enabled tempest; then
echo_summary "Configuring Tempest NGS"
Expand Down
121 changes: 66 additions & 55 deletions doc/source/dev/dev-quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,36 @@ Switch to the stack user and clone DevStack::
git clone https://github.com/openstack-dev/devstack.git devstack

Create devstack/local.conf with minimal settings required to enable
Networking-generic-switch. Here is and example of local.conf::

[[local|localrc]]
# Set credentials
ADMIN_PASSWORD=secrete
DATABASE_PASSWORD=secrete
RABBIT_PASSWORD=secrete
SERVICE_PASSWORD=secrete
SERVICE_TOKEN=secrete

# Enable minimal required services
ENABLED_SERVICES="dstat,mysql,rabbit,key,q-svc,q-agt,q-dhcp"

# Enable networking-generic-switch plugin
enable_plugin networking-generic-switch https://review.openstack.org/openstack/networking-generic-switch

# Configure Neutron
OVS_PHYSICAL_BRIDGE=brbm
PHYSICAL_NETWORK=mynetwork
Q_PLUGIN=ml2
ENABLE_TENANT_VLANS=True
Q_ML2_TENANT_NETWORK_TYPE=vlan
TENANT_VLAN_RANGE=100:150

# Configure logging
LOGFILE=$HOME/devstack.log
LOGDIR=$HOME/logs
Networking-generic-switch. Here is an example of local.conf:


.. code-block:: ini

[[local|localrc]]
# Set credentials
ADMIN_PASSWORD=secrete
DATABASE_PASSWORD=secrete
RABBIT_PASSWORD=secrete
SERVICE_PASSWORD=secrete
SERVICE_TOKEN=secrete

# Enable minimal required services
ENABLED_SERVICES="dstat,mysql,rabbit,key,q-svc,q-agt,q-dhcp"

# Enable networking-generic-switch plugin
enable_plugin networking-generic-switch https://review.openstack.org/openstack/networking-generic-switch

# Configure Neutron
OVS_PHYSICAL_BRIDGE=brbm
PHYSICAL_NETWORK=mynetwork
Q_PLUGIN=ml2
ENABLE_TENANT_VLANS=True
Q_ML2_TENANT_NETWORK_TYPE=vlan
TENANT_VLAN_RANGE=100:150

# Configure logging
LOGFILE=$HOME/devstack.log
LOGDIR=$HOME/logs

Run stack.sh::

Expand All @@ -86,45 +89,53 @@ Test with real hardware

Add information about hardware switch to Networking-generic-switch
config ``/etc/neutron/plugins/ml2/ml2_conf_genericswitch.ini`` and
restart Neutron server::
restart Neutron server:

.. code-block:: ini

[genericswitch:cisco_switch_1]
device_type = netmiko_cisco_ios
ip = 1.2.3.4
username = cisco
password = cisco
secret = enable_password
[genericswitch:cisco_switch_1]
device_type = netmiko_cisco_ios
ip = 1.2.3.4
username = cisco
password = cisco
secret = enable_password


Get current configuration of the port on the switch, for example for
Cisco IOS device::
Cisco IOS device:

.. code-block:: ini

sh running-config int gig 0/12
Building configuration...
sh running-config int gig 0/12
Building configuration...

Current configuration : 283 bytes
!
interface GigabitEthernet0/12
switchport mode access
end
Current configuration : 283 bytes
!
interface GigabitEthernet0/12
switchport mode access
end

Run exercise.py to create/update Neutron port. It will print VLAN id to be
assigned::
assigned:

$ neutron net-create test
$ python ~/networking-generic-switch/devstack/exercise.py --switch_name cisco_switch_1 --port Gig0/12 --switch_id=06:58:1f:e7:b4:44 --network test
126
.. code-block:: ini

$ neutron net-create test
$ python ~/networking-generic-switch/devstack/exercise.py --switch_name cisco_switch_1 --port Gig0/12 --switch_id=06:58:1f:e7:b4:44 --network test
126


Verify that VLAN has been changed on the switch port, for example for
Cisco IOS device::
Cisco IOS device:

.. code-block:: ini

sh running-config int gig 0/12
Building configuration...
sh running-config int gig 0/12
Building configuration...

Current configuration : 311 bytes
!
interface GigabitEthernet0/12
switchport access vlan 126
switchport mode access
end
Current configuration : 311 bytes
!
interface GigabitEthernet0/12
switchport access vlan 126
switchport mode access
end
8 changes: 4 additions & 4 deletions networking_generic_switch/devices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def plug_port_to_network(self, port_id, segmentation_id,
trunk_details=None):
"""Plug port into network.

:param port_id: Then name of the switch interface
:param port_id: The name of the switch interface
:param segmentation_id: VLAN identifier of the network used as access
or native VLAN for port.

Expand All @@ -247,7 +247,7 @@ def plug_port_to_network(self, port_id, segmentation_id,
def delete_port(self, port_id, segmentation_id, trunk_details=None):
"""Delete port from specific network.

:param port_id: Then name of the switch interface
:param port_id: The name of the switch interface
:param segmentation_id: VLAN identifier of the network used as access
or native VLAN for port.

Expand All @@ -259,7 +259,7 @@ def plug_bond_to_network(self, bond_id, segmentation_id,
trunk_details=None):
"""Plug bond port into network.

:param port_id: Then name of the switch interface
:param port_id: The name of the switch interface
:param segmentation_id: VLAN identifier of the network used as access
or native VLAN for port.

Expand All @@ -275,7 +275,7 @@ def unplug_bond_from_network(self, bond_id, segmentation_id,
trunk_details=None):
"""Unplug bond port from network.

:param port_id: Then name of the switch interface
:param port_id: The name of the switch interface
:param segmentation_id: VLAN identifier of the network used as access
or native VLAN for port.

Expand Down
Loading