2// GobySoft, LLC (2013-)
3// Community contributors (see AUTHORS file)
5// Toby Schneider <toby@gobysoft.org>
8// This file is part of the Goby Underwater Autonomy Project Binaries
9// ("The Goby Binaries").
11// The Goby Binaries are free software: you can redistribute them and/or modify
12// them under the terms of the GNU General Public License as published by
13// the Free Software Foundation, either version 2 of the License, or
14// (at your option) any later version.
16// The Goby Binaries are distributed in the hope that they will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU General Public License for more details.
21// You should have received a copy of the GNU General Public License
22// along with Goby. If not, see <http://www.gnu.org/licenses/>.
24import "goby/middleware/protobuf/app_config.proto";
25import "goby/protobuf/option_extensions.proto";
27package goby.apps.middleware.protobuf;
29message InterfaceToolConfig
31 option (goby.msg).cfg.tool = {
37 optional goby.middleware.protobuf.AppConfig app = 1
38 [(goby.field) = { cfg { action: DEVELOPER } }];
42 help = 0 [(goby.ev).cfg = {
43 short_help_msg: "Print usage information",
44 full_help_msg: "Usage: \"goby interface help [action]\"\n"
46 visualize = 1 [(goby.ev).cfg = {
47 short_help_msg: "Draw a deployment's publish/subscribe graph (Graphviz or D2)"
49 validate = 2 [(goby.ev).cfg = {
50 short_help_msg: "Check that every required subscription in a deployment has a publisher"
52 list = 3 [(goby.ev).cfg = {
53 short_help_msg: "List a deployment's platforms, applications or groups"
55 explain = 4 [(goby.ev).cfg = {
56 short_help_msg: "Show who publishes and subscribes to groups, and why a subscription is unmet"
58 diff = 5 [(goby.ev).cfg = {
59 short_help_msg: "Compare the connections of two deployments, or of one against two sets of interface files"
61 init = 6 [(goby.ev).cfg = {
62 short_help_msg: "Write a starter deployment file from a directory of interface files"
64 launch = 7 [(goby.ev).cfg = {
65 short_help_msg: "Write goby_launch files from a deployment file"
67 launch_check = 8 [(goby.ev).cfg = {
68 short_help_msg: "Compare a hand-written goby_launch file with a deployment file"
70 systemd = 9 [(goby.ev).cfg = {
71 short_help_msg: "Write systemd units from a deployment file, or check installed ones"
74 optional Action action = 2 [
77 description: "The action this tool should take [can omit --action if 1st parameter]",
78 cfg { position: { enable: true }, cli_short: "A", action: HIDDEN }
83message InterfaceVisualizeConfig
85 option (goby.msg).cfg.tool = {
88 has_help_action: false
91 optional goby.middleware.protobuf.AppConfig app = 1
92 [(goby.field) = { cfg { action: DEVELOPER } }];
94 required string deployment_file = 10 [(goby.field) = {
95 description: "Deployment file (deployment.yml), or a single interface file drawn as a one-platform deployment",
96 cfg { position: { enable: true } }
98 optional string output_file = 11
99 [(goby.field).description = "Write the graph here instead of stdout"];
106 optional Format format = 14 [
109 description: "Graphviz (render with dot) or D2 (render with d2, https://d2lang.com)"
112 repeated string define = 12 [(goby.field) = {
113 description: "Set a variable used as ${NAME} in the deployment file, as NAME=value; overrides the environment",
114 cfg { cli_short: "D" }
116 repeated string interface_dir = 13 [(goby.field) = {
117 description: "Search this directory for interface files, after the deployment file's own directory (also GOBY_INTERFACE_PATH, colon separated)",
118 cfg { cli_short: "I" }
121 optional bool no_disconnected = 20 [
123 (goby.field).description =
124 "Do not draw publications without subscribers or subscriptions without publishers (required subscriptions are always drawn)"
126 optional bool omit_interthread = 21
127 [default = false, (goby.field).description = "Do not draw interthread connections"];
128 optional string omit_group_regex = 22
129 [(goby.field).description = "Do not draw groups matching this regex"];
130 optional string omit_node_regex = 23 [(goby.field).description =
131 "Do not draw platforms, modules, applications or "
132 "threads whose name matches this regex"];
133 optional bool include_terminate = 24
134 [default = false, (goby.field).description = "Draw goby_terminate groups"];
135 optional bool include_coroner = 25
136 [default = false, (goby.field).description = "Draw goby_coroner groups"];
137 optional bool include_all = 26 [
139 (goby.field).description = "Draw every group, including Goby's internal ones"
141 optional string splines = 27
142 [default = "ortho", (goby.field).description = "Graphviz splines= setting"];
143 optional bool expand_instances = 28 [
145 (goby.field).description =
146 "Draw each of a platform's instances: separately, rather than once for all of them"
148 optional bool expand_goby_apps = 29 [
150 (goby.field).description =
151 "Draw Goby's own applications (gobyd, goby_*) with their threads, rather than as one box (gobyd folded into its module)"
155message InterfaceValidateConfig
157 option (goby.msg).cfg.tool = {
160 has_help_action: false
163 optional goby.middleware.protobuf.AppConfig app = 1
164 [(goby.field) = { cfg { action: DEVELOPER } }];
166 required string deployment_file = 10 [(goby.field) = {
167 description: "Deployment file (deployment.yml), or a single interface file checked as a one-platform deployment",
168 cfg { position: { enable: true } }
170 optional string output_file = 11
171 [(goby.field).description = "Write the report here instead of stdout"];
172 repeated string define = 12 [(goby.field) = {
173 description: "Set a variable used as ${NAME} in the deployment file, as NAME=value; overrides the environment",
174 cfg { cli_short: "D" }
176 repeated string interface_dir = 13 [(goby.field) = {
177 description: "Search this directory for interface files, after the deployment file's own directory (also GOBY_INTERFACE_PATH, colon separated)",
178 cfg { cli_short: "I" }
186 optional OutputFormat output_format = 20
187 [default = HUMAN, (goby.field) = { cfg { cli_short: "o" } }];
188 optional bool strict = 21
189 [default = false, (goby.field).description = "Fail on warnings as well as errors"];
190 optional bool report_unused = 22 [
192 (goby.field).description = "Also report publications that nothing subscribes to"
194 optional bool assume_dynamic = 25 [
196 (goby.field).description =
197 "Count a dynamic publication whose group's numeric part is set at run time (and not given with bind:) as reaching the subscriptions it might"
199 optional string omit_group_regex = 23
200 [(goby.field).description = "Do not check groups matching this regex"];
201 optional string omit_node_regex = 24 [(goby.field).description =
202 "Do not check platforms, modules, applications or "
203 "threads whose name matches this regex"];
206// Reports written with -o JSON
208// a publication or subscription, and where in the deployment it is made
209message InterfaceEndpoint
211 optional string platform = 1;
212 optional string module = 2;
213 optional string application = 3;
214 optional string thread = 4;
215 optional string layer = 5;
216 optional string group = 6;
217 optional string scheme = 7;
218 optional string type = 8;
219 optional string necessity = 9;
222message InterfaceIssue
230 required Severity severity = 1;
231 required string code = 2 [(goby.field).description = "e.g. required-unmet"];
232 required string message = 3;
233 optional string location = 4 [(goby.field).description =
234 "Position in the deployment file, e.g. platforms[0].run[2]"];
236 optional InterfaceEndpoint subject = 5 [(goby.field).description =
237 "The publication or subscription the issue is about"];
240message InterfaceValidation
242 required string file = 1;
243 required bool valid = 2;
244 repeated InterfaceIssue issue = 3;
248 optional int32 platforms = 1;
249 optional int32 applications = 2;
250 optional int32 connections = 3;
251 optional int32 required = 4;
252 optional int32 required_met = 5;
254 optional Summary summary = 4;
257message InterfaceListConfig
259 option (goby.msg).cfg.tool = {
262 has_help_action: false
265 optional goby.middleware.protobuf.AppConfig app = 1
266 [(goby.field) = { cfg { action: DEVELOPER } }];
268 required string deployment_file = 10 [(goby.field) = {
269 description: "Deployment file (deployment.yml), or a single interface file",
270 cfg { position: { enable: true } }
278 optional What what = 11 [
279 default = applications,
281 description: "applications (with their threads and publish/subscribe counts per layer), platforms, or groups (with their publishers and subscribers)",
282 cfg { position: { enable: true } }
285 repeated string define = 14 [(goby.field) = {
286 description: "Set a variable used as ${NAME} in the deployment file, as NAME=value; overrides the environment",
287 cfg { cli_short: "D" }
289 repeated string interface_dir = 15 [(goby.field) = {
290 description: "Search this directory for interface files, after the deployment file's own directory (also GOBY_INTERFACE_PATH, colon separated)",
291 cfg { cli_short: "I" }
293 optional string output_file = 16
294 [(goby.field).description = "Write the list here instead of stdout"];
295 optional InterfaceValidateConfig.OutputFormat output_format = 20
296 [default = HUMAN, (goby.field) = { cfg { cli_short: "o" } }];
299message InterfaceExplainConfig
301 option (goby.msg).cfg.tool = {
304 has_help_action: false
307 optional goby.middleware.protobuf.AppConfig app = 1
308 [(goby.field) = { cfg { action: DEVELOPER } }];
310 required string deployment_file = 10 [(goby.field) = {
311 description: "Deployment file (deployment.yml), or a single interface file",
312 cfg { position: { enable: true } }
314 required string group_regex = 11 [(goby.field) = {
315 description: "Explain the groups matching this regex",
316 cfg { position: { enable: true } }
318 optional string type_regex = 12
319 [(goby.field).description = "Only entries whose type matches this regex"];
320 repeated string define = 14 [(goby.field) = {
321 description: "Set a variable used as ${NAME} in the deployment file, as NAME=value; overrides the environment",
322 cfg { cli_short: "D" }
324 repeated string interface_dir = 15 [(goby.field) = {
325 description: "Search this directory for interface files, after the deployment file's own directory (also GOBY_INTERFACE_PATH, colon separated)",
326 cfg { cli_short: "I" }
328 optional string output_file = 16
329 [(goby.field).description = "Write the explanation here instead of stdout"];
330 optional InterfaceValidateConfig.OutputFormat output_format = 20
331 [default = HUMAN, (goby.field) = { cfg { cli_short: "o" } }];
334message InterfaceDiffConfig
336 option (goby.msg).cfg.tool = {
339 has_help_action: false
342 optional goby.middleware.protobuf.AppConfig app = 1
343 [(goby.field) = { cfg { action: DEVELOPER } }];
345 required string deployment_file = 10 [(goby.field) = {
346 description: "Deployment file before",
347 cfg { position: { enable: true } }
349 optional string deployment_file_b = 11 [(goby.field) = {
350 description: "Deployment file after; the same file if omitted (compare two sets of interface files with --interface_dir_a and --interface_dir_b)",
351 cfg { position: { enable: true } }
353 repeated string define = 14 [(goby.field) = {
354 description: "Set a variable used as ${NAME} in the deployment file, as NAME=value; overrides the environment",
355 cfg { cli_short: "D" }
357 repeated string interface_dir = 15 [(goby.field) = {
358 description: "Search this directory for interface files, for both deployments, after each deployment file's own directory and its --interface_dir_a or --interface_dir_b (also GOBY_INTERFACE_PATH, colon separated)",
359 cfg { cli_short: "I" }
361 repeated string interface_dir_a = 16 [(goby.field).description =
362 "Search this directory for the first deployment's interface files"];
363 repeated string interface_dir_b = 17 [(goby.field).description =
364 "Search this directory for the second deployment's interface files"];
365 optional string output_file = 18
366 [(goby.field).description = "Write the differences here instead of stdout"];
367 optional InterfaceValidateConfig.OutputFormat output_format = 20
368 [default = HUMAN, (goby.field) = { cfg { cli_short: "o" } }];
371message InterfaceInitConfig
373 option (goby.msg).cfg.tool = {
376 has_help_action: false
379 optional goby.middleware.protobuf.AppConfig app = 1
380 [(goby.field) = { cfg { action: DEVELOPER } }];
382 required string directory = 10 [(goby.field) = {
383 description: "Directory of interface files (<target>_interface.yml) to start from",
384 cfg { position: { enable: true } }
386 optional string platform = 11
387 [default = "platform", (goby.field).description = "Name of the one platform written"];
388 optional string deployment_name = 12
389 [(goby.field).description = "Name of the deployment; the directory's name if omitted"];
390 optional string output_file = 13
391 [(goby.field).description = "Write the deployment file here instead of stdout"];
394// Written by 'goby interface list -o JSON'
397 required string file = 1;
401 required string name = 1;
402 repeated string module = 2;
403 optional int32 applications = 3;
407 required string layer = 1;
408 optional int32 publishes = 2;
409 optional int32 subscribes = 3;
413 required string platform = 1;
414 optional string module = 2;
415 required string name = 3;
416 repeated string thread = 4;
417 repeated LayerCount count = 5;
421 required string layer = 1;
422 required string group = 2;
423 repeated InterfaceEndpoint publisher = 3;
424 repeated InterfaceEndpoint subscriber = 4;
426 repeated Platform platform = 2;
427 repeated Application application = 3;
428 repeated Group group = 4;
431// Written by 'goby interface explain -o JSON'
432message InterfaceExplanation
434 required string file = 1;
435 required string group_regex = 2;
436 optional string type_regex = 3;
440 required InterfaceEndpoint subscriber = 1;
441 repeated InterfaceEndpoint publisher = 2;
442 // reached by a publisher whose group certainly matches
443 required bool met = 3;
444 // why it is not met, or what it depends on
445 repeated string reason = 4;
446 optional bool necessity_set_by_deployment = 5;
450 required InterfaceEndpoint publisher = 1;
451 repeated InterfaceEndpoint subscriber = 2;
452 repeated string note = 3;
454 repeated Subscription subscription = 4;
455 repeated Publication publication = 5;
458// Written by 'goby interface diff -o JSON'
461 required string file_a = 1;
462 required string file_b = 2;
466 required InterfaceEndpoint publisher = 1;
467 required InterfaceEndpoint subscriber = 2;
469 repeated string application_added = 3
470 [(goby.field).description = "platform/[module/]application"];
471 repeated string application_removed = 4;
472 repeated Connection connection_added = 5;
473 repeated Connection connection_removed = 6;
474 // required subscriptions without a publisher in the second deployment but not the first
475 repeated InterfaceIssue newly_unmet = 7;
476 // and the other way round
477 repeated InterfaceIssue newly_met = 8;
480message InterfaceLaunchConfig
482 option (goby.msg).cfg.tool = {
485 has_help_action: false
488 optional goby.middleware.protobuf.AppConfig app = 1
489 [(goby.field) = { cfg { action: DEVELOPER } }];
491 required string deployment_file = 10 [(goby.field) = {
492 description: "Deployment file (deployment.yml)",
493 cfg { position: { enable: true } }
495 optional string platform = 12 [(goby.field).description =
496 "Platform to use, or one of its instances (e.g. bot2); needed when the deployment has more than one"];
497 optional uint32 instance = 13
498 [(goby.field).description = "With --platform, the instance (--platform bot --instance 2 is bot2)"];
499 optional string module = 16 [(goby.field).description =
500 "With modules, the module (one gobyd) to use"];
501 repeated string define = 14 [(goby.field) = {
502 description: "Set a variable used as ${NAME} in the deployment file, as NAME=value; overrides the environment",
503 cfg { cli_short: "D" }
505 repeated string interface_dir = 15 [(goby.field) = {
506 description: "Search this directory for interface files, after the deployment file's own directory (also GOBY_INTERFACE_PATH, colon separated)",
507 cfg { cli_short: "I" }
509 optional string output_file = 17
510 [(goby.field).description = "Write the launch file here instead of stdout"];
511 optional string outdir = 18 [(goby.field).description =
512 "Write <platform>[.<module>].launch here for every platform (and module)"];
515message InterfaceLaunchCheckConfig
517 option (goby.msg).cfg.tool = {
520 has_help_action: false
523 optional goby.middleware.protobuf.AppConfig app = 1
524 [(goby.field) = { cfg { action: DEVELOPER } }];
526 required string deployment_file = 10 [(goby.field) = {
527 description: "Deployment file (deployment.yml)",
528 cfg { position: { enable: true } }
530 required string launch_file = 11 [(goby.field) = {
531 description: "goby_launch file to compare with it",
532 cfg { position: { enable: true } }
534 optional string platform = 12 [(goby.field).description =
535 "Platform to use, or one of its instances (e.g. bot2); needed when the deployment has more than one"];
536 optional uint32 instance = 13
537 [(goby.field).description = "With --platform, the instance (--platform bot --instance 2 is bot2)"];
538 optional string module = 16 [(goby.field).description =
539 "With modules, the module (one gobyd) to use"];
540 repeated string define = 14 [(goby.field) = {
541 description: "Set a variable used as ${NAME} in the deployment file, as NAME=value; overrides the environment",
542 cfg { cli_short: "D" }
544 repeated string interface_dir = 15 [(goby.field) = {
545 description: "Search this directory for interface files, after the deployment file's own directory (also GOBY_INTERFACE_PATH, colon separated)",
546 cfg { cli_short: "I" }
548 optional string output_file = 17
549 [(goby.field).description = "Write the differences here instead of stdout"];
550 optional InterfaceValidateConfig.OutputFormat output_format = 20
551 [default = HUMAN, (goby.field) = { cfg { cli_short: "o" } }];
554// Written by 'goby interface launch_check -o JSON'
555message InterfaceLaunchCheck
557 required string launch_file = 1;
558 required string deployment_file = 2;
560 required string unit = 3;
564 // launched-only, not-launched, env or kill
565 required string kind = 1;
566 required string name = 2;
567 // in the launch file, when the line is there
568 optional int32 line = 3;
569 required string detail = 4;
571 repeated Difference difference = 4;
574message InterfaceSystemdConfig
576 option (goby.msg).cfg.tool = {
579 has_help_action: false
582 optional goby.middleware.protobuf.AppConfig app = 1
583 [(goby.field) = { cfg { action: DEVELOPER } }];
585 required string deployment_file = 10 [(goby.field) = {
586 description: "Deployment file (deployment.yml)",
587 cfg { position: { enable: true } }
589 optional string platform = 12 [(goby.field).description =
590 "Platform to use, or one of its instances (e.g. bot2); needed when the deployment has more than one"];
591 optional uint32 instance = 13
592 [(goby.field).description = "With --platform, the instance (--platform bot --instance 2 is bot2)"];
593 optional string module = 16 [(goby.field).description =
594 "With modules, the module (one gobyd) to use"];
595 repeated string define = 14 [(goby.field) = {
596 description: "Set a variable used as ${NAME} in the deployment file, as NAME=value; overrides the environment",
597 cfg { cli_short: "D" }
599 repeated string interface_dir = 15 [(goby.field) = {
600 description: "Search this directory for interface files, after the deployment file's own directory (also GOBY_INTERFACE_PATH, colon separated)",
601 cfg { cli_short: "I" }
603 optional string outdir = 17 [(goby.field).description =
604 "Write the unit files here, instead of printing them"];
605 optional bool check = 18 [
607 (goby.field).description =
608 "Compare the units with those in --unit_dir instead of writing them; exits 1 if any differ"
610 optional string unit_dir = 19 [
611 default = "/etc/systemd/system",
612 (goby.field).description = "Installed units, for --check"