Support TOSCA in verigraph (gRPC service)
[parser.git] / verigraph / src / main / proto / verigraph.proto
1 /* This Protocol Buffer has been updated for supporting TOSCA-based objects.
2  * The only granularity for executing CRUD operations is at the TopologyTemplate level.
3  *
4  * The names of the objects are assigned according to the TOSCA standard, and can be
5  * mapped as follows in the Verigraph domain:
6  * TopologyTemplate -> Graph
7  * NodeTemplate -> Node
8  * RelationshipTemplate -> Neighbour (partial)
9 */
10
11 syntax = "proto3";
12
13 package verigraph;
14
15 option java_multiple_files = true;
16 option java_package = "it.polito.verigraph.grpc";
17 option java_outer_classname = "VerigraphProto";
18
19 /** gRPC */
20 service Verigraph {
21   // Obtains a list of graphs
22   rpc GetGraphs (GetRequest) returns (stream GraphGrpc) {}
23   // Obtains a graph
24   rpc GetGraph (RequestID) returns (GraphGrpc) {}
25   // Obtains a list of Nodes
26   rpc GetNodes (RequestID) returns (stream NodeGrpc) {}
27   // Obtains a node
28   rpc GetNode (RequestID) returns (NodeGrpc) {}
29   // Obtains a list of Neighbours
30   rpc GetNeighbours (RequestID) returns (stream NeighbourGrpc) {}
31   // Obtains a Neighbour
32   rpc GetNeighbour (RequestID) returns (NeighbourGrpc) {}
33
34   // Creates a graph
35   rpc CreateGraph (GraphGrpc) returns (NewGraph) {}
36   // Delete a graph
37   rpc DeleteGraph (RequestID) returns (Status) {}
38   // Updates a graph
39   rpc UpdateGraph (GraphGrpc) returns (NewGraph) {}
40   // Verify a policy
41   rpc VerifyPolicy (Policy) returns (VerificationGrpc) {}
42
43   // Creates a Node
44   rpc CreateNode (NodeGrpc) returns (NewNode) {}
45   // Delete a Node
46   rpc DeleteNode (RequestID) returns (Status) {}
47   // Updates a Node
48   rpc UpdateNode (NodeGrpc) returns (NewNode) {}
49   // Configures a Node
50   rpc ConfigureNode (ConfigurationGrpc) returns (Status) {}
51
52   // Creates a neighbour
53   rpc CreateNeighbour (NeighbourGrpc) returns (NewNeighbour) {}
54   // Delete a neighbour
55   rpc DeleteNeighbour (RequestID) returns (Status) {}
56   // Updates a neighbour
57   rpc UpdateNeighbour (NeighbourGrpc) returns (NewNeighbour) {}
58
59   /** TOSCA gRPC */
60   // Obtain a list of topology templates
61   rpc GetTopologyTemplates (GetRequest) returns (stream TopologyTemplateGrpc) {}
62   // Obtain a topology template
63   rpc GetTopologyTemplate (ToscaRequestID) returns (TopologyTemplateGrpc) {}
64   // Create a TopologyTemplate
65   rpc CreateTopologyTemplate (TopologyTemplateGrpc) returns (NewTopologyTemplate) {}
66   // Delete a TopologyTemplate
67   rpc DeleteTopologyTemplate (ToscaRequestID) returns (Status) {}
68   // Update a TopologyTemplate
69   rpc UpdateTopologyTemplate (TopologyTemplateGrpc) returns (NewTopologyTemplate) {}
70   // Verify a ToscaPolicy
71   rpc VerifyToscaPolicy (ToscaPolicy) returns (ToscaVerificationGrpc) {}
72 }
73
74
75 /** Messages */
76 message GetRequest {
77 }
78
79 message RequestID {
80   int64 idGraph = 1;
81   int64 idNode = 2;
82   int64 idNeighbour = 3;
83 }
84
85 message Policy{
86 int64 idGraph = 1;
87 string source = 2;
88   string destination = 3;
89   enum PolicyType {
90    reachability = 0;
91    isolation = 1;
92    traversal = 2;
93 }
94 PolicyType type = 4;
95 string middlebox = 5;
96 }
97
98 message ConfigurationGrpc{
99 int64 idGraph = 1;
100 int64 idNode = 2;
101 string description = 3;
102 string configuration = 4;
103 string id = 5;
104 }
105
106 message NodeGrpc{
107 int64 idGraph = 1;
108 string name = 2;
109 int64 id = 3;//long
110 enum FunctionalType {
111 antispam = 0;
112    cache = 1;
113    dpi = 2;
114    endhost = 3;
115    endpoint = 4;
116    fieldmodifier = 5;
117    firewall = 6;
118    mailclient = 7;
119    mailserver = 8;
120    nat = 9;
121    vpnaccess = 10;
122    vpnexit = 11;
123    webclient = 12;
124    webserver = 13;
125 }
126 FunctionalType functional_type = 4;
127 repeated NeighbourGrpc neighbour = 5;
128 ConfigurationGrpc configuration = 6;
129 string errorMessage = 7;
130 }
131
132 message GraphGrpc{
133 int64 id = 1;//long
134 repeated NodeGrpc node = 2;
135 string errorMessage = 3;
136 }
137
138 message NeighbourGrpc{
139 int64 idGraph = 1;
140   int64 idNode = 2;
141 string name = 3;
142   int64 id = 4;//long
143   string errorMessage = 5;
144 }
145
146 message NewGraph{
147 bool success = 1;
148 GraphGrpc graph = 2;
149 string errorMessage = 3;
150 }
151
152 message NewNode{
153 bool success = 1;
154 NodeGrpc node = 2;
155 string errorMessage = 3;
156 }
157
158 message NewNeighbour{
159 bool success = 1;
160 NeighbourGrpc neighbour = 2;
161 string errorMessage = 3;
162 }
163
164 message TestGrpc {
165   repeated NodeGrpc node = 1;
166   string result = 2;
167 }
168
169 message VerificationGrpc{
170 bool successOfOperation = 1;
171 string result = 2;
172 string comment = 3;
173 repeated TestGrpc test = 4;
174 string errorMessage = 5;
175 }
176
177 message Status{
178 bool success = 1;
179 string errorMessage = 2;
180 }
181
182 /** TOSCA Messages */
183 message ToscaRequestID {
184   string idTopologyTemplate = 1;
185 }
186
187 message TopologyTemplateGrpc{
188   string id = 1;
189   string name = 2;
190   repeated NodeTemplateGrpc nodeTemplate = 3;
191   repeated RelationshipTemplateGrpc relationshipTemplate = 4;
192   string errorMessage = 5;
193 }
194
195 message NewTopologyTemplate{
196   bool success = 1;
197   TopologyTemplateGrpc topologyTemplate = 2;
198   string errorMessage = 3;
199 }
200
201 message NodeTemplateGrpc{
202   string id = 1;
203   string name = 2;
204   enum Type {
205     antispam = 0;
206     cache = 1;
207     dpi = 2;
208     endhost = 3;
209     endpoint = 4;
210     fieldmodifier = 5;
211     firewall = 6;
212     mailclient = 7;
213     mailserver = 8;
214     nat = 9;
215     vpnaccess = 10;
216     vpnexit = 11;
217     webclient = 12;
218     webserver = 13;
219   }
220   Type type = 3;
221   ToscaConfigurationGrpc configuration = 4;
222   string errorMessage = 5;
223 }
224
225 message RelationshipTemplateGrpc{
226   string idSourceNodeTemplate = 1;
227   string idTargetNodeTemplate = 2;
228   string id = 3;
229   string name = 4;
230   string errorMessage = 5;
231 }
232
233 message ToscaPolicy{
234   string idTopologyTemplate = 1;
235   string source = 2;
236   string destination = 3;
237   enum PolicyType {
238     reachability = 0;
239     isolation = 1;
240     traversal = 2;
241   }
242   PolicyType type = 4;
243   string middlebox = 5;
244 }
245
246 message ToscaConfigurationGrpc{
247   string id = 1;
248   string description = 2;
249   string configuration = 3;
250 }
251
252 message ToscaTestGrpc {
253   repeated NodeTemplateGrpc nodeTemplate = 1;
254   string result = 2;
255 }
256
257 message ToscaVerificationGrpc{
258   bool successOfOperation = 1;
259   string result = 2;
260   string comment = 3;
261   repeated ToscaTestGrpc test = 4;
262   string errorMessage = 5;
263 }