-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathclient_control_test.go
45 lines (37 loc) · 1.46 KB
/
client_control_test.go
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
package client_control
import (
"github.com/wendy512/iec61850"
"github.com/wendy512/iec61850/test"
"testing"
)
const DefValue = false
func TestControl(t *testing.T) {
client := test.CreateClient(t)
defer test.CloseClient(client)
objectRef := "simpleIOGenericIO/GGIO1.SPCSO1"
param := iec61850.NewControlObjectParam(DefValue)
param.OrIdent = "test"
if err := client.ControlByControlModel(objectRef, iec61850.CONTROL_MODEL_DIRECT_NORMAL, param); err != nil {
t.Errorf("[direct-with-normal-security] %s object error %v\n", objectRef, err)
t.FailNow()
}
test.DoRead(t, client, objectRef+".stVal", iec61850.ST)
objectRef = "simpleIOGenericIO/GGIO1.SPCSO2"
if err := client.ControlForSboWithNormalSecurity(objectRef, DefValue); err != nil {
t.Errorf("[sbo-with-normal-security] %s object error %v\n", objectRef, err)
t.FailNow()
}
test.DoRead(t, client, objectRef+".stVal", iec61850.ST)
objectRef = "simpleIOGenericIO/GGIO1.SPCSO3"
if err := client.ControlForDirectWithEnhancedSecurity(objectRef, DefValue); err != nil {
t.Errorf("[direct-with-enhanced-security] %s object error %v\n", objectRef, err)
t.FailNow()
}
test.DoRead(t, client, objectRef+".stVal", iec61850.ST)
objectRef = "simpleIOGenericIO/GGIO1.SPCSO4"
if err := client.ControlForSboWithEnhancedSecurity(objectRef, DefValue); err != nil {
t.Errorf("[sbo-with-enhanced-security] %s object error %v\n", objectRef, err)
t.FailNow()
}
test.DoRead(t, client, objectRef+".stVal", iec61850.ST)
}