-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi_responses.go
290 lines (254 loc) · 7.41 KB
/
api_responses.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
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
package snmpsimclient
/*
Labs is an array of Labs.
*/
type Labs []Lab
/*
Lab - Group of SNMP agents belonging to the same virtual laboratory. Some operations can be applied to them all at once.
*/
type Lab struct {
ID int `json:"id"`
Name string `json:"name"`
Power string `json:"power"`
Agents Agents `json:"agents"`
Tags Tags `json:"tags"`
}
/*
Engines is an array of engines.
*/
type Engines []Engine
/*
Engine - Represents a unique, independent and fully operational SNMP engine, though not yet attached to any transport endpoints.
*/
type Engine struct {
ID int `json:"id"`
Name string `json:"name"`
EngineID string `json:"engine_id"`
Endpoints Endpoints `json:"endpoints"`
Users Users `json:"users"`
Tags Tags `json:"tags"`
}
/*
Agents is an array of agents.
*/
type Agents []Agent
/*
Agent - Represents SNMP agent. Consists of SNMP engine and transport endpoints it binds.
*/
type Agent struct {
ID int `json:"id"`
Name string `json:"name"`
DataDir string `json:"data_dir"`
Engines Engines `json:"engines"`
Selectors Selectors `json:"selectors"`
Tags Tags `json:"tags"`
}
/*
Endpoints is an array of endpoints.
*/
type Endpoints []Endpoint
/*
Endpoint - SNMP transport endpoint object. Each SNMP engine can bind one or more transport endpoints. Each transport endpoint can only be bound by one SNMP engine.
*/
type Endpoint struct {
ID int `json:"id"`
Name string `json:"name"`
Protocol string `json:"protocol"`
Address string `json:"address"`
Tags Tags `json:"tags"`
}
/*
ProcessEndpoints is an array of process-endpoint
*/
type ProcessEndpoints []ProcessEndpoint
/*
ProcessEndpoint - SNMP transport endpoint object. Each SNMP process can bind one or more transport endpoints. Each transport endpoint can only be bound by one SNMP process.
*/
type ProcessEndpoint struct {
ID int `json:"id"`
Protocol string `json:"protocol"`
Address string `json:"address"`
Process ProcessMetrics `json:"process"`
}
/*
Recordings is an array of recordings.
*/
type Recordings []Recording
/*
Recording - Represents a single simulation data file residing by path under simulation data root.
*/
type Recording struct {
ID int `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
}
/*
Users is an array of users.
*/
type Users []User
/*
User - SNMPv3 USM user object. Contains SNMPv3 credentials grouped by user name.
*/
type User struct {
ID int `json:"id"`
Name string `json:"name"`
User string `json:"user"`
AuthKey string `json:"auth_key"`
AuthProto string `json:"auth_proto"`
PrivKey string `json:"priv_key"`
PrivProto string `json:"priv_proto"`
Tags Tags `json:"tags"`
}
//TODO: not implemented int the api yet, there is only one default selector for snmpv2c and one for snmpv3.
// We have to wait with the implementation until its implemented in the api.
// The strucuture is like this in the api doc but it might be different in the real api, this has to be checked first before it can be used.
/*
Selectors is an array of selectors.
*/
type Selectors []Selector
/*
Selector - Each selector should end up being a path to a simulation data file relative to the command responder's data directory.
The value of the selector can be static or, more likely, it contains templates that are expanded at run time. Each template can expand into some property of the inbound request.
Known templates include:
${context-engine-id}
${context-name}
${endpoint-id}
${source-address}
*/
type Selector struct {
ID int `json:"id"`
Comment string `json:"comment"`
Template string `json:"template"`
Tags Tags `json:"tags"`
}
/*
ErrorResponse contains error information.
*/
type ErrorResponse struct {
Message string `json:"message"`
Status int `json:"status"`
}
/*
ProcessMetrics - SNMP simulator system is composed of many running processes. This object describes common properties of a process.
Cmdline *string `json:"cmdline"`
Uptime *int `json:"uptime"`
Owner *string `json:"owner"`
LifeCycle *ProcessLifeCycle `json:"lifecycle"`
*/
type ProcessMetrics struct {
ID int `json:"id"`
Path string `json:"path"`
Runtime int `json:"runtime"`
CPU int `json:"cpu"`
Memory int `json:"memory"`
Files int `json:"files"`
Exits int `json:"exits"`
Changes int `json:"changes"`
UpdateInterval int `json:"update_interval"`
LastUpdate string `json:"last_update"`
ConsolePages ConsolePages `json:"console_pages"`
Supervisor Supervisor `json:"supervisor"`
}
/*
ProcessLifeCycle - How this process has being doing.
*/
type ProcessLifeCycle struct {
Exits *int `json:"exits"`
Restarts *int `json:"restarts"`
}
/*
ProcessesMetrics is an array of ProcessMetrics.
*/
type ProcessesMetrics []ProcessMetrics
/*
PacketMetrics - Transport endpoint related activity. Includes raw network packet counts as well as SNMP messages failed to get processed at the later stages.
*/
type PacketMetrics struct {
FirstHit *int `json:"first_hit"`
LastHit *int `json:"last_hit"`
Total *int64 `json:"total"`
ParseFailures *int64 `json:"parse_failures"`
AuthFailures *int64 `json:"auth_failures"`
ContextFailures *int64 `json:"context_failures"`
}
/*
MessageMetrics - SNMP message level metrics.
*/
type MessageMetrics struct {
FirstHit *int `json:"first_hit"`
LastHit *int `json:"last_hit"`
Pdus *int64 `json:"pdus"`
VarBinds *int64 `json:"var_binds"`
Failures *int64 `json:"failures"`
Variations Variations `json:"variations"`
}
/*
Variation - Variation module metrics.
*/
type Variation struct {
FirstHit *int `json:"first_hit"`
LastHit *int `json:"last_hit"`
Total *int64 `json:"total"`
Name *string `json:"name"`
Failures *int64 `json:"failures"`
}
/*
Variations is an array of variations.
*/
type Variations []Variation
/*
Tag - tags a collection of SNMP simulator control plane resources
*/
type Tag struct {
ID int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Agents Agents `json:"agents"`
Endpoints Endpoints `json:"endpoints"`
Engines Engines `json:"engines"`
Labs Labs `json:"labs"`
Selectors Selectors `json:"selectors"`
Users Users `json:"users"`
}
/*
Tags is an array of tags.
*/
type Tags []Tag
/*
Console - contains information regarding the console
*/
type Console struct {
ID int `json:"id"`
Timestamp string `json:"timestamp"`
Text string `json:"text"`
}
/*
Consoles is an array of Consoles
*/
type Consoles []Console
/*
ConsolePages - contains information regarding snmpsim consoles
*/
type ConsolePages struct {
Count int `json:"count"`
LastUpdate string `json:"last_update"`
}
/*
Supervisor - contains information regarding the supervisor
*/
type Supervisor struct {
Hostname string `json:"hostname"`
WatchDir string `json:"watch_dir"`
}
/*
MessageFilters resembles the response structure of GetMessageFilters
*/
type MessageFilters filters
/*
PacketFilters resembles the response structure of GetPacketFilters
*/
type PacketFilters filters
/*
filters resembles the base structure of a Get...Filters response
*/
type filters []string