tools/boruta.git
5 years agoHTTP API: Don't loop redirecting when URL wasn't found sandbox/amistewicz/demo_v4
Maciej Wereski [Thu, 21 Jun 2018 10:38:50 +0000 (12:38 +0200)]
HTTP API: Don't loop redirecting when URL wasn't found

Currently when api version isn't provided in URL then request is
redirected to default one. If requested resource isn't found there then
the redirected will be served by the same handler, so it will be
redirected which results in another redirection and so on. This change
introduces new handler that responds with 404 error when page wasn't
found in default version of API.

Change-Id: I1b67f7166d3b0d92500ab2f5727c2827b485d940
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoSome logging and minor fixes
Aleksander Mistewicz [Wed, 20 Jun 2018 12:40:17 +0000 (14:40 +0200)]
Some logging and minor fixes

Change-Id: I189b3e66fface419a5e7e5851271b9b2ca55b109

5 years agoAdd Boruta server executable
Maciej Wereski [Thu, 19 Oct 2017 13:34:02 +0000 (15:34 +0200)]
Add Boruta server executable

Change-Id: I05f9509a372efc8326af9f35c122f674f60e7e70
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
5 years agoMerge branch 'new-register' into demo_v4
Aleksander Mistewicz [Wed, 20 Jun 2018 09:53:56 +0000 (11:53 +0200)]
Merge branch 'new-register' into demo_v4

Change-Id: I556e25b9f9827097507b84094ef9a5e4146519f1

5 years agoMerge branch 'httpapi-client' into demo_v4
Aleksander Mistewicz [Wed, 20 Jun 2018 09:49:02 +0000 (11:49 +0200)]
Merge branch 'httpapi-client' into demo_v4

5 years agoMerge branch 'stm-rpc-update' into demo_v4
Aleksander Mistewicz [Wed, 20 Jun 2018 09:47:44 +0000 (11:47 +0200)]
Merge branch 'stm-rpc-update' into demo_v4

5 years agoHTTP API Client: Prolong access to worker 75/181675/2
Maciej Wereski [Fri, 10 Nov 2017 14:16:55 +0000 (15:16 +0100)]
HTTP API Client: Prolong access to worker

Change-Id: Icd4ad6dfbdd226a3c6a11bb420488299465bd716
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API Client: Acquire worker 74/181674/2
Maciej Wereski [Fri, 10 Nov 2017 14:12:31 +0000 (15:12 +0100)]
HTTP API Client: Acquire worker

Definition of boruta/http.AccessInfo2 needed to be changes so that
address point to concrete type (new.TCPAddr) and not to interface.

Change-Id: I37afd203db356ba4621ad7448a554b59f6553ce9
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API Client: List and filter requests 73/181673/2
Maciej Wereski [Fri, 10 Nov 2017 14:05:57 +0000 (15:05 +0100)]
HTTP API Client: List and filter requests

Change-Id: I550ebfd6e87b916e15adf39519568b18828d6ae2
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API Client: Get request information 72/181672/2
Maciej Wereski [Fri, 10 Nov 2017 12:57:53 +0000 (13:57 +0100)]
HTTP API Client: Get request information

Change-Id: Ic2b18ea346c78b50cf0f6754848a31feb753c253
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API Client: Update request 71/181671/2
Maciej Wereski [Fri, 10 Nov 2017 12:46:06 +0000 (13:46 +0100)]
HTTP API Client: Update request

Change-Id: I7bac5be49bfd0f2a410720ec008c31c5d35cabd1
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API Client: Close request 70/181670/2
Maciej Wereski [Fri, 10 Nov 2017 11:48:26 +0000 (12:48 +0100)]
HTTP API Client: Close request

Change-Id: Ief5f66a3d89bf55694506bbf9f8d8fcb24f51274
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API Client: New request 69/181669/2
Maciej Wereski [Thu, 9 Nov 2017 11:28:40 +0000 (12:28 +0100)]
HTTP API Client: New request

Change-Id: Id974791f22f96b1408d9bcd0514291c6672cb6ed
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoAdd STMsocket to dryad/conf 80/181880/1
Aleksander Mistewicz [Tue, 23 Jan 2018 15:05:44 +0000 (16:05 +0100)]
Add STMsocket to dryad/conf

Due to change in git.tizen.org/tools/muxpi/sw/nanopi/stm communication
medium has changed. Preferably, dryad should connect to the running
process of stm via unix socket exposing Go RPC interface.

It is possible to use it in the old way by assigning "" to stm_socket
configuration entry.

Change-Id: If6f4b41c9dbf467e3d40772eb52b55cbbc79d749
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
5 years agoRefactor tests to use mock instead of real STM 79/181879/1
Aleksander Mistewicz [Mon, 18 Jun 2018 11:37:49 +0000 (13:37 +0200)]
Refactor tests to use mock instead of real STM

Testing this part of code was troublesome as a working MuxPi was needed.
Due to recent changes in git.tizen.org/tools/muxpi/sw/nanopi/stm,
functions of STM are exposed with Interface. It is easier to test using
a mockup.

Change-Id: I5c2be2ae717b448f3182896074faefd8f2ea1971
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
5 years agoAdd HTTP client package skeleton 68/181668/2
Maciej Wereski [Tue, 7 Nov 2017 13:38:38 +0000 (14:38 +0100)]
Add HTTP client package skeleton

Client package is intended to be utilized by HTTP API users. It will
be more convenient way to interact with Boruta server then directly
calling HTTP methods and parsing JSON by hand.

