aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarry Huang <huangxiangyu5@huawei.com>2018-06-15 17:47:47 +0800
committerHarry Huang <huangxiangyu5@huawei.com>2018-06-19 12:55:08 +0800
commitcb6aba5b0d0fd689bb89b1c59d6383453e4a794d (patch)
tree8e0f40d1117422b4dcf65ccfd48ab035f565b0ee
parent10c1877374ac8eb2cfbbdf34daeb0049ea4dd67e (diff)
Fix some hard coding for some ip assignments
Change-Id: I13571914eb51fd0923bf025302dab46bae46ba9a Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
-rw-r--r--deploy/conf/base.conf10
-rw-r--r--deploy/conf/cluster.conf1
-rw-r--r--deploy/conf/compass.conf4
-rw-r--r--deploy/conf/virtual.conf5
-rw-r--r--deploy/config_parse.py31
-rwxr-xr-xdeploy/launch.sh2
6 files changed, 26 insertions, 27 deletions
diff --git a/deploy/conf/base.conf b/deploy/conf/base.conf
index c2bf529..714ed82 100644
--- a/deploy/conf/base.conf
+++ b/deploy/conf/base.conf
@@ -2,18 +2,11 @@ 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 CLUSTER_NAME="opnfv2"
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"}
@@ -28,7 +21,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 ddcbb6c..f8abde5 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 98ba302..4582d7f 100644
--- a/deploy/conf/compass.conf
+++ b/deploy/conf/compass.conf
@@ -1,5 +1,6 @@
export COMPASS_VIRT_CPUS=4
export COMPASS_VIRT_MEM=4096
+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"
@@ -8,9 +9,6 @@ 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 1e9034f..9661e19 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 3d8dedc..5891c76 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/launch.sh b/deploy/launch.sh
index 6cbad1f..7cf702a 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