e795a2e4fc9e6dd19f44d66c9fdc22ec75f19ebc
[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/16.04.1/ubuntu-16.04.1-server-amd64.iso'`
32   - `sudo mkdir /mnt/cdrom`
33   - `sudo mount -o loop ubuntu-16.04.1-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 cp /mnt/cdrom/ubuntu/isolinux/ldlinux.c32 /var/lib/tftpboot`
38   - `sudo cp /mnt/cdrom/ubuntu/isolinux/libcom32.c32 /var/lib/tftpboot`
39   - `sudo cp /mnt/cdrom/ubuntu/isolinux/libutil.c32 /var/lib/tftpboot`
40   - `sudo cp /mnt/cdrom/ubuntu/isolinux/chain.c32 /var/lib/tftpboot`
41   - `sudo umount /mnt/cdrom`
42   - edit ks.cfg and replace IP address with that of your PXE bootstrap server
43   - `sudo cp ks.cfg /usr/share/nginx/html/ks.cfg`
44   - edit boot-screens_txt.cfg and replace IP address with that of your PXE bootstrap server
45   - `sudo cp boot-screens_txt.cfg /var/lib/tftpboot/ubuntu-installer/amd64/boot-screens/txt.cfg`
46   - `sudo cp syslinux.cfg /var/lib/tftpboot/ubuntu-installer/amd64/boot-screens/syslinux.cfg`
47
48 ### New testbed host - manual preparation
49
50 - set CIMC address
51 - set CIMC username, password and hostname
52
53 ### Bootstrap the host
54
55 From PXE boostrap server:
56
57   - `cd ~testuser/host-setup/cimc`
58   - Initialize args.ip: Power-Off, reset BIOS defaults, Enable console redir, get LOM MAC addr
59   - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d -i`
60   - Adjust BIOS settings
61   - `./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" />'`
62   - add MAC address to DHCP (/etc/dhcp/dhcpd.conf)
63   - Reboot server with boot from PXE (restart immediately)
64   - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d -pxe`
65
66 While Ubuntu install is running:
67
68   - create RAID array. Reboot if needed.
69       - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d --wipe`
70       - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d -r -rl 1 -rs <disk size> -rd '[1,2]'`
71         Alternatively, create the RAID array manually.
72
73   - Set the next boot from HDD (without restart)
74   - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d -hdd`
75
76 When installation is finished:
77
78   - `ssh-copy-id <>`
79   - `cd ~testuser/host-setup/playbooks`
80   - edit /etc/ansible/hosts; add the hosts you are installing. *REMOVE ANY HOSTS YOU ARE NOT CURRENTLY INSTALLING*.
81
82     Example for physical testbed hosts:
83     ~~~
84     [tg]
85     10.30.51.24 hostname=t3-tg1 isolcpus="1-17,19-35" ansible_python_interpreter=/usr/bin/python2.7
86
87     [sut]
88     10.30.51.25 hostname=t3-sut1 isolcpus="1-17,19-35" ansible_python_interpreter=/usr/bin/python2.7
89     10.30.51.26 hostname=t3-sut2 isolcpus="1-17,19-35" ansible_python_interpreter=/usr/bin/python2.7
90     ~~~
91
92     Example for VIRL hosts -- use the "virl" tag and specify the flat network start and end addresses:
93
94     ~~~
95     [virl]
96     10.30.51.28 hostname=t4-virl1 virl_l2_start=10.30.51.31 virl_l2_end=10.30.51.105
97     ~~~
98
99   - `ansible-playbook --ask-sudo-pass 01-host-setup.yaml`
100   - `ansible-playbook reboot.yaml`
101
102 For non-VIRL hosts, stop here.
103
104
105 ### VIRL installation
106
107 After the host has rebooted:
108
109   - `ansible-playbook 02-virl-bootstrap.yaml`
110   - ssh to host
111       - `sudo -s`
112       - `cd virl-bootstrap`
113       - `./virl-bootstrap-wrapper`
114
115         This command will error out when run the first time, as the VIRL host is not yet licensed.
116
117         Make sure we contact all three VIRL SALT masters:
118
119       - `for a in 1 2 4 ; do sudo salt-call --master us-${a}.virl.info test.ping ; done`
120
121       - Contact the VIRL team, provide the hostname and domain (linuxfoundation.org), and ask them
122         to accept the key
123
124       - After the key has been accepted, verify that connectivity with the SALT master is now OK:
125
126         `for a in 1 2 4 ; do sudo salt-call --master us-${a}.virl.info test.ping ; done`
127
128       - `./virl-bootstrap-wrapper`
129       - `reboot`
130
131 After reboot, ssh to host again
132   - as VIRL user, NOT AS ROOT:
133      - `vinstall all`
134      - `sudo reboot`
135
136 After reboot, ssh to host again
137   - as VIRL user:
138       - `sudo salt-call state.sls virl.routervms.all`
139       - `sudo salt-call state.sls virl.vmm.vmmall`
140
141 Back on the PXE bootstrap server:
142
143   - obtain the current server disk image and place it into
144     `files/virl-server-image/` as `server.qcow2`
145
146     TO-DO: Need to find a place to store this image
147
148   - `ansible-playbook 03-virl-post-install.yaml`
149
150   - Run the following command ONLY ONCE. Otherwise it will create
151     duplicates of the VIRL disk image:
152
153     `ansible-playbook 04-disk-image.yaml`
154
155 The VIRL host should now be operational. Test, and when ready, create a ~jenkins-in/status file with the appropriate status.