Change-Id: Ic27b90fc1559403f56358bd5677c36b2c2e57e71
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoInstall public key on dryad 42/181342/2
Aleksander Mistewicz [Tue, 12 Jun 2018 08:42:30 +0000 (10:42 +0200)]
Install public key on dryad

This patch changes interface and communication between boruta server and
dryads. Key is generated on boruta server, public part is installed on
dryad and private part is stored internally. It is a preparation for
using user's public keys provided by an external service.

Change-Id: Ic6fb087aba02553c6b2b8f7cc13cc6bd67eff36a
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
5 years agoUse address of ssh daemon when creating a tunnel 17/180917/4
Aleksander Mistewicz [Tue, 5 Jun 2018 13:52:12 +0000 (15:52 +0200)]
Use address of ssh daemon when creating a tunnel

This the last change in the series.
Some methods were renamed to reflect migration from net.IP to
net.TCPAddr. It allows multiple dryads to coexist behind NAT or on
a single host. Currently, it is possible to provide network addresses to
non-existent address or to a different dryad than expected. Addresses in
Register() call are checked only for resolvability.

Change-Id: I46cecb8ad6f06fabb88f2262d95c0678329915ab
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
5 years agoUse net.TCPAddr instead of net.IP 16/180916/3
Aleksander Mistewicz [Mon, 4 Jun 2018 08:10:56 +0000 (10:10 +0200)]
Use net.TCPAddr instead of net.IP

net.TCPAddr contains Port field.

Change-Id: Ie66daa17104be1ea06849eccaaee78b2b4353c2e
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
5 years agoAdd dryadAddress and sshAddress to Register 15/180915/3
Aleksander Mistewicz [Tue, 29 May 2018 09:20:44 +0000 (11:20 +0200)]
Add dryadAddress and sshAddress to Register

When running multiple dryads on a single host or behind NAT, they must
listen on different ports and inform boruta about this fact.

Change-Id: I35e084b8ee2e2177d36055f7dedacb53ac74bbf0
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
5 years agoAdd configuration option for SSH listen port 14/180914/2
Aleksander Mistewicz [Mon, 28 May 2018 14:51:57 +0000 (16:51 +0200)]
Add configuration option for SSH listen port

In some circumstances ssh daemon listens on a different port than a
default one.

Change-Id: Iedf8dd5aafb0c45c6d8c6c6b45bc61d47c720041
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
5 years agoMake ServerError a Go error 67/181667/1
Maciej Wereski [Thu, 9 Nov 2017 15:09:09 +0000 (16:09 +0100)]
Make ServerError a Go error

Change-Id: Ie804197ca5b777ad6afd2c01d55a853ae8c287ee
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoMerge branch 'httpapi' 03/180903/3
Maciej Wereski [Tue, 5 Jun 2018 10:58:00 +0000 (12:58 +0200)]
Merge branch 'httpapi'

This branch provides first version of Boruta REST API. It maps
functionality of Requests, Workers and Superviser interface. There is
also API aggregation package which will make it possible to run multiple
API version simultaneously. Generic Boruta HTTP types and functions are
provided in separate package and may be reused by Boruta HTTP client
package.

Change-Id: I9127f1f9f3681fd3b8037b316acc921098dcb773

5 years agoAdd custom Boruta HTTP headers httpapi
Maciej Wereski [Fri, 22 Dec 2017 09:18:29 +0000 (10:18 +0100)]
Add custom Boruta HTTP headers

This patch introduces two custom Boruta headers to replies for some REST
API functions:
* Boruta-Request-Status - contains current status of request. It is
  convenient to request HEAD on GetRequestInfo path to check only status
  of given request.
* Boruta-Request-Count - contains number of requests returned for
  Request List/Filter operation.
* Boruta-Worker-Status - contains current status of worker.
* Boruta-Worker-Count - conttains number of workers returned for Worker
  List/Filter operation.

Change-Id: I871c63058b2690bac50046f0dc500c795843b958
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API: Add agregation package
Maciej Wereski [Thu, 23 Nov 2017 15:12:27 +0000 (16:12 +0100)]
HTTP API: Add agregation package

Its purpose is to create and aggregate all Boruta HTTP API version. It
also provides handler for panics and redirect ambiguous request to a
default API version.

Change-Id: Ida94aed412951744557db6c30dd658d36ff3e47e
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoCreate new package for http datatypes
Maciej Wereski [Thu, 9 Nov 2017 12:54:46 +0000 (13:54 +0100)]
Create new package for http datatypes

Few datatypes will be shared between server and client, such as server
errors and filters. Move these datatypes to separate package.

Change-Id: I06f025ba8449d2e2c045fbdd84fe59fd76b065ca
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API: Implement filtering workers
Maciej Wereski [Tue, 17 Oct 2017 10:53:38 +0000 (12:53 +0200)]
HTTP API: Implement filtering workers

Change-Id: I93137f8e3c7dc66c859de671c316a443ec4aad9e
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API: Implement worker deregistration
Maciej Wereski [Tue, 17 Oct 2017 09:49:19 +0000 (11:49 +0200)]
HTTP API: Implement worker deregistration

Change-Id: Ie0eeb5b8958111f980230eb186e44a1a14663b7a
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API: Implement setting state of a worker
Maciej Wereski [Tue, 17 Oct 2017 09:43:13 +0000 (11:43 +0200)]
HTTP API: Implement setting state of a worker

Change-Id: Ib413efb68b1c6c63ae07d878ee6929cdb4049948
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API: Implement setting worker groups
Maciej Wereski [Fri, 13 Oct 2017 10:57:05 +0000 (12:57 +0200)]
HTTP API: Implement setting worker groups

