summaryrefslogtreecommitdiffstats
path: root/tests/RobotFramework/tedge/call_tedge_config_list.robot
blob: 5e5b3c08bc9c4925112c154d34c6424065b1117e (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
*** Settings ***
Documentation    Purpose of this test is to verify that the tedge config list and tedge config list --all
...              will result with Return Code 0
...              Set new device type and return to default value
...              Set new kay path and return to default value
...              Set new cert path and return to default value
...              Set new c8y.root.cert.path and return to default value
...              Set new c8y.smartrest.templates and return to default value
...              Set new az.root.cert.path and return to default value
...              Set new az.mapper.timestamp and return to default value
...              Set new mqtt.bind_address and return to default value
...              Set new mqtt.port and return to default value
...              Set new tmp.path and return to default value
...              Set new logs.path and return to default value
...              Set new run.path and return to default value

Library    SSHLibrary

Suite Setup            Open Connection And Log In
Suite Teardown         SSHLibrary.Close All Connections

*** Variables ***
${HOST}           192.168.99.110    #Insert the IP address if the default should not be used
${USERNAME}       pi    #Insert the username if the default should not be used
${PASSWORD}       thinedge    #Insert the password if the default should not be used

*** Tasks ***
tedge config list
    ${rc}    Execute Command    tedge config list    return_stdout=False    return_rc=True    #executing tedge config list and expect return code 0
    Should Be Equal As Integers    ${rc}    0
    Log    ${rc}
tedge config list --all
    ${rc}    Execute Command    tedge config list --all    return_stdout=False    return_rc=True    #executing tedge config list --all and expect return code 0
    Should Be Equal As Integers    ${rc}    0
    Log    ${rc}
set/unset device.type
    Execute Command    sudo tedge config set device.type changed-type    #Changing device.type to "changed-type"
    ${set}     Execute Command    tedge config list
    Should Contain    ${set}    device.type=changed-type
    Log    ${set}
    Execute Command    sudo tedge config unset device.type    #Undo the change by using the 'unset' command, value returns to default one
    ${unset}     Execute Command    tedge config list
    Should Contain    ${unset}    device.type=thin-edge.io
    Log    ${unset}
set/unset device.key.path
    Execute Command    sudo tedge config set device.key.path /etc/tedge/device-certs1/tedge-private-key.pem    #Changing device.key.path
    ${set}     Execute Command    tedge config list
    Should Contain    ${set}    device.key.path=/etc/tedge/device-certs1/tedge-private-key.pem
    Log    ${set}
    Execute Command    sudo tedge config unset device.key.path    #Undo the change by using the 'unset' command, value returns to default one
    ${unset}     Execute Command    tedge config list
    Should Contain    ${unset}    device.key.path=/etc/tedge/device-certs/tedge-private-key.pem
    Log    ${unset}
set/unset device.cert.path
    Execute Command    sudo tedge config set device.cert.path /etc/tedge/device-certs1/tedge-certificate.pem   #Changing device.cert.path
    ${set}     Execute Command    tedge config list
    Should Contain    ${set}    device.cert.path=/etc/tedge/device-certs1/tedge-certificate.pem
    Log    ${set}
    Execute Command    sudo tedge config unset device.cert.path    #Undo the change by using the 'unset' command, value returns to default one
    ${unset}     Execute Command    tedge config list
    Should Contain    ${unset}    device.cert.path=/etc/tedge/device-certs/tedge-certificate.pem
    Log    ${unset}
set/unset c8y.root.cert.path
    Execute Command    sudo tedge config set c8y.root.cert.path /etc/ssl/certs1   #Changing c8y.root.cert.path
    ${set}     Execute Command    tedge config list
    Should Contain    ${set}    c8y.root.cert.path=/etc/ssl/certs1
    Log    ${set}
    Execute Command    sudo tedge config unset c8y.root.cert.path    #Undo the change by using the 'unset' command, value returns to default one
    ${unset}     Execute Command    tedge config list
    Should Contain    ${unset}    c8y.root.cert.path=/etc/ssl/certs
    Log    ${unset}
set/unset c8y.smartrest.templates
    Execute Command    sudo tedge config set c8y.smartrest.templates 1   #Changing c8y.smartrest.templates
    ${set}     Execute Command    tedge config list
    Should Contain    ${set}    c8y.smartrest.templates=["1"]
    Log    ${set}
    Execute Command    sudo tedge config unset c8y.smartrest.templates    #Undo the change by using the 'unset' command, value returns to default one
    ${unset}     Execute Command    tedge config list
    Should Contain    ${unset}    c8y.smartrest.templates=[]
    Log    ${unset}
set/unset az.root.cert.path
    Execute Command    sudo tedge config set az.root.cert.path /etc/ssl/certs1   #Changing az.root.cert.path
    ${set}     Execute Command    tedge config list
    Should Contain    ${set}    az.root.cert.path=/etc/ssl/certs1
    Log    ${set}
    Execute Command    sudo tedge config unset az.root.cert.path    #Undo the change by using the 'unset' command, value returns to default one
    ${unset}     Execute Command    tedge config list
    Should Contain    ${unset}    az.root.cert.path=/etc/ssl/certs
    Log    ${unset}
set/unset az.mapper.timestamp
    Execute Command    sudo tedge config set az.mapper.timestamp false  #Changing az.mapper.timestamp
    ${set}     Execute Command    tedge config list
    Should Contain    ${set}    az.mapper.timestamp=false
    Log    ${set}
    Execute Command    sudo tedge config unset az.mapper.timestamp    #Undo the change by using the 'unset' command, value returns to default one
    ${unset}     Execute Command    tedge config list
    Should Contain    ${unset}    az.mapper.timestamp=true
    Log    ${unset}
set/unset mqtt.bind_address
    Execute Command    sudo tedge config set mqtt.bind_address 127.1.1.1  #Changing mqtt.bind_address
    ${set}     Execute Command    tedge config list
    Should Contain    ${set}    mqtt.bind_address=127.1.1.1
    Log    ${set}
    Execute Command    sudo tedge config unset mqtt.bind_address    #Undo the change by using the 'unset' command, value returns to default one
    ${unset}     Execute Command    tedge config list
    Should Contain    ${unset}    mqtt.bind_address=127.0.0.1
    Log    ${unset}
set/unset mqtt.port
    Execute Command    sudo tedge config set mqtt.port 8888  #Changing mqtt.port
    ${set}     Execute Command    tedge config list
    Should Contain    ${set}    mqtt.port=8888
    Log    ${set}
    Execute Command    sudo tedge config unset mqtt.port    #Undo the change by using the 'unset' command, value returns to default one
    ${unset}     Execute Command    tedge config list
    Should Contain    ${unset}    mqtt.port=1883
    Log    ${unset}
set/unset tmp.path
    Execute Command    sudo tedge config set tmp.path /tmp1  #Changing tmp.path
    ${set}     Execute Command    tedge config list
    Should Contain    ${set}    tmp.path=/tmp1
    Log    ${set}
    Execute Command    sudo tedge config unset tmp.path    #Undo the change by using the 'unset' command, value returns to default one
    ${unset}     Execute Command    tedge config list
    Should Contain    ${unset}    tmp.path=/tmp
    Log    ${unset}
set/unset logs.path
    Execute Command    sudo tedge config set logs.path /var/log1  #Changing logs.path
    ${set}     Execute Command    tedge config list
    Should Contain    ${set}    logs.path=/var/log1
    Log    ${set}
    Execute Command    sudo tedge config unset logs.path    #Undo the change by using the 'unset' command, value returns to default one
    ${unset}     Execute Command    tedge config list
    Should Contain    ${unset}    logs.path=/var/log
    Log    ${unset}
set/unset run.path
    Execute Command    sudo tedge config set run.path /run1  #Changing run.path
    ${set}     Execute Command    tedge config list
    Should Contain    ${set}    run.path=/run1
    Log    ${set}
    Execute Command    sudo tedge config unset run.path    #Undo the change by using the 'unset' command, value returns to default one
    ${unset}     Execute Command    tedge config list
    Should Contain    ${unset}    run.path=/run
    Log    ${unset}

*** Keywords ***
Open Connection And Log In
   SSHLibrary.Open Connection     ${HOST}
   SSHLibrary.Login               ${USERNAME}        ${PASSWORD}