# Devstack settings

# Each service you enable has the following meaning:
#
# ovsvapp-server - Add this config flag for ML2 changes in OpenStack
#                  Controller for Neutron.
#
# ovsvapp-compute - Add this config flag for Nova VCDriver changes in
#                   OpenStack ComputeNode for OVSvApp.
#
# ovsvapp-agent - Add this config flag for OVSvApp Agent in OVSvApp VM.

# An example of enabling all-in-one OVSvApp solution is below.
# enable_service ovsvapp-server ovsvapp-compute ovsvapp-agent

# This can be overridden in the local.conf file
OVSVAPP_MODE=${OVSVAPP_MODE:-allinone}

# OVSVAPP_MODE is used to configure how devstack works with OVSvApp solution.
# You can configure this in following ways:
#
# OVSVAPP_MODE=allinone
# Use this mode if you want to run OVSvApp solution in Single Node deployment.
#
# OVSVAPP_MODE=allinone_vmware_dvs
# The same, but for the VMware DVS'es driver.
#
# OVSVAPP_MODE=server
# Use this mode for the controller node of a multi-node devstack install.
#
# OVSVAPP_MODE=server_vmware_dvs
# The same, but for teh VMware DVS'es driver.
#
# OVSVAPP_MODE=compute
# Use this mode for the compute node of a multi-node devstack install.
#
# OVSVAPP_MODE=agent
# Use this mode for the OVSvApp VM of a multi-node devstack install.
#
# OVSVAPP_MODE=agent_vmware_dvs
# The same, but for teh VMware DVS'es driver.
#
# OVSVAPP_MODE=manual
# You're on your own here, and are enabling services outside the scope of
# the OVSVAPP_MODE variable.


# Set in local.conf for OVSvApp Solution
# --------

# Provide IP address for vCenter.
OVSVAPP_VCENTER_IP=${OVSVAPP_VCENTER_IP:-None}

# Provide vCenter Credentials.
OVSVAPP_VCENTER_USERNAME=${OVSVAPP_VCENTER_USERNAME:-None}
OVSVAPP_VCENTER_PASSWORD=${OVSVAPP_VCENTER_PASSWORD:-None}

# vCenter server wsdl location.
OVSVAPP_WSDL_LOCATION=${OVSVAPP_WSDL_LOCATION:-https://${OVSVAPP_VCENTER_IP}:443/sdk/vimService.wsdl}

# Provide ESX host name or IP address where OVSvApp VM is hosted.
OVSVAPP_ESX_HOSTNAME=${OVSVAPP_ESX_HOSTNAME:-None}

# Provide Cluster to DVS/vDS mapping.
OVSVAPP_CLUSTER_DVS_MAPPING=${OVSVAPP_CLUSTER_DVS_MAPPING:-DatacenterName/host/ClusterName:vDSName}

# Provide the tenant network types (VLAN, VXLAN or BOTH).
OVSVAPP_TENANT_NETWORK_TYPES=${OVSVAPP_TENANT_NETWORK_TYPES:-vlan}

# Provide the IP for VXLAN tunnel endpoint.
OVSVAPP_LOCAL_IP=${OVSVAPP_LOCAL_IP:-None}

# Provide Physical Bridge name.
OVSVAPP_PHYSICAL_BRIDGE=${OVSVAPP_PHYSICAL_BRIDGE:-br-ethx}

# Provide Physical Interface to add port to Physical Bridge.
OVSVAPP_PHYSICAL_INTERFACE=${OVSVAPP_PHYSICAL_INTERFACE:-ethx}

# Provide Trunk Interface.
OVSVAPP_TRUNK_INTERFACE=${OVSVAPP_TRUNK_INTERFACE:-ethy}

# Provide Physical Bridge Mappings.
OVSVAPP_BRIDGE_MAPPINGS=${OVSVAPP_BRIDGE_MAPPINGS:-physnet1:br-ethx}

# Provide Security Bridge Mapping.
OVSVAPP_SECURITY_BRIDGE_MAPPINGS=${OVSVAPP_SECURITY_BRIDGE_MAPPINGS:-br-sec:ethy}

# Name of agent file
OVSVAPP_AGENT_BINARY=${OVSVAPP_AGENT_BINARY:-$NEUTRON_BIN_DIR/neutron-ovsvapp-agent}

# Name of agent config file
OVSVAPP_CONF_FILENAME=${OVSVAPP_CONF_FILENAME:-ovsvapp_agent.ini}

# Provide Integration Bridge.
INTEGRATION_BRIDGE=${INTEGRATION_BRIDGE:-br-int}

# Provide Tunnel Bridge.
TUNNEL_BRIDGE=${TUNNEL_BRIDGE:-br-tun}

# Provide Security Bridge.
SECURITY_BRIDGE=${SECURITY_BRIDGE:-br-sec}

# Provide to enable Fault Tolerance for OVSvApp.
ENABLE_OVSVAPP_MONITOR=${ENABLE_OVSVAPP_MONITOR:-False}

# The name of the VMware vSphere cluster.
VMWAREAPI_CLUSTER=${VMWAREAPI_CLUSTER:-Cluster1}

# Provade DVS Uplinks map.
VMWARE_DVS_UPLINK_MAPPING=${VMWARE_DVS_UPLINK_MAPPING:-physnet2:dvUplink1}

# Enable Secuirty Group support.
VMWARE_DVS_ENABLE_SG=${VMWARE_DVS_ENABLE_SG:-True}

# Set FirewallDriver.
VMWARE_DVS_FW_DRIVER=${VMWARE_DVS_FW_DRIVER:-networking_vsphere.agent.firewalls.vcenter_firewall.DVSFirewallDriver}

# Allow to use self signed ssl certificate.
VMWARE_DVS_USE_SS_SSL=${VMWARE_DVS_USE_SS_SSL:-True}

case $OVSVAPP_MODE in
    allinone)
        enable_service ovsvapp-server ovsvapp-compute ovsvapp-agent
        ;;
    server)
        enable_service ovsvapp-server
        ;;
    compute)
        enable_service ovsvapp-compute
        ;;
    agent)
        enable_service ovsvapp-agent
        ;;
    allinone_vmware_dvs)
        enable_service vmware_dvs-server vmware_dvs-agent
        ;;
    server_vmware_dvs)
        enable_service vmware_dvs-server
        ;;
    agent_vmware_dvs)
        enable_service vmware_dvs-agent
        ;;
    manual)
        echo "Manual mode: Enabling services explicitly."
        ;;
esac
