File: __init__.py

package info (click to toggle)
raritan-json-rpc-sdk 3.6.1%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 41,748 kB
  • sloc: cs: 162,629; perl: 85,818; python: 24,275; javascript: 5,937; makefile: 21
file content (606 lines) | stat: -rw-r--r-- 21,611 bytes parent folder | download
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright 2020 Raritan Inc. All rights reserved.
#
# This is an auto-generated file.

#
# Section generated by IdlC from "Zeroconf.idl"
#

import raritan.rpc
from raritan.rpc import Interface, Structure, ValueObject, Enumeration, typecheck, DecodeException
import raritan.rpc.devsettings

import raritan.rpc.idl


# interface
class Zeroconf(Interface):
    idlType = "devsettings.Zeroconf:2.0.0"

    # structure
    class Settings(Structure):
        idlType = "devsettings.Zeroconf_2_0_0.Settings:1.0.0"
        elements = ["mdnsEnabled", "llmnrEnabled"]

        def __init__(self, mdnsEnabled, llmnrEnabled):
            typecheck.is_bool(mdnsEnabled, AssertionError)
            typecheck.is_bool(llmnrEnabled, AssertionError)

            self.mdnsEnabled = mdnsEnabled
            self.llmnrEnabled = llmnrEnabled

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                mdnsEnabled = json['mdnsEnabled'],
                llmnrEnabled = json['llmnrEnabled'],
            )
            return obj

        def encode(self):
            json = {}
            json['mdnsEnabled'] = self.mdnsEnabled
            json['llmnrEnabled'] = self.llmnrEnabled
            return json

    # value object
    class SettingsChangedEvent(raritan.rpc.idl.Event):
        idlType = "devsettings.Zeroconf_2_0_0.SettingsChangedEvent:1.0.0"

        def __init__(self, oldSettings, newSettings, source):
            super(raritan.rpc.devsettings.Zeroconf.SettingsChangedEvent, self).__init__(source)
            typecheck.is_struct(oldSettings, raritan.rpc.devsettings.Zeroconf.Settings, AssertionError)
            typecheck.is_struct(newSettings, raritan.rpc.devsettings.Zeroconf.Settings, AssertionError)

            self.oldSettings = oldSettings
            self.newSettings = newSettings

        def encode(self):
            json = super(raritan.rpc.devsettings.Zeroconf.SettingsChangedEvent, self).encode()
            json['oldSettings'] = raritan.rpc.devsettings.Zeroconf.Settings.encode(self.oldSettings)
            json['newSettings'] = raritan.rpc.devsettings.Zeroconf.Settings.encode(self.newSettings)
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                oldSettings = raritan.rpc.devsettings.Zeroconf.Settings.decode(json['oldSettings'], agent),
                newSettings = raritan.rpc.devsettings.Zeroconf.Settings.decode(json['newSettings'], agent),
                # for idl.Event
                source = Interface.decode(json['source'], agent),
            )
            return obj

        def listElements(self):
            elements = ["oldSettings", "newSettings"]
            elements = elements + super(raritan.rpc.devsettings.Zeroconf.SettingsChangedEvent, self).listElements()
            return elements

    class _getSettings(Interface.Method):
        name = 'getSettings'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.devsettings.Zeroconf.Settings.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.devsettings.Zeroconf.Settings, DecodeException)
            return _ret_

    class _setSettings(Interface.Method):
        name = 'setSettings'

        @staticmethod
        def encode(settings):
            typecheck.is_struct(settings, raritan.rpc.devsettings.Zeroconf.Settings, AssertionError)
            args = {}
            args['settings'] = raritan.rpc.devsettings.Zeroconf.Settings.encode(settings)
            return args

        @staticmethod
        def decode(rsp, agent):
            return None
    def __init__(self, target, agent):
        super(Zeroconf, self).__init__(target, agent)
        self.getSettings = Zeroconf._getSettings(self)
        self.setSettings = Zeroconf._setSettings(self)

#
# Section generated by IdlC from "Modbus.idl"
#

import raritan.rpc
from raritan.rpc import Interface, Structure, ValueObject, Enumeration, typecheck, DecodeException
import raritan.rpc.devsettings


# interface
class Modbus(Interface):
    idlType = "devsettings.Modbus:2.0.0"

    ERR_INVALID_PARAM = 1

    # structure
    class Capabilities(Structure):
        idlType = "devsettings.Modbus_2_0_0.Capabilities:1.0.0"
        elements = ["hasModbusSerial"]

        def __init__(self, hasModbusSerial):
            typecheck.is_bool(hasModbusSerial, AssertionError)

            self.hasModbusSerial = hasModbusSerial

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                hasModbusSerial = json['hasModbusSerial'],
            )
            return obj

        def encode(self):
            json = {}
            json['hasModbusSerial'] = self.hasModbusSerial
            return json

    class _getCapabilities(Interface.Method):
        name = 'getCapabilities'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.devsettings.Modbus.Capabilities.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.devsettings.Modbus.Capabilities, DecodeException)
            return _ret_

    # structure
    class TcpSettings(Structure):
        idlType = "devsettings.Modbus_2_0_0.TcpSettings:1.0.0"
        elements = ["readonly"]

        def __init__(self, readonly):
            typecheck.is_bool(readonly, AssertionError)

            self.readonly = readonly

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                readonly = json['readonly'],
            )
            return obj

        def encode(self):
            json = {}
            json['readonly'] = self.readonly
            return json

    # enumeration
    class Parity(Enumeration):
        idlType = "devsettings.Modbus_2_0_0.Parity:1.0.0"
        values = ["NONE", "EVEN", "ODD"]

    Parity.NONE = Parity(0)
    Parity.EVEN = Parity(1)
    Parity.ODD = Parity(2)

    # structure
    class SerialSettings(Structure):
        idlType = "devsettings.Modbus_2_0_0.SerialSettings:1.0.0"
        elements = ["enabled", "baudrate", "parity", "stopbits", "readonly"]

        def __init__(self, enabled, baudrate, parity, stopbits, readonly):
            typecheck.is_bool(enabled, AssertionError)
            typecheck.is_int(baudrate, AssertionError)
            typecheck.is_enum(parity, raritan.rpc.devsettings.Modbus.Parity, AssertionError)
            typecheck.is_int(stopbits, AssertionError)
            typecheck.is_bool(readonly, AssertionError)

            self.enabled = enabled
            self.baudrate = baudrate
            self.parity = parity
            self.stopbits = stopbits
            self.readonly = readonly

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                enabled = json['enabled'],
                baudrate = json['baudrate'],
                parity = raritan.rpc.devsettings.Modbus.Parity.decode(json['parity']),
                stopbits = json['stopbits'],
                readonly = json['readonly'],
            )
            return obj

        def encode(self):
            json = {}
            json['enabled'] = self.enabled
            json['baudrate'] = self.baudrate
            json['parity'] = raritan.rpc.devsettings.Modbus.Parity.encode(self.parity)
            json['stopbits'] = self.stopbits
            json['readonly'] = self.readonly
            return json

    # structure
    class Settings(Structure):
        idlType = "devsettings.Modbus_2_0_0.Settings:1.0.0"
        elements = ["tcp", "serial", "primaryUnitId"]

        def __init__(self, tcp, serial, primaryUnitId):
            typecheck.is_struct(tcp, raritan.rpc.devsettings.Modbus.TcpSettings, AssertionError)
            typecheck.is_struct(serial, raritan.rpc.devsettings.Modbus.SerialSettings, AssertionError)
            typecheck.is_int(primaryUnitId, AssertionError)

            self.tcp = tcp
            self.serial = serial
            self.primaryUnitId = primaryUnitId

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                tcp = raritan.rpc.devsettings.Modbus.TcpSettings.decode(json['tcp'], agent),
                serial = raritan.rpc.devsettings.Modbus.SerialSettings.decode(json['serial'], agent),
                primaryUnitId = json['primaryUnitId'],
            )
            return obj

        def encode(self):
            json = {}
            json['tcp'] = raritan.rpc.devsettings.Modbus.TcpSettings.encode(self.tcp)
            json['serial'] = raritan.rpc.devsettings.Modbus.SerialSettings.encode(self.serial)
            json['primaryUnitId'] = self.primaryUnitId
            return json

    class _getSettings(Interface.Method):
        name = 'getSettings'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.devsettings.Modbus.Settings.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.devsettings.Modbus.Settings, DecodeException)
            return _ret_

    class _setSettings(Interface.Method):
        name = 'setSettings'

        @staticmethod
        def encode(settings):
            typecheck.is_struct(settings, raritan.rpc.devsettings.Modbus.Settings, AssertionError)
            args = {}
            args['settings'] = raritan.rpc.devsettings.Modbus.Settings.encode(settings)
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_
    def __init__(self, target, agent):
        super(Modbus, self).__init__(target, agent)
        self.getCapabilities = Modbus._getCapabilities(self)
        self.getSettings = Modbus._getSettings(self)
        self.setSettings = Modbus._setSettings(self)

#
# Section generated by IdlC from "Smtp.idl"
#

import raritan.rpc
from raritan.rpc import Interface, Structure, ValueObject, Enumeration, typecheck, DecodeException
import raritan.rpc.devsettings


# interface
class Smtp(Interface):
    idlType = "devsettings.Smtp:2.0.0"

    ERR_INVALID_PARAMS = 1

    # structure
    class Configuration(Structure):
        idlType = "devsettings.Smtp_2_0_0.Configuration:1.0.0"
        elements = ["host", "port", "useTls", "allowOffTimeRangeCerts", "caCertChain", "sender", "useAuth", "username", "password", "retryCount", "retryInterval"]

        def __init__(self, host, port, useTls, allowOffTimeRangeCerts, caCertChain, sender, useAuth, username, password, retryCount, retryInterval):
            typecheck.is_string(host, AssertionError)
            typecheck.is_int(port, AssertionError)
            typecheck.is_bool(useTls, AssertionError)
            typecheck.is_bool(allowOffTimeRangeCerts, AssertionError)
            typecheck.is_string(caCertChain, AssertionError)
            typecheck.is_string(sender, AssertionError)
            typecheck.is_bool(useAuth, AssertionError)
            typecheck.is_string(username, AssertionError)
            typecheck.is_string(password, AssertionError)
            typecheck.is_int(retryCount, AssertionError)
            typecheck.is_int(retryInterval, AssertionError)

            self.host = host
            self.port = port
            self.useTls = useTls
            self.allowOffTimeRangeCerts = allowOffTimeRangeCerts
            self.caCertChain = caCertChain
            self.sender = sender
            self.useAuth = useAuth
            self.username = username
            self.password = password
            self.retryCount = retryCount
            self.retryInterval = retryInterval

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                host = json['host'],
                port = json['port'],
                useTls = json['useTls'],
                allowOffTimeRangeCerts = json['allowOffTimeRangeCerts'],
                caCertChain = json['caCertChain'],
                sender = json['sender'],
                useAuth = json['useAuth'],
                username = json['username'],
                password = json['password'],
                retryCount = json['retryCount'],
                retryInterval = json['retryInterval'],
            )
            return obj

        def encode(self):
            json = {}
            json['host'] = self.host
            json['port'] = self.port
            json['useTls'] = self.useTls
            json['allowOffTimeRangeCerts'] = self.allowOffTimeRangeCerts
            json['caCertChain'] = self.caCertChain
            json['sender'] = self.sender
            json['useAuth'] = self.useAuth
            json['username'] = self.username
            json['password'] = self.password
            json['retryCount'] = self.retryCount
            json['retryInterval'] = self.retryInterval
            return json

    class _getConfiguration(Interface.Method):
        name = 'getConfiguration'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.devsettings.Smtp.Configuration.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.devsettings.Smtp.Configuration, DecodeException)
            return _ret_

    class _setConfiguration(Interface.Method):
        name = 'setConfiguration'

        @staticmethod
        def encode(cfg):
            typecheck.is_struct(cfg, raritan.rpc.devsettings.Smtp.Configuration, AssertionError)
            args = {}
            args['cfg'] = raritan.rpc.devsettings.Smtp.Configuration.encode(cfg)
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_

    # structure
    class TestResult(Structure):
        idlType = "devsettings.Smtp_2_0_0.TestResult:1.0.0"
        elements = ["status", "message"]

        def __init__(self, status, message):
            typecheck.is_int(status, AssertionError)
            typecheck.is_string(message, AssertionError)

            self.status = status
            self.message = message

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                status = json['status'],
                message = json['message'],
            )
            return obj

        def encode(self):
            json = {}
            json['status'] = self.status
            json['message'] = self.message
            return json

    class _testConfiguration(Interface.Method):
        name = 'testConfiguration'

        @staticmethod
        def encode(cfg, recipients):
            typecheck.is_struct(cfg, raritan.rpc.devsettings.Smtp.Configuration, AssertionError)
            for x0 in recipients:
                typecheck.is_string(x0, AssertionError)
            args = {}
            args['cfg'] = raritan.rpc.devsettings.Smtp.Configuration.encode(cfg)
            args['recipients'] = [x0 for x0 in recipients]
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.devsettings.Smtp.TestResult.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.devsettings.Smtp.TestResult, DecodeException)
            return _ret_
    def __init__(self, target, agent):
        super(Smtp, self).__init__(target, agent)
        self.getConfiguration = Smtp._getConfiguration(self)
        self.setConfiguration = Smtp._setConfiguration(self)
        self.testConfiguration = Smtp._testConfiguration(self)

#
# Section generated by IdlC from "Snmp.idl"
#

import raritan.rpc
from raritan.rpc import Interface, Structure, ValueObject, Enumeration, typecheck, DecodeException
import raritan.rpc.devsettings

import raritan.rpc.idl


# interface
class Snmp(Interface):
    idlType = "devsettings.Snmp:1.0.2"

    ERR_INVALID_PARAMS = 1

    # structure
    class Configuration(Structure):
        idlType = "devsettings.Snmp_1_0_2.Configuration:1.0.0"
        elements = ["v2enable", "v3enable", "readComm", "writeComm", "sysContact", "sysName", "sysLocation"]

        def __init__(self, v2enable, v3enable, readComm, writeComm, sysContact, sysName, sysLocation):
            typecheck.is_bool(v2enable, AssertionError)
            typecheck.is_bool(v3enable, AssertionError)
            typecheck.is_string(readComm, AssertionError)
            typecheck.is_string(writeComm, AssertionError)
            typecheck.is_string(sysContact, AssertionError)
            typecheck.is_string(sysName, AssertionError)
            typecheck.is_string(sysLocation, AssertionError)

            self.v2enable = v2enable
            self.v3enable = v3enable
            self.readComm = readComm
            self.writeComm = writeComm
            self.sysContact = sysContact
            self.sysName = sysName
            self.sysLocation = sysLocation

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                v2enable = json['v2enable'],
                v3enable = json['v3enable'],
                readComm = json['readComm'],
                writeComm = json['writeComm'],
                sysContact = json['sysContact'],
                sysName = json['sysName'],
                sysLocation = json['sysLocation'],
            )
            return obj

        def encode(self):
            json = {}
            json['v2enable'] = self.v2enable
            json['v3enable'] = self.v3enable
            json['readComm'] = self.readComm
            json['writeComm'] = self.writeComm
            json['sysContact'] = self.sysContact
            json['sysName'] = self.sysName
            json['sysLocation'] = self.sysLocation
            return json

    # value object
    class ConfigurationChangedEvent(raritan.rpc.idl.Event):
        idlType = "devsettings.Snmp_1_0_2.ConfigurationChangedEvent:1.0.0"

        def __init__(self, userName, ipAddr, oldConfig, newConfig, source):
            super(raritan.rpc.devsettings.Snmp.ConfigurationChangedEvent, self).__init__(source)
            typecheck.is_string(userName, AssertionError)
            typecheck.is_string(ipAddr, AssertionError)
            typecheck.is_struct(oldConfig, raritan.rpc.devsettings.Snmp.Configuration, AssertionError)
            typecheck.is_struct(newConfig, raritan.rpc.devsettings.Snmp.Configuration, AssertionError)

            self.userName = userName
            self.ipAddr = ipAddr
            self.oldConfig = oldConfig
            self.newConfig = newConfig

        def encode(self):
            json = super(raritan.rpc.devsettings.Snmp.ConfigurationChangedEvent, self).encode()
            json['userName'] = self.userName
            json['ipAddr'] = self.ipAddr
            json['oldConfig'] = raritan.rpc.devsettings.Snmp.Configuration.encode(self.oldConfig)
            json['newConfig'] = raritan.rpc.devsettings.Snmp.Configuration.encode(self.newConfig)
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                userName = json['userName'],
                ipAddr = json['ipAddr'],
                oldConfig = raritan.rpc.devsettings.Snmp.Configuration.decode(json['oldConfig'], agent),
                newConfig = raritan.rpc.devsettings.Snmp.Configuration.decode(json['newConfig'], agent),
                # for idl.Event
                source = Interface.decode(json['source'], agent),
            )
            return obj

        def listElements(self):
            elements = ["userName", "ipAddr", "oldConfig", "newConfig"]
            elements = elements + super(raritan.rpc.devsettings.Snmp.ConfigurationChangedEvent, self).listElements()
            return elements

    class _getConfiguration(Interface.Method):
        name = 'getConfiguration'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.devsettings.Snmp.Configuration.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.devsettings.Snmp.Configuration, DecodeException)
            return _ret_

    class _setConfiguration(Interface.Method):
        name = 'setConfiguration'

        @staticmethod
        def encode(cfg):
            typecheck.is_struct(cfg, raritan.rpc.devsettings.Snmp.Configuration, AssertionError)
            args = {}
            args['cfg'] = raritan.rpc.devsettings.Snmp.Configuration.encode(cfg)
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_

    class _getV3EngineId(Interface.Method):
        name = 'getV3EngineId'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = rsp['_ret_']
            typecheck.is_string(_ret_, DecodeException)
            return _ret_
    def __init__(self, target, agent):
        super(Snmp, self).__init__(target, agent)
        self.getConfiguration = Snmp._getConfiguration(self)
        self.setConfiguration = Snmp._setConfiguration(self)
        self.getV3EngineId = Snmp._getV3EngineId(self)