tools/boruta.git
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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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

7 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

7 years agoAdd tunnels to workers package
Aleksander Mistewicz [Tue, 5 Sep 2017 15:59:31 +0000 (17:59 +0200)]
Add tunnels to workers package

Tunnel forwards data between two hosts. It listens on the port,
on connection it opens a corresponding one to the worker, and copies
all data between them. Current implementation is not perfect
and hopefully will be changed soon.

Following library is being investigated:
    https://github.com/coreos/go-iptables

Change-Id: I610cf6aec17558f10ea26232a8ac9672a3a92cc0
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49438
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
7 years agoAdd benchmark tests for WorkerList
Aleksander Mistewicz [Mon, 19 Jun 2017 10:56:47 +0000 (12:56 +0200)]
Add benchmark tests for WorkerList

Change-Id: Ic92c9d6e23a55971edd1c9ad2d15c939c8a4dba6
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49120
Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Tested-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>
7 years agoImplement get information about the Worker
Aleksander Mistewicz [Thu, 8 Jun 2017 15:28:51 +0000 (17:28 +0200)]
Implement get information about the Worker

In order to avoid listing workers when information about only one is
needed, a convenience function has been added. It is faster and
guarantees that a single structure will be returned or an error.

workers/workers_test.go has been removed as all functions has been
implemented.

Change-Id: I0dfaccc4c55bdb30c5875de06db9d3b23b2345b2
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49062
Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Tested-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>
7 years agoImplement filtered worker listing
Aleksander Mistewicz [Thu, 8 Jun 2017 15:22:02 +0000 (17:22 +0200)]
Implement filtered worker listing

WorkerList first applies Capabilities (Caps) and then Group filter.
Currently Caps require exact match, i.e. all keys must be found and
values must be equal. It is planned to support ranges and lists
of values.

Change-Id: I705c7b2f3e7a0be5506c5e6cfef5cd32af274fc9
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49061
Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Tested-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>
7 years agoImplement setting groups for worker
Aleksander Mistewicz [Thu, 8 Jun 2017 13:29:10 +0000 (15:29 +0200)]
Implement setting groups for worker

One of the assumptions of Boruta system is that every user will have
access to the limited amount of resources. It is done by groups.
Initially Worker is not assigned to any. In order to add or remove
group from the list a new list should be created and SetGroups used
to replace it.

Change-Id: Id17eb5feab091dbaa90404d8a09bf4e52537fc61
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49060
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
7 years agoImplement setting worker state
Aleksander Mistewicz [Thu, 8 Jun 2017 13:00:34 +0000 (15:00 +0200)]
Implement setting worker state

In order to perform maintenance, Worker should be in a proper state.
Administrator should set state to MAINTENANCE before taking action
and set it back to IDLE so it will return to the pool.

Change-Id: I44e2c64645e3643c16e8484c746ae4a233a6d232
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49059
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
7 years agoImplement worker removal from the pool
Aleksander Mistewicz [Thu, 8 Jun 2017 12:51:47 +0000 (14:51 +0200)]
Implement worker removal from the pool

When Worker will not be used anymore, it should be removed in order
to free the resources. Administrator should first put Worker
in the MAINTENANCE state, using SetState, and then remove it,
using Deregister.

Change-Id: Ic9bb5e705418fae664857f3f541e9543ca7da9e2
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49058
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
7 years agoImplement state update after failure
Aleksander Mistewicz [Thu, 8 Jun 2017 12:30:34 +0000 (14:30 +0200)]
Implement state update after failure

When Worker detects malfunction of Dryad it informs Boruta server
of failure and reason of it. Boruta will not dispatch any jobs to worker
in the FAIL state. Only administrator is able to change the state.

Change-Id: I7132193218974fa3b8eb7d97d07b98e4e45dced3
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49057
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
7 years agoFix type of WorkerState constants
Aleksander Mistewicz [Mon, 4 Sep 2017 09:21:49 +0000 (11:21 +0200)]
Fix type of WorkerState constants

