diff options
author | Harry Huang <huangxiangyu5@huawei.com> | 2017-12-13 17:04:21 +0800 |
---|---|---|
committer | Harry Huang <huangxiangyu5@huawei.com> | 2018-01-22 16:39:39 +0800 |
commit | f229198474dd5c8af9a195679c0480e154629c9b (patch) | |
tree | 4ba11b91a47d23eefeb360808cf6baafa5e55183 /deploy | |
parent | 24e25de8fc981e3b33ffaa71e76f27dedcf6b89e (diff) |
Fix some hard coding for some ip assignments
JIRA: COMPASS-570
1. fix hard coding in ip assignments for
install network. support full ip assignments
from network.yml
2. remove some used config item in deploy/conf
Change-Id: I566b74f4a55e6b96af3ee9f41d1e183a73424a91
Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
Diffstat (limited to 'deploy')
-rw-r--r-- | deploy/conf/base.conf | 10 | ||||
-rw-r--r-- | deploy/conf/cluster.conf | 1 | ||||
-rw-r--r-- | deploy/conf/compass.conf | 8 | ||||
-rw-r--r-- | deploy/conf/virtual.conf | 5 | ||||
-rw-r--r-- | deploy/config_parse.py | 31 | ||||
-rwxr-xr-x | deploy/deploy_host.sh | 2 | ||||
-rwxr-xr-x | deploy/launch.sh | 2 |
7 files changed, 29 insertions, 30 deletions
diff --git a/deploy/conf/base.conf b/deploy/conf/base.conf index 5395405d..274847ae 100644 --- a/deploy/conf/base.conf +++ b/deploy/conf/base.conf @@ -2,17 +2,10 @@ export DHA=${DHA:-$COMPASS_DIR/deploy/conf/vm_environment/os-nosdn-nofeature-ha. export NEUTRON=${NEUTRON:-$COMPASS_DIR/deploy/conf/neutron_cfg.yaml} export NETWORK=${NETWORK:-$COMPASS_DIR/deploy/conf/network_cfg.yaml} export TAR_URL=${TAR_URL:-file://`pwd`/work/building/compass.tar.gz} -export INSTALL_IP=${INSTALL_IP:-10.1.0.1} -export EXT_NAT_MASK=${EXT_NAT_MASK:-255.255.252.0} -export EXT_NAT_GW=${EXT_NAT_GW:-192.16.1.1} -export EXT_NAT_IP_START=${EXT_NAT_IP_START:-192.16.1.3} -export EXT_NAT_IP_END=${EXT_NAT_IP_END:-192.16.1.254} -export EXTERNAL_NIC=${EXTERNAL_NIC:-eth0} +export PXE_NIC=${PXE_NIC:-eth0} export DOMAIN="ods.com" export PARTITIONS="/=30%,/home=5%,/tmp=5%,/var=60%" -export SUBNETS="10.1.0.0/24,172.16.2.0/24,172.16.3.0/24,172.16.4.0/24" -export MANAGEMENT_IP_START=${MANAGEMENT_IP_START:-'10.1.0.50'} export MANAGEMENT_INTERFACE=${MANAGEMENT_INTERFACE:-eth0} export DASHBOARD_URL="" export ENABLE_SECGROUP=${ENABLE_SECGROUP:-"true"} @@ -27,7 +20,6 @@ export NETWORK_MAPPING=${NETWORK_MAPPING:-"install=${MANAGEMENT_INTERFACE}"} export PROXY="" export IGNORE_PROXY="" export SEARCH_PATH="ods.com" -export GATEWAY="10.1.0.1" export SERVER_CREDENTIAL="root=root" export LOCAL_REPO_URL="" export OS_CONFIG_FILENAME="" diff --git a/deploy/conf/cluster.conf b/deploy/conf/cluster.conf index 750ff113..c7a708b9 100644 --- a/deploy/conf/cluster.conf +++ b/deploy/conf/cluster.conf @@ -30,4 +30,3 @@ if [[ "x"$KUBERNETES_VERSION != "x" ]]; then fi export DEFAULT_ROLES="" -export VIP="10.1.0.222" diff --git a/deploy/conf/compass.conf b/deploy/conf/compass.conf index 9d9145f1..bccc64d4 100644 --- a/deploy/conf/compass.conf +++ b/deploy/conf/compass.conf @@ -1,16 +1,14 @@ -export COMPASS_VIRT_CPUS=4 -export COMPASS_VIRT_MEM=4096 +export CLUSTER_NAME=${CLUSTER_NAME:-opnfv} +export INSTALL_IP=${INSTALL_IP:-$INSTALL_GW} export COMPASS_SERVER=$INSTALL_IP export COMPASS_DECK_PORT="5050" export COMPASS_SERVER_URL="http://$INSTALL_IP:$COMPASS_DECK_PORT/api" export HTTP_SERVER_URL="http://$INSTALL_IP:$COMPASS_DECK_PORT/api" export COMPASS_USER_EMAIL="admin@huawei.com" export COMPASS_USER_PASSWORD="admin" + export COMPASS_DNS1=${COMPASS_DNS1:-'8.8.8.8'} export COMPASS_DNS2=${COMPASS_DNS2:-} -export COMPASS_EXTERNAL_IP=${COMPASS_EXTERNAL_IP:-} -export COMPASS_EXTERNAL_MASK=${COMPASS_EXTERNAL_MASK:-} -export COMPASS_EXTERNAL_GW=${COMPASS_EXTERNAL_GW:-} export LANGUAGE="EN" export TIMEZONE="America/Los_Angeles" export NTP_SERVER="$COMPASS_SERVER" diff --git a/deploy/conf/virtual.conf b/deploy/conf/virtual.conf index 1e9034f3..9661e199 100644 --- a/deploy/conf/virtual.conf +++ b/deploy/conf/virtual.conf @@ -3,6 +3,11 @@ export VIRT_CPUS=${VIRT_CPUS:-8} export VIRT_MEM=${VIRT_MEM:-16384} export VIRT_DISK=${VIRT_DISK:-200G} +export EXT_NAT_MASK=${EXT_NAT_MASK:-255.255.252.0} +export EXT_NAT_GW=${EXT_NAT_GW:-192.16.1.1} +export EXT_NAT_IP_START=${EXT_NAT_IP_START:-192.16.1.3} +export EXT_NAT_IP_END=${EXT_NAT_IP_END:-192.16.1.254} + export SWITCH_IPS="1.1.1.1" export SWITCH_CREDENTIAL="version=2c,community=public" export DEPLOYMENT_TIMEOUT="300" diff --git a/deploy/config_parse.py b/deploy/config_parse.py index 1575ca37..ceaab0f5 100644 --- a/deploy/config_parse.py +++ b/deploy/config_parse.py @@ -13,8 +13,6 @@ import yaml import sys from Cheetah.Template import Template -PXE_INTF = "eth0" - def init(file): with open(file) as fd: @@ -64,9 +62,10 @@ def hostmacs(s, seq, host=None): def export_network_file(dha, network, ofile): - env = {} - - mgmt_net = [item for item in network['ip_settings'] + install_network_env = {} + host_network_env = {} + ip_settings = network['ip_settings'] + mgmt_net = [item for item in ip_settings if item['name'] == 'mgmt'][0] mgmt_gw = mgmt_net['gw'] mgmt_cidr = mgmt_net['cidr'] @@ -74,12 +73,15 @@ def export_network_file(dha, network, ofile): mgmt_netmask = '.'.join([str((0xffffffff << (32 - prefix) >> i) & 0xff) for i in [24, 16, 8, 0]]) dhcp_ip_range = ' '.join(mgmt_net['dhcp_ranges'][0]) - env.update({'INSTALL_GW': mgmt_gw}) - env.update({'INSTALL_CIDR': mgmt_cidr}) - env.update({'INSTALL_NETMASK': mgmt_netmask}) - env.update({'INSTALL_IP_RANGE': dhcp_ip_range}) - export_env_dict(env, ofile) - + internal_vip = network['internal_vip']['ip'] + install_network_env.update({'INSTALL_GW': mgmt_gw}) + install_network_env.update({'INSTALL_CIDR': mgmt_cidr}) + install_network_env.update({'INSTALL_NETMASK': mgmt_netmask}) + install_network_env.update({'INSTALL_IP_RANGE': dhcp_ip_range}) + install_network_env.update({'VIP': internal_vip}) + export_env_dict(install_network_env, ofile) + + pxe_nic = os.environ['PXE_NIC'] host_ip_range = mgmt_net['ip_ranges'][0] host_ips = netaddr.iter_iprange(host_ip_range[0], host_ip_range[1]) host_networks = [] @@ -87,8 +89,11 @@ def export_network_file(dha, network, ofile): host_name = host['name'] host_ip = str(host_ips.next()) host_networks.append( - "{0}:{1}={2}|is_mgmt".format(host_name, PXE_INTF, host_ip)) - host_network_env = {"HOST_NETWORKS": ';'.join(host_networks)} + '{0}:{1}={2}|is_mgmt'.format(host_name, pxe_nic, host_ip)) + host_subnets = [item['cidr'] for item in ip_settings] + host_network_env.update({'NETWORK_MAPPING': "install=" + pxe_nic}) + host_network_env.update({'HOST_NETWORKS': ';'.join(host_networks)}) + host_network_env.update({'SUBNETS': ','.join(host_subnets)}) export_env_dict(host_network_env, ofile, True) diff --git a/deploy/deploy_host.sh b/deploy/deploy_host.sh index 7a91bd88..512386e5 100755 --- a/deploy/deploy_host.sh +++ b/deploy/deploy_host.sh @@ -37,7 +37,7 @@ function deploy_host(){ --adapter_flavor_pattern="${ADAPTER_FLAVOR_PATTERN}" --repo_name="${REPO_NAME}" \ --http_proxy="${PROXY}" --https_proxy="${PROXY}" --no_proxy="${IGNORE_PROXY}" \ --ntp_server="${NTP_SERVER}" --dns_servers="${NAMESERVERS}" --domain="${DOMAIN}" \ - --search_path="${SEARCH_PATH}" --default_gateway="${GATEWAY}" \ + --search_path="${SEARCH_PATH}" --default_gateway="${INSTALL_GW}" \ --server_credential="${SERVER_CREDENTIAL}" --local_repo_url="${LOCAL_REPO_URL}" \ --os_config_json_file="${OS_CONFIG_FILENAME}" --service_credentials="${SERVICE_CREDENTIALS}" \ --console_credentials="${CONSOLE_CREDENTIALS}" --host_networks="${HOST_NETWORKS}" \ diff --git a/deploy/launch.sh b/deploy/launch.sh index 98d9e4d6..2b32c337 100755 --- a/deploy/launch.sh +++ b/deploy/launch.sh @@ -15,6 +15,7 @@ mkdir -p $WORK_DIR/script export DEPLOY_FIRST_TIME=${DEPLOY_FIRST_TIME:-"true"} export DEPLOY_RECOVERY=${DEPLOY_RECOVERY:-"false"} +source ${COMPASS_DIR}/deploy/conf/base.conf source ${COMPASS_DIR}/deploy/prepare.sh prepare_python_env source ${COMPASS_DIR}/util/log.sh @@ -24,7 +25,6 @@ check_input_para source $(process_default_para $*) || exit 1 source ${COMPASS_DIR}/deploy/conf/${FLAVOR}.conf source ${COMPASS_DIR}/deploy/conf/${TYPE}.conf -source ${COMPASS_DIR}/deploy/conf/base.conf source ${COMPASS_DIR}/deploy/conf/compass.conf source ${COMPASS_DIR}/deploy/network.sh source ${COMPASS_DIR}/deploy/host_${TYPE}.sh |