CGW_KAFKA_CONSUME_TOPIC and PRODUCE topic are invalid
env vars. We can safely remove them to avoid confusion.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
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>
Internally, group add / del requests do alter the Redis timestamp
(lat update timestamp), however the main loop of connection_server
that processes messages is _not_ aware of this change up untill
the next iteration of the loop.
Fix this to make sure we _save_ locally the timestamp that
we get from redis once we know for sure that local shard
modified it (e.g. after group add/del request handled).
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Whenever CGW receives reply for an unknown GID, it firstly
sends the <unknown GID> reply.
Right after that it sends another one (duplicate), which
is redundant and should not be sent.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Change CGW behavior to return only 'failed_infras' in both
infra add/del partial or completely failed responses.
This tweaks the previous redundant data that was returned in the
response - list of <all> macs in case of a successfull completion,
which is unnecessary - it's already clear that request succeeded,
and actions were made over supplied infra list.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Remove unused 'infra_name' from NB API requests that
manage infra_group (add/del).
Also change tests / utils and helper scripts to no longer
form kafka msgs with 'infra_name' present.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Replace script-based approach for CGW/services creation,
in favor of multi-cgw templated generated compose file.
Also, add a new run-tests target, that executes / starts
test run, for the sake of convinience.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Whenever tests start, they might do some enviromental
changes to local FS. Handle this by moving
the 'context' of tests execution to a tmpfs folder, that
can be easily purged after tests are done / new test run
is being executed.
NOTE: further changes in regard to tests isolation should
potentially utilize a separate docker container that serves
as a fresh clean and isolated enviroment for tests run.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Force redis, PSQL, kafka clients to have a strict
timeout value for any requests.
It's done to ensure our tests do not hang for an unknown
period of time in case if something goes wrong.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Whenever TLS accept (tungstenite::accept(tls_stream))
blocks for too long (>15 seconds), stop trying
to accept the stream using tokio_selector.
This is done to ensure we don't have a hang
connection processor that might hang for a very
long period of time waiting for a connection to be
accepted.
Also run cargo fmt to fix some import indentation.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>