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
|
/*-
* ============LICENSE_START==========================================
* OPENECOMP - DCAE
* ===================================================================
* Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
* ===================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
*/
@GenModel(modelDirectory="/ncomp-docker-model/src/main/xcore-gen")
package org.openecomp.ncomp.docker
import org.openecomp.ncomp.core.NamedEntity
class DockerAdaptor {
contains DockerHost[] dockerHosts
}
class DockerHost extends NamedEntity {
String url
long pollingFrequency = "30000"
boolean remote = "false"
contains DockerImage[] images
contains DockerContainer[] containers
contains DockerNetwork[] networks
op void poll()
op void startContainer(String name)
op void stopContainer(String name, int seconds)
op void restartContainer(String name, int seconds)
op void pauseContainer(String name)
op void unpauseContainer(String name)
op void removeContainer(String name,boolean remove,boolean force)
op void inspectContainer(String name)
op void killContainer(String name,String sigint)
op void dockerRun(String image)
op void dockerRunWithName(String image, String name)
op void dockerRunWithOptions(String image, ContainerOptions opts)
op void containerStats(String name, boolean stream)
op void containerProcesses(String name)
}
class DockerImage extends NamedEntity {
String ^id // "Id": "89d5d8e8bafb6e279fa70ea444260fa61cc7c5c7d93eff51002005c54a49c918",
String parentId // "ParentId": "e24428725dd6f8e354a0c6080570f90d40e9e963c6878144291c6ba9fd39b25f",
String[] repoTags //"RepoTags": ["ubuntu:latest"],
String[] repoDigests //"RepoDigests": [],
Date dockerCreated //"Created": 1449599913,
Long size //"Size": 0,
Long virtualSize //"VirtualSize": 187920354,
String[] labels //"Labels": null
}
class DockerContainer extends NamedEntity {
String ^id // "Id": "d2dc0b5f101cff3f0d015ab92266d8672f57668449710e5d05500baf8b53404e",
String[] names // "Names": ["/angry_bardeen"],
String image // "Image": "ubuntu",
String imageID // "ImageID": "89d5d8e8bafb6e279fa70ea444260fa61cc7c5c7d93eff51002005c54a49c918",
String command // "Command": "/bin/bash",
String dockerCreated // "Created": 1451671108,
contains DockerPort[] ports
contains DockerKeyPair[] labels // "Labels": {},
String status // "Status": "Up 3 hours",
contains DockerKeyPair[] hostConfig // "HostConfig": {"NetworkMode": "default"}
contains DockerProcess[] processes // container processes
contains DockerMount[] mounts
contains DockerContainerStats stats // container statistic snapshots
contains DockerEvents[] events // docker events since the last poll
}
class DockerPort {
int privatePort // "PrivatePort": 2222
int publicPort // "PublicPort": 3333
String ^type // "Type": "tcp"
}
class DockerKeyPair {
String name
String value
}
class DockerMount {
String source
String destination
String mode
Boolean rW
String propagation
}
//
// Docker run command takes numerous runtime arguments. At present we only support
// -v, --volume bind mount a volume
// --name assign a name to the container
// -P map any exposed port to an ephmeral port
// -p cPort[/protocol]:vPort container port:vm port if no proto, defaults to tcp
//
class ContainerOptions extends NamedEntity {
String imageNm
// list of key=value pairs such as MYSQL_USER=nmsadm to pass as runtime environment
// arguments for the container
String[] env
// bind volume syntax "vm_folder:countainer_folder" such as "/var/log:/opt/app/manager/logs" which
// means -- mount the VM /var/log directory as /opt/app/manager/logs in the container
String[] volumes
// Link to another container. link is containerName:containerAlias
String[] links
boolean setContainerName
// map an exposed container port to an ephemeral VM port
boolean publishAllPorts
// expected format is container_port/protocol:host_port
contains ContainerPortBindings[] portBindings
contains ContainerRestartPolicy autoRestart
}
//
// valid policies
// no - do not auto restart the container, this is the default docker behavior
// on-failure - restart only if the container exits with a non-zero status
// always - always restart. daemon will always try, indefinitely
// unless-stop - always restart, unless the container has been put into a stopped start
//
// maxRetryCnt applies to on-failure policy
//
class ContainerRestartPolicy {
String nm
int maxRetryCnt
}
class ContainerPortBindings extends NamedEntity {
int containerPort
String protocol
int vmPort
}
// {
// "Name": "bridge",
// "Id": "f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566",
// "Scope": "local",
// "Driver": "bridge",
// "IPAM": {
// "Driver": "default",
// "Config": [
// {
// "Subnet": "172.17.0.0/16"
// }
// ]
// },
// "Containers": {
// "39b69226f9d79f5634485fb236a23b2fe4e96a0a94128390a7fbbcc167065867": {
// "EndpointID": "ed2419a97c1d9954d05b46e462e7002ea552f216e9b136b80a7db8d98b442eda",
// "MacAddress": "02:42:ac:11:00:02",
// "IPv4Address": "172.17.0.2/16",
// "IPv6Address": ""
// }
// },
// "Options": {
// "com.docker.network.bridge.default_bridge": "true",
// "com.docker.network.bridge.enable_icc": "true",
// "com.docker.network.bridge.enable_ip_masquerade": "true",
// "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
// "com.docker.network.bridge.name": "docker0",
// "com.docker.network.driver.mtu": "1500"
// }
// },
class DockerNetwork extends NamedEntity {
String ^id
String scope
String driver
contains DockerIpam iPAM
contains DockerNetworkContainer[] containers
contains DockerKeyPair[] options
}
class DockerIpam {
String driver
contains DockerIpamConfig[] config
}
class DockerIpamConfig {
String subnet
}
class DockerNetworkContainer {
String ^id
String iPv4Address
String iPv6Address
String endpointID
String macAddress
}
class DockerEvents extends NamedEntity {
String status
String ^id
String ^type
String action
contains DockerActor actor
int time
long timenano
}
class DockerActor {
String ^id
contains DockerActorAttributes attributes
}
class DockerActorAttributes {
String name
}
//{
// "Hostname": "",
// "Domainname": "",
// "User": "",
// "AttachStdin": false,
// "AttachStdout": true,
// "AttachStderr": true,
// "Tty": false,
// "OpenStdin": false,
// "StdinOnce": false,
// "Env": [
// "FOO=bar",
// "BAZ=quux"
// ],
// "Cmd": [
// "date"
// ],
// "Entrypoint": "",
// "Image": "ubuntu",
// "Labels": {
// "com.example.vendor": "Acme",
// "com.example.license": "GPL",
// "com.example.version": "1.0"
// },
// "Mounts": [
// {
// "Source": "/data",
// "Destination": "/data",
// "Mode": "ro,Z",
// "RW": false
// }
// ],
// "WorkingDir": "",
// "NetworkDisabled": false,
// "MacAddress": "12:34:56:78:9a:bc",
// "ExposedPorts": {
// "22/tcp": {}
// },
// "StopSignal": "SIGTERM",
// "HostConfig": {
// "Binds": ["/tmp:/tmp"],
// "Links": ["redis3:redis"],
// "LxcConf": {"lxc.utsname":"docker"},
// "Memory": 0,
// "MemorySwap": 0,
// "MemoryReservation": 0,
// "KernelMemory": 0,
// "CpuShares": 512,
// "CpuPeriod": 100000,
// "CpuQuota": 50000,
// "CpusetCpus": "0,1",
// "CpusetMems": "0,1",
// "BlkioWeight": 300,
// "MemorySwappiness": 60,
// "OomKillDisable": false,
// "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
// "PublishAllPorts": false,
// "Privileged": false,
// "ReadonlyRootfs": false,
// "Dns": ["8.8.8.8"],
// "DnsOptions": [""],
// "DnsSearch": [""],
// "ExtraHosts": null,
// "VolumesFrom": ["parent", "other:ro"],
// "CapAdd": ["NET_ADMIN"],
// "CapDrop": ["MKNOD"],
// "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
// "NetworkMode": "bridge",
// "Devices": [],
// "Ulimits": [{}],
// "LogConfig": { "Type": "json-file", "Config": {} },
// "SecurityOpt": [""],
// "CgroupParent": "",
// "VolumeDriver": ""
// }
// }
class DockerCreateRequest {
String hostname
String[] cmd
}
/*
* docker container process table json
*
{
"Titles" : [
"USER","PID","%CPU","%MEM","VSZ","RSS","TTY","STAT","START","TIME","COMMAND"
]
"Processes" : [
[
"root","13642","0.0","0.1","18172","3184","pts/0","Ss","17:03","0:00","/bin/bash"
],
[
"root","13895","0.0","0.0","4348","692","pts/0","S+","17:15","0:00","sleep 10"
]
],
}
*/
class DockerProcess extends NamedEntity {
String user
long pid
double cpu
double mem
long vsz
long rss
String tty
String stat
Date start
long timeElapsed
String command
}
/*
* Container stats - JSON
*
{
"read" : "2015-01-08T22:57:31.547920715Z",
"networks": {
"eth0": {
"rx_bytes": 5338,
"rx_dropped": 0,
"rx_errors": 0,
"rx_packets": 36,
"tx_bytes": 648,
"tx_dropped": 0,
"tx_errors": 0,
"tx_packets": 8
},
"eth5": {
"rx_bytes": 4641,
"rx_dropped": 0,
"rx_errors": 0,
"rx_packets": 26,
"tx_bytes": 690,
"tx_dropped": 0,
"tx_errors": 0,
"tx_packets": 9
}
},
"memory_stats" : {
"stats" : {
"total_pgmajfault" : 0,
"cache" : 0,
"mapped_file" : 0,
"total_inactive_file" : 0,
"pgpgout" : 414,
"rss" : 6537216,
"total_mapped_file" : 0,
"writeback" : 0,
"unevictable" : 0,
"pgpgin" : 477,
"total_unevictable" : 0,
"pgmajfault" : 0,
"total_rss" : 6537216,
"total_rss_huge" : 6291456,
"total_writeback" : 0,
"total_inactive_anon" : 0,
"rss_huge" : 6291456,
"hierarchical_memory_limit" : 67108864,
"total_pgfault" : 964,
"total_active_file" : 0,
"active_anon" : 6537216,
"total_active_anon" : 6537216,
"total_pgpgout" : 414,
"total_cache" : 0,
"inactive_anon" : 0,
"active_file" : 0,
"pgfault" : 964,
"inactive_file" : 0,
"total_pgpgin" : 477
},
"max_usage" : 6651904,
"usage" : 6537216,
"failcnt" : 0,
"limit" : 67108864
},
"blkio_stats" : {},
"cpu_stats" : {
"cpu_usage" : {
"percpu_usage" : [
16970827,
1839451,
7107380,
10571290
],
"usage_in_usermode" : 10000000,
"total_usage" : 36488948,
"usage_in_kernelmode" : 20000000
},
"system_cpu_usage" : 20091722000000000,
"throttling_data" : {}
}
}
*/
class DockerContainerStats extends NamedEntity {
contains ContainerNetworkStats[] networks
contains ContainerMemoryUsage memory
contains ContainerCpuStats cpu
Date lastRead
}
/*
"networks": {
"eth0": {
"rx_bytes": 5338,
"rx_dropped": 0,
"rx_errors": 0,
"rx_packets": 36,
"tx_bytes": 648,
"tx_dropped": 0,
"tx_errors": 0,
"tx_packets": 8
},
"eth5": {
"rx_bytes": 4641,
"rx_dropped": 0,
"rx_errors": 0,
"rx_packets": 26,
"tx_bytes": 690,
"tx_dropped": 0,
"tx_errors": 0,
"tx_packets": 9
}
},
*/
class ContainerNetworkStats {
String intf
int rx_bytes
int rx_dropped
int rx_errors
int rx_packets
int tx_bytes
int tx_dropped
int tx_errors
int tx_packets
}
/*
* "memory_stats" : {
"stats" : {
"total_pgmajfault" : 0,
"cache" : 0,
"mapped_file" : 0,
"total_inactive_file" : 0,
"pgpgout" : 414,
"rss" : 6537216,
"total_mapped_file" : 0,
"writeback" : 0,
"unevictable" : 0,
"pgpgin" : 477,
"total_unevictable" : 0,
"pgmajfault" : 0,
"total_rss" : 6537216,
"total_rss_huge" : 6291456,
"total_writeback" : 0,
"total_inactive_anon" : 0,
"rss_huge" : 6291456,
"hierarchical_memory_limit" : 67108864,
"total_pgfault" : 964,
"total_active_file" : 0,
"active_anon" : 6537216,
"total_active_anon" : 6537216,
"total_pgpgout" : 414,
"total_cache" : 0,
"inactive_anon" : 0,
"active_file" : 0,
"pgfault" : 964,
"inactive_file" : 0,
"total_pgpgin" : 477
},
"max_usage" : 6651904,
"usage" : 6537216,
"failcnt" : 0,
"limit" : 67108864
},
*/
class ContainerMemoryStats {
int total_pgmajfault
int cache
int mapped_file
int total_inactive_file
int pgpgout
int rss
int total_mapped_file
int writeback
int unevictable
int pgpgin
int total_unevictable
int pgmajfault
int total_rss
int total_rss_huge
int total_writeback
int total_inactive_anon
int rss_huge
int hierarchical_memory_limit
int total_pgfault
int total_active_file
int active_anon
int total_active_anon
int total_pgpgout
int total_cache
int inactive_anon
int active_file
int pgfault
int inactive_file
int total_pgpgin
}
class ContainerMemoryUsage {
contains ContainerMemoryStats memstats
int max_usage
int usage
int failcnt
int limit
}
/*
"cpu_stats" : {
"cpu_usage" : {
"percpu_usage" : [
16970827,
1839451,
7107380,
10571290
],
"usage_in_usermode" : 10000000,
"total_usage" : 36488948,
"usage_in_kernelmode" : 20000000
},
"system_cpu_usage" : 20091722000000000,
"throttling_data" : {}
}
*/
class ContainerCpuUsage {
long[] percpu_usage
long usage_in_usermode
long total_usage
long user_in_kernelmode
}
class ContainerCpuStats {
contains ContainerCpuUsage cpu_usage
long system_cpu_usage
}
|