From 2a937932642f3e8288d338c6fa4a2b6a7a5defc2 Mon Sep 17 00:00:00 2001 From: bob Date: Thu, 14 Jan 2016 17:42:49 +0800 Subject: add step to execute gw_mac_update.sh after apex deployed Change-Id: I47c316e26ff8e597c781562645397335e8c5bd70 Signed-off-by: bob zhou Signed-off-by: Tim Rozet --- build/opnfv-apex-common.spec | 3 ++ ci/deploy.sh | 19 +++++++++++ lib/common-functions.sh | 20 ++++++++++++ lib/installer/onos/onos_gw_mac_update.sh | 56 ++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+) create mode 100644 lib/installer/onos/onos_gw_mac_update.sh diff --git a/build/opnfv-apex-common.spec b/build/opnfv-apex-common.spec index 9aaf088d..4d3c4509 100644 --- a/build/opnfv-apex-common.spec +++ b/build/opnfv-apex-common.spec @@ -38,6 +38,8 @@ install config/deploy/network/network_settings.yaml %{buildroot}%{_sysconfdir}/o mkdir -p %{buildroot}%{_var}/opt/opnfv/lib/ install lib/common-functions.sh %{buildroot}%{_var}/opt/opnfv/lib/ +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/ mkdir -p %{buildroot}%{_docdir}/opnfv/ install LICENSE.rst %{buildroot}%{_docdir}/opnfv/ @@ -53,6 +55,7 @@ install config/deploy/network/network_settings.yaml %{buildroot}%{_docdir}/opnfv %attr(755,root,root) %{_bindir}/opnfv-deploy %attr(755,root,root) %{_bindir}/opnfv-clean %{_var}/opt/opnfv/lib/common-functions.sh +%{_var}/opt/opnfv/lib/installer/onos/onos_gw_mac_update.sh %{_sysconfdir}/opnfv-apex/os-odl_l2-nofeature-ha.yaml %{_sysconfdir}/opnfv-apex/os-odl_l2-sfc-ha.yaml %{_sysconfdir}/opnfv-apex/os-odl_l3-nofeature-ha.yaml diff --git a/ci/deploy.sh b/ci/deploy.sh index 232d8251..6ac6aff9 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -47,6 +47,7 @@ NET_MAP['storage_network']="brbm3" ##LIBRARIES source $CONFIG/lib/common-functions.sh +source $CONFIG/lib/installer/onos/onos_gw_mac_update.sh ##FUNCTIONS ##translates yaml into variables @@ -873,6 +874,16 @@ EOI fi fi done + + # for virtual, we NAT public network through instack + if [ "$virtual" == "TRUE" ]; then + if ! configure_undercloud_nat ${public_network_cidr}; then + echo -e "${red}ERROR: Unable to NAT undercloud with external net: ${public_network_cidr}${reset}" + exit 1 + else + echo -e "${blue}INFO: Undercloud (instack VM) has been setup to NAT Overcloud public network${reset}" + fi + fi } display_usage() { @@ -1029,6 +1040,14 @@ main() { echo -e "${blue}INFO: Post Install Configuration Complete${reset}" fi fi + if [[ ${deploy_options_array['sdn_controller']} == 'onos' ]]; then + if ! onos_update_gw_mac ${public_network_cidr} ${public_network_gateway}; then + echo -e "${red}ERROR:ONOS Post Install Configuration Failed, Exiting.${reset}" + exit 1 + else + echo -e "${blue}INFO: ONOS Post Install Configuration Complete${reset}" + fi + fi } main "$@" diff --git a/lib/common-functions.sh b/lib/common-functions.sh index edf06cff..1e55aa18 100644 --- a/lib/common-functions.sh +++ b/lib/common-functions.sh @@ -504,3 +504,23 @@ PEERDNS=no" > ${net_path}/ifcfg-${line} sudo systemctl restart network } + +# Update iptables rule for external network reach internet +# for virtual deployments +# params: external_cidr +function configure_undercloud_nat { + local external_cidr + if [[ -z "$1" ]]; then + return 1 + else + external_cidr=$1 + fi + + ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" <