Seed code for Routing Manager (ric-plt/rtmgr).
[ric-plt/rtmgr.git] / README.md
1 # Routing Manager\r
2 \r
3 ## Table of contents\r
4 * [Introduction](#introduction)\r
5 * [Release notes](#release-notes)\r
6 * [Prerequisites](#prerequisites)\r
7 * [Project folders structure](#project-folders-structure)\r
8 * [Installation guide](#installation-guide)\r
9   * [Compiling code](#compiling-code)\r
10   * [Building docker container](#building-docker-container)\r
11   * [Installing Routing Manager](#installing-routing-manager)\r
12   * [Testing and Troubleshoting](#testing-and-troubleshoting)\r
13 * [Upcoming changes](#upcoming-changes)\r
14 * [License](#license)\r
15 \r
16 ## Introduction\r
17 __Routing Manager__ is a basic platform serive of RIC. It is responsible for distributing routing policies among the other platform components and xApps.\r
18 \r
19 The implemented logic periodically queries the xApp Manager component for xApps' list. Stores the data then processes it to create routing policies and distributes them to all xApps.\r
20 The architecture consists of the following five well defined functions:\r
21 * NorthBound Interface (__NBI__): Maintains the communication channels towards RIC manager components \r
22 * Routing Policy Engine (__RPE__): Provides the logic to calculate routing policies\r
23 * Shared Data Layer (__SDL__): Provides access to different kind persistent data stores\r
24 * SouthBound Interface (__SBI__): Maintains the communication channels towards RIC tenants and control components\r
25 * Controll Logic (__RTMGR__): Controls the operatin of above functions\r
26 \r
27 Current implementation provides support for the followings:\r
28 * NBI:\r
29   * __httpGet__: simple HTTP GET interface. Expects an URL where it gets the xApps' list in JSON format\r
30   * (WIP) __httRESTful__: provides REST API endpoints towards RIC manager components \r
31 * RPE:\r
32   * __rmr__: creates routing policies formatted for RIC RMR\r
33 * SDL:\r
34   * __file__: stores xApp data in container's local filesystem (or in a mountpoint)\r
35   * (backlog) __sdl__: Shared Data Library to Redis database\r
36 * SBI:\r
37   * __nngpub__: distributes RPE created policies via NNG Pub channel\r
38   * (WIP) __nngpipe__: distributes RPE created policies via NNG Pipeline channel\r
39 \r
40 ## Release notes\r
41 Check the separated `RELNOTES` file.\r
42 \r
43 ## Prerequisites\r
44 * Healthy kubernetes cluster\r
45 * Access to the common docker registry\r
46 \r
47 ## Project folder structure\r
48 * /api: contains swagger source files\r
49 * /build: contains build tools (scripts, Dockerfiles, etc.)\r
50 * /manifest: contains deployment files (kubernetes manifests, helm chart)\r
51 * /cmd: contains go project's main file\r
52 * /pkg: contains go project's internal packages\r
53 * /test: contains CI/CD testing files (scripts, mocks, manifests)\r
54 \r
55 ## Installation guide\r
56 \r
57 ### Compiling code\r
58 Enter the project root and execute `./build.sh` script.\r
59 The build script has two main phases. First is the code compilation, where it creates a temporary container for downloading all dependencies then compiles the code. In the second phase it builds the production ready container and taggs it to `rtmgr:builder`\r
60 **NOTE:** The script puts a copy of the binary into the `./bin` folder for further use cases\r
61 \r
62 ### Installing Routing Manager\r
63 #### Preparing environment\r
64 Re-Tag the `rtmgr` container according to the project release and push it to a registry accessible from all minions of the kubernetes cluster.\r
65 Edit the container image section of `rtmgr-dep.yaml` file according to the `rtmgr` image tag\r
66 \r
67 #### Deploying Routing Manager \r
68 Issue the `kubectl create -f {manifest.yaml}` command in the following order\r
69   1. `manifests/namespaces.yaml`: creates the `example` namespace for routing-manager resources\r
70   2. `manifests/rtmgr/rtmgr-dep.yaml`: instantiates the `rtmgr` deployment in the `example` namespace\r
71   3. `manifests/rtmgr/rtmgr-svc.yaml`: creates the `rtmgr` service in `example` namespace\r
72 \r
73 ### Testing and Troubleshoting\r
74 Routing Manager's behaviour can be tested using the mocked xApp Manager, traffic generator xApp and receiver xApp.\r
75 \r
76   1. Checkout and compile both xApp receiver and xApp Tx generator of RIC admission control project\r
77   2. Copy the `adm-ctrl-xapp` binary to `./test/docker/xapp.build` folder. Enter the folder and issue `docker build .`. Tag the recently created docker image and push it to the common registry.\r
78   3. Copy the `test-tx` binary to `./test/docker/xapp-tx.build` folder. Enter the folder and issue `docker build .`.  Tag the recently created docker image and push it to the common registry.\r
79   4. Enter the `./test/docker/xmgr.build` folder and issue `docker build .`.  Tag the recently created docker image and push it to the common registry.\r
80   5. Modify the the docker image version in each kuberbetes manifest files under `./test/kubernetes/` folder accordingly then issue the `kubectl create -f {manifest.yaml}` on each file.\r
81   6. [Compile](#compiling-code) and [Install routing manager](#installing-routing-manager)\r
82 \r
83 #### Command line arguments\r
84 Routing manager binary can be called with `-h` flag when it displays the available command line arguments and it's default value.\r
85 \r
86 Example:\r
87 \r
88 ```bash\r
89 root@a3684ff4cdb0:/# ./rtmgr -h\r
90 Usage of ./rtmgr:\r
91   -loglevel string\r
92         INFO | WARN | ERROR | DEBUG (default "INFO")\r
93   -nbi-httpget string\r
94         xApp Manager URL (default "http://localhost:3000/xapps")\r
95   -rpe string\r
96         Policy Engine Module name (default "rmr")\r
97   -sbi-nngsub string\r
98         NNG Subsciption Socket URI (default "tcp://0.0.0.0:4560")\r
99   -sdl-file string\r
100         Local file store location (default "/db/rt.json")\r
101 ```\r
102 \r
103 For troubleshooting purpose the default logging level can be increased to `DEBUG`.\r
104 \r
105 ## Upcoming changes\r
106 [] Add RESTful NBI based on swagger api definition\r
107 \r
108 [] Support RMR Pipeline\r
109 \r
110 [] Add unit tests\r
111 \r
112 ## License\r
113 This project is licensed under the Apache License, Version 2.0 - see the [LICENSE](LICENSE)\r
114 \r