@@ -124,45 +124,46 @@ function configure_generic_switch {
124124 # Generate SSH keypair
125125 configure_generic_switch_user
126126
127- sudo ovs-vsctl --may-exist add-br $GENERIC_SWITCH_TEST_BRIDGE
128- ip link show gs_port_01 || sudo ip link add gs_port_01 type dummy
129- sudo ovs-vsctl --may-exist add-port $GENERIC_SWITCH_TEST_BRIDGE $GENERIC_SWITCH_TEST_PORT
130- if [[ " $GENERIC_SWITCH_USER_MAX_SESSIONS " -gt 0 ]]; then
131- # NOTE(pas-ha) these are used for concurrent tests in tempest plugin
132- N_PORTS=$(( $GENERIC_SWITCH_USER_MAX_SESSIONS * 2 ))
133- for (( n= 0 ;n< $N_PORTS ;n++ )) ; do
134- sudo ovs-vsctl --may-exist add-port $GENERIC_SWITCH_TEST_BRIDGE ${GENERIC_SWITCH_TEST_PORT} _${n}
135- done
136- fi
127+ if [[ " ${IRONIC_NETWORK_SIMULATOR:- ovs} " == " ovs" ]]; then
128+ sudo ovs-vsctl --may-exist add-br $GENERIC_SWITCH_TEST_BRIDGE
129+ ip link show gs_port_01 || sudo ip link add gs_port_01 type dummy
130+ sudo ovs-vsctl --may-exist add-port $GENERIC_SWITCH_TEST_BRIDGE $GENERIC_SWITCH_TEST_PORT
131+ if [[ " $GENERIC_SWITCH_USER_MAX_SESSIONS " -gt 0 ]]; then
132+ # NOTE(pas-ha) these are used for concurrent tests in tempest plugin
133+ N_PORTS=$(( $GENERIC_SWITCH_USER_MAX_SESSIONS * 2 ))
134+ for (( n= 0 ;n< $N_PORTS ;n++ )) ; do
135+ sudo ovs-vsctl --may-exist add-port $GENERIC_SWITCH_TEST_BRIDGE ${GENERIC_SWITCH_TEST_PORT} _${n}
136+ done
137+ fi
137138
138- if [ -e " $HOME /.ssh/id_rsa" ] && [[ " $HOST_TOPOLOGY " == " multinode" ]]; then
139- # NOTE(TheJulia): Reset the key pair to utilize a pre-existing key,
140- # this is instead of generating one, which doesn't work in multinode
141- # environments. This is because the keys are managed and placed by zuul.
142- GENERIC_SWITCH_KEY_FILE=" ${HOME} /.ssh/id_rsa"
143- fi
139+ if [ -e " $HOME /.ssh/id_rsa" ] && [[ " $HOST_TOPOLOGY " == " multinode" ]]; then
140+ # NOTE(TheJulia): Reset the key pair to utilize a pre-existing key,
141+ # this is instead of generating one, which doesn't work in multinode
142+ # environments. This is because the keys are managed and placed by zuul.
143+ GENERIC_SWITCH_KEY_FILE=" ${HOME} /.ssh/id_rsa"
144+ fi
144145
145- # Create generic_switch ml2 config
146- for switch in $GENERIC_SWITCH_TEST_BRIDGE $IRONIC_VM_NETWORK_BRIDGE ; do
147- local bridge_mac
148- bridge_mac=$( ip link show dev $switch | egrep -o " ether [A-Za-z0-9:]+" | sed " s/ether\ //" )
149- switch=" genericswitch:$switch "
150- add_generic_switch_to_ml2_config $switch $GENERIC_SWITCH_KEY_FILE $GENERIC_SWITCH_USER ::1 netmiko_ovs_linux " $GENERIC_SWITCH_PORT " " $bridge_mac "
151- done
152- echo " HOST_TOPOLOGY: $HOST_TOPOLOGY "
153- echo " HOST_TOPOLOGY_SUBNODES: $HOST_TOPOLOGY_SUBNODES "
154- if [ -n " $HOST_TOPOLOGY_SUBNODES " ]; then
155- # NOTE(vsaienko) with multinode topology we need to add switches from all
156- # the subnodes to the config on primary node
157- local cnt=0
158- local section
159- for node in $HOST_TOPOLOGY_SUBNODES ; do
160- cnt=$(( cnt+ 1 ))
161- section=" genericswitch:sub${cnt}${IRONIC_VM_NETWORK_BRIDGE} "
162- add_generic_switch_to_ml2_config $section $GENERIC_SWITCH_KEY_FILE $GENERIC_SWITCH_USER $node netmiko_ovs_linux " $GENERIC_SWITCH_PORT "
146+ # Create generic_switch ml2 config
147+ for switch in $GENERIC_SWITCH_TEST_BRIDGE $IRONIC_VM_NETWORK_BRIDGE ; do
148+ local bridge_mac
149+ bridge_mac=$( ip link show dev $switch | egrep -o " ether [A-Za-z0-9:]+" | sed " s/ether\ //" )
150+ switch=" genericswitch:$switch "
151+ add_generic_switch_to_ml2_config $switch $GENERIC_SWITCH_KEY_FILE $GENERIC_SWITCH_USER ::1 netmiko_ovs_linux " $GENERIC_SWITCH_PORT " " $bridge_mac "
163152 done
153+ echo " HOST_TOPOLOGY: $HOST_TOPOLOGY "
154+ echo " HOST_TOPOLOGY_SUBNODES: $HOST_TOPOLOGY_SUBNODES "
155+ if [ -n " $HOST_TOPOLOGY_SUBNODES " ]; then
156+ # NOTE(vsaienko) with multinode topology we need to add switches from all
157+ # the subnodes to the config on primary node
158+ local cnt=0
159+ local section
160+ for node in $HOST_TOPOLOGY_SUBNODES ; do
161+ cnt=$(( cnt+ 1 ))
162+ section=" genericswitch:sub${cnt}${IRONIC_VM_NETWORK_BRIDGE} "
163+ add_generic_switch_to_ml2_config $section $GENERIC_SWITCH_KEY_FILE $GENERIC_SWITCH_USER $node netmiko_ovs_linux " $GENERIC_SWITCH_PORT "
164+ done
165+ fi
164166 fi
165-
166167 neutron_server_config_add $GENERIC_SWITCH_INI_FILE
167168
168169}
@@ -175,11 +176,22 @@ function add_generic_switch_to_ml2_config {
175176 local device_type=$5
176177 local port=$6
177178 local ngs_mac_address=$7
178-
179- populate_ml2_config $GENERIC_SWITCH_INI_FILE $switch_name key_file=$key_file
179+ local password=$8
180+ local enable_secret=$9
181+ # Use curly braces above 9 to prevent expression expansion
182+ local trunk_interface=" ${10} "
183+
184+ if [[ -n " $key_file " ]]; then
185+ populate_ml2_config $GENERIC_SWITCH_INI_FILE $switch_name key_file=$key_file
186+ elif [[ -n " $password " ]]; then
187+ populate_ml2_config $GENERIC_SWITCH_INI_FILE $switch_name password=$password
188+ fi
180189 populate_ml2_config $GENERIC_SWITCH_INI_FILE $switch_name username=$username
181190 populate_ml2_config $GENERIC_SWITCH_INI_FILE $switch_name ip=$ip
182191 populate_ml2_config $GENERIC_SWITCH_INI_FILE $switch_name device_type=$device_type
192+ if [[ -n " $enable_secret " ]]; then
193+ populate_ml2_config $GENERIC_SWITCH_INI_FILE $switch_name secret=$enable_secret
194+ fi
183195 if [[ -n " $port " ]]; then
184196 populate_ml2_config $GENERIC_SWITCH_INI_FILE $switch_name port=$port
185197 fi
@@ -190,6 +202,9 @@ function add_generic_switch_to_ml2_config {
190202 if [[ " $device_type " =~ " netmiko" && " $GENERIC_SWITCH_USER_MAX_SESSIONS " -gt 0 ]]; then
191203 populate_ml2_config $GENERIC_SWITCH_INI_FILE $switch_name ngs_max_connections=$GENERIC_SWITCH_USER_MAX_SESSIONS
192204 fi
205+ if [[ -n " $trunk_interface " ]]; then
206+ populate_ml2_config $GENERIC_SWITCH_INI_FILE $switch_name ngs_trunk_ports=$trunk_interface
207+ fi
193208}
194209
195210function cleanup_networking_generic_switch {
@@ -220,6 +235,9 @@ function ngs_configure_tempest {
220235 if [ $GENERIC_SWITCH_USER_MAX_SESSIONS -gt 0 ]; then
221236 iniset $TEMPEST_CONFIG ngs port_dlm_concurrency $(( $GENERIC_SWITCH_USER_MAX_SESSIONS * 2 ))
222237 fi
238+ if [[ " ${ML2_L3_PLUGIN:- } " =~ " trunk" ]]; then
239+ iniset $TEMPEST_CONFIG baremetal_feature_enabled trunks_supported True
240+ fi
223241}
224242
225243# check for service enabled
0 commit comments