| Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 1 | #!/bin/bash | 
 | 2 | # | 
 | 3 | #    Licensed under the Apache License, Version 2.0 (the "License"); you may | 
 | 4 | #    not use this file except in compliance with the License. You may obtain | 
 | 5 | #    a copy of the License at | 
 | 6 | # | 
 | 7 | #         http://www.apache.org/licenses/LICENSE-2.0 | 
 | 8 | # | 
 | 9 | #    Unless required by applicable law or agreed to in writing, software | 
 | 10 | #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | 
 | 11 | #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | 
 | 12 | #    License for the specific language governing permissions and limitations | 
 | 13 | #    under the License. | 
 | 14 | # | 
 | 15 |  | 
 | 16 | # Global Sources | 
 | 17 | # -------------- | 
 | 18 |  | 
 | 19 | # There are some ovs functions OVN depends on that must be sourced from | 
 | 20 | # the ovs neutron plugins. | 
 | 21 | source ${TOP_DIR}/lib/neutron_plugins/ovs_base | 
 | 22 | source ${TOP_DIR}/lib/neutron_plugins/openvswitch_agent | 
 | 23 |  | 
 | 24 | # Load devstack ovs base functions | 
 | 25 | source $NEUTRON_DIR/devstack/lib/ovs | 
 | 26 |  | 
 | 27 |  | 
 | 28 | # Defaults | 
 | 29 | # -------- | 
 | 30 |  | 
| Slawek Kaplonski | 7ba26f5 | 2020-09-17 11:13:52 +0200 | [diff] [blame^] | 31 | Q_BUILD_OVS_FROM_GIT=$(trueorfalse True Q_BUILD_OVS_FROM_GIT) | 
 | 32 |  | 
| Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 33 | # Set variables for building OVN from source | 
 | 34 | OVN_REPO=${OVN_REPO:-https://github.com/ovn-org/ovn.git} | 
 | 35 | OVN_REPO_NAME=$(basename ${OVN_REPO} | cut -f1 -d'.') | 
 | 36 | OVN_REPO_NAME=${OVN_REPO_NAME:-ovn} | 
 | 37 | OVN_BRANCH=${OVN_BRANCH:-v20.06.1} | 
 | 38 | # The commit removing OVN bits from the OVS tree, it is the commit that is not | 
 | 39 | # present in OVN tree and is used to distinguish if OVN is part of OVS or not. | 
 | 40 | # https://github.com/openvswitch/ovs/commit/05bf1dbb98b0635a51f75e268ef8aed27601401d | 
 | 41 | OVN_SPLIT_HASH=05bf1dbb98b0635a51f75e268ef8aed27601401d | 
 | 42 |  | 
 | 43 | if is_service_enabled tls-proxy; then | 
 | 44 |     OVN_PROTO=ssl | 
 | 45 | else | 
 | 46 |     OVN_PROTO=tcp | 
 | 47 | fi | 
 | 48 |  | 
 | 49 | # How to connect to ovsdb-server hosting the OVN SB database. | 
 | 50 | OVN_SB_REMOTE=${OVN_SB_REMOTE:-$OVN_PROTO:$SERVICE_HOST:6642} | 
 | 51 |  | 
 | 52 | # How to connect to ovsdb-server hosting the OVN NB database | 
 | 53 | OVN_NB_REMOTE=${OVN_NB_REMOTE:-$OVN_PROTO:$SERVICE_HOST:6641} | 
 | 54 |  | 
 | 55 | # ml2/config for neutron_sync_mode | 
 | 56 | OVN_NEUTRON_SYNC_MODE=${OVN_NEUTRON_SYNC_MODE:-log} | 
 | 57 |  | 
 | 58 | # Configured DNS servers to be used with internal_dns extension, only | 
 | 59 | # if the subnet DNS is not configured. | 
 | 60 | OVN_DNS_SERVERS=${OVN_DNS_SERVERS:-8.8.8.8} | 
 | 61 |  | 
 | 62 | # The type of OVN L3 Scheduler to use. The OVN L3 Scheduler determines the | 
 | 63 | # hypervisor/chassis where a routers gateway should be hosted in OVN. The | 
 | 64 | # default OVN L3 scheduler is leastloaded | 
 | 65 | OVN_L3_SCHEDULER=${OVN_L3_SCHEDULER:-leastloaded} | 
 | 66 |  | 
 | 67 | # A UUID to uniquely identify this system.  If one is not specified, a random | 
 | 68 | # one will be generated.  A randomly generated UUID will be saved in a file | 
 | 69 | # 'ovn-uuid' so that the same one will be re-used if you re-run DevStack. | 
 | 70 | OVN_UUID=${OVN_UUID:-} | 
 | 71 |  | 
 | 72 | # Whether or not to build the openvswitch kernel module from ovs.  This is required | 
 | 73 | # unless the distro kernel includes ovs+conntrack support. | 
 | 74 | OVN_BUILD_MODULES=$(trueorfalse False OVN_BUILD_MODULES) | 
 | 75 |  | 
 | 76 | # Whether or not to install the ovs python module from ovs source.  This can be | 
 | 77 | # used to test and validate new ovs python features.  This should only be used | 
 | 78 | # for development purposes since the ovs python version is controlled by OpenStack | 
 | 79 | # requirements. | 
 | 80 | OVN_INSTALL_OVS_PYTHON_MODULE=$(trueorfalse False OVN_INSTALL_OVS_PYTHON_MODULE) | 
 | 81 |  | 
 | 82 | # GENEVE overlay protocol overhead. Defaults to 38 bytes plus the IP version | 
 | 83 | # overhead (20 bytes for IPv4 (default) or 40 bytes for IPv6) which is determined | 
 | 84 | # based on the ML2 overlay_ip_version option. The ML2 framework will use this to | 
 | 85 | # configure the MTU DHCP option. | 
 | 86 | OVN_GENEVE_OVERHEAD=${OVN_GENEVE_OVERHEAD:-38} | 
 | 87 |  | 
 | 88 | # The log level of the OVN databases (north and south) | 
 | 89 | OVN_DBS_LOG_LEVEL=${OVN_DBS_LOG_LEVEL:-info} | 
 | 90 |  | 
 | 91 | OVN_META_CONF=$NEUTRON_CONF_DIR/neutron_ovn_metadata_agent.ini | 
 | 92 | OVN_META_DATA_HOST=${OVN_META_DATA_HOST:-$(ipv6_unquote $SERVICE_HOST)} | 
 | 93 |  | 
 | 94 | OVSDB_SERVER_LOCAL_HOST=$SERVICE_LOCAL_HOST | 
 | 95 |  | 
 | 96 | OVN_IGMP_SNOOPING_ENABLE=$(trueorfalse False OVN_IGMP_SNOOPING_ENABLE) | 
 | 97 |  | 
 | 98 | OVS_PREFIX=/usr/local | 
 | 99 | OVS_SBINDIR=$OVS_PREFIX/sbin | 
 | 100 | OVS_BINDIR=$OVS_PREFIX/bin | 
 | 101 | OVS_RUNDIR=$OVS_PREFIX/var/run/openvswitch | 
 | 102 | OVS_SHAREDIR=$OVS_PREFIX/share/openvswitch | 
 | 103 | OVS_SCRIPTDIR=$OVS_SHAREDIR/scripts | 
 | 104 | OVS_DATADIR=$DATA_DIR/ovs | 
 | 105 |  | 
 | 106 | OVN_DATADIR=$DATA_DIR/ovn | 
 | 107 | OVN_SHAREDIR=$OVS_PREFIX/share/ovn | 
 | 108 | OVN_SCRIPTDIR=$OVN_SHAREDIR/scripts | 
 | 109 | OVN_RUNDIR=$OVS_PREFIX/var/run/ovn | 
 | 110 |  | 
 | 111 | NEUTRON_OVN_BIN_DIR=$(get_python_exec_prefix) | 
 | 112 | NEUTRON_OVN_METADATA_BINARY="neutron-ovn-metadata-agent" | 
 | 113 |  | 
 | 114 | STACK_GROUP="$( id --group --name "$STACK_USER" )" | 
 | 115 |  | 
 | 116 | # Defaults Overwrite | 
 | 117 | # ------------------ | 
 | 118 |  | 
 | 119 | Q_ML2_PLUGIN_MECHANISM_DRIVERS=${Q_ML2_PLUGIN_MECHANISM_DRIVERS:-ovn,logger} | 
 | 120 | Q_ML2_PLUGIN_TYPE_DRIVERS=${Q_ML2_PLUGIN_TYPE_DRIVERS:-local,flat,vlan,geneve} | 
 | 121 | Q_ML2_TENANT_NETWORK_TYPE=${Q_ML2_TENANT_NETWORK_TYPE:-"geneve"} | 
 | 122 | Q_ML2_PLUGIN_GENEVE_TYPE_OPTIONS=${Q_ML2_PLUGIN_GENEVE_TYPE_OPTIONS:-"vni_ranges=1:65536"} | 
| Lucas Alvares Gomes | e7625fc | 2020-08-26 09:46:35 +0100 | [diff] [blame] | 123 | Q_ML2_PLUGIN_EXT_DRIVERS=${Q_ML2_PLUGIN_EXT_DRIVERS:-port_security,qos} | 
| Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 124 | # this one allows empty: | 
 | 125 | ML2_L3_PLUGIN=${ML2_L3_PLUGIN-"ovn-router"} | 
 | 126 |  | 
 | 127 |  | 
 | 128 | # Utility Functions | 
 | 129 | # ----------------- | 
 | 130 |  | 
 | 131 | function use_new_ovn_repository { | 
 | 132 |     if [ -z "$is_new_ovn" ]; then | 
 | 133 |         local ovs_repo_dir=$DEST/$OVS_REPO_NAME | 
 | 134 |         if [ ! -d $ovs_repo_dir ]; then | 
 | 135 |             clone_repository $OVS_REPO $ovs_repo_dir $OVS_BRANCH | 
 | 136 |         fi | 
 | 137 |         # Check the split commit exists in the current branch | 
 | 138 |         pushd $ovs_repo_dir | 
 | 139 |         git log $OVS_BRANCH --pretty=format:"%H" | grep -q $OVN_SPLIT_HASH | 
 | 140 |         is_new_ovn=$? | 
 | 141 |         popd | 
 | 142 |     fi | 
 | 143 |     return $is_new_ovn | 
 | 144 | } | 
 | 145 |  | 
 | 146 | # NOTE(rtheis): Function copied from DevStack _neutron_ovs_base_setup_bridge | 
 | 147 | # and _neutron_ovs_base_add_bridge with the call to neutron-ovs-cleanup | 
 | 148 | # removed. The call is not relevant for OVN, as it is specific to the use | 
 | 149 | # of Neutron's OVS agent and hangs when running stack.sh because | 
 | 150 | # neutron-ovs-cleanup uses the OVSDB native interface. | 
 | 151 | function ovn_base_setup_bridge { | 
 | 152 |     local bridge=$1 | 
 | 153 |     local addbr_cmd="ovs-vsctl --no-wait -- --may-exist add-br $bridge -- set bridge $bridge protocols=OpenFlow13,OpenFlow15" | 
 | 154 |  | 
 | 155 |     if [ "$OVS_DATAPATH_TYPE" != "system" ] ; then | 
 | 156 |         addbr_cmd="$addbr_cmd -- set Bridge $bridge datapath_type=${OVS_DATAPATH_TYPE}" | 
 | 157 |     fi | 
 | 158 |  | 
 | 159 |     $addbr_cmd | 
 | 160 |     ovs-vsctl --no-wait br-set-external-id $bridge bridge-id $bridge | 
 | 161 | } | 
 | 162 |  | 
 | 163 | function _start_process { | 
 | 164 |     $SYSTEMCTL daemon-reload | 
 | 165 |     $SYSTEMCTL enable $1 | 
 | 166 |     $SYSTEMCTL restart $1 | 
 | 167 | } | 
 | 168 |  | 
 | 169 | function _run_process { | 
 | 170 |     local service=$1 | 
 | 171 |     local cmd="$2" | 
 | 172 |     local stop_cmd="$3" | 
 | 173 |     local group=$4 | 
 | 174 |     local user=${5:-$STACK_USER} | 
 | 175 |  | 
 | 176 |     local systemd_service="devstack@$service.service" | 
 | 177 |     local unit_file="$SYSTEMD_DIR/$systemd_service" | 
 | 178 |     local environment="OVN_RUNDIR=$OVS_RUNDIR OVN_DBDIR=$OVN_DATADIR OVN_LOGDIR=$LOGDIR OVS_RUNDIR=$OVS_RUNDIR OVS_DBDIR=$OVS_DATADIR OVS_LOGDIR=$LOGDIR" | 
 | 179 |  | 
 | 180 |     echo "Starting $service executed command": $cmd | 
 | 181 |  | 
 | 182 |     write_user_unit_file $systemd_service "$cmd" "$group" "$user" | 
 | 183 |     iniset -sudo $unit_file "Service" "Type" "forking" | 
 | 184 |     iniset -sudo $unit_file "Service" "RemainAfterExit" "yes" | 
 | 185 |     iniset -sudo $unit_file "Service" "KillMode" "mixed" | 
 | 186 |     iniset -sudo $unit_file "Service" "LimitNOFILE" "65536" | 
 | 187 |     iniset -sudo $unit_file "Service" "Environment" "$environment" | 
 | 188 |     if [ -n "$stop_cmd" ]; then | 
 | 189 |         iniset -sudo $unit_file "Service" "ExecStop" "$stop_cmd" | 
 | 190 |     fi | 
 | 191 |  | 
 | 192 |     _start_process $systemd_service | 
 | 193 |  | 
 | 194 |     local testcmd="test -e $OVS_RUNDIR/$service.pid" | 
 | 195 |     test_with_retry "$testcmd" "$service did not start" $SERVICE_TIMEOUT 1 | 
 | 196 |     sudo ovs-appctl -t $service vlog/set console:off syslog:info file:info | 
 | 197 | } | 
 | 198 |  | 
 | 199 | function clone_repository { | 
 | 200 |     local repo=$1 | 
 | 201 |     local dir=$2 | 
 | 202 |     local branch=$3 | 
 | 203 |     # Set ERROR_ON_CLONE to false to avoid the need of having the | 
 | 204 |     # repositories like OVN and OVS in the required_projects of the job | 
 | 205 |     # definition. | 
 | 206 |     ERROR_ON_CLONE=false git_clone $repo $dir $branch | 
 | 207 | } | 
 | 208 |  | 
 | 209 | function get_ext_gw_interface { | 
 | 210 |     # Get ext_gw_interface depending on value of Q_USE_PUBLIC_VETH | 
 | 211 |     # This function is copied directly from the devstack neutron-legacy script | 
 | 212 |     if [[ "$Q_USE_PUBLIC_VETH" == "True" ]]; then | 
 | 213 |         echo $Q_PUBLIC_VETH_EX | 
 | 214 |     else | 
 | 215 |         # Disable in-band as we are going to use local port | 
 | 216 |         # to communicate with VMs | 
 | 217 |         sudo ovs-vsctl set Bridge $PUBLIC_BRIDGE \ | 
 | 218 |             other_config:disable-in-band=true | 
 | 219 |         echo $PUBLIC_BRIDGE | 
 | 220 |     fi | 
 | 221 | } | 
 | 222 |  | 
 | 223 | function create_public_bridge { | 
 | 224 |     # Create the public bridge that OVN will use | 
 | 225 |     # This logic is based on the devstack neutron-legacy _neutron_configure_router_v4 and _v6 | 
 | 226 |     local ext_gw_ifc | 
 | 227 |     ext_gw_ifc=$(get_ext_gw_interface) | 
 | 228 |  | 
 | 229 |     ovs-vsctl --may-exist add-br $ext_gw_ifc -- set bridge $ext_gw_ifc protocols=OpenFlow13,OpenFlow15 | 
 | 230 |     ovs-vsctl set open . external-ids:ovn-bridge-mappings=$PHYSICAL_NETWORK:$ext_gw_ifc | 
 | 231 |     if [ -n "$FLOATING_RANGE" ]; then | 
 | 232 |         local cidr_len=${FLOATING_RANGE#*/} | 
 | 233 |         sudo ip addr flush dev $ext_gw_ifc | 
 | 234 |         sudo ip addr add $PUBLIC_NETWORK_GATEWAY/$cidr_len dev $ext_gw_ifc | 
 | 235 |     fi | 
 | 236 |  | 
 | 237 |     # Ensure IPv6 RAs are accepted on the interface with the default route. | 
 | 238 |     # This is needed for neutron-based devstack clouds to work in | 
 | 239 |     # IPv6-only clouds in the gate. Please do not remove this without | 
 | 240 |     # talking to folks in Infra. This fix is based on a devstack fix for | 
 | 241 |     # neutron L3 agent: https://review.openstack.org/#/c/359490/. | 
 | 242 |     default_route_dev=$(ip route | grep ^default | awk '{print $5}') | 
 | 243 |     sudo sysctl -w net.ipv6.conf.$default_route_dev.accept_ra=2 | 
 | 244 |  | 
 | 245 |     sudo sysctl -w net.ipv6.conf.all.forwarding=1 | 
 | 246 |     if [ -n "$IPV6_PUBLIC_RANGE" ]; then | 
 | 247 |         local ipv6_cidr_len=${IPV6_PUBLIC_RANGE#*/} | 
 | 248 |         sudo ip -6 addr flush dev $ext_gw_ifc | 
 | 249 |         sudo ip -6 addr add $IPV6_PUBLIC_NETWORK_GATEWAY/$ipv6_cidr_len dev $ext_gw_ifc | 
 | 250 |     fi | 
 | 251 |  | 
 | 252 |     sudo ip link set $ext_gw_ifc up | 
 | 253 | } | 
 | 254 |  | 
 | 255 | function _disable_libvirt_apparmor { | 
 | 256 |     if ! sudo aa-status --enabled ; then | 
 | 257 |         return 0 | 
 | 258 |     fi | 
 | 259 |     # NOTE(arosen): This is used as a work around to allow newer versions | 
 | 260 |     # of libvirt to work with ovs configured ports. See LP#1466631. | 
 | 261 |     # requires the apparmor-utils | 
 | 262 |     install_package apparmor-utils | 
 | 263 |     # disables apparmor for libvirtd | 
 | 264 |     sudo aa-complain /etc/apparmor.d/usr.sbin.libvirtd | 
 | 265 | } | 
 | 266 |  | 
 | 267 |  | 
 | 268 | # OVN compilation functions | 
 | 269 | # ------------------------- | 
 | 270 |  | 
 | 271 |  | 
 | 272 | # compile_ovn() - Compile OVN from source and load needed modules | 
 | 273 | #                 Accepts three parameters: | 
 | 274 | #                   - first optional is False by default and means that | 
 | 275 | #                     modules are built and installed. | 
 | 276 | #                   - second optional parameter defines prefix for | 
 | 277 | #                     ovn compilation | 
 | 278 | #                   - third optional parameter defines localstatedir for | 
 | 279 | #                     ovn single machine runtime | 
 | 280 | function compile_ovn { | 
 | 281 |     local build_modules=${1:-False} | 
 | 282 |     local prefix=$2 | 
 | 283 |     local localstatedir=$3 | 
 | 284 |  | 
 | 285 |     if [ -n "$prefix" ]; then | 
 | 286 |         prefix="--prefix=$prefix" | 
 | 287 |     fi | 
 | 288 |  | 
 | 289 |     if [ -n "$localstatedir" ]; then | 
 | 290 |         localstatedir="--localstatedir=$localstatedir" | 
 | 291 |     fi | 
 | 292 |  | 
 | 293 |     clone_repository $OVN_REPO $DEST/$OVN_REPO_NAME $OVN_BRANCH | 
 | 294 |     pushd $DEST/$OVN_REPO_NAME | 
 | 295 |  | 
 | 296 |     if [ ! -f configure ] ; then | 
 | 297 |         ./boot.sh | 
 | 298 |     fi | 
 | 299 |  | 
 | 300 |     if [ ! -f config.status ] || [ configure -nt config.status ] ; then | 
 | 301 |         ./configure --with-ovs-source=$DEST/$OVS_REPO_NAME $prefix $localstatedir | 
 | 302 |     fi | 
 | 303 |     make -j$(($(nproc) + 1)) | 
 | 304 |     sudo make install | 
 | 305 |     popd | 
 | 306 | } | 
 | 307 |  | 
 | 308 |  | 
 | 309 | # OVN Neutron driver functions | 
 | 310 | # ---------------------------- | 
 | 311 |  | 
 | 312 | # OVN service sanity check | 
 | 313 | function ovn_sanity_check { | 
 | 314 |     if is_service_enabled q-agt neutron-agt; then | 
 | 315 |         die $LINENO "The q-agt/neutron-agt service must be disabled with OVN." | 
 | 316 |     elif is_service_enabled q-l3 neutron-l3; then | 
 | 317 |         die $LINENO "The q-l3/neutron-l3 service must be disabled with OVN." | 
 | 318 |     elif is_service_enabled q-svc neutron-api && [[ ! $Q_ML2_PLUGIN_MECHANISM_DRIVERS =~ "ovn" ]]; then | 
 | 319 |         die $LINENO "OVN needs to be enabled in \$Q_ML2_PLUGIN_MECHANISM_DRIVERS" | 
 | 320 |     elif is_service_enabled q-svc neutron-api && [[ ! $Q_ML2_PLUGIN_TYPE_DRIVERS =~ "geneve" ]]; then | 
 | 321 |         die $LINENO "Geneve needs to be enabled in \$Q_ML2_PLUGIN_TYPE_DRIVERS to be used with OVN" | 
 | 322 |     fi | 
 | 323 | } | 
 | 324 |  | 
 | 325 | # install_ovn() - Collect source and prepare | 
 | 326 | function install_ovn { | 
| Slawek Kaplonski | 7ba26f5 | 2020-09-17 11:13:52 +0200 | [diff] [blame^] | 327 |     if [[ "$Q_BUILD_OVS_FROM_GIT" == "False" ]]; then | 
 | 328 |         echo "Installation of OVS from source disabled." | 
 | 329 |         return 0 | 
 | 330 |     fi | 
 | 331 |  | 
| Lucas Alvares Gomes | 1d468d4 | 2020-06-09 14:35:52 +0100 | [diff] [blame] | 332 |     echo "Installing OVN and dependent packages" | 
 | 333 |  | 
 | 334 |     # Check the OVN configuration | 
 | 335 |     ovn_sanity_check | 
 | 336 |  | 
 | 337 |     # If OVS is already installed, remove it, because we're about to re-install | 
 | 338 |     # it from source. | 
 | 339 |     for package in openvswitch openvswitch-switch openvswitch-common; do | 
 | 340 |         if is_package_installed $package ; then | 
 | 341 |             uninstall_package $package | 
 | 342 |         fi | 
 | 343 |     done | 
 | 344 |  | 
 | 345 |     # Install tox, used to generate the config (see devstack/override-defaults) | 
 | 346 |     pip_install tox | 
 | 347 |     remove_ovs_packages | 
 | 348 |     sudo rm -f $OVS_RUNDIR/* | 
 | 349 |  | 
 | 350 |     compile_ovs $OVN_BUILD_MODULES | 
 | 351 |     if use_new_ovn_repository; then | 
 | 352 |         compile_ovn $OVN_BUILD_MODULES | 
 | 353 |     fi | 
 | 354 |  | 
 | 355 |     # Ensure that the OVS commands are accessible in the PATH | 
 | 356 |     OVS_BINDIR=${OVS_BINDIR:-/usr/local/bin} | 
 | 357 |     export PATH=$OVS_BINDIR:$PATH | 
 | 358 |  | 
 | 359 |     sudo mkdir -p $OVS_RUNDIR | 
 | 360 |     sudo chown $(whoami) $OVS_RUNDIR | 
 | 361 |     sudo mkdir -p $OVS_PREFIX/var/log/openvswitch | 
 | 362 |     sudo chown $(whoami) $OVS_PREFIX/var/log/openvswitch | 
 | 363 |     sudo mkdir -p $OVS_PREFIX/var/log/ovn | 
 | 364 |     sudo chown $(whoami) $OVS_PREFIX/var/log/ovn | 
 | 365 |  | 
 | 366 |     # Archive log files and create new | 
 | 367 |     local log_archive_dir=$LOGDIR/archive | 
 | 368 |     mkdir -p $log_archive_dir | 
 | 369 |     for logfile in ovs-vswitchd.log ovn-northd.log ovn-controller.log ovn-controller-vtep.log ovs-vtep.log ovsdb-server.log ovsdb-server-nb.log ovsdb-server-sb.log; do | 
 | 370 |         if [ -f "$LOGDIR/$logfile" ] ; then | 
 | 371 |             mv "$LOGDIR/$logfile"  "$log_archive_dir/$logfile.${CURRENT_LOG_TIME}" | 
 | 372 |         fi | 
 | 373 |     done | 
 | 374 |  | 
 | 375 |     # Install ovsdbapp from source if requested | 
 | 376 |     if use_library_from_git "ovsdbapp"; then | 
 | 377 |         git_clone_by_name "ovsdbapp" | 
 | 378 |         setup_dev_lib "ovsdbapp" | 
 | 379 |     fi | 
 | 380 |  | 
 | 381 |     # Install ovs python module from ovs source. | 
 | 382 |     if [[ "$OVN_INSTALL_OVS_PYTHON_MODULE" == "True" ]]; then | 
 | 383 |         sudo pip uninstall -y ovs | 
 | 384 |         # Clone the OVS repository if it's not yet present | 
 | 385 |         clone_repository $OVS_REPO $DEST/$OVS_REPO_NAME $OVS_BRANCH | 
 | 386 |         sudo pip install -e $DEST/$OVS_REPO_NAME/python | 
 | 387 |     fi | 
 | 388 | } | 
 | 389 |  | 
 | 390 | # filter_network_api_extensions() - Remove non-supported API extensions by | 
 | 391 | # the OVN driver from the list of enabled API extensions | 
 | 392 | function filter_network_api_extensions { | 
 | 393 |     SUPPORTED_NETWORK_API_EXTENSIONS=$($PYTHON -c \ | 
 | 394 |         'from neutron.common.ovn import extensions ;\ | 
 | 395 |         print(",".join(extensions.ML2_SUPPORTED_API_EXTENSIONS))') | 
 | 396 |     SUPPORTED_NETWORK_API_EXTENSIONS=$SUPPORTED_NETWORK_API_EXTENSIONS,$($PYTHON -c \ | 
 | 397 |         'from neutron.common.ovn import extensions ;\ | 
 | 398 |         print(",".join(extensions.ML2_SUPPORTED_API_EXTENSIONS_OVN_L3))') | 
 | 399 |     if is_service_enabled q-qos neutron-qos ; then | 
 | 400 |         SUPPORTED_NETWORK_API_EXTENSIONS="$SUPPORTED_NETWORK_API_EXTENSIONS,qos" | 
 | 401 |     fi | 
 | 402 |     NETWORK_API_EXTENSIONS=${NETWORK_API_EXTENSIONS:-$SUPPORTED_NETWORK_API_EXTENSIONS} | 
 | 403 |     extensions=$(echo $NETWORK_API_EXTENSIONS | tr ', ' '\n' | sort -u) | 
 | 404 |     supported_ext=$(echo $SUPPORTED_NETWORK_API_EXTENSIONS | tr ', ' '\n' | sort -u) | 
 | 405 |     enabled_ext=$(comm -12 <(echo -e "$extensions") <(echo -e "$supported_ext")) | 
 | 406 |     disabled_ext=$(comm -3 <(echo -e "$extensions") <(echo -e "$enabled_ext")) | 
 | 407 |  | 
 | 408 |     # Log a message in case some extensions had to be disabled because | 
 | 409 |     # they are not supported by the OVN driver | 
 | 410 |     if [ ! -z "$disabled_ext" ]; then | 
 | 411 |         _disabled=$(echo $disabled_ext | tr ' ' ',') | 
 | 412 |         echo "The folling network API extensions have been disabled because they are not supported by OVN: $_disabled" | 
 | 413 |     fi | 
 | 414 |  | 
 | 415 |     # Export the final list of extensions that have been enabled and are | 
 | 416 |     # supported by OVN | 
 | 417 |     export NETWORK_API_EXTENSIONS=$(echo $enabled_ext | tr ' ' ',') | 
 | 418 | } | 
 | 419 |  | 
 | 420 | function configure_ovn_plugin { | 
 | 421 |     echo "Configuring Neutron for OVN" | 
 | 422 |  | 
 | 423 |     if is_service_enabled q-svc ; then | 
 | 424 |         filter_network_api_extensions | 
 | 425 |         populate_ml2_config /$Q_PLUGIN_CONF_FILE ml2_type_geneve max_header_size=$OVN_GENEVE_OVERHEAD | 
 | 426 |         populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_nb_connection="$OVN_NB_REMOTE" | 
 | 427 |         populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_sb_connection="$OVN_SB_REMOTE" | 
 | 428 |         if is_service_enabled tls-proxy; then | 
 | 429 |             populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_sb_ca_cert="$INT_CA_DIR/ca-chain.pem" | 
 | 430 |             populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_sb_certificate="$INT_CA_DIR/$DEVSTACK_CERT_NAME.crt" | 
 | 431 |             populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_sb_private_key="$INT_CA_DIR/private/$DEVSTACK_CERT_NAME.key" | 
 | 432 |             populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_nb_ca_cert="$INT_CA_DIR/ca-chain.pem" | 
 | 433 |             populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_nb_certificate="$INT_CA_DIR/$DEVSTACK_CERT_NAME.crt" | 
 | 434 |             populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_nb_private_key="$INT_CA_DIR/private/$DEVSTACK_CERT_NAME.key" | 
 | 435 |         fi | 
 | 436 |         populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn neutron_sync_mode="$OVN_NEUTRON_SYNC_MODE" | 
 | 437 |         populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_l3_scheduler="$OVN_L3_SCHEDULER" | 
 | 438 |         populate_ml2_config /$Q_PLUGIN_CONF_FILE securitygroup enable_security_group="$Q_USE_SECGROUP" | 
 | 439 |         inicomment /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver | 
 | 440 |  | 
 | 441 |         if is_service_enabled q-ovn-metadata-agent; then | 
 | 442 |             populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_metadata_enabled=True | 
 | 443 |         else | 
 | 444 |             populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn ovn_metadata_enabled=False | 
 | 445 |         fi | 
 | 446 |  | 
 | 447 |         if is_service_enabled q-dns neutron-dns ; then | 
 | 448 |             iniset $NEUTRON_CONF DEFAULT dns_domain openstackgate.local | 
 | 449 |             populate_ml2_config /$Q_PLUGIN_CONF_FILE ovn dns_servers="$OVN_DNS_SERVERS" | 
 | 450 |         fi | 
 | 451 |  | 
 | 452 |         iniset $NEUTRON_CONF ovs igmp_snooping_enable $OVN_IGMP_SNOOPING_ENABLE | 
 | 453 |     fi | 
 | 454 |  | 
 | 455 |     if is_service_enabled q-dhcp neutron-dhcp ; then | 
 | 456 |         iniset $NEUTRON_CONF DEFAULT dhcp_agent_notification True | 
 | 457 |     else | 
 | 458 |         iniset $NEUTRON_CONF DEFAULT dhcp_agent_notification False | 
 | 459 |     fi | 
 | 460 |  | 
 | 461 |     if is_service_enabled n-api-meta ; then | 
 | 462 |         if is_service_enabled q-ovn-metadata-agent ; then | 
 | 463 |             iniset $NOVA_CONF neutron service_metadata_proxy True | 
 | 464 |         fi | 
 | 465 |     fi | 
 | 466 | } | 
 | 467 |  | 
 | 468 | function configure_ovn { | 
 | 469 |     echo "Configuring OVN" | 
 | 470 |  | 
 | 471 |     if [ -z "$OVN_UUID" ] ; then | 
 | 472 |         if [ -f ./ovn-uuid ] ; then | 
 | 473 |             OVN_UUID=$(cat ovn-uuid) | 
 | 474 |         else | 
 | 475 |             OVN_UUID=$(uuidgen) | 
 | 476 |             echo $OVN_UUID > ovn-uuid | 
 | 477 |         fi | 
 | 478 |     fi | 
 | 479 |  | 
 | 480 |     # Metadata | 
 | 481 |     if is_service_enabled q-ovn-metadata-agent && is_service_enabled ovn-controller; then | 
 | 482 |         sudo install -d -o $STACK_USER $NEUTRON_CONF_DIR | 
 | 483 |  | 
 | 484 |         mkdir -p $NEUTRON_DIR/etc/neutron/plugins/ml2 | 
 | 485 |         (cd $NEUTRON_DIR && exec ./tools/generate_config_file_samples.sh) | 
 | 486 |  | 
 | 487 |         cp $NEUTRON_DIR/etc/neutron_ovn_metadata_agent.ini.sample $OVN_META_CONF | 
 | 488 |         configure_root_helper_options $OVN_META_CONF | 
 | 489 |  | 
 | 490 |         iniset $OVN_META_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL | 
 | 491 |         iniset $OVN_META_CONF DEFAULT nova_metadata_host $OVN_META_DATA_HOST | 
 | 492 |         iniset $OVN_META_CONF DEFAULT metadata_workers $API_WORKERS | 
 | 493 |         iniset $OVN_META_CONF DEFAULT state_path $NEUTRON_STATE_PATH | 
 | 494 |         iniset $OVN_META_CONF ovs ovsdb_connection unix:$OVS_RUNDIR/db.sock | 
 | 495 |         iniset $OVN_META_CONF ovn ovn_sb_connection $OVN_SB_REMOTE | 
 | 496 |         if is_service_enabled tls-proxy; then | 
 | 497 |             iniset $OVN_META_CONF ovn \ | 
 | 498 |                 ovn_sb_ca_cert $INT_CA_DIR/ca-chain.pem | 
 | 499 |             iniset $OVN_META_CONF ovn \ | 
 | 500 |                 ovn_sb_certificate $INT_CA_DIR/$DEVSTACK_CERT_NAME.crt | 
 | 501 |             iniset $OVN_META_CONF ovn \ | 
 | 502 |                 ovn_sb_private_key $INT_CA_DIR/private/$DEVSTACK_CERT_NAME.key | 
 | 503 |         fi | 
 | 504 |     fi | 
 | 505 | } | 
 | 506 |  | 
 | 507 | function init_ovn { | 
 | 508 |     # clean up from previous (possibly aborted) runs | 
 | 509 |     # create required data files | 
 | 510 |  | 
 | 511 |     # Assumption: this is a dedicated test system and there is nothing important | 
 | 512 |     # in the ovn, ovn-nb, or ovs databases.  We're going to trash them and | 
 | 513 |     # create new ones on each devstack run. | 
 | 514 |  | 
 | 515 |     _disable_libvirt_apparmor | 
 | 516 |  | 
 | 517 |     mkdir -p $OVN_DATADIR | 
 | 518 |     mkdir -p $OVS_DATADIR | 
 | 519 |  | 
 | 520 |     rm -f $OVS_DATADIR/*.db | 
 | 521 |     rm -f $OVS_DATADIR/.*.db.~lock~ | 
 | 522 |     rm -f $OVN_DATADIR/*.db | 
 | 523 |     rm -f $OVN_DATADIR/.*.db.~lock~ | 
 | 524 | } | 
 | 525 |  | 
 | 526 | function _start_ovs { | 
 | 527 |     echo "Starting OVS" | 
 | 528 |     if is_service_enabled ovn-controller ovn-controller-vtep ovn-northd; then | 
 | 529 |         # ovsdb-server and ovs-vswitchd are used privately in OVN as openvswitch service names. | 
 | 530 |         enable_service ovsdb-server | 
 | 531 |         enable_service ovs-vswitchd | 
 | 532 |  | 
 | 533 |         if [ ! -f $OVS_DATADIR/conf.db ]; then | 
 | 534 |             ovsdb-tool create $OVS_DATADIR/conf.db $OVS_SHAREDIR/vswitch.ovsschema | 
 | 535 |         fi | 
 | 536 |  | 
 | 537 |         if is_service_enabled ovn-controller-vtep; then | 
 | 538 |             if [ ! -f $OVS_DATADIR/vtep.db ]; then | 
 | 539 |                 ovsdb-tool create $OVS_DATADIR/vtep.db $OVS_SHAREDIR/vtep.ovsschema | 
 | 540 |             fi | 
 | 541 |         fi | 
 | 542 |  | 
 | 543 |         local dbcmd="$OVS_SBINDIR/ovsdb-server --remote=punix:$OVS_RUNDIR/db.sock --remote=ptcp:6640:$OVSDB_SERVER_LOCAL_HOST --pidfile --detach --log-file" | 
 | 544 |         dbcmd+=" --remote=db:Open_vSwitch,Open_vSwitch,manager_options" | 
 | 545 |         if is_service_enabled ovn-controller-vtep; then | 
 | 546 |             dbcmd+=" --remote=db:hardware_vtep,Global,managers $OVS_DATADIR/vtep.db" | 
 | 547 |         fi | 
 | 548 |         dbcmd+=" $OVS_DATADIR/conf.db" | 
 | 549 |         _run_process ovsdb-server "$dbcmd" | 
 | 550 |  | 
 | 551 |         echo "Configuring OVSDB" | 
 | 552 |         if is_service_enabled tls-proxy; then | 
 | 553 |             ovs-vsctl --no-wait set-ssl \ | 
 | 554 |                 $INT_CA_DIR/private/$DEVSTACK_CERT_NAME.key \ | 
 | 555 |                 $INT_CA_DIR/$DEVSTACK_CERT_NAME.crt \ | 
 | 556 |                 $INT_CA_DIR/ca-chain.pem | 
 | 557 |         fi | 
 | 558 |         ovs-vsctl --no-wait set open_vswitch . system-type="devstack" | 
 | 559 |         ovs-vsctl --no-wait set open_vswitch . external-ids:system-id="$OVN_UUID" | 
 | 560 |         ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-remote="$OVN_SB_REMOTE" | 
 | 561 |         ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-bridge="br-int" | 
 | 562 |         ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-encap-type="geneve" | 
 | 563 |         ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-encap-ip="$HOST_IP" | 
 | 564 |         # Select this chassis to host gateway routers | 
 | 565 |         if [[ "$ENABLE_CHASSIS_AS_GW" == "True" ]]; then | 
 | 566 |             ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-cms-options="enable-chassis-as-gw" | 
 | 567 |         fi | 
 | 568 |  | 
 | 569 |         # Note: ovn-controller will create and configure br-int once it is started. | 
 | 570 |         # So, no need to create it now because nothing depends on that bridge here. | 
 | 571 |  | 
 | 572 |         local ovscmd="$OVS_SBINDIR/ovs-vswitchd --log-file --pidfile --detach" | 
 | 573 |         _run_process ovs-vswitchd "$ovscmd" "" "$STACK_GROUP" "root" | 
 | 574 |  | 
 | 575 |         if is_provider_network || [[ $Q_USE_PROVIDERNET_FOR_PUBLIC == "True" ]]; then | 
 | 576 |             ovn_base_setup_bridge $OVS_PHYSICAL_BRIDGE | 
 | 577 |             ovs-vsctl set open . external-ids:ovn-bridge-mappings=${PHYSICAL_NETWORK}:${OVS_PHYSICAL_BRIDGE} | 
 | 578 |         fi | 
 | 579 |  | 
 | 580 |         if is_service_enabled ovn-controller-vtep ; then | 
 | 581 |             ovn_base_setup_bridge br-v | 
 | 582 |             vtep-ctl add-ps br-v | 
 | 583 |             vtep-ctl set Physical_Switch br-v tunnel_ips=$HOST_IP | 
 | 584 |  | 
 | 585 |             enable_service ovs-vtep | 
 | 586 |             local vtepcmd="$OVS_SCRIPTDIR/ovs-vtep --log-file --pidfile --detach br-v" | 
 | 587 |             _run_process ovs-vtep "$vtepcmd" "" "$STACK_GROUP" "root" | 
 | 588 |  | 
 | 589 |             vtep-ctl set-manager tcp:$HOST_IP:6640 | 
 | 590 |         fi | 
 | 591 |     fi | 
 | 592 | } | 
 | 593 |  | 
 | 594 | function _start_ovn_services { | 
 | 595 |     _start_process "devstack@ovsdb-server.service" | 
 | 596 |     _start_process "devstack@ovs-vswitchd.service" | 
 | 597 |  | 
 | 598 |     if is_service_enabled ovs-vtep ; then | 
 | 599 |         _start_process "devstack@ovs-vtep.service" | 
 | 600 |     fi | 
 | 601 |     if is_service_enabled ovn-northd ; then | 
 | 602 |         _start_process "devstack@ovn-northd.service" | 
 | 603 |     fi | 
 | 604 |     if is_service_enabled ovn-controller ; then | 
 | 605 |         _start_process "devstack@ovn-controller.service" | 
 | 606 |     fi | 
 | 607 |     if is_service_enabled ovn-controller-vtep ; then | 
 | 608 |         _start_process "devstack@ovn-controller-vtep.service" | 
 | 609 |     fi | 
 | 610 |     if is_service_enabled q-ovn-metadata-agent; then | 
 | 611 |         _start_process "devstack@q-ovn-metadata-agent.service" | 
 | 612 |     fi | 
 | 613 | } | 
 | 614 |  | 
 | 615 | # start_ovn() - Start running processes, including screen | 
 | 616 | function start_ovn { | 
 | 617 |     echo "Starting OVN" | 
 | 618 |  | 
 | 619 |     _start_ovs | 
 | 620 |  | 
 | 621 |     local SCRIPTDIR=$OVN_SCRIPTDIR | 
 | 622 |     if ! use_new_ovn_repository; then | 
 | 623 |         SCRIPTDIR=$OVS_SCRIPTDIR | 
 | 624 |     fi | 
 | 625 |  | 
 | 626 |     if is_service_enabled ovn-northd ; then | 
 | 627 |         if is_service_enabled tls-proxy; then | 
 | 628 |             local tls_args="\ | 
 | 629 |                 --ovn-nb-db-ssl-ca-cert=$INT_CA_DIR/ca-chain.pem \ | 
 | 630 |                 --ovn-nb-db-ssl-cert=$INT_CA_DIR/$DEVSTACK_CERT_NAME.crt \ | 
 | 631 |                 --ovn-nb-db-ssl-key=$INT_CA_DIR/private/$DEVSTACK_CERT_NAME.key \ | 
 | 632 |                 --ovn-sb-db-ssl-ca-cert=$INT_CA_DIR/ca-chain.pem \ | 
 | 633 |                 --ovn-sb-db-ssl-cert=$INT_CA_DIR/$DEVSTACK_CERT_NAME.crt \ | 
 | 634 |                 --ovn-sb-db-ssl-key=$INT_CA_DIR/private/$DEVSTACK_CERT_NAME.key \ | 
 | 635 |                 " | 
 | 636 |         else | 
 | 637 |             local tls_args="" | 
 | 638 |         fi | 
 | 639 |         local cmd="/bin/bash $SCRIPTDIR/ovn-ctl --no-monitor $tls_args start_northd" | 
 | 640 |         local stop_cmd="/bin/bash $SCRIPTDIR/ovn-ctl stop_northd" | 
 | 641 |  | 
 | 642 |         _run_process ovn-northd "$cmd" "$stop_cmd" | 
 | 643 |         ovn-nbctl --db=unix:$OVS_RUNDIR/ovnnb_db.sock set-connection p${OVN_PROTO}:6641:$SERVICE_LISTEN_ADDRESS -- set connection . inactivity_probe=60000 | 
 | 644 |         ovn-sbctl --db=unix:$OVS_RUNDIR/ovnsb_db.sock set-connection p${OVN_PROTO}:6642:$SERVICE_LISTEN_ADDRESS -- set connection . inactivity_probe=60000 | 
 | 645 |         sudo ovs-appctl -t $OVS_RUNDIR/ovnnb_db.ctl vlog/set console:off syslog:$OVN_DBS_LOG_LEVEL file:$OVN_DBS_LOG_LEVEL | 
 | 646 |         sudo ovs-appctl -t $OVS_RUNDIR/ovnsb_db.ctl vlog/set console:off syslog:$OVN_DBS_LOG_LEVEL file:$OVN_DBS_LOG_LEVEL | 
 | 647 |     fi | 
 | 648 |  | 
 | 649 |     if is_service_enabled ovn-controller ; then | 
 | 650 |         local cmd="/bin/bash $SCRIPTDIR/ovn-ctl --no-monitor start_controller" | 
 | 651 |         local stop_cmd="/bin/bash $SCRIPTDIR/ovn-ctl stop_controller" | 
 | 652 |  | 
 | 653 |         _run_process ovn-controller "$cmd" "$stop_cmd" "$STACK_GROUP" "root" | 
 | 654 |     fi | 
 | 655 |  | 
 | 656 |     if is_service_enabled ovn-controller-vtep ; then | 
 | 657 |         local cmd="$OVS_BINDIR/ovn-controller-vtep --log-file --pidfile --detach --ovnsb-db=$OVN_SB_REMOTE" | 
 | 658 |  | 
 | 659 |         _run_process ovn-controller-vtep "$cmd" "" "$STACK_GROUP" "root" | 
 | 660 |     fi | 
 | 661 |  | 
 | 662 |     if is_service_enabled q-ovn-metadata-agent; then | 
 | 663 |         run_process q-ovn-metadata-agent "$NEUTRON_OVN_BIN_DIR/$NEUTRON_OVN_METADATA_BINARY --config-file $OVN_META_CONF" | 
 | 664 |         # Format logging | 
 | 665 |         setup_logging $OVN_META_CONF | 
 | 666 |     fi | 
 | 667 |  | 
 | 668 |     # NOTE(lucasagomes): To keep things simpler, let's reuse the same | 
 | 669 |     # RUNDIR for both OVS and OVN. This way we avoid having to specify the | 
 | 670 |     # --db option in the ovn-{n,s}bctl commands while playing with DevStack | 
 | 671 |     if use_new_ovn_repository; then | 
 | 672 |         sudo ln -s $OVS_RUNDIR $OVN_RUNDIR | 
 | 673 |     fi | 
 | 674 |  | 
 | 675 |     _start_ovn_services | 
 | 676 | } | 
 | 677 |  | 
 | 678 | function _stop_ovs_dp { | 
 | 679 |     sudo ovs-dpctl dump-dps | sudo xargs -n1 ovs-dpctl del-dp | 
 | 680 |     modprobe -q -r vport_geneve vport_vxlan openvswitch || true | 
 | 681 | } | 
 | 682 |  | 
 | 683 | function stop_ovn { | 
 | 684 |     if is_service_enabled q-ovn-metadata-agent; then | 
 | 685 |         sudo pkill -9 -f haproxy || : | 
 | 686 |         stop_process neutron-ovn-metadata-agent | 
 | 687 |     fi | 
 | 688 |     if is_service_enabled ovn-controller-vtep ; then | 
 | 689 |         stop_process ovn-controller-vtep | 
 | 690 |     fi | 
 | 691 |     if is_service_enabled ovn-controller ; then | 
 | 692 |         stop_process ovn-controller | 
 | 693 |     fi | 
 | 694 |     if is_service_enabled ovn-northd ; then | 
 | 695 |         stop_process ovn-northd | 
 | 696 |     fi | 
 | 697 |     if is_service_enabled ovs-vtep ; then | 
 | 698 |         stop_process ovs-vtep | 
 | 699 |     fi | 
 | 700 |  | 
 | 701 |     stop_process ovs-vswitchd | 
 | 702 |     stop_process ovsdb-server | 
 | 703 |  | 
 | 704 |     _stop_ovs_dp | 
 | 705 | } | 
 | 706 |  | 
 | 707 | function _cleanup { | 
 | 708 |     local path=${1:-$DEST/$OVN_REPO_NAME} | 
 | 709 |     pushd $path | 
 | 710 |     cd $path | 
 | 711 |     sudo make uninstall | 
 | 712 |     sudo make distclean | 
 | 713 |     popd | 
 | 714 | } | 
 | 715 |  | 
 | 716 | # cleanup_ovn() - Remove residual data files, anything left over from previous | 
 | 717 | # runs that a clean run would need to clean up | 
 | 718 | function cleanup_ovn { | 
 | 719 |     local ovn_path=$DEST/$OVN_REPO_NAME | 
 | 720 |     local ovs_path=$DEST/$OVS_REPO_NAME | 
 | 721 |  | 
 | 722 |     if [ -d $ovn_path ]; then | 
 | 723 |         _cleanup $ovn_path | 
 | 724 |     fi | 
 | 725 |  | 
 | 726 |     if [ -d $ovs_path ]; then | 
 | 727 |         _cleanup $ovs_path | 
 | 728 |     fi | 
 | 729 |  | 
 | 730 |     sudo rm -f $OVN_RUNDIR | 
 | 731 | } |