For unknown reason only the first value defined in the const block had
type WorkerState, all subsequent definitions had type string.

Change-Id: I1320a8a94525f08f37e14b79188bcfdac0048b0e
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49430
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
7 years agoImplement Worker registration
Aleksander Mistewicz [Thu, 8 Jun 2017 11:46:35 +0000 (13:46 +0200)]
Implement Worker registration

When new Dyrad (MuxPi board + tested device) is attached to network it
has all information to join Boruta server. It should register
with the server by providing Capabilities which are provided
by MuxPi hardware. They include UUID which will be used to identify
Dryad. After successful registration worker is put in the MAINTENANCE
state, which means that it won't get any jobs until administrator
manually puts it in the IDLE state.

Tests use new library, which can be downloaded with:
    go get github.com/satori/go.uuid

Change-Id: I75a72cf446dd4ff5bc4540f600bc7840c8a189f4
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49056
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
7 years agoAdd workers package
Aleksander Mistewicz [Thu, 8 Jun 2017 10:50:20 +0000 (12:50 +0200)]
Add workers package

Package workers is responsible for Workers list management. Moreover
it implements Superviser and Workers interfaces. It can be used either
directly from API handlers or indirectly through a decorator which can
add authentication layer. It can also be aggregated with implementation
of Requests interface to construct a implementation of Server.
Tests are added in order to achieve 100% coverage.

Change-Id: I268f9e61f7551993e279326a7bd33637248c453c
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49055
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
7 years agoAdd Dryad interface
Aleksander Mistewicz [Thu, 17 Aug 2017 13:17:35 +0000 (15:17 +0200)]
Add Dryad interface

User, Admin and Worker communication to Boruta was designed, but an
interface in opposite direction, from Server to Worker, was missing.

Change-Id: I915c31e12b0b49d6863d1162734db7a324d709d1
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49405
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
7 years agoRework interfaces definitions
Maciej Wereski [Tue, 12 Sep 2017 10:56:20 +0000 (12:56 +0200)]
Rework interfaces definitions

Current methods division between interfaces is done in a way that causes
situation where no package implements full interface. This change fixes
this situation.

Change-Id: Ifcfba7d740c86e853410b71da954810ceaf813f3
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49448
Reviewed-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Tested-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
7 years agoBase state types on string instead of byte
Maciej Wereski [Mon, 7 Aug 2017 15:09:51 +0000 (17:09 +0200)]
Base state types on string instead of byte

States may be frequently used in errors or other information messages.
Make them based on strings, so there's no need to implement String()
methods.

Change-Id: I1c4e0f0221b0e6ee9669cda9736fd3e7beceac51
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49391
Reviewed-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
7 years agoAdd UserInfo argument to NewRequest
Maciej Wereski [Tue, 4 Jul 2017 09:53:13 +0000 (11:53 +0200)]
Add UserInfo argument to NewRequest

Change-Id: I8a47938f22e836a1b07af2f07811af8d4942f911
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49200
Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Reviewed-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
7 years agoAdd missing license header
Maciej Wereski [Thu, 8 Jun 2017 07:58:23 +0000 (09:58 +0200)]
Add missing license header

Change-Id: I279647811b0a0399285441c46312e80e24747fc6
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/49053
Reviewed-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
Tested-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
7 years agoAdd basic structures of the boruta
Aleksander Mistewicz [Thu, 25 May 2017 17:34:03 +0000 (19:34 +0200)]
Add basic structures of the boruta

Change-Id: I56ba1e2898e7b90029cbdefdd2b29f4d73b40372
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Reviewed-on: https://mcdsrvbld02.digital.local/review/48999
Reviewed-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
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>
7 years agoInitial empty repository
Rafal Krypa [Tue, 2 May 2017 16:44:46 +0000 (18:44 +0200)]
Initial empty repository