Change-Id: I7d0c6ad8da766c0716ab1186b3894079044e58d8
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API: Implement getting information about worker
Maciej Wereski [Tue, 10 Oct 2017 14:57:30 +0000 (16:57 +0200)]
HTTP API: Implement getting information about worker

Change-Id: Iae6bc7a4f936defc409396f43a56bd13f37a532b
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API: Add Superviser API skeleton
Maciej Wereski [Tue, 10 Oct 2017 10:30:54 +0000 (12:30 +0200)]
HTTP API: Add Superviser API skeleton

Currently only Requests and handlers of 2 Workers functions were
present, although HTTP API should cover full Workers API.

Tests will use mocked Workers and Superviser interfaces, so
generation line was added to boruta.go.

Change-Id: Id6d82a8c6e61121a2e75d5c90445edf35b2268a5
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API: Implement modification of Boruta requests
Maciej Wereski [Fri, 6 Oct 2017 15:43:18 +0000 (17:43 +0200)]
HTTP API: Implement modification of Boruta requests

Change-Id: I8d91554776871dfd7be85f64d868c81911682491
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API: Implement access to worker prolongation
Maciej Wereski [Fri, 29 Sep 2017 10:27:17 +0000 (12:27 +0200)]
HTTP API: Implement access to worker prolongation

Change-Id: Iecc19c55a9c1b4a674d742e7922776da671fc3c9
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API: Implement acquiring worker
Maciej Wereski [Fri, 29 Sep 2017 10:22:28 +0000 (12:22 +0200)]
HTTP API: Implement acquiring worker

AccessInfo structure provides key in golang rsa.PrivateKey format, so
handler repacks it and replies with AccessInfo2 structure, which has key
in PEM format. This is temporary solution - private keys will be removed
when proper user support is added (user public key will be used).

Change-Id: Ia4b8bc4a0ed007f0a6a0c0ff8e3ef48750646e51
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API: Implement listing and filtering requests
Maciej Wereski [Fri, 29 Sep 2017 09:14:22 +0000 (11:14 +0200)]
HTTP API: Implement listing and filtering requests

Change-Id: I27f8d037978ef0f0f60ea5c7ee406f8459a90796
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API: Implement ListFilter interface
Maciej Wereski [Thu, 28 Sep 2017 15:18:05 +0000 (17:18 +0200)]
HTTP API: Implement ListFilter interface

To filter requests method ListRequests() from Requests interface will be
called. This method needs to be passed argument that implements
ListFilter interface. This interface provides appropriate Match()
method, which is used by ListRequests() to decide if request should be
appended to the results.

Change-Id: Ic284a5c2b173328f079184c7c4eac56e723db533
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API: Implement getting information about requests
Maciej Wereski [Thu, 28 Sep 2017 13:42:24 +0000 (15:42 +0200)]
HTTP API: Implement getting information about requests

Change-Id: Ia0e7675dbcaad1ac90c6bc50f9d9de0c4a02b32d
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API: Implement closing requests
Maciej Wereski [Wed, 27 Sep 2017 10:49:13 +0000 (12:49 +0200)]
HTTP API: Implement closing requests

Change-Id: Iae3aec7a4a4d3cf34e4b3b01b9121efcece94436
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoHTTP API: Creating new requests
Maciej Wereski [Wed, 6 Sep 2017 15:45:01 +0000 (17:45 +0200)]
HTTP API: Creating new requests

Change-Id: I42423080832d0bba13f9b219d05c0e9fa48c7d06
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
5 years agoAdd HTTP API package
Maciej Wereski [Thu, 31 Aug 2017 14:11:31 +0000 (16:11 +0200)]
Add HTTP API package

HTTP API package will provide all HTTP API which will be exposed to the
Boruta clients. Only User API counterpart of Boruta is added for now.
Currently the package provides only one function, which takes pointer to
httprouter.Router and registers all paths and HTTP methods in it.

HTTP API module will have a lot of test cases agregated in test tables.
To improve test cases development time and readability of test files,
flag '-update' is added to test. It will run tests and for all
testcases a file with results will be generated in 'testdata'
subdirectory. During testing (running without '-update' flag) those
files are read and compared with results of tested functions.

Generating testcase files:
$ go test git.tizen.org/tools/boruta/server/api/v1 -update
Testing (as usual):
$ go test git.tizen.org/tools/boruta/server/api/v1

After updating testcase files output must be inspected by developer
before commiting to the repository (and should be also checked by
reviewers before merging).

Change-Id: I6d98f093cce116512dc305e07a8614990580faff
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoAdd LICENSE file 82/178282/4
Maciej Wereski [Wed, 9 May 2018 06:48:37 +0000 (08:48 +0200)]
Add LICENSE file

Change-Id: Ie73b74954425d30994f0e6de9c971bb970a93696
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoMerge branch 'matcher'
Maciej Wereski [Fri, 27 Apr 2018 16:52:38 +0000 (18:52 +0200)]
Merge branch 'matcher'

This branch provides logic for matching pending requests with
appropriate workers and reacting to time events (validAfters, deadlines
and timeouts). When succesfully matched, tunnel to dryad is created and
owner of request may get access info and ssh to the dryad.

6 years agoSet ReqsCollection as WorkerChange listener
Lukasz Wojciechowski [Tue, 24 Oct 2017 09:59:52 +0000 (11:59 +0200)]
Set ReqsCollection as WorkerChange listener

