Merge "Improve device manager 1.4"
[ccsdk/features.git] / sdnr / wt / odlux / README.md
1 # Developing a ODLUX application
2
3 ## Introduction
4
5 ODLUX bundle contains the Browser based Grapical User Interface for SDN-R.
6 ODLUX is available as OSGi bundle that is running in Opendaylight Karaf environment, using the configured jetty server of Opendaylight.
7 Since ONAP Frankfurt a second WEB Server setup "sdncweb" is available, that extracts the JavaScrip files.
8
9 ## Prerequisites
10
11 Actual version in framework pom.xml in the frontend-maven-plugin definition.
12   * Node
13   * Yarn
14   * Lerna
15
16 You can install these globally or let it be installed by maven due "mvn clean install"
17
18 * Maven: 3 or higher
19 * Java: 8
20
21 ## Dev-Environment Installation
22
23  * install NodeJS LTS https://nodejs.org/en/ or via packetmanager
24  * sudo npm install -g yarn
25  * sudo yarn global add lerna
26  * get framework from repository: git clone https://gerrit.onap.org/r/ccsdk/features
27  * in features/sdnr/wt/odlux you find a structure like this:
28  ```
29   odlux
30   |-apps
31   |-core
32   |-framework
33
34  ```
35  * go to features/sdnr/wt/odlux/apps and create your app:
36  ```
37  mvn archetype:generate -DarchetypeGroupId=org.onap.ccsdk.features.sdnr.wt \
38   -DarchetypeArtifactId=odlux-app-archetype \
39   -DgroupId=<groupId> \
40   -DartifactId=<artifactId> \
41   -Dversion=<version> \
42   -DappName=<applicationName>
43  ```
44
45  * your start folder for your web application is src/
46  * in src2/main/java are located the Java files and in src2/main/resources/ is the blueprint located
47  * with ```yarn start``` you can run your application due runtime in your application folder
48  * by default this will run on http://localhost:3100/index.html
49  * if you have added new dependencies you have to run ```lerna bootstrap``` in odlux/
50  * build your app for development version you can use ```yarn run build``` or ```yarn run build:dev```
51  * build for karaf with ```mvn clean install```
52
53
54 ## Including app into karaf environment
55
56  * copy maven repository files to karaf repository e.g.: ```cp ~/.m2/repository/path/of/groupId/artifactId $KARAF_HOME/system/path/of/groupId/```
57  * check if odlux-core is started in karaf console: ```feature:list | grep odlux```
58  * if not install: ```sdnr-wt-odlux-core-feature```
59  * start your app in karaf console: ```bundle:install -s mvn:<groupId>/<artifactId>/<version>```
60
61 ## Including into ONAP sdnc docker container
62
63  * add maven module to odlux/pom.xml
64  * add dependency to odlux/apps/app-feature/pom.xml and odlux/apps/app-installer/pom.xml
65  * build odlux/pom.xml
66  * this will automatically package your app into the packaged zip file of the installer
67
68 ## Details
69
70 ### Default menu positions
71
72  * from 0 for top to 999 for bottom.
73
74 ```
75 0    Connect
76 10    Fault
77 20    Maintenance
78 30    Configuration
79 40    Protection
80 50    Performance
81 60    Security
82 70    Inventory
83 80    Topology
84 90    Mediator
85 100    Help
86 ```
87
88 ### blueprint.xml
89
90 ```
91 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
92     <reference id="loadersvc" availability="mandatory" activation="eager" interface="org.onap.ccsdk.features.sdnr.wt.odlux.model.bundles.OdluxBundleLoader"/>
93     <bean id="bundle" init-method="initialize" destroy-method="clean" class="org.onap.ccsdk.features.sdnr.wt.odlux.bundles.MyOdluxBundle">
94         <property name="loader" ref="loadersvc"/>
95         <property name="bundleName" value="demoApp"/>
96         <property name="index" value="999"/>
97     </bean>
98 </blueprint>
99 ```
100  * bundleName defines the applicationName => default javascript file: <applicationName>.js
101  * index defines the menu position.
102
103 ### MyOdluxBundle.java
104
105  * is just for getting access to the resources of its bundle (implemented because of OSGi access restrictions)
106
107 ### pom.xml
108
109  * The pom.xml in the framework subdirectory is the reference for ODLUX creation. [framework pom](framework/pom.xml)
110  * The node and yarn versions are specified
111  * A specific variant of "frontend-maven-plugin" is used to create the environment to compile to javascript. This modified frontend-maven-plugin installs node, yarn and (optionally lerna) to compile the typescript sources to javascript. These will be build into the dist folder.