summaryrefslogtreecommitdiffstats
path: root/src/tests/keywords/integer
blob: 7e43270c151ac2ce27c63ae2eb48f9b43afeb1c0 (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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#
# PRE: update
#
update reply {
       Filter-Id := "filter"
}

update request {
	Tmp-String-0        := '9870'
	Tmp-String-1        := '98709870'
	Tmp-String-2        := '987098709870'
	Tmp-Octets-0        := 0x39383731
	Tmp-Octets-1        := 0x3938373139383731
	Tmp-Octets-2        := 0x393837313938373139383731
	Tmp-IP-Address-0    := 57.56.55.50
	Tmp-Date-0          := 959985459
	Tmp-Integer-0       := 959985460
	Tmp-Cast-Abinary    := 'ip out forward srcip 57.56.55.53/32 udp dstport = 1812'
	Tmp-Cast-IfId       := '0000:0000:3938:3737'
	Tmp-Cast-IPv6Addr   := '::3938:3738'
	Tmp-Cast-IPv6Prefix := '::3938:3739/128'
	Tmp-Cast-Byte       := 58
	Tmp-Cast-Short      := 14139
	Tmp-Cast-Ethernet   := 00:00:39:38:37:3c
	Tmp-Cast-Integer64  := 1152921505566832445
	Tmp-Cast-IPv4Prefix := 57.56.55.62/32
}

update request {
	Tmp-String-2        := "%{integer:Tmp-IP-Address-0}"
	Tmp-String-3        := "%{integer:Tmp-Date-0}"
	Tmp-String-4        := "%{integer:Tmp-Integer-0}"
	Tmp-String-5        := "%{integer:Tmp-Cast-Abinary}"
	Tmp-String-6        := "%{integer:Tmp-Cast-Ifid}"
	Tmp-String-7        := "%{integer:Tmp-Cast-IPv6Addr}"
	Tmp-String-8        := "%{integer:Tmp-Cast-IPv6Prefix}"
}

# String - network order representation of a 4 char string
update request {
	Tmp-Integer-0 := "%{integer:Tmp-String-0}"
}
if ((Tmp-String-0 != "%{string:Tmp-Integer-0}") || (Tmp-Integer-0 != 959985456)) {
	update reply {
		Filter-Id += 'fail 1'
	}
}

# String - network order representation of a 8 char string
update request {
	Tmp-Integer64-0 := "%{integer:Tmp-String-1}"
}
if ((Tmp-String-1 != "%{string:Tmp-Integer64-0}") || (Tmp-Integer64-0 != 4123106139115632432)) {
	update reply {
		Filter-Id += 'fail 2'
	}
}

# String - Can't convert 12 byte string to integer (our biggest native size is a 64bit unsigned int)
if ("%{integer:Tmp-String-2}" != '') {
	update reply {
		Filter-Id += 'fail 3'
	}
}

# Octets - network order representation of a 4 byte octet string
update request {
	Tmp-Integer-0 := "%{integer:Tmp-Octets-0}"
}
if (Tmp-Octets-0 != "0x%{hex:Tmp-Integer-0}") {
	update reply {
		Filter-Id += 'fail 4a'
	}
}

if (Tmp-Integer-0 != 959985457) {
	update reply {
		Filter-Id += 'fail 4b'
	}
}

# Octets - network order representation of a 8 byte octet string
update request {
	Tmp-Integer64-0 := "%{integer:Tmp-Octets-1}"
}
if (Tmp-Octets-1 != "0x%{hex:Tmp-Integer64-0}") {
	update reply {
		Filter-Id += 'fail 5a'
	}
}

if (Tmp-Integer64-0 != 4123106143410599729) {
	update reply {
		Filter-Id += 'fail 5b'
	}
}

# String - Can't convert 12 byte octet string to integer (our biggest native size is a 64bit unsigned int)
if ("%{integer:Tmp-Octets-2}" != '') {
	update reply {
		Filter-Id += 'fail 6'
	}
}

# IP Address
if (Tmp-String-2 != '959985458') {
	update reply {
		Filter-Id += 'fail 7'
	}
}

if (<ipaddr>Tmp-String-2 != &Tmp-IP-Address-0) {
	update reply {
		Filter-Id += 'fail 8'
	}
}

# Date
if (Tmp-String-3 != '959985459') {
	update reply {
		Filter-Id += 'fail 9'
	}
}

# Integer
if (Tmp-String-4 != '959985460') {
	update reply {
		Filter-Id += 'fail 10'
	}
}

# Abinary - Can't convert ascend binary to an integer
if (Tmp-String-5 != '') {
	update reply {
		Filter-Id += 'fail 11'
	}
}

# ifid - Can't convert interface ID to an integer
if (Tmp-String-6 != '') {
	update reply {
		Filter-Id += 'fail 12'
	}
}

# ipv6addr - Can't convert IPv6 to integer
if (Tmp-String-7 != '959985464') {
	update reply {
		Filter-ID += 'fail 13'
	}
}

# ipv6addrprefix
if (Tmp-String-8 != '959985465') {
	update reply {
		Filter-ID += 'fail 14'
	}
}
update request {
	Tmp-String-0        := "%{integer:Tmp-Cast-Byte}"
	Tmp-String-1        := "%{integer:Tmp-Cast-Short}"
	Tmp-String-2        := "%{integer:Tmp-Cast-Ethernet}"
	Tmp-String-3        := "%{integer:Tmp-Cast-Integer64}"
	Tmp-String-4        := "%{integer:Tmp-Cast-IPv4Prefix}"
}

# byte
if (Tmp-String-0 != '58') {
	update reply {
		Filter-ID += 'fail 15'
	}
}

# short
if (Tmp-String-1 != '14139') {
	update reply {
		Filter-ID += 'fail 16'
	}
}

# ethernet
if (Tmp-String-2 != '62913607630848') {
	update reply {
		Filter-Id += 'fail 17'
	}
}
if (<ether>Tmp-String-2 != &Tmp-Cast-Ethernet) {
	update reply {
		Filter-Id += 'fail 18'
	}
}

# integer64
if (Tmp-String-3 != '1152921505566832445') {
	update reply {
		Filter-Id += 'fail 19'
	}
}

# ipv4prefix
if (Tmp-String-4 != '959985470') {
	update reply {
		Filter-Id += 'fail 20'
	}
}