Debian Codegraph @

src/tests/keywords/update-tag

raw
1 #
2 # PRE: update
3 #
4 # Remove all attributes in a list
5 #
6 update {
7 control:Cleartext-Password := 'hello'
8 reply:Filter-Id := 'filter'
9 }
10
11 update request {
12 Tunnel-Server-Endpoint:0 := '192.0.1.1' # Should not be tagged
13 Tunnel-Server-Endpoint:0 += '192.0.1.2' # Should not be tagged
14 Tunnel-Server-Endpoint:1 := '192.0.2.1'
15 Tunnel-Server-Endpoint:1 += '192.0.2.2'
16 Tunnel-Server-Endpoint:2 := '192.0.3.1'
17 Tunnel-Server-Endpoint:2 += '192.0.3.2'
18 }
19
20 update request {
21 Tmp-Integer-0 := "%{debug_attr:request:}"
22 }
23
24
25 #
26 # Selecting on attributes which have no tag (0)
27 #
28 if (Tunnel-Server-Endpoint:0[0] != '192.0.1.1') {
29 update {
30 reply:Filter-Id += 'fail 1'
31 }
32 }
33
34 if (Tunnel-Server-Endpoint:0[1] != '192.0.1.2') {
35 update {
36 reply:Filter-Id += 'fail 2'
37 }
38 }
39
40 #
41 # Selecting on attributes with no tag specified (should match all of that type)
42 #
43 if (Tunnel-Server-Endpoint[0] != '192.0.1.1') {
44 update {
45 reply:Filter-Id += 'fail 3'
46 }
47 }
48
49 if (Tunnel-Server-Endpoint[1] != '192.0.1.2') {
50 update {
51 reply:Filter-Id += 'fail 4'
52 }
53 }
54
55 if (Tunnel-Server-Endpoint[2] != '192.0.2.1') {
56 update {
57 reply:Filter-Id += 'fail 5'
58 }
59 }
60
61 #
62 # Now the none xlat version
63 #
64 # Check that access attributes by tag works first
65 if (Tunnel-Server-Endpoint:2 != '192.0.3.1') {
66 update {
67 reply:Filter-Id += 'fail 6'
68 }
69 }
70
71 if (Tunnel-Server-Endpoint:2 == '192.0.3.2') {
72 update {
73 reply:Filter-Id += 'fail 7'
74 }
75 }
76
77 if (Tunnel-Server-Endpoint:1 != '192.0.2.1') {
78 update {
79 reply:Filter-Id += 'fail 8'
80 }
81 }
82
83 # Get the first instance of Tunnel-Server-Endpoint:2
84 if (Tunnel-Server-Endpoint:2[0] != '192.0.3.1') {
85 update {
86 reply:Filter-Id += 'fail 9'
87 }
88 }
89
90 # Get the first instance of Tunnel-Server-Endpoint:2
91 if (Tunnel-Server-Endpoint:2[1] != '192.0.3.2') {
92 update {
93 reply:Filter-Id += 'fail 10'
94 }
95 }
96
97 #
98 # Assignment (bare)
99 #
100 update request {
101 Tmp-String-1 += &Tunnel-Server-Endpoint:2 # 0
102 Tmp-String-1 += &Tunnel-Server-Endpoint:2 # 1
103 Tmp-String-1 += &Tunnel-Server-Endpoint:1 # 2
104 Tmp-String-1 += &Tunnel-Server-Endpoint:2[0] # 3
105 Tmp-String-1 += &Tunnel-Server-Endpoint:2[1] # 4
106 Tmp-String-1 += &Tunnel-Server-Endpoint:0[0] # 5
107 Tmp-String-1 += &Tunnel-Server-Endpoint:0[1] # 6
108 Tmp-String-1 += &Tunnel-Server-Endpoint:0[2] # 7 (No attribute should be added here)
109 Tmp-String-1 += &Tunnel-Server-Endpoint[0] # 8
110 Tmp-String-1 += &Tunnel-Server-Endpoint[1] # 9
111 Tmp-String-1 += &Tunnel-Server-Endpoint[2] # 10
112 }
113
114 # Check that access attributes by tag works first
115 if (Tmp-String-1[0] != '192.0.3.1') {
116 update {
117 reply:Filter-Id += 'fail 11'
118 }
119 }
120
121 if (Tmp-String-1[1] == '192.0.3.2') {
122 update {
123 reply:Filter-Id += 'fail 12'
124 }
125 }
126
127 if (Tmp-String-1[2] != '192.0.2.1') {
128 update {
129 reply:Filter-Id += 'fail 13'
130 }
131 }
132
133 # Get the first instance of Tunnel-Server-Endpoint:2
134 if (Tmp-String-1[3] != '192.0.3.1') {
135 update {
136 reply:Filter-Id += 'fail 14'
137 }
138 }
139
140 # Get the first instance of Tunnel-Server-Endpoint:2
141 if (Tmp-String-1[4] != '192.0.3.2') {
142 update {
143 reply:Filter-Id += 'fail 15'
144 }
145 }
146
147 # Now check the assignment
148 if (Tmp-String-1[5] != '192.0.1.1') {
149 update {
150 reply:Filter-Id += 'fail 16'
151 }
152 }
153
154 if (Tmp-String-1[6] != '192.0.1.2') {
155 update {
156 reply:Filter-Id += 'fail 17'
157 }
158 }
159
160 if (Tmp-String-1[7] != '192.0.1.1') {
161 update {
162 reply:Filter-Id += 'fail 19'
163 }
164 }
165
166 if (Tmp-String-1[8] != '192.0.1.2') {
167 update {
168 reply:Filter-Id += 'fail 20'
169 }
170 }
171
172 if (Tmp-String-1[9] != '192.0.2.1') {
173 update {
174 reply:Filter-Id += 'fail 21'
175 }
176 }