#!/bin/bash
#
# Add here any global default values that apply for any ODL release
# -----------------------------------------------------------------

# What release to use. Choices are:
# https://wiki.opendaylight.org/view/Release_Plan
#
#   latest-snapshot          (master latest snapshot)
#   latest-release
#   sodium-latest            (master)
#   neon-latest
#   fluorine-latest
#   fluorine-snapshot-0.9.3
#   fluorine-snapshot-0.9.4

ODL_RELEASE=${ODL_RELEASE:-latest-snapshot}

# The IP address of ODL. Set this in local.conf.

#Set ODL_MGR_HOST to ODL_MGR_IP if ODL_MGR_HOST is not set
ODL_MGR_HOST=${ODL_MGR_HOST:-$ODL_MGR_IP}

# Set ODL_MGR_HOST to SERVICE_HOST if neither ODL_MGR_HOST nor ODL_MGR_IP is set
ODL_MGR_HOST=${ODL_MGR_HOST:-$SERVICE_HOST}

# The list of IP addresses used as OVS manager, separated by a comma.
# In non-clustering cases, this is normally the same as ODL_MGR_HOST. However,
# for HA deployments the southbound portion to ODL is expected to
# use the ip addresses of the ODL instances instead of a single vip. That
# enables OVS to simultaneously connect to more than one ODL instance.
# Example of expected format: ODL_OVS_MANAGERS=1.1.1.1,2.2.2.2,3.3.3.3
ODL_OVS_MANAGERS=${ODL_OVS_MANAGERS:-$ODL_MGR_HOST}

# The default ODL port for Jetty to use
# NOTE: We make this configurable because by default, ODL uses port 8080 for
# Jetty, and this conflicts with swift which also uses port 8080.
ODL_PORT=${ODL_PORT:-8087}

# The ODL endpoint URL
ODL_ENDPOINT=${ODL_ENDPOINT:-http://${ODL_MGR_HOST}:${ODL_PORT}/controller/nb/v2/neutron}

# The ODL username
ODL_USERNAME=${ODL_USERNAME:-admin}

# The ODL password
ODL_PASSWORD=${ODL_PASSWORD:-admin}

# The http timeout in seconds for http client to ODL neutron northbound.
# unset or empty string means default.
ODL_TIMEOUT=${ODL_TIMEOUT:-""}

# use opendaylight dhcp server
ODL_DHCP_SERVICE=${ODL_DHCP_SERVICE:-False}

# NOTE, this parameter is used for development purpose where opendaylight is
# already installed and does not have to install again. It will save a lot of
# time for developer
ODL_INSTALL=${ODL_INSTALL:-True}

# The OpenDaylight URL PREFIX
ODL_URL_PREFIX=${ODL_URL_PREFIX:-https://nexus.opendaylight.org}

# OpenDaylight snapshot & release repositories paths
# Can be overridden in case you host proxy repositories which have a different directory structure than OpenDaylight's
ODL_URL_SNAPSHOT_REPOSITORY_PATH=${ODL_URL_SNAPSHOT_REPOSITORY_PATH:-content/repositories/opendaylight.snapshot}
ODL_URL_RELEASE_REPOSITORY_PATH=${ODL_URL_RELEASE_REPOSITORY_PATH:-content/repositories/opendaylight.release}
ODL_URL_DISTRIBUTION_KARAF_PATH=${ODL_URL_DISTRIBUTION_KARAF_PATH:-org/opendaylight/integration/karaf}

# How long (in seconds) to pause after ODL starts to let it complete booting
ODL_BOOT_WAIT=${ODL_BOOT_WAIT:-600}

# Enable conntrack support for legacy netvirt
ODL_LEGACY_NETVIRT_CONNTRACK=${ODL_LEGACY_NETVIRT_CONNTRACK:-False}

# Enable OpenDaylight l3 forwarding
ODL_L3=${ODL_L3:-False}

# If you need to route the traffic out of the box, set
# ODL_PROVIDER_MAPPINGS to map br-ex as shown below. Note
# This used to be accomplished via PUBLIC_BRIDGE, but that
# is no longer necessary.
#
# The physical provider network to device mapping. Use this
# to instruct ODL to map ports into specific bridges
# Examples:
# ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS:-br-ex:eth2}
# ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS:-physnet1:eth1,br-ex:eth2}

# MAC address for next hop gateway at external network
ODL_L3GW_MAC=${ODL_L3GW_MAC:-''}

# Enable debug logs for odl ovsdb
ODL_NETVIRT_DEBUG_LOGS=${ODL_NETVIRT_DEBUG_LOGS:-False}

# Karaf logfile information
ODL_KARAF_LOG_DATE=$(date +%Y-%m-%d-%H%M%S)
ODL_KARAF_LOG_BASE=${ODL_KARAF_LOG_BASE:-screen-karaf.log}
ODL_KARAF_LOG_NAME=$ODL_KARAF_LOG_BASE.$ODL_KARAF_LOG_DATE

# The bridge to configure
OVS_BR=${OVS_BR:-br-int}

# Use the existing ready java env
ODL_USING_EXISTING_JAVA=${ODL_USING_EXISTING_JAVA:-False}

# Allow the min/max/perm Java memory to be configurable
ODL_JAVA_MIN_MEM=${ODL_JAVA_MIN_MEM:-}
ODL_JAVA_MAX_MEM=${ODL_JAVA_MAX_MEM:-}
ODL_JAVA_MAX_PERM_MEM=${ODL_JAVA_MAX_PERM_MEM:-}

# Interval in test_with_retry calls
ODL_RETRY_SLEEP_INTERVAL=${ODL_RETRY_SLEEP_INTERVAL:-5}

# Skip installation of distribution provided Open vSwitch
SKIP_OVS_INSTALL=$(trueorfalse False SKIP_OVS_INSTALL)

# The ODL Restconf URL
# URI to hostconfigs: empty for default value
ODL_HOSTCONF_URI=${ODL_HOSTCONF_URI:-}

# Port binding controller
# pseudo-agentdb-binding, legacy-port-binding
# pseudo-agentdb-binding is supported by Boron or later
ODL_PORT_BINDING_CONTROLLER=${ODL_PORT_BINDING_CONTROLLER:-pseudo-agentdb-binding}

# Snapshot version - allows using a specific version e.g. 0.5.0-20160719.101233-3643
# latest: check the latest snapshot
# specific version: the specific version of the snapshot
# "": odl release
ODL_SNAPSHOT_VERSION=${ODL_SNAPSHOT_VERSION:-}

# Set to True to keep odl running after unstack
UNSTACK_KEEP_ODL=${UNSTACK_KEEP_ODL:-False}
