Release dashboard image at version 2.1.0
[portal/ric-dashboard.git] / docs / developer-guide.rst
1 .. ===============LICENSE_START=======================================================
2 .. O-RAN SC CC-BY-4.0
3 .. %%
4 .. Copyright (C) 2019 AT&T Intellectual Property and Nokia
5 .. %%
6 .. Licensed under the Apache License, Version 2.0 (the "License");
7 .. you may not use this file except in compliance with the License.
8 .. You may obtain a copy of the License at
9 ..
10 ..      http://www.apache.org/licenses/LICENSE-2.0
11 ..
12 .. Unless required by applicable law or agreed to in writing, software
13 .. distributed under the License is distributed on an "AS IS" BASIS,
14 .. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 .. See the License for the specific language governing permissions and
16 .. limitations under the License.
17 .. ===============LICENSE_END=========================================================
18
19 RIC Dashboard Developer Guide
20 =============================
21
22 This document provides a quickstart for developers of the O-RAN SC RIC Dashboard web application.
23
24 Prerequisites
25 -------------
26
27 1. Java development kit (JDK), version 11 or later
28 2. Maven dependency-management tool, version 3.4 or later
29
30 Other tools including the Node Package Manager (npm) are fetched dynamically.
31
32 Angular Front-End Application
33 -----------------------------
34
35 The Angular 8 application files are in subdirectory ``webapp-frontend``.
36 Build the front-end application via ``mvn package``.  For development and debugging,
37 build the application, then launch an ng development server using this command::
38
39     ./ng serve --proxy-config proxy.conf.json
40
41 The app will automatically reload in the browser if you change any of the source files.
42 The ng server listens for requests at this URL:
43
44     http://localhost:4200
45
46
47 Spring-Boot Back-End Application
48 --------------------------------
49
50 A development (not production) server uses local configuration and serves mock data
51 that simulates the behavior of remote endpoints.  The back-end server listens for
52 requests at this URL:
53
54     http://localhost:8080
55
56 The directory ``src/test/resources`` contains usable versions of the required property
57 files.  These steps are required to launch:
58
59 1. Set an environment variable via JVM argument: ``-Dorg.oransc.ric.portal.dashboard=mock``
60 2. Run the JUnit test case ``DashboardServerTest`` which is not exactly a "test" because it never finishes.
61
62 Both steps can be done with this command-line invocation::
63
64      mvn -Dorg.oransc.ric.portal.dashboard=mock -Dtest=DashboardTestServer test
65
66 Development user authentication
67 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
68
69 The development server requires basic HTTP user authentication for all requests. Like
70 the production server, it requires HTTP headers with authentication for Portal API
71 requests.  The username and password are stored in constants in this Java class in
72 the ``src/test/java`` folder::
73
74     org.oransc.ric.portal.dashboard.config.WebSecurityMockConfiguration
75
76 Like the production server, the development server also performs role-based
77 authentication on requests. The user name-role name associations are also defined
78 in the class shown above.
79
80 Production user authentication
81 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
82
83 The server uses the ONAP Portal's "EPSDK-FW" library to support a
84 single-sign-on (SSO) feature, which requires users to authenticate
85 at the ONAP Portal UI. The RIC Dashboard can be on-boarded as an 
86 application on the ONAP Portal using its application on-boarding UI.
87
88 The server authenticates requests using cookies that are set
89 by the ONAP Portal::
90
91      EPService
92      UserId
93
94 The EPService value is not checked.  The UserId value is decrypted
95 using a secret key shared with the ONAP Portal to yield a user ID.
96 That ID must match a user's loginId defined in the user manager.
97
98 The regular server checks requests for the following granted
99 authorities (role names), as defined in the java class ``DashboardConstants``.
100 A standard user can invoke all "GET" methods but not make changes.
101 A system administrator can invoke all methods ("GET", "POST", "PUT",
102 "DELETE") to make arbitrary changes::
103
104     Standard_User
105     System_Administrator
106
107 Use the following structure in a JSON file to publish a user for the
108 user manager::
109
110     [
111      {
112       "orgId":null,
113       "managerId":null,
114       "firstName":"Demo",
115       "middleInitial":null,
116       "lastName":"User",
117       "phone":null,
118       "email":null,
119       "hrid":null,
120       "orgUserId":null,
121       "orgCode":null,
122       "orgManagerUserId":null,
123       "jobTitle":null,
124       "loginId":"demo",
125       "active":true,
126       "roles":[
127          {
128             "id":null,
129             "name":"Standard_User",
130             "roleFunctions":null
131          }
132       ]
133      }
134     ]