]>
git.proxmox.com Git - mirror_lxc.git/blob - src/tests/lxc-test-usernic
3 # lxc: linux Container library
6 # Serge Hallyn <serge.hallyn@ubuntu.com>
8 # This is a test script for the lxc-user-nic program
10 # This library is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU Lesser General Public
12 # License as published by the Free Software Foundation; either
13 # version 2.1 of the License, or (at your option) any later version.
15 # This library is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # Lesser General Public License for more details.
20 # You should have received a copy of the GNU Lesser General Public
21 # License along with this library; if not, write to the Free Software
22 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 conffile
="/tmp/lxc-usernet"
26 sysfsdir
=/tmp
/lxcnettest
28 rm -f $conffile $dbfile
33 # there is no conffile, so we have no permissions
34 lxc-usernic-test
1111 veth lxcbr0
> /dev
/null
2>&1
36 echo "Fail: empty conffile should not allow me a nic"
40 cat > $conffile << EOF
41 $(id -un) veth lxcbr0 1
44 # Should be allowed one but not two
45 lxc-usernic-test
1111 veth lxcbr0
> /dev
/null
2>&1
47 echo "Failed to get one allowed nic"
51 lxc-usernic-test
1111 veth lxcbr0
> /dev
/null
2>&1
53 echo "Fail: was able to get a second nic"
57 # now remove the 'existing nic' and make sure we're allowed to create
59 lxc-usernic-test
1111 veth lxcbr0
> /dev
/null
2>&1
63 echo "Fail: was unable to get a replacement nic"
67 echo "All tests passed"