summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/opnfv-apex-common.spec1
-rw-r--r--build/opnfv-apex-undercloud.spec7
-rwxr-xr-xci/build.sh11
-rwxr-xr-xci/deploy.sh21
-rw-r--r--lib/common-functions.sh85
5 files changed, 91 insertions, 34 deletions
diff --git a/build/opnfv-apex-common.spec b/build/opnfv-apex-common.spec
index 2b49e18c..6915b795 100644
--- a/build/opnfv-apex-common.spec
+++ b/build/opnfv-apex-common.spec
@@ -50,6 +50,7 @@ mkdir -p %{buildroot}%{python3_sitelib}/apex/
install lib/python/apex/__init__.py %{buildroot}%{python3_sitelib}/apex/
install lib/python/apex/ip_utils.py %{buildroot}%{python3_sitelib}/apex/
install lib/python/apex/net_env.py %{buildroot}%{python3_sitelib}/apex/
+install lib/python/apex/deploy_env.py %{buildroot}%{python3_sitelib}/apex/
mkdir -p %{buildroot}%{_var}/opt/opnfv/lib/installer/onos/
install lib/installer/onos/onos_gw_mac_update.sh %{buildroot}%{_var}/opt/opnfv/lib/installer/onos/
diff --git a/build/opnfv-apex-undercloud.spec b/build/opnfv-apex-undercloud.spec
index ae72485f..0e4798b3 100644
--- a/build/opnfv-apex-undercloud.spec
+++ b/build/opnfv-apex-undercloud.spec
@@ -27,6 +27,8 @@ install build/undercloud.qcow2 %{buildroot}%{_var}/opt/opnfv/images/
install build/network-environment.yaml %{buildroot}%{_var}/opt/opnfv/
install build/nics-controller.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-controller.yaml.template
install build/nics-compute.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-compute.yaml.template
+install build/nics-controller.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-controller.yaml.jinja2
+install build/nics-compute.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-compute.yaml.jinja2
%files
%defattr(644, root, root, -)
@@ -34,8 +36,13 @@ install build/nics-compute.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-comp
%{_var}/opt/opnfv/network-environment.yaml
%{_var}/opt/opnfv/nics-controller.yaml.template
%{_var}/opt/opnfv/nics-compute.yaml.template
+%{_var}/opt/opnfv/nics-controller.yaml.jinja2
+%{_var}/opt/opnfv/nics-compute.yaml.jinja2
+
%changelog
+* Thu May 24 2016 Tim Rozet <trozet@redhat.com> - 3.0-1
+- Adds jinja2 nic templates
* Mon Apr 04 2016 Dan Radez <dradez@redhat.com> - 3.0-0
- Version update for Colorado
* Wed Mar 30 2016 Dan Radez <dradez@redhat.com> - 2.1-2
diff --git a/ci/build.sh b/ci/build.sh
index 7e080bed..e6870558 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -35,6 +35,7 @@ CACHE_DEST=""
CACHE_DIR="cache"
CACHE_NAME="apex-cache"
MAKE_TARGETS="images"
+REQUIRED_PKGS="rpm-build python-docutils"
parse_cmdline() {
while [ "${1:0:1}" = "-" ]
@@ -82,6 +83,16 @@ run_make() {
parse_cmdline "$@"
+# Install build dependencies
+for pkg in $REQUIRED_PKGS; do
+ if ! rpm -q $pkg > /dev/null; then
+ if ! sudo yum -y install $pkg > /dev/null; then
+ echo "Required package $pkg missing and installation failed."
+ exit 1
+ fi
+ fi
+done
+
if [ -n "$RELEASE" ]; then MAKE_ARGS+="RELEASE=$RELEASE "; fi
# Get the Old Cache
diff --git a/ci/deploy.sh b/ci/deploy.sh
index d43960ef..18f96319 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -106,7 +106,8 @@ parse_setting_value() {
##parses network settings yaml into globals
parse_network_settings() {
- if local output=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py parse_net_settings -n $NETSETS -i $net_isolation_enabled); then
+ local output
+ if output=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py parse_net_settings -n $NETSETS -i $net_isolation_enabled); then
echo -e "${blue}${output}${reset}"
eval "$output"
else
@@ -117,7 +118,8 @@ parse_network_settings() {
##parses deploy settings yaml into globals
parse_deploy_settings() {
- if local output=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py parse-deploy-settings -f $DEPLOY_SETTINGS_FILE); then
+ local output
+ if output=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py parse-deploy-settings -f $DEPLOY_SETTINGS_FILE); then
echo -e "${blue}${output}${reset}"
eval "$output"
else
@@ -639,7 +641,7 @@ function configure_network_environment {
##Copy over the glance images and instackenv json file
##params: none
function configure_undercloud {
-
+ local controller_nic_template compute_nic_template
echo
echo "Copying configuration files to Undercloud"
if [[ "$net_isolation_enabled" == "TRUE" ]]; then
@@ -647,13 +649,22 @@ function configure_undercloud {
echo -e "${blue}Network Environment set for Deployment: ${reset}"
cat $CONFIG/network-environment.yaml
scp ${SSH_OPTIONS[@]} $CONFIG/network-environment.yaml "stack@$UNDERCLOUD":
+ if ! controller_nic_template=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py nic_template -d $CONFIG -f nics-controller.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family); then
+ echo -e "${red}ERROR: Failed to generate controller NIC heat template ${reset}"
+ exit 1
+ fi
+
+ if ! compute_nic_template=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py nic_template -d $CONFIG -f nics-compute.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family); then
+ echo -e "${red}ERROR: Failed to generate compute NIC heat template ${reset}"
+ exit 1
+ fi
ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" << EOI
mkdir nics/
cat > nics/controller.yaml << EOF
-$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py nic_template -d $CONFIG -f nics-controller.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family)
+$controller_nic_template
EOF
cat > nics/compute.yaml << EOF
-$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py nic_template -d $CONFIG -f nics-compute.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family)
+$compute_nic_template
EOF
EOI
fi
diff --git a/lib/common-functions.sh b/lib/common-functions.sh
index e7041ac4..dfac008e 100644
--- a/lib/common-functions.sh
+++ b/lib/common-functions.sh
@@ -27,6 +27,7 @@ function find_ip {
function attach_interface_to_ovs {
local bridge interface
local if_ip if_mask if_gw if_file ovs_file if_prefix
+ local if_metric if_dns1 if_dns2
if [[ -z "$1" || -z "$2" ]]; then
return 1
@@ -46,6 +47,9 @@ function attach_interface_to_ovs {
if_ip=$(sed -n 's/^IPADDR=\(.*\)$/\1/p' ${if_file})
if_mask=$(sed -n 's/^NETMASK=\(.*\)$/\1/p' ${if_file})
if_gw=$(sed -n 's/^GATEWAY=\(.*\)$/\1/p' ${if_file})
+ if_metric=$(sed -n 's/^METRIC=\(.*\)$/\1/p' ${if_file})
+ if_dns1=$(sed -n 's/^DNS1=\(.*\)$/\1/p' ${if_file})
+ if_dns2=$(sed -n 's/^DNS2=\(.*\)$/\1/p' ${if_file})
else
echo "ERROR: ifcfg file missing for ${interface}"
return 1
@@ -77,7 +81,7 @@ ONBOOT=yes
OVS_BRIDGE=${bridge}
PROMISC=yes" > ${if_file}
- if [ -z ${if_gw} ]; then
+
# create bridge cfg
echo "DEVICE=${bridge}
DEVICETYPE=ovs
@@ -89,17 +93,24 @@ TYPE=OVSBridge
PROMISC=yes
PEERDNS=no" > ${ovs_file}
- else
- echo "DEVICE=${bridge}
-DEVICETYPE=ovs
-IPADDR=${if_ip}
-NETMASK=${if_mask}
-BOOTPROTO=static
-ONBOOT=yes
-TYPE=OVSBridge
-PROMISC=yes
-GATEWAY=${if_gw}
-PEERDNS=no" > ${ovs_file}
+ if [ -n "$if_gw" ]; then
+ echo "GATEWAY=${if_gw}" >> ${ovs_file}
+ fi
+
+ if [ -n "$if_metric" ]; then
+ echo "METRIC=${if_metric}" >> ${ovs_file}
+ fi
+
+ if [[ -n "$if_dns1" || -n "$if_dns2" ]]; then
+ sed -i '/PEERDNS/c\PEERDNS=yes' ${ovs_file}
+
+ if [ -n "$if_dns1" ]; then
+ echo "DNS1=${if_dns1}" >> ${ovs_file}
+ fi
+
+ if [ -n "$if_dns2" ]; then
+ echo "DNS2=${if_dns2}" >> ${ovs_file}
+ fi
fi
sudo systemctl restart network
@@ -113,6 +124,7 @@ function detach_interface_from_ovs {
local port_output ports_no_orig
local net_path
local if_ip if_mask if_gw if_prefix
+ local if_metric if_dns1 if_dns2
net_path=/etc/sysconfig/network-scripts/
if [[ -z "$1" ]]; then
@@ -134,12 +146,15 @@ function detach_interface_from_ovs {
elif [ -e ${net_path}/ifcfg-${line}.orig ]; then
mv -f ${net_path}/ifcfg-${line}.orig ${net_path}/ifcfg-${line}
elif [ -e ${net_path}/ifcfg-${bridge} ]; then
- if_ip=$(sed -n 's/^IPADDR=\(.*\)$/\1/p' ${if_file})
- if_mask=$(sed -n 's/^NETMASK=\(.*\)$/\1/p' ${if_file})
- if_gw=$(sed -n 's/^GATEWAY=\(.*\)$/\1/p' ${if_file})
+ if_ip=$(sed -n 's/^IPADDR=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge})
+ if_mask=$(sed -n 's/^NETMASK=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge})
+ if_gw=$(sed -n 's/^GATEWAY=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge})
+ if_metric=$(sed -n 's/^METRIC=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge})
+ if_dns1=$(sed -n 's/^DNS1=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge})
+ if_dns2=$(sed -n 's/^DNS2=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge})
if [ -z "$if_mask" ]; then
- if_prefix=$(sed -n 's/^PREFIX=\(.*\)$/\1/p' ${if_file})
+ if_prefix=$(sed -n 's/^PREFIX=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge})
if_mask=$(prefix2mask ${if_prefix})
fi
@@ -148,26 +163,34 @@ function detach_interface_from_ovs {
return 1
fi
- if [ -z ${if_gw} ]; then
- # create if cfg
- echo "DEVICE=${line}
-IPADDR=${if_ip}
-NETMASK=${if_mask}
-BOOTPROTO=static
-ONBOOT=yes
-TYPE=Ethernet
-NM_CONTROLLED=no
-PEERDNS=no" > ${net_path}/ifcfg-${line}
- else
- echo "DEVICE=${line}
+ # create if cfg
+ echo "DEVICE=${line}
IPADDR=${if_ip}
NETMASK=${if_mask}
BOOTPROTO=static
ONBOOT=yes
TYPE=Ethernet
NM_CONTROLLED=no
-GATEWAY=${if_gw}
PEERDNS=no" > ${net_path}/ifcfg-${line}
+
+ if [ -n "$if_gw" ]; then
+ echo "GATEWAY=${if_gw}" >> ${net_path}/ifcfg-${line}
+ fi
+
+ if [ -n "$if_metric" ]; then
+ echo "METRIC=${if_metric}" >> ${net_path}/ifcfg-${line}
+ fi
+
+ if [[ -n "$if_dns1" || -n "$if_dns2" ]]; then
+ sed -i '/PEERDNS/c\PEERDNS=yes' ${net_path}/ifcfg-${line}
+
+ if [ -n "$if_dns1" ]; then
+ echo "DNS1=${if_dns1}" >> ${net_path}/ifcfg-${line}
+ fi
+
+ if [ -n "$if_dns2" ]; then
+ echo "DNS2=${if_dns2}" >> ${net_path}/ifcfg-${line}
+ fi
fi
break
else
@@ -182,6 +205,10 @@ PEERDNS=no" > ${net_path}/ifcfg-${line}
sudo sed -i 's/IPADDR=.*//' ${net_path}/ifcfg-${bridge}
sudo sed -i 's/NETMASK=.*//' ${net_path}/ifcfg-${bridge}
sudo sed -i 's/GATEWAY=.*//' ${net_path}/ifcfg-${bridge}
+ sudo sed -i 's/DNS1=.*//' ${net_path}/ifcfg-${bridge}
+ sudo sed -i 's/DNS2=.*//' ${net_path}/ifcfg-${bridge}
+ sudo sed -i 's/METRIC=.*//' ${net_path}/ifcfg-${bridge}
+ sudo sed -i 's/PEERDNS=.*//' ${net_path}/ifcfg-${bridge}
sudo systemctl restart network
}