WorkerChange listener is notified about changes of worker state:
* when worker becomes IDLE;
* when worker's work has been broken by entering FAIL
 or MAINTENANCE state.

The ReqsCollection implementing WorkerChange interface reacts by:
* matching new pending request to IDLE worker;
* finishing request execution with FAILED state if worker's job has
 been broken.

Change-Id: Icff6a91e3173712243bf6d8ee382d1f1222b4735
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoUse change listener in workers
Lukasz Wojciechowski [Tue, 24 Oct 2017 09:55:06 +0000 (11:55 +0200)]
Use change listener in workers

Notify WorkerChange listener (if registered) about changes of worker state:
* when worker becomes IDLE;
* when worker's work was break by entering FAIL or MAINTENANCE state.

Change-Id: Ia5350912871d7ac6d1454dc5f0ae74155e811850
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoTrigger appropriate actions on Drayd in SetState
Aleksander Mistewicz [Thu, 19 Oct 2017 12:35:55 +0000 (14:35 +0200)]
Trigger appropriate actions on Drayd in SetState

Usage of mutexes is added into tests, as now more goroutines
can operate on WorkerList at the same time.
SetState changes are updated and enhanced to cover all possible
scenarios.

Change-Id: I99b00309e5ab937720d5848e3a3279e966c0cbad
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoImplement WorkerChange in requests
Lukasz Wojciechowski [Tue, 24 Oct 2017 09:13:48 +0000 (11:13 +0200)]
Implement WorkerChange in requests

Implementation covers OnWorkerIdle and OnWorkerFail methods.
The tests for both functions are available in requests_workerchange_test.go.

Change-Id: I0b35bf275e61448e2d9cf1ec943745592bb85394
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoImplement closing request
Lukasz Wojciechowski [Mon, 23 Oct 2017 08:41:54 +0000 (10:41 +0200)]
Implement closing request

Adjust test for CloseRequest.

Change-Id: I0bc0399206f3285cdd8e20eacf1a5d25815e54f7
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoUse Job information in Acquire and Prolong
Lukasz Wojciechowski [Wed, 18 Oct 2017 11:32:48 +0000 (13:32 +0200)]
Use Job information in Acquire and Prolong

Implement AcquireWorker and ProlongAccess in ReqsCollection.
Adjust tests to the usage of JobsManager in AcquireWorker
and cover new functionality.

Usage of mocked up JobsManager in tests is required.
The MockJobsManager has been generated using command:

mockgen -package requests \
-destination=requests/jobsmanager_mock_test.go \
-write_package_comment=false \
git.tizen.org/tools/boruta/matcher JobsManager

Change-Id: Ia925e556ddbb86a7998e982d760901e9e80666f2
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoSetup job when request processing starts
Lukasz Wojciechowski [Wed, 18 Oct 2017 10:14:57 +0000 (12:14 +0200)]
Setup job when request processing starts

In this patch timeout for Job is set to one hour.
It should be changed when proper timeout can be read from configuration
of boruta or user capabilities.

Change-Id: Iefe93f436a481797958d6563b2708b8f29c9652e
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoCreate matchers in requests
Lukasz Wojciechowski [Wed, 18 Oct 2017 09:43:25 +0000 (11:43 +0200)]
Create matchers in requests

Pass WorkersManager and JobsManager to requests. They are required
to control workers and jobs by matchers.
Create timeRequests time events monitors for ValidAfter, Deadline
and Timeout events and creates matchers for handling them.
Update timeRequests after creation and changing pending requests.

Update tests to fit changes in code.

As tests required usage of WorkersManager, a mockup type
MockWorkersManager has been generated using following command:

mockgen -package requests \
-destination=requests/workersmanager_mock_test.go \
-write_package_comment=false \
git.tizen.org/tools/boruta/matcher WorkersManager

Change-Id: Id6bbcf650859e27e137d462a11540589a3620385
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoImplement WorkersManager interface in WorkerList
Lukasz Wojciechowski [Fri, 27 Oct 2017 19:41:56 +0000 (21:41 +0200)]
Implement WorkersManager interface in WorkerList

Implementation of WorkersManager from matcher package makes WorkerList usable
as interface for acquiring workers by Matcher.

The implemnetation adds 2 new fields:
* changeListener which is notified after Worker's state changes;
* newDryadClient which provides dryad.ClientManager.

The implementation is covered by tests.
2 mock up types: MockDryadClientManager and MockWorkerChange for mocking up
rpc.dryad.ClientManager and WorkerChange.

Change-Id: I2177824aef7aea564cd0a9900d9970c8a8386ca7
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoAdd TCP Dial RPC client creation to DryadClient
Lukasz Wojciechowski [Mon, 5 Mar 2018 19:08:46 +0000 (20:08 +0100)]
Add TCP Dial RPC client creation to DryadClient

The Create function implements ClientManager interface.
It sets up a new TCP dialled RPC client in DryadClient structure.

The connection created this way will be used for managing Dryad
(key generation, putting in maintenance state, preparation).

Change-Id: I2d9c48d05f65e38b49aa6fe7ded10e324248f84e
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoAdd rpc.dryad.ClientManager interface
Lukasz Wojciechowski [Mon, 6 Nov 2017 15:53:36 +0000 (16:53 +0100)]
Add rpc.dryad.ClientManager interface

This interface allows adding an abstraction layer between Dryad's
client implementation and usage. It can be used also for using
mocked up implementation od Dryad's client for test purposes.

The mock implementation of interface is provided in workers package.
It is generated using mockgen command:

