Advertisement
jolausa

switch_ODL.sh

May 31st, 2015
63
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. #https://gerrit.opnfv.org/gerrit/#/c/648/
  3.  
  4. #Get Controler IP
  5. contr_ip=$(fuel node  | grep controller | awk '{print $10}')
  6.  
  7. #Get Compute IPs
  8. ips=$(fuel node  | grep compute | awk '{print $10}')
  9. comp_ips_arr=($ips)
  10.  
  11. echo "Controller node:"
  12. echo $contr_ip
  13.  
  14. echo "Compute nodes:"
  15. for i in "${comp_ips_arr[@]}" ; do
  16.     echo $i
  17. done
  18.  
  19.  
  20. # Change DNS config and call config_net_odl.sh on all Nodes
  21. cmd1='echo -e "domain domain.tld\nnameserver" 8.8.8.8> /etc/resolv.conf'
  22. cmd2='/etc/puppet/modules/opnfv/scripts/config_net_odl.sh'
  23.  
  24. ssh $contr_ip $cmd1
  25. ssh $contr_ip $cmd2
  26.  
  27. for i in "${comp_ips_arr[@]}" ; do
  28.     #ssh $i $cmd1 · on computes, the br-ex doesn't have an IP, and they cannot even ping 8.8.8.8
  29.     ssh $i $cmd2
  30. done
  31.  
  32. # Stage ODL on controller
  33. ssh $contr_ip "/etc/puppet/modules/opnfv/scripts/stage_odl.sh"
  34.  
  35. # Wait a bit (not sure how long or if this is needed...)
  36. sleep 60
  37.  
  38. # Reboot Nodes
  39. ssh $contr_ip "reboot"
  40. for i in "${comp_ips_arr[@]}" ; do
  41.     ssh $i "reboot"
  42. done
Advertisement
RAW Paste Data Copied
Advertisement