-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjson_rendering.tex
1093 lines (910 loc) · 32.9 KB
/
json_rendering.tex
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
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true]{microtype}
\usepackage[plainpages=false,pdfpagelabels,unicode]{hyperref}
\usepackage{fullpage}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{comment}
\usepackage{occi}
\usepackage{lineno} % adds line numbers, may be removed for non draft versions
\linenumbers % adds line numbers, may be removed for non draft versions
\usepackage{verbatim} % adds verbatim options
\usepackage{tabularx} % adds extended tabular formatting options
\usepackage{listings}
\usepackage{color}
\usepackage{appendix}
\definecolor{lightgray}{rgb}{.9,.9,.9}
\definecolor{darkgray}{rgb}{.4,.4,.4}
\definecolor{purple}{rgb}{0.65, 0.12, 0.82}
\lstdefinelanguage{json}{
ndkeywords={String, Number, Boolean, Null, Object, Array},
ndkeywordstyle=\itshape
}
\lstset{
language=json,
basicstyle=\footnotesize,
xleftmargin=1.5cm
}
\setlength{\headheight}{13pt}
\pagestyle{fancy}
% default sans-serif
\renewcommand{\familydefault}{\sfdefault}
% no lines for headers and footers
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
% header
\fancyhf{}
\lhead{GFD-R-P.225}
\rhead{\today}
% footer
\lfoot{[email protected]}
\rfoot{\thepage}
% paragraphs need some space...
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
% some space between header and text...
\headsep 13pt
\setcounter{secnumdepth}{4}
\begin{document}
% header on first page is different
\thispagestyle{empty}
GFD-R-P.225 \hfill Ralf Nyrén, Independent \\
OCCI-WG \hfill Florian Feldhaus, Independent\\
\rightline {Boris Parák, CESNET}\\
\rightline {Zden\v{e}k \v{S}ustr, CESNET}\\
\rightline {February 25, 2011}\\
\rightline {Updated: \today}
\vspace*{0.5in}
\begin{Large}
\textbf{Open Cloud Computing Interface -- JSON Rendering}
\end{Large}
\vspace*{0.5in}
\underline{Status of this Document}
\input{include/status}
\underline{Copyright Notice}
Copyright \copyright Open Grid Forum (2012-2016). All Rights Reserved.
\underline{Trademarks}
OCCI is a trademark of the Open Grid Forum.
\underline{Abstract}
\input{include/abstract}
\newpage
\tableofcontents
\newpage
\section{Introduction}
\input{include/introduction}
\section{Notational Conventions}
\input{include/notational}
\section{OCCI JSON Rendering}
\label{sec:json_format}
The OCCI JSON Rendering specifies a rendering of OCCI instance types in the JSON
data interchange format as defined in \cite{rfc4627}.
The rendering can be used to render OCCI instances independently of the
protocol being used. Thus messages can be delivered by, e.g., the HTTP
protocol as specified in \cite{occi:http_protocol}.
The following media-type MUST be used for the OCCI JSON Rendering:
{\tt application/occi+json}
The OCCI JSON Rendering consists of a JSON object containing information on the
OCCI Core instances OCCI Kind, OCCI Mixin, OCCI Action,
OCCI Link and OCCI Resource. The rendering also include a JSON object to invoke
the operation identified by OCCI Actions.
The rendering of each OCCI Core instance will be
described in the following sections.
\subsection{Entity Instance Rendering}
\label{sec:format_entity_instance_rendering}
Entity instances MUST be rendered as JSON hashmaps.
\subsubsection{Resource Instance Rendering}
\label{sec:format_resource}
The OCCI Resource Instance Rendering consists of a JSON object as shown in the
following declaration. Appendix~\ref{resouce_instance_rendering_example} contains a detailed
example.
Table~\ref{tbl:format_resource} defines the object members.
\begin{lstlisting}
{
"kind": String,
"mixins": Array,
"attributes": Object,
"actions": Array,
"id": String,
"links": Array,
"summary": String,
"title": String,
}
\end{lstlisting}
\mytablefloat{
\label{tbl:format_resource}
OCCI Resource instance rendered with the following entries:
} {
\begin{tabularx}{\textwidth}{llllX}
\toprule
Object member & JSON type & Mutability & Multiplicity & Description \\
\colrule
kind & String & immutable & 1 & Type identifier. \\
mixins & Array of Strings & mutable & 0..1 & List of type identifiers of associated OCCI Mixins. \\
attributes & Object & mutable & 0..1 & Instance Attributes (see \ref{sec:format_attribute_description}). \\
actions & Array of Strings & mutable & 0..1 & List of type identifiers of OCCI Actions applicable to the OCCI Resource instance. \\
id & String & immutable & 1 & ID of the OCCI Resource. \\
links & Array of Objects & mutable & 0..1 & List of OCCI Links (fully rendered instances, see \ref{sec:format_link}). \\
summary & String & mutable & 0..1 & Summary text of resource. \\
title & String & mutable & 0..1 & Title of resource. \\
\botrule
\end{tabularx}
}
\paragraph{Action Invocation Rendering}
\label{sec:format_action_invocation}
The OCCI Action Invocation Rendering identifies an invocable operation on a OCCI Resource or
OCCI Link instance. To trigger such an operation the OCCI Action Invocation
Rendering is required.
The OCCI Action Invocation Rendering consists of a top-level JSON object as shown in the
following declaration. Appendix~\ref{action_invocation_rendering_example} contains a detailed example.
Table~\ref{tbl:format_action_invocation} defines the object members.
\begin{lstlisting}
{
"action": String,
"attributes": Object
}
\end{lstlisting}
\mytablefloat{
\label{tbl:format_action_invocation}
An OCCI Action invocation is rendered with the following entries:
} {
\begin{tabularx}{\textwidth}{llllX}
\toprule
Object member & JSON type & Mutability & Multiplicity & Description \\
\colrule
action & String & immutable & 1 & Type identifier. \\
attributes & Object & mutable & 0..1 & Instance attributes (see \ref{sec:format_attribute_description}). \\
\botrule
\end{tabularx}
}
\subsubsection{Link Instance Rendering}
\label{sec:format_link}
The OCCI Link Instance Rendering consists of a JSON object as shown in the
following declaration. Appendix~\ref{link_instance_rendering_example} contains a detailed example.
Table~\ref{tbl:format_link} defines the object members.
\begin{lstlisting}
{
"kind": String,
"mixins": Array,
"attributes": Object,
"actions": Array,
"id": String,
"source": Object,
"target": Object,
"title": String
}
\end{lstlisting}
\mytablefloat{
\label{tbl:format_link}
OCCI Link instances are rendered with the following entries:
} {
\begin{tabularx}{\textwidth}{llllX}
\toprule
Object member & JSON type & Mutability & Multiplicity & Description \\
\colrule
kind & String & immutable & 1 & Type identifier. \\
mixins & Array of Strings & mutable & 0..1 & List of type identifiers of associated OCCI Mixins. \\
attributes & Object & mutable & 0..1 & Instance attributes (see \ref{sec:format_attribute_description}). \\
actions & Array of Strings & mutable & 0..1 & List of type identifiers of OCCI Action Categories applicable to the OCCI Link instance. \\
id & String & immutable & 1 & ID of the OCCI Link.\\
source & Object & immutable & 1 & Hashmap of the link source (see \ref{par:format_link_src_trgt}). \\
target & Object & immutable & 1 & Hashmap of the link target (see \ref{par:format_link_src_trgt}). \\
title & String & mutable & 0..1 & Title of the Link \\
\botrule
\end{tabularx}
}
\paragraph{Link Instance Source/Target Rendering}
\label{par:format_link_src_trgt}\hfill\\
The OCCI Link Instance Source/Target Rendering consists of a JSON object as shown in the
following declaration. Appendix~\ref{link_instance_rendering_example} contains a detailed example.
Table~\ref{tbl:format_link_src_trgt} defines the object members. {\tt location} maps to OCCI
Core's {\tt source} and {\tt target} model attributes and {\tt kind} maps to OCCI Core's {\tt target.kind}
model attribute. The value of {\tt kind} for {\tt source} is implied by OCCI Core's model attribute value
for {\tt source}.
\begin{lstlisting}
{
"location": String,
"kind": String
}
\end{lstlisting}
\mytablefloat{
\label{tbl:format_link_src_trgt}
OCCI Link sources/targets are rendered with the following entries:
} {
\begin{tabularx}{\textwidth}{llllX}
\toprule
Object member & JSON type & Mutability & Multiplicity & Description \\
\colrule
location & String & immutable & 1 & URI of the link target/source. \\
kind & String & immutable & 0..1 & Kind identifier, supplied if location points to an OCCI Resource. \\
\botrule
\end{tabularx}
}
\subsection{Category Instance Rendering}
\label{sec:format_category_instance_rendering}
Category instances MUST be rendered as JSON hashmaps.
\subsubsection{Kind Instance Rendering}
\label{sec:format_kind}
The OCCI Kind Instance Rendering consists of a JSON object as shown in the
following declaration. Appendix~\ref{kind_instance_rendering_example} contains a detailed example.
Table~\ref{tbl:format_kind} defines the top-level object members.
\mytablefloat{
\label{tbl:format_kind}
OCCI Kind instances are rendered with the following entries:
} {
\begin{tabularx}{\textwidth}{llllX}
\toprule
Object member & JSON type & Mutability & Multiplicity & Description \\
\colrule
term & String & immutable & 1 & Unique identifier within the categorization scheme. \\
scheme & String & immutable & 1 & Categorization scheme. \\
title & String & immutable & 0..1 & Title of the OCCI Kind. \\
attributes & Object & immutable & 0..1 & Attribute description, see~\ref{tbl:format_attribute_description}. \\
parent & String & immutable & 0..1 & OCCI Kind type identifier of the related ``parent'' \hl{Kind} instance. \\
actions & Array of Strings & immutable & 0..1 & List of OCCI Action type identifiers. \\
location & String & immutable & 0..1 & Transport protocol specific URI bound to the OCCI Kind instance. MUST be supplied for the OCCI Kinds of all OCCI Entities except OCCI Entity itself. \\
\botrule
\end{tabularx}
}
\begin{lstlisting}
{
"term": String,
"scheme": String,
"title": String,
"attributes": Object,
"actions": Array,
"parent": String,
"location": String
}
\end{lstlisting}
\subsubsection{Mixin Instance Rendering}
\label{sec:format_mixin}
The OCCI Mixin Instance Rendering consists of a JSON object as shown in the following
declaration. Appendix~\ref{mixin_instance_rendering_example} contains a detailed example.
Table~\ref{tbl:format_mixin} defines the top-level object members.
\begin{lstlisting}
{
"term": String,
"scheme": String,
"title": String,
"attributes": Object,
"actions": Array,
"depends": Array,
"applies": Array,
"location": String
}
\end{lstlisting}
\mytablefloat{
\label{tbl:format_mixin}
OCCI Mixin instances are rendered with the following entries:
} {
\begin{tabularx}{\textwidth}{llllX}
\toprule
Object member & JSON type & Mutability & Multiplicity & Description \\
\colrule
term & String & immutable & 1 & Unique identifier within the categorization scheme. \\
scheme & String & immutable & 1 & Categorization scheme. \\
title & String & immutable & 0..1 & Title of the OCCI Mixin. \\
attributes & Object & immutable & 0..1 & Attribute description, see~\ref{tbl:format_attribute_description}. \\
depends & Array of Strings & immutable & 0..1 & List of type identifiers of the dependent \hl{Mixin} instances. \\
applies & Array of Strings & immutable & 0..1 & List of OCCI Kind type identifiers this OCCI Mixin can be applied to. \\
actions & Array of Strings & immutable & 0..1 & List of OCCI Action type identifiers. \\
location & String & immutable & 1 & Transport protocol specific URI bound to the OCCI Mixin instance. \\
\botrule
\end{tabularx}
}
\subsubsection{Action Instance Rendering}
\label{sec:format_action}
The OCCI Action Instance Rendering consists of a JSON object as shown in the
following declaration. Appendix~\ref{action_instance_rendering_example} contains a detailed example.
Table~\ref{tbl:format_action} defines the top-level object members.
\mytablefloat{
\label{tbl:format_action}
OCCI Actions are rendered inside the top-level JSON object with name {\em actions} as an array of JSON Objects with the following entries:
} {
\begin{tabularx}{\textwidth}{llllX}
\toprule
Object member & JSON type & Mutability & Multiplicity & Description \\
\colrule
term & String & immutable & 1 & Unique type identifier within the categorization scheme. \\
scheme & String & immutable & 1 & Categorization scheme. \\
title & String & immutable & 0..1 & Title of the OCCI Action. \\
attributes & Object & immutable & 0..1 & Attribute description, see~\ref{tbl:format_attribute_description}. \\
\botrule
\end{tabularx}
}
\begin{lstlisting}
{
"term": String,
"scheme": String,
"title": String,
"attributes": Object,
}
\end{lstlisting}
\subsection{Entity Collection Rendering}
Collections of Entity instances MUST be rendered as JSON arrays. The content of that array is a set
of entity instance renderings.
That array MUST be a member of a JSON hashmap that is associated with the relevant key name specific
to the type of Entity collection being rendered.
\subsubsection{Resource Collection Rendering}
The JSON hashmap key-name associated with the array of resource instances MUST be \hl{resources}.
\begin{lstlisting}
{
"resources": []
}
\end{lstlisting}
\subsubsection{Link Collection Rendering}
The JSON hashmap key-name associated with the array of link instances MUST be \hl{links}.
\begin{lstlisting}
{
"links": []
}
\end{lstlisting}
\subsection{Category Collection Rendering}
Collections of Category instances MUST be rendered as JSON arrays. The content of that array
is a set of Category instance renderings.
That array MUST be a member of a JSON hashmap that is associated with the relevant key name
specific to the type of Category collection being rendered.
\subsubsection{Kind Collection Rendering}
The JSON hashmap key-name associated with the array of kind instances MUST be \hl{kinds}.
\begin{lstlisting}
{
"kinds": []
}
\end{lstlisting}
\subsubsection{Mixin Collection Rendering}
The JSON hashmap key-name associated with the array of mixin instances MUST be \hl{mixins}.
\begin{lstlisting}
{
"mixins": []
}
\end{lstlisting}
\subsubsection{Action Collection Rendering}
The JSON hashmap key-name associated with the array of action instances MUST be \hl{actions}.
\begin{lstlisting}
{
"actions": []
}
\end{lstlisting}
Collections of Category instances are rendered as JSON arrays.
\subsection{Attributes Rendering}
Attribute names consist of alphanumeric characters separated by dots. The dots
define a logical namespace-like hierarchy. This hierarchy is NOT reflected in JSON
objects. As shown in the following declaration, the attribute name is an opaque
identifier rendered as hashmap \textit{key}. The hashmap \textit{value} contains either a
Number, a String, a Boolean, an Array or an Object (as an attribute value or an attribute
description, following the Attribute Description Rendering, see \ref{sec:format_attribute_description}).
\begin{lstlisting}
{
"one.two.three": Number|String|Boolean|Array|Object,
"one.two.four" : Number|String|Boolean|Array|Object
}
\end{lstlisting}
For examples of rendered Attributes please refer for instance to the Resource instance
rendering example in Appendix~\ref{resouce_instance_rendering_example}.
\subsubsection{Attribute Description Rendering}
\label{sec:format_attribute_description}
Attribute Descriptions are rendered as JSON objects as defined in table~\ref{tbl:format_attribute_description}
\mytablefloat{
\label{tbl:format_attribute_description}
All properties of the Attribute definition are optional, but may contain
defaults which MUST be used if the Attribute is not present in the instantiated
OCCI Entity.
} {
\begin{tabularx}{\textwidth}{lllX}
\toprule
Object member & JSON type & Default & Description \\
\colrule
mutable & Boolean & false & Defines if the Attribute is mutable after initialization. \\
required & Boolean & false & Defines if the Attribute MUST be specified at instantiation of the OCCI Entity. \\
type & String & string & Type of the Attribute. MUST be either ``string'', ``number'', ``boolean'', ``array'' or ``object''. \\
pattern & Object & {} & JSON Schema \cite{json-schema} to validate the value of the attribute. It is recommended to specify the \texttt{\$schema} property for the schema used. \\
default & String, Number, Boolean, Array, Object & {\tt (none)} & Attribute default. MUST be the same type as defined in the type property and MUST be used if the Attribute is not present in the instantiated OCCI Entity. \\
description & String & {\tt (none)} & Description of the attribute. \\
\botrule
\end{tabularx}
}
\begin{lstlisting}
{
"mutable": Boolean,
"required": Boolean,
"type": String,
"pattern": Object,
"default": String | Number | Boolean | Array | Object,
"description": String
}
\end{lstlisting}
For examples of rendered Attribute Descriptions please refer, e.g., to
the Kind rendering example in Appendix~\ref{kind_instance_rendering_example}.
\section{Security Considerations}
OCCI does not require that an authentication mechanism be used nor
does it require that client to service communications are secured. It
does RECOMMEND that an authentication mechanism be used and that where
appropriate, communications are encrypted using HTTP over TLS. The
authentication mechanisms that MAY be used with OCCI are those that
can be used with HTTP and TLS. For further discussion see the
appropiate section in \cite{occi:http_protocol}.
\section{Glossary}
\label{sec:glossary}
\input{include/glossary}
\section{Contributors}
\input{include/contributors}
\section{Intellectual Property Statement}
\input{include/ip}
\section{Disclaimer}
\input{include/disclaimer}
\section{Full Copyright Notice}
\input{include/copyright}
\bibliographystyle{IEEEtran}
\bibliography{references}
\clearpage
\begin{appendices}
\lstset{
language=json,
basicstyle=\footnotesize,
xleftmargin=0.0cm
}
\section{JSON Rendering Examples}
\subsection{Resouce Instance Example}
\label{resouce_instance_rendering_example}
The following is an example of a rendered \texttt{compute} resource instance as specified in section~\ref{sec:format_resource}.
\begin{lstlisting}
{
"kind": "http://schemas.ogf.org/occi/infrastructure#compute",
"mixins": [
"http://example.com/occi/infrastructure/os_tpl#debian9",
"http://example.com/occi/infrastructure/resource_tpl#medium"
],
"attributes": {
"occi.compute.speed": 2,
"occi.compute.memory": 4,
"occi.compute.cores": 2,
"com.example.occi.templates.myosmixin": {
"mykey": "myvalue"
}
},
"actions": [
"http://schemas.ogf.org/occi/infrastructure/compute/action#start"
],
"id": "urn:uuid:996ad860-2a9a-504f-8861-aeafd0b2ae29",
"links": [
{
"kind":"http://schemas.ogf.org/occi/infrastructure#networkinterface",
"mixins":[
"http://schemas.ogf.org/occi/infrastructure/networkinterface#ipnetworkinterface"
],
"attributes":{
"occi.infrastructure.networkinterface.interface":"eth0",
"occi.infrastructure.networkinterface.mac":"00:80:41:ae:fd:7e",
"occi.infrastructure.networkinterface.address":"192.168.0.100",
"occi.infrastructure.networkinterface.gateway":"192.168.0.1",
"occi.infrastructure.networkinterface.allocation":"dynamic"
},
"actions":[
"http://schemas.ogf.org/occi/infrastructure/networkinterface/action#up",
"http://schemas.ogf.org/occi/infrastructure/networkinterface/action#down"
],
"id":"urn:uuid:22fe83ae-a20f-54fc-b436-cec85c94c5e8",
"target": {
"location:"/network/b7d55bf4-7057-5113-85c8-141871bf7635",
"kind":"http://schemas.ogf.org/occi/infrastructure#network"
},
"source": {
"location":"/compute/996ad860-2a9a-504f-8861-aeafd0b2ae29",
"kind":"http://schemas.ogf.org/occi/infrastructure#compute"
}
}
]
}
\end{lstlisting}
\subsection{Action Invocation Example}
\label{action_invocation_rendering_example}
The following is an example of a rendered \texttt{stop} action invocation as specified in section~\ref{sec:format_action_invocation}.
\begin{lstlisting}
{
"action":"http://schemas.ogf.org/occi/infrastructure/compute/action#stop",
"attributes":{
"method":"graceful"
}
}
\end{lstlisting}
\subsection{Link Instance Example}
\label{link_instance_rendering_example}
The following is an example of a rendered \texttt{networkinterface} link as specified in section~\ref{sec:format_link}.
\begin{lstlisting}
{
"kind":"http://schemas.ogf.org/occi/infrastructure#networkinterface",
"mixins":[
"http://schemas.ogf.org/occi/infrastructure/networkinterface#ipnetworkinterface"
],
"attributes":{
"occi.infrastructure.networkinterface.interface":"eth0",
"occi.infrastructure.networkinterface.mac":"00:80:41:ae:fd:7e",
"occi.infrastructure.networkinterface.address":"192.168.0.100",
"occi.infrastructure.networkinterface.gateway":"192.168.0.1",
"occi.infrastructure.networkinterface.allocation":"dynamic"
},
"actions":[
"http://schemas.ogf.org/occi/infrastructure/networkinterface/action#up",
"http://schemas.ogf.org/occi/infrastructure/networkinterface/action#down"
],
"id":"urn:uuid:22fe83ae-a20f-54fc-b436-cec85c94c5e8",
"target": {
"location:"/network/b7d55bf4-7057-5113-85c8-141871bf7635",
"kind":"http://schemas.ogf.org/occi/infrastructure#network"
},
"source": {
"location":"/compute/996ad860-2a9a-504f-8861-aeafd0b2ae29",
"kind":"http://schemas.ogf.org/occi/infrastructure#compute"
}
}
\end{lstlisting}
\subsection{Kind Instance Example}
\label{kind_instance_rendering_example}
The following is an example of a rendered Kind instance as specified in section~\ref{sec:format_kind}.
\begin{lstlisting}
{
"term":"compute",
"scheme":"http://schemas.ogf.org/occi/infrastructure#",
"title":"ComputeResource",
"parent":"http://schemas.ogf.org/occi/core#resource",
"attributes":{
"occi.compute.hostname":{
"mutable":true,
"required":false,
"type":"string",
"description":"Hostname of the compute resource"
"pattern": {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "string",
"pattern": "\S+"
}
},
"occi.compute.state":{
"mutable":false,
"required":false,
"type":"string",
"default":"inactive",
"description":"State the compute resource is in"
}
},
"actions":[
"http://schemas.ogf.org/occi/infrastructure/compute/action#start",
"http://schemas.ogf.org/occi/infrastructure/compute/action#stop",
"http://schemas.ogf.org/occi/infrastructure/compute/action#restart",
"http://schemas.ogf.org/occi/infrastructure/compute/action#suspend"
],
"location":"/compute/"
}
\end{lstlisting}
\subsection{Mixin Instance Example}
\label{mixin_instance_rendering_example}
The following is an example of a rendered \texttt{medium} Resource Template Mixin as specified in section~\ref{sec:format_mixin}.
\begin{lstlisting}
{
"term":"medium",
"scheme":"http://example.com/template/resource#",
"depends":[
"http://schemas.ogf.org/occi/infrastructure#resourcetpl"
],
"applies":[
"http://schemas.ogf.org/occi/infrastructure#compute"
],
"attributes":{
"occi.compute.speed":{
"type":"number",
"default":2.8
}
},
"title":"MediumVM",
"location":"/template/resource/medium/"
}
\end{lstlisting}
\subsection{Action Instance Example}
\label{action_instance_rendering_example}
The following is an example of a rendered \texttt{stop} Action instance as specified in section~\ref{sec:format_action}.
\begin{lstlisting}
{
"term":"stop",
"scheme":"http://schemas.ogf.org/occi/infrastructure/compute/action#",
"title":"StopComputeinstance",
"attributes":{
"method":{
"mutable":true,
"required":false,
"type":"string",
"default":"poweroff"
}
}
}
\end{lstlisting}
\section{OCCI JSON Schema}
The JSON schema provided below validates any valid OCCI message courtesy of the \texttt{anyOf} construct below. Sub-schemas or fragments need to be used to validate specific OCCI classes.
\lstset{
language=json,
basicstyle=\tiny,
xleftmargin=0.0cm
}
\begin{lstlisting}
{
"id": "http://schemas.ogf.org/occi/OCCI-schema.json",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "OCCI v. 1.2 JSON Rendering Schema",
"definitions": {
"array_of_strings": {
"type": "array",
"items": { "type": "string" }
},
"kinded_uri": {
"id": "#kinded_uri",
"type": "object",
"required": ["location"],
"additionalProperties": false,
"properties": {
"location": { "type": "string" },
"kind": { "type": "string" }
}
},
"resource": {
"id": "#resource",
"type": "object",
"required": ["kind", "id"],
"additionalProperties": false,
"properties": {
"kind": { "type": "string" },
"mixins": { "$ref": "#/definitions/array_of_strings" },
"attributes": { "$ref": "#/definitions/attributes" },
"actions": { "$ref": "#/definitions/array_of_strings" },
"id": { "type": "string" },
"links": {
"type": "array",
"items": {
"$ref": "#definitions/link"
}
},
"summary": { "type": "string" },
"title": { "type": "string" }
}
},
"action_invocation": {
"id": "#action_invocation",
"type": "object",
"required": ["action"],
"additionalProperties": false,
"properties": {
"action": { "type": "string" },
"attributes": { "$ref": "#/definitions/attributes" }
}
},
"link": {
"id": "#link",
"type": "object",
"required": ["kind", "id", "target", "source"],
"additionalProperties": false,
"properties": {
"kind": { "type": "string" },
"mixins": { "$ref": "#/definitions/array_of_strings" },
"attributes": { "$ref": "#/definitions/attributes" },
"actions": { "$ref": "#/definitions/array_of_strings" },
"id": { "type": "string" },
"source": { "$ref": "#/definitions/kinded_uri" },
"target": { "$ref": "#/definitions/kinded_uri" },
"rel": { "type": "string" },
"title": { "type": "string" }
}
},
"kind": {
"id": "#kind",
"type": "object",
"required": ["term", "scheme"],
"additionalProperties": false,
"properties": {
"term": { "type": "string" },
"scheme": { "type": "string" },
"title": { "type": "string" },
"attributes": { "$ref": "#/definitions/attribute_description" },
"actions": { "$ref": "#/definitions/array_of_strings" },
"parent": { "type": "string" },
"location": { "type": "string" }
}
},
"mixin": {
"id": "#mixin",
"type": "object",
"required": ["term", "scheme", "location"],
"additionalProperties": false,
"properties": {
"term": { "type": "string" },
"scheme": { "type": "string" },
"title": { "type": "string" },
"attributes": { "$ref": "#/definitions/attribute_description" },
"actions": { "$ref": "#/definitions/array_of_strings" },
"depends": { "$ref": "#/definitions/array_of_strings" },
"applies": { "$ref": "#/definitions/array_of_strings" },
"location": { "type": "string" }
}
},
"action": {
"id": "#action",
"type": "object",
"required": ["term", "scheme"],
"additionalProperties": false,
"properties": {
"term": { "type": "string" },
"scheme": { "type": "string" },
"title": { "type": "string" },
"attributes": { "$ref": "#/definitions/attribute_description" }
}
},
"resource_collection": {
"id": "#resource_collection",
"type": "object",
"required": ["resources"],
"additionalProperties": false,
"properties": {
"resources": {
"type": "array",
"items": {
"$ref": "#definitions/resource"
}
}
}
},
"link_collection": {
"id": "#link_collection",
"type": "object",
"required": ["links"],
"additionalProperties": false,
"properties": {
"links": {
"type": "array",
"items": {
"$ref": "#definitions/link"
}
}
}
},
"kind_collection": {
"id": "#kind_collection",
"type": "object",
"required": ["kinds"],
"additionalProperties": false,
"properties": {
"kinds": {
"type": "array",
"items": {
"$ref": "#definitions/kind"
}
}
}
},
"mixin_collection": {
"id": "#mixin_collection",
"type": "object",
"required": ["mixins"],
"additionalProperties": false,
"properties": {
"mixins": {
"type": "array",
"items": {
"$ref": "#definitions/mixin"
}
}
}
},
"action_collection": {
"id": "#action_collection",
"type": "object",
"required": ["actions"],
"additionalProperties": false,
"properties": {
"actions": {
"type": "array",
"items": {
"$ref": "#definitions/action"
}
}
}
},
"attributes": {
"id": "#attributes",
"type": "object",
"additionalProperties": {
"oneOf": [
{ "type": "number" },
{ "type": "boolean" },
{ "type": "string" },
{ "type": "object" },
{ "type": "array" }
]
}
},