mockgen -package workers \
-destination=workers/dryadclientmanager_mock_test.go \
-write_package_comment=false \
-mock_names ClientManager=MockDryadClientManager \
git.tizen.org/tools/boruta/rpc/dryad ClientManager

Change-Id: I7366a0e68a355c98b898fb00ec8efb3c642a725d
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoAdd RW mutex based synchronization to WorkersList
Lukasz Wojciechowski [Wed, 11 Oct 2017 18:12:10 +0000 (20:12 +0200)]
Add RW mutex based synchronization to WorkersList

Change-Id: I43cea0084c1001b61cfbef6c5be7968f841b584b
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoImplement RequestsManager in ReqsCollection
Lukasz Wojciechowski [Tue, 10 Oct 2017 08:25:06 +0000 (10:25 +0200)]
Implement RequestsManager in ReqsCollection

Add implementation of RequestsManager interface by *ReqsCollection.
Implementation is required for internal boruta access to requests
structures to react on time passed events.

requests_requestsmanager_test.go file contains tests
of this implementation.

Change-Id: I2480138ca2625c8dca84b8191ef62d47fb9bc164
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoAdd TimeoutMatcher with tests
Lukasz Wojciechowski [Fri, 6 Oct 2017 20:04:50 +0000 (22:04 +0200)]
Add TimeoutMatcher with tests

TimeoutMatcher is a Matcher interface implementation for handling
running requests timeouts caused by expiration of requests' job timeout.

It tries to run Close on all reported requests. Some of the timeouts
might be invalid, because the request has changed it's state to done
or failed.

Tests base on using MockRequestsManager for mocking up RequestsManager
interface.

Change-Id: I6540ab50eb84f8ab1b9737ad71e7ae3a5ddd3170
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoAdd DeadlineMatcher with tests
Lukasz Wojciechowski [Fri, 6 Oct 2017 19:52:53 +0000 (21:52 +0200)]
Add DeadlineMatcher with tests

DeadlineMatcher is a Matcher interface implementation for handling
pending requests timeouts caused by expiration of Deadline times.

It tries to set Timeout on all reported requests. Some of the timeouts
might be invalid, because the request has change it's state
to canceled or running; or the Deadline time itself has been changed.

Tests base on using MockRequestsManager for mocking up RequestsManager
interface.

Change-Id: I4d790b58a26aa7389250ff57b6bfad662d4d3f7b
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoAdd ValidMatcher with tests
Lukasz Wojciechowski [Fri, 6 Oct 2017 19:34:06 +0000 (21:34 +0200)]
Add ValidMatcher with tests

ValidMatcher is a Matcher interface implementation for handling events
related to validation of requests after ValidAfter time is passed.
It matches pending, ready to be run requests with idle workers that are
capable to fulfill request capabilities and belong to group for which
request owner has rights.

Tests base on using MockRequestsManager, MockWorkersManager
and MockJobsManager for mocking up RequestsManager, WorkersManager
and JobsManager interfaces.

Change-Id: Ib654f1ef276eecb14dc4ad3114afcccd83a7bf5d
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoAdd RequestsManager interface
Lukasz Wojciechowski [Fri, 6 Oct 2017 17:49:32 +0000 (19:49 +0200)]
Add RequestsManager interface

RequestsManager interface defines API for taking actions
triggered by matcher events on requests structures.

The mock implementation of interface is provided in matcher package.
It is generated using mockgen command:

mockgen -package matcher \
-destination=matcher/requestsmanager_mock_test.go \
-write_package_comment=false \
git.tizen.org/tools/boruta/matcher RequestsManager

Change-Id: Idbf83988dba4cfa761dbfe8cae0a33d0a39245ac
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoAdd JobsManager implementation with tests
Lukasz Wojciechowski [Thu, 26 Apr 2018 10:16:28 +0000 (12:16 +0200)]
Add JobsManager implementation with tests

JobsManagerImpl implements JobsManager interface providing support
for jobs management. It uses provided WorkManager for managing
workers and Tunnels implementation of Tunneler for handling tunnels.

Tests base on usage of MockWorkersManager and MockTunneler
for mockuping access to workers and tunnels.

Change-Id: I4c469f32fc4f918641f69843567b39bfcce8da4c
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoAdd JobsManager interface
Lukasz Wojciechowski [Fri, 27 Oct 2017 18:39:23 +0000 (20:39 +0200)]
Add JobsManager interface

JobsManager interface defines API for taking actions on jobs.

The mock implementation of interface is provided in matcher package.
It is generated using mockgen command:

mockgen -package matcher \
-destination=matcher/jobsmanager_mock_test.go \
-write_package_comment=false \
git.tizen.org/tools/boruta/matcher JobsManager

Change-Id: I950b68cbadd2a2e7be3d65406d36082d6ac29ee4
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoMove tunnels from workers to separate package
Lukasz Wojciechowski [Tue, 31 Oct 2017 08:59:38 +0000 (09:59 +0100)]
Move tunnels from workers to separate package

Tunnels package provides implementation of simple data forwarding
tunnels between IP addresses pairs.

The implementation has been moved from workers package and adjusted
to newly defined Tunneler interface. The interface defines basic
operations on tunnels (creation, getting address, closing).
It provides additional layer of abstraction allowing mockuping tests
of parts of the code using tunnels.

The mock implementation of interface is provided in matcher package.
It is generated using mockgen command:

mockgen -package matcher \
-destination=matcher/tunneler_mock_test.go \
-write_package_comment=false \
git.tizen.org/tools/boruta/tunnels Tunneler

