Add documentation and files related to initial host setup
[csit.git] / resources / tools / testbed-setup / README.md
1 # Testbed Setup
2
3 ## Introduction
4
5 This directoctory contains the *high-level* process to set up a hardware
6 machine as a CSIT testbed, either for use as a physical testbed host or
7 as a VIRL server.
8
9 Code in this directory is NOT executed as part of a regular CSIT test case
10 but is stored here merely for archiving and documentation purposes.
11
12
13 ## Setting up a hardware host
14
15 Documentation below is just bullet points and assumes and understanding
16 of PXE boot and ansible.
17
18 This process is specific for LF lab, and both examples given here as
19 well as associated code, are based on the assumption that they are run
20 in LF environment. If run elsewhere, changes will be required to IP addresses
21 and other parameters.
22
23 The process below assumes that there is a host used for boostrapping (referred
24 to as "PXE boostrap server" below), and that the directory containig this README
25 is available on the PXE bootstrap server in ~testuser/host-setup.
26
27 ### Prepare the PXE bootstrap server (one-time)
28
29   - `sudo apt-get install isc-dhcp-server tftpd-hpa nginx-light ansible`
30   - `cd ~testuser/host-setup`
31   - `wget 'http://releases.ubuntu.com/14.04/ubuntu-14.04.4-server-amd64.iso'`
32   - `sudo mkdir /mnt/cdrom`
33   - `sudo mount -o loop ubuntu-14.04.4-server-amd64.iso /mnt/cdrom/`
34   - `sudo cp -r /mnt/cdrom/install/netboot/* /var/lib/tftpboot/`
35   - `sudo mkdir /usr/share/nginx/html/ubuntu`
36   - `sudo cp -r /mnt/cdrom/* /usr/share/nginx/html/ubuntu/`
37   - `sudo umount /mnt/cdrom`
38   - edit ks.cfg and replace IP address with that of your PXE bootstrap server
39   - `sudo cp ks.cfg /usr/share/nginx/html/ks.cfg`
40   - edit boot-screens_txt.cfg and replace IP address with that of your PXE bootstrap server
41   - `sudo cp boot-screens_txt.cfg /var/lib/tftpboot/ubuntu-installer/amd64/boot-screens/txt.cfg`
42   - `sudo cp syslinux.cfg /var/lib/tftpboot/ubuntu-installer/amd64/boot-screens/syslinux.cfg`
43
44 ### New testbed host - manual preparation
45
46 - set CIMC address
47 - set CIMC username, password and hostname
48
49 ### Bootstrap the host
50
51 From PXE boostrap server:
52
53   - `cd ~testuser/host-setup/cimc`
54   - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d -i`
55   - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d -s '<biosVfIntelHyperThreadingTech rn="Intel-HyperThreading-Tech" vpIntelHyperThreadingTech="disabled" />' -s '<biosVfEnhancedIntelSpeedStepTech rn="Enhanced-Intel-SpeedStep-Tech" vpEnhancedIntelSpeedStepTech="disabled" />' -s '<biosVfIntelTurboBoostTech rn="Intel-Turbo-Boost-Tech" vpIntelTurboBoostTech="disabled" />'`
56   - add MAC address to DHCP
57   - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d -pxe`
58
59 While Ubuntu install is running:
60
61   - create RAID array. Reboot if needed.
62       - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d --wipe`
63       - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d -r -rl 1 -rs <disk size> -rd '[1,2]'`
64         Alternatively, create the RAID array manually.
65
66   - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d -hdd`
67
68 When installation is finished:
69
70   - `ssh-copy-id <>`
71   - `cd ~testuser/host-setup/playbooks`
72   - edit /etc/ansible/hosts; add the hosts you are installing. *REMOVE ANY HOSTS YOU ARE NOT CURRENTLY INSTALLING*.
73
74     Example for physical testbed hosts:
75     ~~~
76     [tg]
77     10.30.51.16 hostname=t1-tg1
78
79     [sut]
80     10.30.51.17 hostname=t1-sut1
81     10.30.51.18 hostname=t1-sut2
82     ~~~
83
84     Example for VIRL hosts -- use the "virl" tag and specify the flat network start and end addresses:
85
86     ~~~
87     [virl]
88     10.30.51.28 hostname=t4-virl1 virl_l2_start=10.30.51.31 virl_l2_end=10.30.51.105
89     ~~~
90
91   - `ansible-playbook --ask-sudo-pass 01-host-setup.yaml`
92   - `ansible-playbook reboot.yaml`
93
94 For non-VIRL hosts, stop here.
95
96
97 ### VIRL installation
98
99 After the host has rebooted:
100
101   - `ansible-playbook 02-virl-bootstrap.yaml`
102   - ssh to host
103       - `sudo -s`
104       - `cd virl-bootstrap`
105       - `./virl-bootstrap-wrapper`
106
107         This command will error out when run the first time, as the VIRL host is not yet licensed.
108
109         Make sure we contact all three VIRL SALT masters:
110
111       - `for a in 1 2 4 ; do sudo salt-call --master us-${a}.virl.info test.ping ; done`
112
113       - Contact the VIRL team, provide the hostname and domain (linuxfoundation.org), and ask them
114         to accept the key
115
116       - After the key has been accepted, verify that connectivity with the SALT master is now OK:
117
118         `for a in 1 2 4 ; do sudo salt-call --master us-${a}.virl.info test.ping ; done`
119
120       - `./virl-bootstrap-wrapper`
121       - `reboot`
122
123 After reboot, ssh to host again
124   - as VIRL user, NOT AS ROOT:
125      - `vinstall all`
126      - `sudo reboot`
127
128 After reboot, ssh to host again
129   - as VIRL user:
130       - `sudo salt-call state.sls virl.routervms.all`
131       - `sudo salt-call state.sls virl.vmm.vmmall`
132
133 Back on the PXE bootstrap server:
134
135   - obtain the current server disk image and place it into
136     `files/virl-server-image/` as `server.qcow2`
137
138     TO-DO: Need to find a place to store this image
139
140   - `ansible-playbook 03-virl-post-install.yaml`
141
142   - Run the following command ONLY ONCE. Otherwise it will create
143     duplicates of the VIRL disk image:
144
145     `ansible-playbook 04-disk-image.yaml`
146
147 The VIRL host should now be operational. Test, and when ready, create a ~jenkins-in/status file with the appropriate status.