aboutsummaryrefslogtreecommitdiffstats
path: root/test/net_macvlan.exp
blob: 20d022de9428bb8ce4ad6c9ef6167a4ab33ce3e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/expect -f

set timeout 10
spawn $env(SHELL)
match_max 100000

# check the existing address
spawn $env(SHELL)
send -- "firejail --net=eth0 --ip=192.168.1.60\r"
expect {
	timeout {puts "TESTING ERROR 1.1\n";puts "Please open a sandbox on 192.168.1.60\n";exit}
	"the address 192.168.1.60 is already in use"
}



# grab 30 ip addresses
set MAXi 229
set i 200
while { $i <= $MAXi } {
	spawn $env(SHELL)
	send -- "firejail --net=eth0 --ip=192.168.1.$i\r"
	expect {
		timeout {puts "TESTING ERROR 0\n";exit}
		"Child process initialized"
	}
	incr i
	after 100
}


# check an existing address
spawn $env(SHELL)
send -- "firejail --net=eth0 --ip=192.168.1.200\r"
expect {
	timeout {puts "TESTING ERROR 1\n";exit}
	"the address 192.168.1.200 is already in use"
}


set MAXi 254
set i 2
while { $i <= $MAXi } {
	spawn $env(SHELL)
	send -- "firejail --net=eth0\r"
	expect {
		timeout {puts "TESTING ERROR 2.1\n";exit}
		"192.168.1.60" {puts "TESTING ERROR 2.2\n";exit}
		"192.168.1.200" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.201" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.202" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.203" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.204" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.205" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.206" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.207" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.208" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.209" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.210" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.211" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.212" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.213" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.214" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.215" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.216" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.217" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.218" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.219" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.220" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.221" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.222" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.223" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.224" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.225" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.226" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.227" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.228" {puts "TESTING ERROR 3\n";exit}
		"192.168.1.229" {puts "TESTING ERROR 3\n";exit}
		"Child process initialized"
	}
	puts "************ $i ******************\n"
	incr i
	after 100
#	sleep 1
}

puts "\n"