8 test "`$tinc $c1 get Name | sed 's/\r//'`" = "foo"
10 # Test case sensitivity
12 $tinc $c1 set Mode switch
13 test "`$tinc $c1 get Mode | sed 's/\r//'`" = "switch"
14 test "`$tinc $c1 get mode | sed 's/\r//'`" = "switch"
15 $tinc $c1 set mode router
16 test "`$tinc $c1 get Mode | sed 's/\r//'`" = "router"
17 test "`$tinc $c1 get mode | sed 's/\r//'`" = "router"
18 $tinc $c1 set Mode Switch
19 test "`$tinc $c1 get Mode | sed 's/\r//'`" = "Switch"
23 $tinc $c1 del Mode hub && exit 1 || true
24 $tinc $c1 del Mode switch
25 test -z "`$tinc $c1 get Mode`"
27 # There can only be one Mode variable
29 $tinc $c1 add Mode switch
30 $tinc $c1 add Mode hub
31 test "`$tinc $c1 get Mode | sed 's/\r//'`" = "hub"
33 # Test addition/deletion of multivalued variables
35 $tinc $c1 add Subnet 1
36 $tinc $c1 add Subnet 2
37 $tinc $c1 add Subnet 2
38 $tinc $c1 add Subnet 3
39 test "`$tinc $c1 get Subnet | sed 's/\r//'`" = "1
42 $tinc $c1 del Subnet 2
43 test "`$tinc $c1 get Subnet | sed 's/\r//'`" = "1
46 test -z "`$tinc $c1 get Subnet`"
48 # We should not be able to get/set server variables using node.variable syntax
50 test -z "`$tinc $c1 get foo.Name`"
51 $tinc $c1 set foo.Name bar && exit 1 || true
53 # Test getting/setting host variables for other nodes
57 $tinc $c1 add bar.PMTU 1
58 $tinc $c1 add bar.PMTU 2
59 test "`$tinc $c1 get bar.PMTU | sed 's/\r//'`" = "2"
61 $tinc $c1 add bar.Subnet 1
62 $tinc $c1 add bar.Subnet 2
63 $tinc $c1 add bar.Subnet 2
64 $tinc $c1 add bar.Subnet 3
65 test "`$tinc $c1 get bar.Subnet | sed 's/\r//'`" = "1
68 $tinc $c1 del bar.Subnet 2
69 test "`$tinc $c1 get bar.Subnet | sed 's/\r//'`" = "1
71 $tinc $c1 del bar.Subnet
72 test -z "`$tinc $c1 get bar.Subnet`"
74 # We should not be able to get/set for nodes with invalid names
78 $tinc $c1 set qu-ux.Subnet 1 && exit 1 || true
80 # We should not be able to set obsolete variables unless forced
82 $tinc $c1 set PrivateKey 12345 && exit 1 || true
83 $tinc $c1 --force set PrivateKey 12345
84 test "`$tinc $c1 get PrivateKey | sed 's/\r//'`" = "12345"
85 $tinc $c1 del PrivateKey
86 test -z "`$tinc $c1 get PrivateKey`"