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>
Add initial infrastructure for sending / receiving messages
using websocket bindings for client sim.
Add initial handle-reboot-simulation test, that both
tests CGW's ability to sink down a request, as well as
test it's behavior whenever simulated device's been rebooted.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Change the AP ucentral result parser to expect proper
format of result message.
Add a basic (same as for AP) ucentral result parser
for switch-parser.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
The predefined mac list in the txt file is used
internally by the client simulator. It was missed
in previous commits.
Future clientsim rework should eliminate use of <predefined>
mac lists, but it's used now.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
The provided kafka key in (some of the) replies can be used
by NB services to talk <directly> to _this_ local shard
that replied, effectively using kafka partitioning to
not rely on the relaying mechanism.
The keys list is calculated upon each kafka partition rebalancing,
if the partition number changes.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Remove unused shard id argument from cli parser in
<generic> (assign to <any>) infra group create request.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>