summaryrefslogtreecommitdiffstats
path: root/src/tests/keywords/update-tag
blob: 15afd59ecc780af912c4458f4902c6e7184d3db8 (plain)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#
# PRE: update
#
#  Remove all attributes in a list
#
update {
	control:Cleartext-Password := 'hello'
	reply:Filter-Id := 'filter'
}

update request {
	Tunnel-Server-Endpoint:0 := '192.0.1.1'	# Should not be tagged
	Tunnel-Server-Endpoint:0 += '192.0.1.2'	# Should not be tagged
	Tunnel-Server-Endpoint:1 := '192.0.2.1'
	Tunnel-Server-Endpoint:1 += '192.0.2.2'
	Tunnel-Server-Endpoint:2 := '192.0.3.1'
	Tunnel-Server-Endpoint:2 += '192.0.3.2'
}

update request {
	Tmp-Integer-0 := "%{debug_attr:request:}"
}


#
# Selecting on attributes which have no tag (0)
#
if (Tunnel-Server-Endpoint:0[0] != '192.0.1.1') {
	update {
		reply:Filter-Id += 'fail 1'
	}
}

if (Tunnel-Server-Endpoint:0[1] != '192.0.1.2') {
	update {
		reply:Filter-Id += 'fail 2'
	}
}

#
# Selecting on attributes with no tag specified (should match all of that type)
#
if (Tunnel-Server-Endpoint[0] != '192.0.1.1') {
	update {
		reply:Filter-Id += 'fail 3'
	}
}

if (Tunnel-Server-Endpoint[1] != '192.0.1.2') {
	update {
		reply:Filter-Id += 'fail 4'
	}
}

if (Tunnel-Server-Endpoint[2] != '192.0.2.1') {
	update {
		reply:Filter-Id += 'fail 5'
	}
}

#
# Now the none xlat version
#
# Check that access attributes by tag works first
if (Tunnel-Server-Endpoint:2 != '192.0.3.1') {
	update {
		reply:Filter-Id += 'fail 6'
	}
}

if (Tunnel-Server-Endpoint:2 == '192.0.3.2') {
	update {
		reply:Filter-Id += 'fail 7'
	}
}

if (Tunnel-Server-Endpoint:1 != '192.0.2.1') {
	update {
		reply:Filter-Id += 'fail 8'
	}
}

# Get the first instance of Tunnel-Server-Endpoint:2
if (Tunnel-Server-Endpoint:2[0] != '192.0.3.1') {
	update {
		reply:Filter-Id += 'fail 9'
	}
}

# Get the first instance of Tunnel-Server-Endpoint:2
if (Tunnel-Server-Endpoint:2[1] != '192.0.3.2') {
	update {
		reply:Filter-Id += 'fail 10'
	}
}

#
# Assignment (bare)
#
update request {
	Tmp-String-1 += &Tunnel-Server-Endpoint:2		# 0
	Tmp-String-1 += &Tunnel-Server-Endpoint:2		# 1
	Tmp-String-1 += &Tunnel-Server-Endpoint:1		# 2
	Tmp-String-1 += &Tunnel-Server-Endpoint:2[0]		# 3
	Tmp-String-1 += &Tunnel-Server-Endpoint:2[1]		# 4
	Tmp-String-1 += &Tunnel-Server-Endpoint:0[0]		# 5
	Tmp-String-1 += &Tunnel-Server-Endpoint:0[1]		# 6
	Tmp-String-1 += &Tunnel-Server-Endpoint:0[2]		# 7 (No attribute should be added here)
	Tmp-String-1 += &Tunnel-Server-Endpoint[0]		# 8
	Tmp-String-1 += &Tunnel-Server-Endpoint[1]		# 9
	Tmp-String-1 += &Tunnel-Server-Endpoint[2]		# 10
}

# Check that access attributes by tag works first
if (Tmp-String-1[0] != '192.0.3.1') {
	update {
		reply:Filter-Id += 'fail 11'
	}
}

if (Tmp-String-1[1] == '192.0.3.2') {
	update {
		reply:Filter-Id += 'fail 12'
	}
}

if (Tmp-String-1[2] != '192.0.2.1') {
	update {
		reply:Filter-Id += 'fail 13'
	}
}

# Get the first instance of Tunnel-Server-Endpoint:2
if (Tmp-String-1[3] != '192.0.3.1') {
	update {
		reply:Filter-Id += 'fail 14'
	}
}

# Get the first instance of Tunnel-Server-Endpoint:2
if (Tmp-String-1[4] != '192.0.3.2') {
	update {
		reply:Filter-Id += 'fail 15'
	}
}

# Now check the assignment
if (Tmp-String-1[5] != '192.0.1.1') {
	update {
		reply:Filter-Id += 'fail 16'
	}
}

if (Tmp-String-1[6] != '192.0.1.2') {
	update {
		reply:Filter-Id += 'fail 17'
	}
}

if (Tmp-String-1[7] != '192.0.1.1') {
	update {
		reply:Filter-Id += 'fail 19'
	}
}

if (Tmp-String-1[8] != '192.0.1.2') {
	update {
		reply:Filter-Id += 'fail 20'
	}
}

if (Tmp-String-1[9] != '192.0.2.1') {
	update {
		reply:Filter-Id += 'fail 21'
	}
}