pymscada 0.0.14__py3-none-any.whl → 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pymscada might be problematic. Click here for more details.
- pymscada/checkout.py +38 -5
- pymscada/demo/logixclient.yaml +24 -23
- pymscada/demo/modbusclient.yaml +22 -18
- pymscada/demo/modbusserver.yaml +10 -2
- pymscada/demo/ping.yaml +12 -0
- pymscada/demo/pymscada-io-ping.service +15 -0
- pymscada/demo/snmpclient.yaml +17 -17
- pymscada/demo/tags.yaml +50 -1
- pymscada/demo/wwwserver.yaml +447 -1
- pymscada/iodrivers/logix_client.py +9 -9
- pymscada/iodrivers/logix_map.py +74 -62
- pymscada/iodrivers/modbus_client.py +20 -34
- pymscada/iodrivers/modbus_map.py +4 -1
- pymscada/iodrivers/modbus_server.py +34 -48
- pymscada/iodrivers/ping_client.py +120 -0
- pymscada/iodrivers/ping_map.py +43 -0
- pymscada/iodrivers/snmp_client.py +4 -2
- pymscada/iodrivers/snmp_map.py +1 -1
- pymscada/main.py +239 -71
- pymscada/validate.py +127 -35
- pymscada-0.1.0.dist-info/METADATA +88 -0
- {pymscada-0.0.14.dist-info → pymscada-0.1.0.dist-info}/RECORD +28 -26
- pymscada/demo/simulate.yaml +0 -21
- pymscada/simulate.py +0 -66
- pymscada-0.0.14.dist-info/METADATA +0 -251
- /pymscada/demo/{pymscada-modbusclient.service → pymscada-io-modbusclient.service} +0 -0
- /pymscada/demo/{pymscada-modbusserver.service → pymscada-io-modbusserver.service} +0 -0
- /pymscada/{iodrivers → tools}/snmp_client2.py +0 -0
- {pymscada-0.0.14.dist-info → pymscada-0.1.0.dist-info}/WHEEL +0 -0
- {pymscada-0.0.14.dist-info → pymscada-0.1.0.dist-info}/entry_points.txt +0 -0
- {pymscada-0.0.14.dist-info → pymscada-0.1.0.dist-info}/licenses/LICENSE +0 -0
pymscada/checkout.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Create base config folder and check out demo files."""
|
|
2
|
+
import difflib
|
|
2
3
|
from pathlib import Path
|
|
3
4
|
import sys
|
|
4
5
|
from pymscada.config import get_demo_files, get_pdf_files
|
|
@@ -36,7 +37,7 @@ def make_pdf():
|
|
|
36
37
|
target.write_bytes(pdf_file.read_bytes())
|
|
37
38
|
|
|
38
39
|
|
|
39
|
-
def make_config(overwrite):
|
|
40
|
+
def make_config(overwrite: bool):
|
|
40
41
|
"""Make the config folder, if missing, and copy files in."""
|
|
41
42
|
config_dir = PATH['__DIR__'].joinpath('config')
|
|
42
43
|
if not config_dir.exists():
|
|
@@ -62,11 +63,43 @@ def make_config(overwrite):
|
|
|
62
63
|
target.write_bytes(config_file.read_bytes())
|
|
63
64
|
|
|
64
65
|
|
|
65
|
-
def
|
|
66
|
+
def read_with_subst(file: Path):
|
|
67
|
+
"""Read the file and replace DIR markers."""
|
|
68
|
+
rd = file.read_bytes().decode()
|
|
69
|
+
if str(file).endswith('service'):
|
|
70
|
+
for k, v in PATH.items():
|
|
71
|
+
rd = rd.replace(k, str(v.absolute()))
|
|
72
|
+
lines = rd.splitlines()
|
|
73
|
+
return lines
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def compare_config():
|
|
77
|
+
"""Compare old and new config."""
|
|
78
|
+
config_dir = PATH['__DIR__'].joinpath('config')
|
|
79
|
+
if not config_dir.exists():
|
|
80
|
+
print('No config dir, are you in the right directory')
|
|
81
|
+
return
|
|
82
|
+
for config_file in get_demo_files():
|
|
83
|
+
target = config_dir.joinpath(config_file.name)
|
|
84
|
+
if target.exists():
|
|
85
|
+
new_lines = read_with_subst(config_file)
|
|
86
|
+
old_lines = read_with_subst(target)
|
|
87
|
+
diff = list(difflib.unified_diff(old_lines, new_lines,
|
|
88
|
+
fromfile=str(target), tofile=str(config_file)))
|
|
89
|
+
if len(diff):
|
|
90
|
+
print('\n'.join(diff), '\n')
|
|
91
|
+
else:
|
|
92
|
+
print(f'\n--- MISSING FILE\n\n+++ {config_file}')
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def checkout(overwrite=False, diff=False):
|
|
66
96
|
"""Do it."""
|
|
67
97
|
for name in PATH:
|
|
68
98
|
if not PATH[name].exists():
|
|
69
99
|
raise SystemExit(f'{PATH[name]} is missing')
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
100
|
+
if diff:
|
|
101
|
+
compare_config()
|
|
102
|
+
else:
|
|
103
|
+
make_history()
|
|
104
|
+
make_pdf()
|
|
105
|
+
make_config(overwrite)
|
pymscada/demo/logixclient.yaml
CHANGED
|
@@ -4,42 +4,43 @@ rtus:
|
|
|
4
4
|
- name: Ani
|
|
5
5
|
ip: 172.26.7.196
|
|
6
6
|
rate: 0.2
|
|
7
|
-
|
|
7
|
+
poll:
|
|
8
8
|
- {addr: Fout, type: 'REAL[]', start: 0, end: 99}
|
|
9
9
|
- {addr: Iout, type: 'DINT[]', start: 0, end: 99}
|
|
10
10
|
- {addr: OutVar, type: REAL}
|
|
11
|
-
writeok:
|
|
12
|
-
- {addr: Fin, type: 'REAL[]', start: 0, end: 99}
|
|
13
|
-
- {addr: Iin, type: 'REAL[]', start: 0, end: 99}
|
|
14
|
-
- {addr: InVar, type: REAL}
|
|
15
11
|
tags:
|
|
12
|
+
Ani_Fin_20:
|
|
13
|
+
type: float32
|
|
14
|
+
read: 'Ani:Fout[20]'
|
|
15
|
+
write: 'Ani:Fin[20]'
|
|
16
16
|
Ani_Fout_20:
|
|
17
17
|
type: float32
|
|
18
|
-
|
|
18
|
+
read: 'Ani:Fout[20]'
|
|
19
|
+
Ani_Iin_20:
|
|
20
|
+
type: int32
|
|
21
|
+
read: 'Ani:Iout[20]'
|
|
22
|
+
write: 'Ani:Iin[20]'
|
|
19
23
|
Ani_Iout_20:
|
|
20
24
|
type: int32
|
|
21
|
-
|
|
25
|
+
read: 'Ani:Iout[20]'
|
|
26
|
+
Ani_Iin_21_0:
|
|
27
|
+
type: bool
|
|
28
|
+
read: 'Ani:Iout[21].0'
|
|
29
|
+
write: 'Ani:Iin[21].0'
|
|
22
30
|
Ani_Iout_21_0:
|
|
23
31
|
type: bool
|
|
24
|
-
|
|
32
|
+
read: 'Ani:Iout[21].0'
|
|
33
|
+
Ani_Iin_21_1:
|
|
34
|
+
type: bool
|
|
35
|
+
read: 'Ani:Iout[21].1'
|
|
36
|
+
write: 'Ani:Iin[21].1'
|
|
25
37
|
Ani_Iout_21_1:
|
|
26
38
|
type: bool
|
|
27
|
-
|
|
28
|
-
Ani_Fin_20:
|
|
29
|
-
type: float32
|
|
30
|
-
addr: 'Ani:Fin[20]'
|
|
31
|
-
Ani_Iin_20:
|
|
32
|
-
type: int32
|
|
33
|
-
addr: 'Ani:Iin[20]'
|
|
39
|
+
read: 'Ani:Iout[21].1'
|
|
34
40
|
InVar:
|
|
35
41
|
type: float32
|
|
36
|
-
|
|
42
|
+
read: Ani:OutVar
|
|
43
|
+
write: Ani:InVar
|
|
37
44
|
OutVar:
|
|
38
45
|
type: float32
|
|
39
|
-
|
|
40
|
-
Ani_Iin_21_0:
|
|
41
|
-
type: bool
|
|
42
|
-
addr: 'Ani:Iin[21].0'
|
|
43
|
-
Ani_Iin_21_1:
|
|
44
|
-
type: bool
|
|
45
|
-
addr: 'Ani:Iin[21].1'
|
|
46
|
+
read: Ani:OutVar
|
pymscada/demo/modbusclient.yaml
CHANGED
|
@@ -6,54 +6,58 @@ rtus:
|
|
|
6
6
|
port: 1502
|
|
7
7
|
tcp_udp: tcp
|
|
8
8
|
rate: 0.2
|
|
9
|
-
|
|
9
|
+
poll:
|
|
10
10
|
- {unit: 1, file: 4x, start: 1, end: 50}
|
|
11
11
|
- {unit: 1, file: 4x, start: 51, end: 100}
|
|
12
|
-
writeok:
|
|
13
|
-
- {unit: 1, file: 4x, start: 1, end: 100}
|
|
14
12
|
tags:
|
|
15
13
|
IntSet:
|
|
16
14
|
type: int16
|
|
17
|
-
|
|
15
|
+
read: RTU:1:4x:1
|
|
16
|
+
write: RTU:1:4x:1
|
|
18
17
|
IntVal:
|
|
19
18
|
type: int16
|
|
20
|
-
|
|
19
|
+
read: RTU:1:4x:2
|
|
21
20
|
FloatSet:
|
|
22
21
|
type: float32
|
|
23
|
-
|
|
22
|
+
read: RTU:1:4x:3
|
|
23
|
+
write: RTU:1:4x:3
|
|
24
24
|
FloatVal:
|
|
25
25
|
type: float32
|
|
26
|
-
|
|
26
|
+
read: RTU:1:4x:5
|
|
27
27
|
MultiSet:
|
|
28
28
|
type: int16
|
|
29
|
-
|
|
29
|
+
read: RTU:1:4x:7
|
|
30
|
+
write: RTU:1:4x:7
|
|
30
31
|
MultiVal:
|
|
31
32
|
type: int16
|
|
32
|
-
|
|
33
|
+
read: RTU:1:4x:8
|
|
33
34
|
TimeSet:
|
|
34
35
|
type: uint64
|
|
35
|
-
|
|
36
|
+
read: RTU:1:4x:9
|
|
37
|
+
write: RTU:1:4x:9
|
|
36
38
|
TimeVal:
|
|
37
39
|
type: uint64
|
|
38
|
-
|
|
40
|
+
read: RTU:1:4x:13
|
|
39
41
|
DateSet:
|
|
40
42
|
type: uint64
|
|
41
|
-
|
|
43
|
+
read: RTU:1:4x:17
|
|
44
|
+
write: RTU:1:4x:17
|
|
42
45
|
DateVal:
|
|
43
46
|
type: uint64
|
|
44
|
-
|
|
47
|
+
read: RTU:1:4x:21
|
|
45
48
|
DateTimeSet:
|
|
46
49
|
type: uint64
|
|
47
|
-
|
|
50
|
+
read: RTU:1:4x:25
|
|
51
|
+
write: RTU:1:4x:25
|
|
48
52
|
DateTimeVal:
|
|
49
53
|
type: uint64
|
|
50
|
-
|
|
54
|
+
read: RTU:1:4x:29
|
|
51
55
|
cpu_temp:
|
|
52
56
|
type: float32
|
|
53
|
-
|
|
57
|
+
read: RTU:1:4x:33
|
|
54
58
|
cpu_load:
|
|
55
59
|
type: float32
|
|
56
|
-
|
|
60
|
+
read: RTU:1:4x:35
|
|
57
61
|
disk_use:
|
|
58
62
|
type: float32
|
|
59
|
-
|
|
63
|
+
read: RTU:1:4x:37
|
pymscada/demo/modbusserver.yaml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
bus_ip:
|
|
2
|
-
bus_port:
|
|
1
|
+
bus_ip:
|
|
2
|
+
bus_port:
|
|
3
3
|
rtus:
|
|
4
4
|
- name: RTU
|
|
5
5
|
ip: 0.0.0.0
|
|
@@ -7,10 +7,18 @@ rtus:
|
|
|
7
7
|
tcp_udp: tcp
|
|
8
8
|
serve:
|
|
9
9
|
- {unit: 1, file: 4x, start: 1, end: 100}
|
|
10
|
+
- {unit: 2, file: 4x, start: 1, end: 100}
|
|
11
|
+
- {unit: 3, file: 4x, start: 1, end: 100}
|
|
10
12
|
tags:
|
|
11
13
|
sim_IntSet:
|
|
12
14
|
type: int16
|
|
13
15
|
addr: RTU:1:4x:1
|
|
16
|
+
sim_IntSet2:
|
|
17
|
+
type: int16
|
|
18
|
+
addr: RTU:2:4x:1
|
|
19
|
+
sim_IntSet3:
|
|
20
|
+
type: int16
|
|
21
|
+
addr: RTU:3:4x:1
|
|
14
22
|
sim_IntVal:
|
|
15
23
|
type: int16
|
|
16
24
|
addr: RTU:1:4x:2
|
pymscada/demo/ping.yaml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[Unit]
|
|
2
|
+
Description=pymscada - Ping client
|
|
3
|
+
BindsTo=pymscada-bus.service
|
|
4
|
+
After=pymscada-bus.service
|
|
5
|
+
|
|
6
|
+
[Service]
|
|
7
|
+
WorkingDirectory=__DIR__
|
|
8
|
+
ExecStart=__PYMSCADA__ ping --config __DIR__/config/ping.yaml
|
|
9
|
+
Restart=always
|
|
10
|
+
RestartSec=5
|
|
11
|
+
User=mscada
|
|
12
|
+
Group=mscada
|
|
13
|
+
|
|
14
|
+
[Install]
|
|
15
|
+
WantedBy=multi-user.target
|
pymscada/demo/snmpclient.yaml
CHANGED
|
@@ -5,7 +5,7 @@ rtus:
|
|
|
5
5
|
ip: 172.26.3.254
|
|
6
6
|
community: public
|
|
7
7
|
rate: 10
|
|
8
|
-
|
|
8
|
+
poll:
|
|
9
9
|
- '1.3.6.1.2.1.31.1.1.1.6.1'
|
|
10
10
|
- '1.3.6.1.2.1.31.1.1.1.6.2'
|
|
11
11
|
- '1.3.6.1.2.1.31.1.1.1.6.3'
|
|
@@ -25,49 +25,49 @@ rtus:
|
|
|
25
25
|
tags:
|
|
26
26
|
Router_eth1_bytes_in:
|
|
27
27
|
type: int_roc
|
|
28
|
-
|
|
28
|
+
read: 'router:1.3.6.1.2.1.31.1.1.1.6.1'
|
|
29
29
|
Router_eth1_bytes_out:
|
|
30
30
|
type: int_roc
|
|
31
|
-
|
|
31
|
+
read: 'router:1.3.6.1.2.1.31.1.1.1.10.1'
|
|
32
32
|
Router_eth2_bytes_in:
|
|
33
33
|
type: int_roc
|
|
34
|
-
|
|
34
|
+
read: 'router:1.3.6.1.2.1.31.1.1.1.6.2'
|
|
35
35
|
Router_eth2_bytes_out:
|
|
36
36
|
type: int_roc
|
|
37
|
-
|
|
37
|
+
read: 'router:1.3.6.1.2.1.31.1.1.1.10.2'
|
|
38
38
|
Router_eth3_bytes_in:
|
|
39
39
|
type: int_roc
|
|
40
|
-
|
|
40
|
+
read: 'router:1.3.6.1.2.1.31.1.1.1.6.3'
|
|
41
41
|
Router_eth3_bytes_out:
|
|
42
42
|
type: int_roc
|
|
43
|
-
|
|
43
|
+
read: 'router:1.3.6.1.2.1.31.1.1.1.10.3'
|
|
44
44
|
Router_eth4_bytes_in:
|
|
45
45
|
type: int_roc
|
|
46
|
-
|
|
46
|
+
read: 'router:1.3.6.1.2.1.31.1.1.1.6.4'
|
|
47
47
|
Router_eth4_bytes_out:
|
|
48
48
|
type: int_roc
|
|
49
|
-
|
|
49
|
+
read: 'router:1.3.6.1.2.1.31.1.1.1.10.4'
|
|
50
50
|
Router_eth5_bytes_in:
|
|
51
51
|
type: int_roc
|
|
52
|
-
|
|
52
|
+
read: 'router:1.3.6.1.2.1.31.1.1.1.6.5'
|
|
53
53
|
Router_eth5_bytes_out:
|
|
54
54
|
type: int_roc
|
|
55
|
-
|
|
55
|
+
read: 'router:1.3.6.1.2.1.31.1.1.1.10.5'
|
|
56
56
|
Router_eth6_bytes_in:
|
|
57
57
|
type: int_roc
|
|
58
|
-
|
|
58
|
+
read: 'router:1.3.6.1.2.1.31.1.1.1.6.6'
|
|
59
59
|
Router_eth6_bytes_out:
|
|
60
60
|
type: int_roc
|
|
61
|
-
|
|
61
|
+
read: 'router:1.3.6.1.2.1.31.1.1.1.10.6'
|
|
62
62
|
Router_eth7_bytes_in:
|
|
63
63
|
type: int_roc
|
|
64
|
-
|
|
64
|
+
read: 'router:1.3.6.1.2.1.31.1.1.1.6.7'
|
|
65
65
|
Router_eth7_bytes_out:
|
|
66
66
|
type: int_roc
|
|
67
|
-
|
|
67
|
+
read: 'router:1.3.6.1.2.1.31.1.1.1.10.7'
|
|
68
68
|
Router_eth8_bytes_in:
|
|
69
69
|
type: int_roc
|
|
70
|
-
|
|
70
|
+
read: 'router:1.3.6.1.2.1.31.1.1.1.6.8'
|
|
71
71
|
Router_eth8_bytes_out:
|
|
72
72
|
type: int_roc
|
|
73
|
-
|
|
73
|
+
read: 'router:1.3.6.1.2.1.31.1.1.1.10.8'
|
pymscada/demo/tags.yaml
CHANGED
|
@@ -166,6 +166,46 @@ sim_DateTimeSet:
|
|
|
166
166
|
sim_DateTimeVal:
|
|
167
167
|
desc: Simulation tag
|
|
168
168
|
type: int
|
|
169
|
+
Ani_Fin_20:
|
|
170
|
+
desc: 'Logix Fin[20]'
|
|
171
|
+
type: float
|
|
172
|
+
dp: 2
|
|
173
|
+
Ani_Fout_20:
|
|
174
|
+
desc: 'Logix Fout[20]'
|
|
175
|
+
type: float
|
|
176
|
+
dp: 2
|
|
177
|
+
Ani_Iin_20:
|
|
178
|
+
desc: 'Logix Iin[20]'
|
|
179
|
+
type: int
|
|
180
|
+
Ani_Iout_20:
|
|
181
|
+
desc: 'Logix Iout[20]'
|
|
182
|
+
type: int
|
|
183
|
+
Ani_Iout_21_0:
|
|
184
|
+
desc: 'Logix Iout[21].0'
|
|
185
|
+
multi:
|
|
186
|
+
- 'Off'
|
|
187
|
+
- 'On'
|
|
188
|
+
Ani_Iout_21_1:
|
|
189
|
+
desc: 'Logix Iout[21].1'
|
|
190
|
+
multi:
|
|
191
|
+
- 'Off'
|
|
192
|
+
- 'On'
|
|
193
|
+
Ani_Iin_21_0:
|
|
194
|
+
desc: 'Logix Iin[21].0'
|
|
195
|
+
multi:
|
|
196
|
+
- 'Off'
|
|
197
|
+
- 'On'
|
|
198
|
+
Ani_Iin_21_1:
|
|
199
|
+
desc: 'Logix Iin[21].1'
|
|
200
|
+
multi:
|
|
201
|
+
- 'Off'
|
|
202
|
+
- 'On'
|
|
203
|
+
InVar:
|
|
204
|
+
desc: InVar
|
|
205
|
+
type: float
|
|
206
|
+
OutVar:
|
|
207
|
+
desc: OutVar
|
|
208
|
+
type: float
|
|
169
209
|
Router_eth1_bytes_in:
|
|
170
210
|
desc: eth1 bytes in
|
|
171
211
|
type: int
|
|
@@ -213,4 +253,13 @@ Router_eth8_bytes_in:
|
|
|
213
253
|
type: int
|
|
214
254
|
Router_eth8_bytes_out:
|
|
215
255
|
desc: eth8 bytes out
|
|
216
|
-
type: int
|
|
256
|
+
type: int
|
|
257
|
+
localhost_ping:
|
|
258
|
+
desc: Ping time to localhost
|
|
259
|
+
units: ms
|
|
260
|
+
google_ping:
|
|
261
|
+
desc: Ping time to google
|
|
262
|
+
units: ms
|
|
263
|
+
electronet_ping:
|
|
264
|
+
desc: Ping time to electronet
|
|
265
|
+
units: ms
|