/
experiment_messages.go
378 lines (325 loc) · 8.98 KB
/
experiment_messages.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
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
package spi
import (
"encoding/xml"
"fmt"
)
type ExperimentFaultEnvelope struct {
Envelope
Body struct {
Body
Fault struct {
Code struct {
Value string
}
Reason struct {
Text string
}
Detail struct {
ExperimentsDeterFault struct {
//XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd ExperimentsDeterFault"`
DeterFault struct {
//XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd DeterFault"`
DetailMessage string `xml:"detailMessage"`
ErrorCode int `xml:"errorCode"`
ErrorMessage string `xml:"errorMessage"`
}
}
}
}
}
}
func (f ExperimentFaultEnvelope) String() string {
df := &f.Body.Fault.Detail.ExperimentsDeterFault.DeterFault
return fmt.Sprintf("%s (%d): %s", df.ErrorMessage, df.ErrorCode, df.DetailMessage)
}
type RealizationsFaultEnvelope struct {
Envelope
Body struct {
Body
Fault struct {
Code struct {
Value string
}
Reason struct {
Text string
}
Detail struct {
RealizationsDeterFault struct {
//XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd ExperimentsDeterFault"`
DeterFault struct {
//XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd DeterFault"`
DetailMessage string `xml:"detailMessage"`
ErrorCode int `xml:"errorCode"`
ErrorMessage string `xml:"errorMessage"`
}
}
}
}
}
}
func (f RealizationsFaultEnvelope) String() string {
df := &f.Body.Fault.Detail.RealizationsDeterFault.DeterFault
return fmt.Sprintf("%s (%d): %s", df.ErrorMessage, df.ErrorCode, df.DetailMessage)
}
// Attributes & Aspects --------------------------------------------------------
type ExperimentAspect struct {
XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd aspects"`
Data string `xml:"data"`
Type string `xml:"type"`
}
type Attribute interface {
GetName() string
}
type DescriptionAttr struct {
XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd profile"`
Name string `xml:"name"`
Value string `xml:"value"`
}
func (d DescriptionAttr) GetName() string {
return d.Name
}
// Create Experiment -----------------------------------------------------------
type CreateExperimentEnvelope struct {
Envelope
Body struct {
Body
CreateExperiment struct {
XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd createExperiment"`
EID string `xml:"eid"`
Owner string `xml:"owner"`
Aspects []ExperimentAspect
Profile []Attribute
}
}
}
type CreateExperimentResponse struct {
Return bool `xml:"return"`
}
type CreateExperimentResponseEnvelope struct {
Envelope
Body struct {
Body
CreateExperimentResponse CreateExperimentResponse `xml:"createExperimentResponse"`
}
}
// Realize Experiment ----------------------------------------------------------
type RealizeExperimentEnvelope struct {
Envelope
Body struct {
Body
RealizeExperiment struct {
XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd realizeExperiment"`
UID string `xml:"uid"`
EID string `xml:"eid"`
CID string `xml:"cid"`
}
}
}
type RealizeExperimentResponse struct {
Return RealizationDescription `xml:"return"`
}
type RealizeExperimentResponseEnvelope struct {
Envelope
Body struct {
Body
RealizeExperimentResponse RealizeExperimentResponse `xml:"realizeExperimentResponse"`
}
}
type RealizationContainment struct {
XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd containment"`
Inner string `xml:"inner"`
Outer string `xml:"outer"`
}
type RealizationMap struct {
XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd mapping"`
Resource string `xml:"resource"`
TopologyName string `xml:"topologyName"`
}
type RealizationDescription struct {
XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd return"`
Circle string `xml:"circle"`
Experiment string `xml:"experiment"`
Name string `xml:"name"`
Status string `xml:"status"`
Containment []RealizationContainment `xml:"containment"`
Mapping []RealizationMap `xml:"mapping"`
Perms []string `xml:"perms"`
}
type ExperimentDescription struct {
XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd return"`
Name string `xml:"experimentId"`
Owner string `xml:"owner"`
Staus string `xml:"status"`
Perms []string `xml:"perms"`
}
// Remove Realization ---------------------------------------------------------
type RemoveRealizationEnvelope struct {
Envelope
Body struct {
Body
RemoveRealization struct {
XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd removeRealization"`
Name string `xml:"name"`
}
}
}
type RemoveRealizationResponse struct {
Return bool `xml:"return"`
}
type RemoveRealizationResponseEnvelope struct {
Envelope
Body struct {
Body
RemoveRealizationResponse RemoveRealizationResponse `xml:"removeRealizationResponse"`
}
}
// Release Realization --------------------------------------------------------
type ReleaseRealizationEnvelope struct {
Envelope
Body struct {
Body
ReleaseRealization struct {
XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd releaseRealization"`
Name string `xml:"name"`
}
}
}
type ReleaseRealizationResponse struct {
Return bool `xml:"return"`
}
type ReleaseRealizationResponseEnvelope struct {
Envelope
Body struct {
Body
ReleaseRealizationResponse ReleaseRealizationResponse `xml:"releaseRealizationResponse"`
}
}
// View Realizations -----------------------------------------------------------
type ViewRealizationsEnvelope struct {
Envelope
Body struct {
Body
ViewRealizations struct {
XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd viewRealizations"`
UID string `xml:"uid"`
Regex string `xml:"regex"`
}
}
}
type ViewRealizationsResponse struct {
Return []RealizationDescription `xml:"return"`
}
type ViewRealizationsResponseEnvelope struct {
Envelope
Body struct {
Body
ViewRealizationsResponse ViewRealizationsResponse `xml:"viewRealizationsResponse"`
}
}
// View Experiments -----------------------------------------------------------
type ViewExperimentsEnvelope struct {
Envelope
Body struct {
Body
ViewExperiments struct {
XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd viewExperiments"`
UID string `xml:"uid"`
Regex string `xml:"regex"`
ListOnly bool `xml:"listOnly"`
Offset int `xml:"offset"`
Count int `xml:"count"`
}
}
}
type ViewExperimentsResponse struct {
Return []ExperimentDescription `xml:"return"`
}
type ViewExperimentsResponseEnvelope struct {
Envelope
Body struct {
Body
ViewExperimentsResponse ViewExperimentsResponse `xml:"viewExperimentsResponse"`
}
}
// Remove Experiment -----------------------------------------------------------
type RemoveExperimentEnvelope struct {
Envelope
Body struct {
Body
RemoveExperiment struct {
XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd removeExperiment"`
EID string `xml:"eid"`
}
}
}
type RemoveExperimentResponse struct {
XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd removeExperimentResponse"`
Return bool `xml:"return"`
}
type RemoveExperimentResponseEnvelope struct {
Envelope
Body struct {
Body
RemoveExperimentResponse RemoveExperimentResponse
}
}
// Change Experiment Profile ---------------------------------------------------
type ChangeExperimentProfileEnvelope struct {
Envelope
Body struct {
Body
ChangeExperimentProfile struct {
XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd changeExperimentProfile"`
EID string `xml:"eid"`
Changes []ChangeAttribute `xml:"changes"`
}
}
}
type ChangeAttribute struct {
XMLName xml.Name `xml:"changes"`
Delete bool `xml:"delete"`
Name string `xml:"name"`
Value string `xml:"value"`
}
type ChangeExperimentProfileResponse struct {
Return []ChangeResult `xml:"return"`
}
type ChangeExperimentProfileResponseEnvelope struct {
Envelope
Body struct {
Body
ChangeExperimentProfileResponse ChangeExperimentProfileResponse
}
}
type ChangeResult struct {
Name string `xml:"name"`
Reason string `xml:"reason"`
Success bool `xml:"success"`
}
// Change Experiment ACL -------------------------------------------------------
type AccessMember struct {
XMLName xml.Name `xml:"acl"`
CircleId string `xml:"circleId"`
Permissions []string `xml:"permissions"`
}
type ChangeExperimentACLEnvelope struct {
Envelope
Body struct {
Body
ChangeExperimentACL struct {
XMLName xml.Name `xml:"http://api.testbed.deterlab.net/xsd changeExperimentACL"`
EID string `xml:"eid"`
ACL []AccessMember
}
}
}
type ChangeExperimentACLResponse struct {
Return []ChangeResult `xml:"return"`
}
type ChangeExperimentACLResponseEnvelope struct {
Envelope
Body struct {
Body
ChangeExperimentACLResponse ChangeExperimentACLResponse
}
}