Change-Id: Ida42f0134f0c365c8f1ffe772b859a0218c301ed
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoAdd fields to AccessInfo struct
Lukasz Wojciechowski [Mon, 16 Oct 2017 08:23:52 +0000 (10:23 +0200)]
Add fields to AccessInfo struct

Added fields define required connection data for the request owner
who want to connect to the Dryad running job.

Change-Id: I372abac096d5b1cacc2744cbbbce2d1b0740cf81
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoAdd WorkersManager interface
Lukasz Wojciechowski [Fri, 6 Oct 2017 18:52:00 +0000 (20:52 +0200)]
Add WorkersManager interface

WorkersManager interface defines API for taking actions
triggered by matcher events on workers structures.

The mock implementation of interface is provided in matcher package.
It is generated using mockgen command:

mockgen -package matcher \
-destination=matcher/workersmanager_mock_test.go \
-write_package_comment=false \
git.tizen.org/tools/boruta/matcher WorkersManager

Change-Id: I026c661696b19a3443afc430e46d96abf9a272d5
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoAdd WorkerChange interface
Lukasz Wojciechowski [Tue, 24 Oct 2017 09:11:34 +0000 (11:11 +0200)]
Add WorkerChange interface

WorkerChange interface defines API for implementation to be informed
about changes in workers.

The mock implementation of interface is provided in workers package.
It is generated using mockgen command:

mockgen -package workers \
-destination=workers/workerchange_mock_test.go \
-write_package_comment=false \
git.tizen.org/tools/boruta/workers WorkerChange

Change-Id: Ia17aefd747057868bf2b4b57332397a591ac038a
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoAdd Groups to UserInfo
Lukasz Wojciechowski [Fri, 6 Oct 2017 09:33:02 +0000 (11:33 +0200)]
Add Groups to UserInfo

Change-Id: Ie8369804df2eb6fa79bffe1895b6737c14ad74d1
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoAdd requestTimes with tests
Lukasz Wojciechowski [Wed, 13 Sep 2017 18:02:18 +0000 (20:02 +0200)]
Add requestTimes with tests

requestTimes collects requestTime objects and notifies registered
matcher.Matcher when the time comes. Past times are removed from
collection. timesHeap is used for storing requestTime objects.
Notifications are called asynchronously from dedicated goroutine.
requestTimes will be used by requests package for monitoring ValidAfter,
Deadline and Timeout time of requests.

Change-Id: Ib27608f89057791bb1d615ec881ba2c06512f6f0
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoAdd matcher interface
Lukasz Wojciechowski [Wed, 13 Sep 2017 18:00:16 +0000 (20:00 +0200)]
Add matcher interface

Matcher is an interface for taking actions related to assigning requests
to workers and reacting to requests time events.
It should be implemented by objects that are notified about such events.

Change-Id: I8c7e3931e16fea8ce8be8f7dbdf28f5a3c13c11e
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoAdd timesHeap with tests
Lukasz Wojciechowski [Tue, 5 Sep 2017 15:38:10 +0000 (17:38 +0200)]
Add timesHeap with tests

timesHeap uses timesHeapContainer for heap implementation.
It provides API to heap of requestTime for higher layers of requests
package.
It will be used for finding minimum time among ValidAfter, Deadline
and Timeout requests' times. Every time the minimum time will come
requests-workers matcher will be notified.

Change-Id: Ifb30ff0180c39fe9d8c4748253a0391e1cf8bc75
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoAdd timesHeapContainer with tests
Lukasz Wojciechowski [Tue, 5 Sep 2017 15:35:50 +0000 (17:35 +0200)]
Add timesHeapContainer with tests

timesHeapContainer is a slice based implementation of heap.Interface
for requestTime structure (combines time.Time with ReqID).
Defined type is required for creating a heap of time structures with
additional data identifying request related to the time.
It will be used by requests package for getting minimal ValidAfter,
Deadline and Timeout times of requests. The special goroutine will
notify request-worker matcher, when proper time comes.

Change-Id: I2b71f84d2f3843bb47c0c9b7c7279ca224fba64b
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoFix Guard requests collection with mutex
Lukasz Wojciechowski [Tue, 30 Jan 2018 10:07:00 +0000 (11:07 +0100)]
Fix Guard requests collection with mutex

Change-Id: I580c7f44f6c412908b09f595f4eed768dca30b0a
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoMerge branch 'workers'
Maciej Wereski [Fri, 30 Mar 2018 10:08:37 +0000 (12:08 +0200)]
Merge branch 'workers'

Small improvements for listing workers and fixes for tunnel creation.

Change-Id: I6fb9e462a0039be0b1fb2808669eb9b385e74459

6 years agoImprove NewTunnel and remove global variable
Aleksander Mistewicz [Mon, 9 Oct 2017 08:19:54 +0000 (10:19 +0200)]
Improve NewTunnel and remove global variable

Only a constant for a default value of SSH port is left. Non-public
function newTunnel() takes port number as a parameter and is called by
a public function with a default value.

This patch also avoids possible allocation of not used memory by moving
error path in the NewTunnel earlier, before structure is initialized.

Change-Id: I26355af115187d9b36d7633ba47591fcb98d0ebb
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49834
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoSimplify implementation of ListWorkers
Aleksander Mistewicz [Fri, 6 Oct 2017 16:34:04 +0000 (18:34 +0200)]
Simplify implementation of ListWorkers

For unknown reason it was a little more complicated than necessary.
It also slightly improves perfomance - around 10%.

