X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=lib%2Fpost-install-functions.sh;h=55b4fe4d1742255f06c0d323275b4753d931e894;hb=b8cad752ff9e3685c3b6490e7a4ef3a6862e3767;hp=f52e28e1876d535dd032d9297ce8cea05a9fb3bc;hpb=1895dcd2fa7d6888b5e451b229b213954f923de5;p=apex.git diff --git a/lib/post-install-functions.sh b/lib/post-install-functions.sh index f52e28e1..55b4fe4d 100755 --- a/lib/post-install-functions.sh +++ b/lib/post-install-functions.sh @@ -11,8 +11,12 @@ ##Post configuration after install ##params: none function configure_post_install { - local opnfv_attach_networks ovs_ip ip_range net_cidr tmp_ip - opnfv_attach_networks="admin_network public_network" + local opnfv_attach_networks ovs_ip ip_range net_cidr tmp_ip af external_network_ipv6 + external_network_ipv6=False + opnfv_attach_networks="admin" + if [[ $enabled_network_list =~ "external" ]]; then + opnfv_attach_networks+=' external' + fi echo -e "${blue}INFO: Post Install Configuration Running...${reset}" @@ -29,6 +33,41 @@ cat ~/jumphost_id_rsa.pub | ssh -T ${SSH_OPTIONS[@]} "heat-admin@\$node" 'cat >> done EOI + echo -e "${blue}INFO: Checking if OVS bridges have IP addresses...${reset}" + for network in ${opnfv_attach_networks}; do + ovs_ip=$(find_ip ${NET_MAP[$network]}) + tmp_ip='' + if [ -n "$ovs_ip" ]; then + echo -e "${blue}INFO: OVS Bridge ${NET_MAP[$network]} has IP address ${ovs_ip}${reset}" + else + echo -e "${blue}INFO: OVS Bridge ${NET_MAP[$network]} missing IP, will configure${reset}" + # use last IP of allocation pool + eval "ip_range=\${${network}_overcloud_ip_range}" + ovs_ip=${ip_range##*,} + eval "net_cidr=\${${network}_cidr}" + if [[ $ovs_ip =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + af=4 + else + af=6 + if [ "$network" == "external" ]; then + ublic_network_ipv6=True + fi + #enable ipv6 on bridge interface + echo 0 > /proc/sys/net/ipv6/conf/${NET_MAP[$network]}/disable_ipv6 + fi + sudo ip addr add ${ovs_ip}/${net_cidr##*/} dev ${NET_MAP[$network]} + sudo ip link set up ${NET_MAP[$network]} + tmp_ip=$(find_ip ${NET_MAP[$network]} $af) + if [ -n "$tmp_ip" ]; then + echo -e "${blue}INFO: OVS Bridge ${NET_MAP[$network]} IP set: ${tmp_ip}${reset}" + continue + else + echo -e "${red}ERROR: Unable to set OVS Bridge ${NET_MAP[$network]} with IP: ${ovs_ip}${reset}" + return 1 + fi + fi + done + if [ "${deploy_options_array['dataplane']}" == 'ovs_dpdk' ]; then echo -e "${blue}INFO: Bringing up br-phy and ovs-agent for dpdk compute nodes...${reset}" compute_nodes=$(undercloud_connect stack "source stackrc; nova list | grep compute | wc -l") @@ -39,68 +78,107 @@ EOI done fi + # TODO fix this when HA SDN controllers are supported + if [ "${deploy_options_array['sdn_controller']}" != 'False' ]; then + echo -e "${blue}INFO: Finding SDN Controller IP for overcloudrc...${reset}" + sdn_controller_ip=$(undercloud_connect stack "source stackrc;nova list | grep controller-0 | cut -d '|' -f 7 | grep -Eo [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + echo -e "${blue}INFO: SDN Controller IP is ${sdn_controller_ip} ${reset}" + undercloud_connect stack "echo 'export SDN_CONTROLLER_IP=${sdn_controller_ip}' >> /home/stack/overcloudrc" + fi + ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <> ./overcloudrc +fi +if ! grep -q "OS_TENANT_NAME" ./overcloudrc;then + echo "export OS_TENANT_NAME=admin" >> ./overcloudrc +fi + + EOI - echo -e "${blue}INFO: Checking if OVS bridges have IP addresses...${reset}" - for network in ${opnfv_attach_networks}; do - ovs_ip=$(find_ip ${NET_MAP[$network]}) - tmp_ip='' - if [ -n "$ovs_ip" ]; then - echo -e "${blue}INFO: OVS Bridge ${NET_MAP[$network]} has IP address ${ovs_ip}${reset}" + # for virtual, we NAT external network through Undercloud + # same goes for baremetal if only jumphost has external connectivity + if [ "$virtual" == "TRUE" ] || ! test_overcloud_connectivity && [ "$external_network_ipv6" != "True" ]; then + if [[ "$enabled_network_list" =~ "external" ]]; then + nat_cidr=${external_cidr} else - echo -e "${blue}INFO: OVS Bridge ${NET_MAP[$network]} missing IP, will configure${reset}" - # use last IP of allocation pool - eval "ip_range=\${${network}_usable_ip_range}" - ovs_ip=${ip_range##*,} - eval "net_cidr=\${${network}_cidr}" - sudo ip addr add ${ovs_ip}/${net_cidr##*/} dev ${NET_MAP[$network]} - sudo ip link set up ${NET_MAP[$network]} - tmp_ip=$(find_ip ${NET_MAP[$network]}) - if [ -n "$tmp_ip" ]; then - echo -e "${blue}INFO: OVS Bridge ${NET_MAP[$network]} IP set: ${tmp_ip}${reset}" - continue - else - echo -e "${red}ERROR: Unable to set OVS Bridge ${NET_MAP[$network]} with IP: ${ovs_ip}${reset}" - return 1 - fi + nat_cidr=${admin_cidr} fi - done - - # for virtual, we NAT public network through Undercloud - 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}" + if ! configure_undercloud_nat ${nat_cidr}; then + echo -e "${red}ERROR: Unable to NAT undercloud with external net: ${nat_cidr}${reset}" exit 1 else - echo -e "${blue}INFO: Undercloud VM has been setup to NAT Overcloud public network${reset}" + echo -e "${blue}INFO: Undercloud VM has been setup to NAT Overcloud external network${reset}" fi fi @@ -118,6 +196,12 @@ done EOI fi + ### VSPERF ### + if [[ "${deploy_options_array['vsperf']}" == 'True' ]]; then + echo "${blue}\nVSPERF enabled, running build_base_machine.sh\n${reset}" + overcloud_connect "compute0" "sudo sh -c 'cd /var/opt/vsperf/systems/ && ./build_base_machine.sh 2>&1 > /var/log/vsperf.log'" + fi + # Collect deployment logs ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <