Raritan PX2/PX3 JSON-RPC API
testrpc.idl
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * Copyright 2012 Raritan Inc. All rights reserved.
4  */
5 
6 /**
7  * system test interfaces
8  *
9  */
10 
11 module test {
12 
13  /**
14  * Convenience structure to return test or operation results.
15  * - There is a result code
16  * Typically 0 means OK
17  * 1 means Test Error
18  * 2 means Invalid Parameter
19  * However indivdual test may redefine or extend this definition
20  * - There is a descriptive error string,
21  * which is empty in case test went OK
22  *
23  * This structure is not neccessarily used for all operations
24  * but only for those where it comes in handy
25  */
26  structure Result {
27  int code; ///< Result code
28  string errtext; ///< Descriptive error string
29  };
30 
31  /**
32  * Interface to enter and exit special test modes.
33  * Some of the port tests require the unit to be set in
34  * dedicated test modes because special equipment is plugged into the
35  * ports which would confuse ordinary services observing those ports.
36  */
37  interface Control {
38 
39  /**
40  * returns actual state of test mode
41  */
42  boolean isTestMode();
43 
44  /**
45  * sets the unit in test mode which pulls away services
46  * dealing with feature ports, aux ports, 1wire ports
47  */
48  void setTestMode(in boolean isTestModeOn);
49 
50  };
51 
52 
53  /**
54  * Test routines for full RS232 Serial Interface
55  */
56  interface RS232Serial {
57 
58  /**
59  * returns list of valid device files for the test
60  */
61  vector<string> getDeviceFiles();
62 
63  /**
64  * loop test with adapter 1
65  * DTR->DSR, RTS->CTS
66  */
67  Result testLoop1(in string devfile);
68 
69  /**
70  * loop test with adapter 2
71  * DTR->DCD, RTS->RI
72  */
73  Result testLoop2(in string devfile);
74 
75  };
76 
77 
78  /**
79  * test routines for Raritan Feature Serial interface
80  * (RS232 with some control lines and switched power)
81  * Require TestMode to be ON.
82  */
83  interface FeatSerial {
84 
85  constant int OK = 0; ///< No error
86  constant int ERR_NO_TEST_MODE = 1; ///< Not in test mode
87  constant int ERR_INVAL_PORT_NUM = 2; ///< Invalid port number
88  constant int ERR_TEST_FAILED = 3; ///< Test failed
89 
90  /**
91  * returns number of ports
92  *
93  * @return 0 if OK
94  * @return 1 if not in test mode
95  */
96  int getNumberOfPorts(out int numPorts);
97 
98  /**
99  * Switches Power supplied to the port
100  * Observable with special test adapter
101  * Power->LED
102  *
103  * @return OK if OK
104  * @return ERR_NO_TEST_MODE if not in test mode
105  * @return ERR_INVAL_PORT_NUM if invalid port number
106  */
107  int setPower(in int portNum, in boolean hasPower);
108 
109  /**
110  * Performs a loop test with special test adapter
111  * TX->RX
112  *
113  * @return OK if OK
114  * @return ERR_NO_TEST_MODE if not in test mode
115  * @return ERR_INVAL_PORT_NUM if invalid port number
116  * @return ERR_TEST_FAILED if test failed, errstr may be set
117  */
118  int testLoopTxRx(in int portNum, out string errstr);
119 
120  /**
121  * Performs a loop test with special test adapter
122  * DTR->DCD
123  *
124  * @return OK if OK
125  * @return ERR_NO_TEST_MODE if not in test mode
126  * @return ERR_INVAL_PORT_NUM if invalid port number
127  * @return ERR_TEST_FAILED if test failed, errstr may be set
128  */
129  int testLoopDtrDcd(in int portNum, out string errstr);
130 
131  };
132 
133 
134  /**
135  * test routines for Raritan Aux Serial interface
136  * (RS485 on pins 3 and 6 of RJ45)
137  * Require TestMode to be ON.
138  */
139  interface AuxSerial {
140 
141  constant int OK = 0; ///< No error
142  constant int ERR_NO_TEST_MODE = 1; ///< Not in test mode
143  constant int ERR_INVAL_PORT_NUM = 2; ///< Invalid port number
144  constant int ERR_TEST_FAILED = 3; ///< Test failed
145 
146  /**
147  * returns number of ports
148  *
149  * @return 0 if OK
150  * @return 1 if not in test mode
151  */
152  int getNumberOfPorts(out int numPorts);
153 
154  /**
155  * Performs a loop test with special test adapter
156  *
157  * @return OK if OK
158  * @return ERR_NO_TEST_MODE if not in test mode
159  * @return ERR_INVAL_PORT_NUM if invalid port number
160  * @return ERR_TEST_FAILED if test failed, errstr may be set
161  */
162  int testLoop(in int portNum, out string errstr);
163  };
164 
165 
166  /**
167  * test routines for RJ45 Ethernet port
168  * This is low level interface using ethtool
169  * that does not persist any of the settings made
170  * (TODO: this interface may be combined with a 'decent'
171  * network interface. Currently the network interface is
172  * dedicated to special use cases)
173  */
174  interface Ethernet {
175 
176  /**
177  * returns a a list of valid network interface devices
178  */
179  vector<string> getDevices();
180 
181  /** Ethernet Speed */
182  enumeration Speed {
183  SPD_10, ///< 10 Mbit/s
184  SPD_100, ///< 100 Mbit/s
185  SPD_1000 ///< 1 Gbit/s
186  };
187 
188  /** Ethernet Duplex Mode */
189  enumeration Duplex {
190  DPX_HALF, ///< Half Duplex
191  DPX_FULL ///< Full Duplex
192  };
193 
194  /**
195  * transiently sets the interface to the desired parameters
196  * @return 0 if OK
197  * @return 1 if invalid param
198  * @return 2 if system error executing operation
199  */
200  int setParameters(in string device, in Speed speed, in Duplex duplex,
201  in boolean isAutoNeg);
202 
203  };
204 
205 }
test routines for Raritan Aux Serial interface (RS485 on pins 3 and 6 of RJ45) Require TestMode to be...
Definition: testrpc.idl:139
int getNumberOfPorts(out int numPorts)
returns number of ports
int testLoop(in int portNum, out string errstr)
Performs a loop test with special test adapter.
Interface to enter and exit special test modes.
Definition: testrpc.idl:37
boolean isTestMode()
returns actual state of test mode
void setTestMode(in boolean isTestModeOn)
sets the unit in test mode which pulls away services dealing with feature ports, aux ports,...
test routines for RJ45 Ethernet port This is low level interface using ethtool that does not persist ...
Definition: testrpc.idl:174
vector< string > getDevices()
returns a a list of valid network interface devices
int setParameters(in string device, in Speed speed, in Duplex duplex, in boolean isAutoNeg)
transiently sets the interface to the desired parameters
Speed
Ethernet Speed.
Definition: testrpc.idl:182
@ SPD_10
10 Mbit/s
Definition: testrpc.idl:183
@ SPD_100
100 Mbit/s
Definition: testrpc.idl:184
Duplex
Ethernet Duplex Mode.
Definition: testrpc.idl:189
@ DPX_HALF
Half Duplex.
Definition: testrpc.idl:190
test routines for Raritan Feature Serial interface (RS232 with some control lines and switched power)...
Definition: testrpc.idl:83
int getNumberOfPorts(out int numPorts)
returns number of ports
int testLoopTxRx(in int portNum, out string errstr)
Performs a loop test with special test adapter TX->RX.
int testLoopDtrDcd(in int portNum, out string errstr)
Performs a loop test with special test adapter DTR->DCD.
int setPower(in int portNum, in boolean hasPower)
Switches Power supplied to the port Observable with special test adapter Power->LED.
Test routines for full RS232 Serial Interface.
Definition: testrpc.idl:56
Result testLoop1(in string devfile)
loop test with adapter 1 DTR->DSR, RTS->CTS
vector< string > getDeviceFiles()
returns list of valid device files for the test
Result testLoop2(in string devfile)
loop test with adapter 2 DTR->DCD, RTS->RI
Test Interfaces.
Definition: TestDisplay.idl:12
Convenience structure to return test or operation results.
Definition: testrpc.idl:26
string errtext
Descriptive error string.
Definition: testrpc.idl:28
int code
Result code.
Definition: testrpc.idl:27