Merge "Activate l2switch verify with JDK8"
[releng/builder.git] / jenkins-scripts / mininet.sh
1 #!/bin/bash
2
3 # make sure we don't require tty for sudo operations
4 cat <<EOF >/etc/sudoers.d/89-jenkins-user-defaults
5 Defaults:jenkins !requiretty
6 jenkins     ALL = NOPASSWD: ALL
7 EOF
8
9 # for whatever reason netopeer & CPqD aren't installed (they weren't in
10 # one of the yum repos we were hooked up to when the base image was
11 # built, they are now. Make sure they're install
12 yum install -q -y netopeer-server-sl CPqD-ofsoftswitch13
13
14 # netaddr and ipaddress libraries can be useful on this system as
15 # some tests are starting to push pyhon scripts/tools to this VM
16 # during CI tests
17 yum install -q -y python-{ipaddr,iptools,netaddr}
18
19 # the vagrant configuration for netopeer doesn't configure SSH correctly
20 # as it uses and here document via echo and not cat fix that
21 cat << EOSSH >> /etc/ssh/sshd_config
22
23 # Added for netconf / netopeer testing
24 Port 22
25 Port 830
26 Subsystem netconf /usr/bin/netopeer-server-sl
27 EOSSH
28
29 # Configuring sshd to accept root login with password
30 sed -ie 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
31 sed -ie 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config
32 chattr +i /etc/ssh/sshd_config
33
34 # sshd has to get a restart because of the above
35 service sshd restart
36
37 # found out while doing testing to fix netopeer that the selinux perms
38 # aren't set correctly (thanks Rackspace for having an EL6 image that
39 # didn't have selinux on at first!) fix it so that the password can be
40 # set
41 /sbin/restorecon -R /etc
42
43 # According to Luis in RT7956 the controller SSH capabilities require
44 # that for NETCONF it uses a password (how broken!) So we're going to
45 # force a password onto the jenkins user
46 echo 'jenkins' | passwd -f --stdin jenkins
47
48 # netopeer doesn't work correctly for non-root users from what I'm
49 # seeing (at least for the initial connection). Let's allow the tests to
50 # get in as the root user since jenkins already has full sudo
51 echo 'root' | passwd -f --stdin root
52
53 # make sure the firewall is stopped
54 service iptables stop
55
56 # vim: sw=2 ts=2 sts=2 et :