summaryrefslogtreecommitdiffstats
path: root/src/tests/keywords/update-operator
blob: ccbcb168bc489680c8b7a79e109913994803d7f0 (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
#
#  PRE: update
#

#
#  Set it.
#
update request {
	NAS-Port := 1000
}

#
#  Enforce it.
#
update request {
	NAS-Port == 1000
}

if (NAS-Port != 1000) {
	update reply {
		Filter-Id += "fail 1"
	}
}

#
#  Enforce to new lower value.
#
update request {
	NAS-Port <= 500
}

if (NAS-Port != 500) {
	update reply {
		Filter-Id += "fail 2 - expected 500, got %{NAS-Port}"
	}
}

#
#  Enforce to new higher value
#
update request {
	NAS-Port >= 2000
}

if (NAS-Port != 2000) {
	update reply {
		Filter-Id += "fail 3 - expected 2000, got %{NAS-Port}"
	}
}

#
#  Enforce value which previously didn't exist.
#
update request {
	Idle-Timeout >= 14400
}

if (&request:Idle-Timeout != 14400) {
	update reply {
		Filter-Id += "fail Idle-Timeout >= 14400"
	}
}

# non-existent attribute
update request {
       Class -= 0xabcdef
}

update request {
       Class -= &Class
}

update request {
       NAS-Port -= &NAS-Port
}

if (!reply:Filter-Id) {
	update control {
		Cleartext-Password := 'hello'
	}

	update reply {
		Filter-Id := "filter"
	}
}