Change-Id: I6fc6555e3a92a5b79762b0d9f5a1ed570f39c45c
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49582
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoMerge branch 'dryad'
Maciej Wereski [Mon, 5 Mar 2018 17:45:57 +0000 (18:45 +0100)]
Merge branch 'dryad'

    Superviser and Dryad interfaces defined how Dryads and Boruta will
    interact. Merged changes provide RPC implementation for aforementioned
    interfaces together with a service that should run on a Dryad.

    Change-Id: I0ef4a8dbd1dab5f3db3d7bdb5b509959e3c64ef3

6 years agoAdd superviserReception to rpc/superviser package
Aleksander Mistewicz [Fri, 16 Feb 2018 13:51:07 +0000 (14:51 +0100)]
Add superviserReception to rpc/superviser package

boruta server requires IP address of the connected dryads to be saved
so that it can connect back to the Go RPC service they expose.

superviserReception wraps WorkerList in Superviser interface.
It saves IP address of a connection and registers a new Go RPC
service. The saved IP address is later used during call to Register.

Change-Id: I72f91d1c981e02ac13a07327b0b910e82a32fae9
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49609
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoAdd Caps method to get UUID value
Aleksander Mistewicz [Fri, 13 Oct 2017 17:20:07 +0000 (19:20 +0200)]
Add Caps method to get UUID value

Change-Id: I3c5ee9a4a3a399648328be6f2e03fab7eb7d56b0
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49608
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoAdd Caps to dryad configuration
Aleksander Mistewicz [Thu, 12 Oct 2017 12:54:33 +0000 (14:54 +0200)]
Add Caps to dryad configuration

In the future Capabilities will be read from MuxPi's hardware.
Currently write to and read from it is not supported therefore
it has been added to configuration.

Change-Id: Idedc71205bc4eea0fa489fa595daf6c367a1082c
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49596
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoAdd boruta_address to dryad configuration
Aleksander Mistewicz [Thu, 12 Oct 2017 12:27:18 +0000 (14:27 +0200)]
Add boruta_address to dryad configuration

Change-Id: I0627223dc2b4cd9b8c6d17564a20ac334811789f
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49595
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoAdd dryad executable
Aleksander Mistewicz [Tue, 3 Oct 2017 12:03:18 +0000 (14:03 +0200)]
Add dryad executable

Compiled dryad exposes Dryad interface with Go RPC.

Currently the only flag is path to configuration file.
It will be generated if it is not found.

Change-Id: I07809bea9991228b32f9bb24fae9c99dc1fad0c0
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49536
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoAdd generated client and server for Superviser
Aleksander Mistewicz [Fri, 16 Feb 2018 11:55:23 +0000 (12:55 +0100)]
Add generated client and server for Superviser

It uses go-rpcgen which can be installed with the following command:
    go get github.com/alecthomas/go-rpcgen

Command used to generate RPC stubs:
    go-rpcgen --source=boruta.go --type=Superviser \
        --target=rpc/superviser/superviser.go \
        --package=superviser \
        --imports "net/rpc",".=git.tizen.org/tools/boruta"

Change-Id: Ia6d327d847a4b2c80b4a1458dc30f862b2dded51
Reviewed-on: https://mcdsrvbld02.digital.local/review/49764
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoMake Superviser suitable for go-rpcgen
Aleksander Mistewicz [Fri, 16 Feb 2018 11:33:47 +0000 (12:33 +0100)]
Make Superviser suitable for go-rpcgen

Change-Id: Ieebd76be2278f076d9b20d13f9d6067209926cb7
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49763
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoAdd generated client and server for Dryad
Aleksander Mistewicz [Fri, 16 Feb 2018 11:53:48 +0000 (12:53 +0100)]
Add generated client and server for Dryad

It uses go-rpcgen which can be installed with the following command:
    go get github.com/alecthomas/go-rpcgen

Command used to generate RPC stubs:
    go-rpcgen --source=boruta.go --type=Dryad \
        --target=rpc/dryad/dryad.go \
        --package dryad \
        --imports "net/rpc",".=git.tizen.org/tools/boruta"

Change-Id: I20ffdc4f5f93cb57bde8878a371f88b507c24864
Reviewed-on: https://mcdsrvbld02.digital.local/review/49762
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoMake Dryad suitable for go-rpcgen
Aleksander Mistewicz [Fri, 16 Feb 2018 11:32:56 +0000 (12:32 +0100)]
Make Dryad suitable for go-rpcgen

Change-Id: If978d57f924ef730712c5533512ce5792feebca5
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49761
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoAdd dryad package
Aleksander Mistewicz [Fri, 8 Sep 2017 12:52:34 +0000 (14:52 +0200)]
Add dryad package

Package dryad provides:
 * implementation of Dryad interface
 * utilities to manage Dryad and its users

Verification steps:
    // compile tests
    GOARCH=arm GOARM=7 GOOS=linux ginkgo build -cover dryad
    // copy dryad/dryad.test to device
    // run everything
    ./dryad.test -ginkgo.v
    // run without measurements
    ./dryad.test -ginkgo.v -ginkgo.skipMeasurements
    // run prepare only
    ./dyrad.test -ginkgo.focus "should prepare"
    // private key will be printed on stderr
    // it can be used to verify that SSH key is properly installed

Currently dryad is being run as root on muxpi. Future patches will
probably use sudo and require configured file in /etc/sudoers.d/
directory.

Change-Id: I095361ffd1f4b2b3fa5dfe2c000f960dd32886e2
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
6 years agoAdd Dryad configuration package
Aleksander Mistewicz [Fri, 8 Sep 2017 12:52:11 +0000 (14:52 +0200)]
Add Dryad configuration package

