+ # If bridge already exists and is up, it has been configured through
+ # other cases like OVSPort, OVSIntPort and OVSBond. If it is down or
+ # it does not exist, create it. It is possible for a bridge to exist
+ # because it remained in the OVSDB for some reason, but it won't be up.
+ if check_device_down "${DEVICE}"; then
+ ovs-vsctl -t ${TIMEOUT} -- --may-exist add-br "$DEVICE" $OVS_OPTIONS \
+ ${OVS_EXTRA+-- $OVS_EXTRA} \
+ ${STP+-- set bridge "$DEVICE" stp_enable="${STP}"}
+ else
+ OVSBRIDGECONFIGURED="yes"
+ fi
+
+ # When dhcp is enabled, the assumption is that there will be a port to
+ # attach (otherwise, we can't reach out for dhcp). So, we do not
+ # configure the bridge through rhel's ifup infrastructure unless
+ # it is being configured after the port has been configured.
+ # The "OVSINTF" is set only after the port is configured.
+ if [ "${OVSBOOTPROTO}" = "dhcp" ] && [ -n "${OVSINTF}" ]; then
+ case " ${OVSDHCPINTERFACES} " in
+ *" ${OVSINTF} "*)
+ BOOTPROTO=dhcp ${OTHERSCRIPT} ${CONFIG}
+ ;;
+ esac
+ fi
+
+ # When dhcp is not enabled, it is possible that someone may want
+ # a standalone bridge (i.e it may not have any ports). Configure it.
+ if [ "${OVSBOOTPROTO}" != "dhcp" ] && [ -z "${OVSINTF}" ] && \
+ [ "${OVSBRIDGECONFIGURED}" != "yes" ]; then
+ ${OTHERSCRIPT} ${CONFIG}
+ fi
+ exit 0