commit | 2f9b55c1a2aac9f0865beb73b6619b106b32edb2 | [log] [tgz] |
---|---|---|
author | wahidw <abdulwahid.w@nokia.com> | Tue Jan 14 05:20:39 2020 +0000 |
committer | wahidw <abdulwahid.w@nokia.com> | Tue Jan 14 05:20:45 2020 +0000 |
tree | 49d91561527b4ab8d21750230b74c114fbaee1f0 | |
parent | 51db0122302c9d72e1de6f8a8e250d219b8b44d8 [diff] |
Adding UT test cases for Multiple E2T Change-Id: Id20c52b2e1023c4d34906653a6cd57dd71cfd559 Signed-off-by: wahidw <abdulwahid.w@nokia.com>
Routing Manager is a basic platform service of RIC. It is responsible for distributing routing policies among the other platform components and xApps.
The routing manager has two ways to get the xapp details from xapp manager - httpGetter or httpRESTful. In case of httpGetter, the implemented logic periodically queries the xApp Manager component for xApps' list. Where in httpRESTful, starts a http server and creates a webhook subscription in xapp manager to update about changes in xapps and waits changed data to arrive on the REST http server. Either ways, the xapp data received is stored and then processed to create routing policies and distributes them to all xApps.
The architecture consists of the following five well defined functions:
Current implementation provides support for the followings:
Check the separated RELNOTES
file.
The Dockerfile located in the project root folder does the following three things:
docker build --tag=rtmgr-build:test .
in the project root directory (feel free to replace the name:tag with your own)Compiling without Docker involves some manual steps before compiling directly with "go build". The XApp manager's spec file must be fetched, then api generated with swagger. (these steps are included in the Dockerfile). After the code is generated, glide can install the dependencies of rtmgr. Make sure you set your GOPATH variable correctly (example: $HOME/go/src/routing-manager) Code generation and building example (from project root folder):
git clone "https://gerrit.o-ran-sc.org/r/ric-plt/appmgr" && cp appmgr/api/appmgr_rest_api.yaml api/ swagger generate server -f api/routing_manager.yaml -t pkg/ --exclude-main -r LICENSE swagger generate client -f api/appmgr_rest_api.yaml -t pkg/ -m appmgr_model -c appmgr_client -r LICENSE glide install --strip-vendor go build cmd/rtmgr.go
NOTE: before doing a docker build it is advised to remove any generated files and vendor packages:
# assuming that you stand in project root dir rm -rf appmgr vendor pkg/appmgr_* pkg/models pkg/restapi
Tag the rtmgr
container according to the project release and push it to a registry accessible from all minions of the Kubernetes cluster. Edit the container image section of rtmgr-dep.yaml
file according to the rtmgr
image tag.
Issue the kubectl create -f {manifest.yaml}
command in the following order:
manifests/namespace.yaml
: creates the example
namespace for routing-manager resourcesmanifests/rtmgr/rtmgr-cfg.yaml
: creates default routes config file for routing-managermanifests/rtmgr/rtmgr-dep.yaml
: instantiates the rtmgr
deployment in the example
namespacemanifests/rtmgr/rtmgr-svc.yaml
: creates the rtmgr
service in example
namespaceNOTE: The above manifest files will deploy routing manager with NBI as httpRESTful which would not succeed unless there is an xapp manager running at the defined xm-url. The solution is either to deploy a real XAPP manager before deploying routing-manager or start the mock xmgr as mentioned in Testing.
Routing Manager's behaviour can be tested using the mocked xApp Manager, traffic generator xApp and receiver xApp.
https://gerrit.o-ran-sc.org/r/admin/repos/ric-app/admin
adm-ctrl-xapp
binary to ./test/docker/xapp.build
folder furthermore copy all RMR related dinamycally linked library under ./test/docker/xapp.build/usr
folder. Issue docker build ./test/docker/xapp.build
command. Tag the recently created docker image and push it to the common registry.test-tx
binary to ./test/docker/xapp-tx.build
folder furthermore copy all RMR related dinamycally linked library under ./test/docker/xapp.build/usr
folder. Issue docker build ./test/docker/xapp-tx.build
command. Tag the recently created docker image and push it to the common registry../test/docker/xmgr.build
folder and issue docker build .
. Tag the recently created docker image and push it to the common registry../test/kubernetes/
folder accordingly then issue the kubectl create -f {manifest.yaml}
on each file.xmgr
via HTTPGet additonaly it starts to listen on http://rtmgr:8888/v1/handles/xapp-handle endpoint and ready to receive xapp list updates.test/data/xapp.json
file accordingly and issue the following curl command to update rtmgr's
xapp list. curl --header "Content-Type: application/json" --request POST --data '@./test/data/xapps.json' http://10.244.2.104:8888/v1/handles/xapp-handle
For running unit tests, execute the following command: go test ./pkg/nbi
(or any package - feel free to add your own parameters) If you wish to execute the full UT set with coverage:
mkdir -p unit-test go test ./pkg/sbi ./pkg/rpe ./pkg/nbi ./pkg/sdl -cover -race -coverprofile=$PWD/unit-test/c.out go tool cover -html=$PWD/unit-test/c.out -o $PWD/unit-test/coverage.htm
Routing manager binary can be called with -h
flag when it displays the available command line arguments and it's default value.
Example:
Usage of ./rtmgr: -configfile string Routing manager's configuration file path (default "/etc/rtmgrcfg.json") -filename string Absolute path of file where the route information to be stored (default "/db/rt.json") -loglevel string INFO | WARN | ERROR | DEBUG (default "INFO") -nbi string Northbound interface module to be used. Valid values are: 'httpGetter | httpRESTful' (default "httpGetter") -nbi-if string Base HTTP URL where routing manager will be listening on (default "http://localhost:8888") -rpe string Route Policy Engine to be used. Valid values are: 'rmrpush | rmrpub' (default "rmrpush") -sbi string Southbound interface module to be used. Valid values are: 'nngpush | nngpub' (default "nngpush") -sbi-if string IPv4 address of interface where Southbound socket to be opened (default "0.0.0.0") -sdl string Datastore enginge to be used. Valid values are: 'file' (default "file") -xm-url string HTTP URL where xApp Manager exposes the entire xApp List (default "http://localhost:3000/xapps")
For troubleshooting purpose the default logging level can be increased to DEBUG
. (by hand launch it's set to INFO, kubernetes manifest has DEBUG set by default).
[] Add unit tests
This project is licensed under the Apache License, Version 2.0 - see the LICENSE