A non-standard library for configuration serialization is used.
It is licensed under MIT license. Install it with command below:
    go get "github.com/BurntSushi/toml"

Change-Id: I71321d341ac8d64c6a9ed85f2d895524eca01fac
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
6 years agoImplement UpdateRequest
Maciej Wereski [Wed, 4 Oct 2017 18:07:07 +0000 (20:07 +0200)]
Implement UpdateRequest

Change-Id: Ibad4fab53af38f0be6794c1c16394c4bc06dafc9
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49546
Reviewed-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Tested-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
6 years agoChange Set methods in Requests interface
Maciej Wereski [Wed, 4 Oct 2017 10:40:09 +0000 (12:40 +0200)]
Change Set methods in Requests interface

One UpdateRequest() public method is introduced instead of three Set
methods. Also Priority values are shifted by one. This will be required
to check if user has set Priority field (which takes zero value when it
wasn't set).

Change-Id: I2be2573edb93cb4a70f7f155786e6a18ba520270
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49545
Reviewed-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Tested-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
6 years agoGuard requests collection with mutex
Maciej Wereski [Wed, 20 Sep 2017 11:11:46 +0000 (13:11 +0200)]
Guard requests collection with mutex

Package requests will be used by HTTP API implementation to provide
functionality required to handle request, so there may be many
simultaneous clients working on requests collection.

Change-Id: I5fbeeced6de199436b73f20ef24db3eb84b48689
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49523
Reviewed-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Tested-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
6 years agoInitial Request Queue implementation
Maciej Wereski [Fri, 7 Jul 2017 10:54:40 +0000 (12:54 +0200)]
Initial Request Queue implementation

Package requests provides Requests and ListFilter interfaces
implementation. Users of this package can create new Boruta requests,
list them (with filter), get detail information about them or modify it.
What still needs to be done is interaction with worker mostly. This
needs working implementations of Workers interface and appropriate
matcher.

Change-Id: Ia4458f1959f7e52fdbe1df5f89c86785f5db3e70
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49522
Reviewed-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Tested-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
6 years agoUse common error type for ErrWorkerNotFound
Aleksander Mistewicz [Tue, 10 Oct 2017 10:41:49 +0000 (12:41 +0200)]
Use common error type for ErrWorkerNotFound

Change-Id: I95123f98b8b3c53fa19c30d7f07afadce32d280d
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49581
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoRemove unused interface
Maciej Wereski [Tue, 10 Oct 2017 11:37:25 +0000 (13:37 +0200)]
Remove unused interface

Change-Id: I51f7072d1f5ab52ffb1635df65ca6a754c01db46
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49577
Reviewed-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoMake uint types have explicit sizes
Maciej Wereski [Fri, 6 Oct 2017 15:51:27 +0000 (17:51 +0200)]
Make uint types have explicit sizes

Change-Id: Ibed42f8862c3f21a8a29c477427950b879fabdc1
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49556
Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
6 years agoStore ip and key alongside WorkerInfo
Aleksander Mistewicz [Fri, 6 Oct 2017 11:34:04 +0000 (13:34 +0200)]
Store ip and key alongside WorkerInfo

Information about workers is being generated and used by different
components. Now it is possible to store:
 * ip address - used by tunnels and received by handler of Register call
 * private key - used by AccessInfo and generated by caller to Prepare

This patch also introduces generic approach to tests of getters and
setters.

Change-Id: Ic6fd0b3764a3d411ee47d901ac1b2d0683dd63fa
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49555
Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoReplace WorkerInfo with private mapWorker
Aleksander Mistewicz [Fri, 6 Oct 2017 10:16:07 +0000 (12:16 +0200)]
Replace WorkerInfo with private mapWorker

Change-Id: Iad8117199f6d0101fd3b0866d84a554d45a437bc
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49554
Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoRemove AccessInfo from WorkerInfo
Aleksander Mistewicz [Fri, 6 Oct 2017 10:02:35 +0000 (12:02 +0200)]
Remove AccessInfo from WorkerInfo

AccessInfo is associated with JobInfo and it is temporary information.
Before this change a simple ListWorkers would disclose data which should
be secured (private keys and addresses of a tunnels).

Change-Id: I14404d452c85e300f5e261b0a9e6d4144fbcf03a
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49553
Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Reviewed-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
6 years agoAdd common errors
Maciej Wereski [Fri, 7 Jul 2017 10:55:43 +0000 (12:55 +0200)]
Add common errors

Some types of errors may occur in more than one component of Boruta.
For now only one type is introduced, but there will be probably more in
the future.

Change-Id: Ie0a7eb8490fb2ec1c70d0e8e2fa27d8706d0040e
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49277
Reviewed-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
6 years agoMake ListFilter an interface
Maciej Wereski [Wed, 20 Sep 2017 14:55:47 +0000 (16:55 +0200)]
Make ListFilter an interface

Currently ListFilter is defined as a structure. We don't know
how such structure should look like. Moreover it will be probably
changed to match new uses. We're not interested in the data provided,
but what functionality it provides. Thus change it to simple interface.

Change-Id: Ib297345d2f188fc941cf04794f03ec5250501474
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49471

6 years agoFix types of request states
Maciej Wereski [Wed, 20 Sep 2017 11:16:13 +0000 (13:16 +0200)]
Fix types of request states

Change-Id: Ic8fa0bbe2f19d08deaf05a8f2e974fc45f368f6d
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49470