Files
openlan-cgw/api/cnc_res_api.yaml
Oleksandr Mazur e9d37d1b8c Initial formalization of API in form of YAML files
Add initial list of YAML files that formalize Kafka API:
 - requests list that CGW can handle
 - responses that CGW will generate
 - unsolicited events that CGW might generate

Also a small cleanup of requests and responses was made,
to align it with a common format (renamed some of the fields,
added missing etc).
Tests are tweaked to accomodate for changed field names.

Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
2024-12-19 14:51:16 +02:00

254 lines
7.8 KiB
YAML

---
# Kafka 'CnC_Res' (default) topic API list that defines response messages format
# for each of the CnC request.
# The request messages for which these results are generated can be found in the
# 'cnc_api.yaml' file.
infrastructure_group_create_response:
description:
Response to corresponding 'infrastructure_group_create'
or 'infrastructure_group_create_to_shard' request(s).
type:
type: string
enum:
- infrastructure_group_create_response
reporter_shard_id:
description:
ID of the shard that handled request and generated this response.
type: integer
infra_group_id:
type: integer
uuid:
description:
The underlying unique identifier of the request, to which
this response is being generated.
type: string
format: uuid
success:
type: boolean
error_message:
description:
Error message reporting why the request failed.
Non-empty only if 'success' is false (e.g. request failed).
type: string
infrastructure_group_delete_response:
description:
Response to corresponding 'infrastructure_group_delete' request.
type:
type: string
enum:
- infrastructure_group_delete_response
reporter_shard_id:
description:
ID of the shard that handled request and generated this response.
type: integer
infra_group_id:
type: integer
uuid:
description:
The underlying unique identifier of the request, to which
this response is being generated.
type: string
format: uuid
success:
type: boolean
error_message:
type: string
description:
Error message reporting why the request failed.
Non-empty only if 'success' is false (e.g. request failed).
infrastructure_group_infras_add_response:
description:
Response to corresponding 'infrastructure_group_infras_add' request.
type:
type: string
enum:
- infrastructure_group_infras_add_response
reporter_shard_id:
description:
ID of the shard that handled request and generated this response.
type: integer
infra_group_id:
type: integer
uuid:
type: string
format: uuid
description:
The underlying unique identifier of the request, to which
this response is being generated.
success:
type: boolean
error_message:
type: string
description:
Error message reporting why the request failed.
Non-empty only if 'success' is false (e.g. request failed).
failed_infras:
description:
Array of infras (MAC address / mac serial, any form is accepted) that
should were not added (failed to) to specified infra group.
Potential cause - infra is a duplicate (already member of specified group),
or it is already a member of some other group and should be removed
from old group first.
type: array
items:
type: string
kafka_partition_key:
description:
CGW can return a special string value - kafka partition key,
that can be used by generating consecutive CnC request,
that will result in direct addressing of the shard that replied
to the original request.
It's an optimization technique to overcome the need of
using relaying mechanism all the time.
NOTE - this kafka key in replies _could_ be used by the callers,
but it's not required. It's optional.
Can be empty.
Can be present even if request failed.
type: string
infrastructure_group_infras_del_response:
description:
Response to corresponding 'infrastructure_group_infras_del' request.
type:
type: string
enum:
- infrastructure_group_infras_del_response
reporter_shard_id:
description:
ID of the shard that handled request and generated this response.
type: integer
infra_group_id:
type: integer
uuid:
type: string
format: uuid
description:
The underlying unique identifier of the request, to which
this response is being generated.
success:
type: boolean
error_message:
type: string
description:
Error message reporting why the request failed.
Non-empty only if 'success' is false (e.g. request failed).
failed_infras:
description:
Array of infras (MAC address / mac serial, any form is accepted) that
should were not removed (failed to) from specified infra group.
Potential cause - infra is not member of specified group.
type: array
items:
type: string
kafka_partition_key:
description:
CGW can return a special string value - kafka partition key,
that can be used by generating consecutive CnC request,
that will result in direct addressing of the shard that replied
to the original request.
It's an optimization technique to overcome the need of
using relaying mechanism all the time.
NOTE - this kafka key in replies _could_ be used by the callers,
but it's not required. It's optional.
Can be empty.
Can be present even if request failed.
type: string
infrastructure_group_infra_message_enqueue_response:
description:
Response to corresponding 'infrastructure_group_infra_message_enqueue' request.
type:
type: string
enum:
- infrastructure_group_infra_message_enqueue_response
reporter_shard_id:
description:
ID of the shard that handled request and generated this response.
type: integer
infra_group_id:
type: integer
uuid:
type: string
format: uuid
description:
The underlying unique identifier of the request, to which
this response is being generated.
success:
type: boolean
error_message:
type: string
description:
Error message reporting why the request failed.
Non-empty only if 'success' is false (e.g. request failed).
kafka_partition_key:
description:
CGW can return a special string value - kafka partition key,
that can be used by generating consecutive CnC request,
that will result in direct addressing of the shard that replied
to the original request.
It's an optimization technique to overcome the need of
using relaying mechanism all the time.
NOTE - this kafka key in replies _could_ be used by the callers,
but it's not required. It's optional.
Can be empty.
Can be present even if request failed.
type: string
infra_request_result:
description:
Result of the underlying 'infrastructure_group_infra_message_enqueue' request execution.
This result is generated whenever underlying infra finishes and responds
to the request with status 'result' message that CGW handles internally.
type:
type: string
enum:
- infra_request_result
reporter_shard_id:
description:
ID of the shard that handled request and generated this response.
type: integer
infra_group_id:
type: integer
uuid:
type: string
format: uuid
description:
The underlying unique identifier of the request, to which
this response is being generated.
success:
type: boolean
error_message:
type: string
description:
Error message reporting why the request failed.
Non-empty only if 'success' is false (e.g. request failed).
rebalance_groups_response:
description:
Response to corresponding 'rebalance_groups' request.
type:
type: string
enum:
- rebalance_groups_response
reporter_shard_id:
type: integer
description:
ID of the shard that handled request and generated this response.
infra_group_id:
type: integer
uuid:
type: string
format: uuid
description:
The underlying unique identifier of the request, to which
this response is being generated.
success:
type: boolean
error_message:
type: string
description:
Error message reporting why the request failed.
Non-empty only if 'success' is false (e.g. request failed).