-
Notifications
You must be signed in to change notification settings - Fork 1
/
Archetype_Next_Steps.README
143 lines (100 loc) · 6.64 KB
/
Archetype_Next_Steps.README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
This project was generated using the MD-SAL Maven Archetype.
This ReadMe has the following sections:
1) Quick Start - Follow Steps Before Editing Anything
2) Quick Start - Deploying Your New Bundles.
3) Automatically Deploying your Bundles
4) Overview of Bundles
5) Which Bundles do I Need?
6) More Information
==========================================================
=== Quick Start - Follow Steps Before Editing Anything ===
==========================================================
These quick steps outline the commands you run one immediately following the creation of these projects.
1) One time only, cd into the 'generate' folder.
2) Run 'mvn clean install -Dgen' (this generates the remaining initial file content to finalize your
project's initial set up.
3) cd back up one level ( i.e. run 'cd ..' )
4) Delete the generate directory (it is no longer needed).
5) Run a maven build (i.e. 'mvn clean install' ).
You are now ready to modify your source code. If you want, you can deploy your MD-SAL application now.
================================================
=== Quick Start - Deploying Your New Bundles ===
================================================
These steps outline how to manually deploy your application feature into the controller.
1) Locate your ODL distribution. The distribution for the core controller is found under the controller git repository (after running a mvn clean install from the controller root).
The path is controller/opendaylight/distribution/opendaylight-karaf/target/assembly/bin.
2) Start karaf via command ./karaf.
3) Add your feature repo in the karaf. This can be done in following way, where <artifactId>, <groupId> and <version> are what you supplied before -
```
feature:repo-add mvn:<groupId>/features-<artifactId>/<version>/xml/features
```
An example of above command would be like below -
```
feature:repo-add mvn:org.opendaylight.controller/features-mdSalExample/1.0-SNAPSHOT/xml/features
```
4) Once feature repo is added, install the feature on karaf console via command such as
```
feature:install odl-task-web
```
If you have picked a different appName, then feature name will be odl-<appName>-web etc.
5) You should see messages similar to the following being printed:
Note: Below our "app-name" is "Task" (yours by default is the same)- you can see that we use that name as the prefix for classes.
2014-07-02 05:16:08.258 EDT [config-pusher] INFO o.o.c.c.y.c.t.i.TaskProviderModule - TaskProvider (instance org.opendaylight.controller.config.yang.config.task_provider.impl.TaskProviderModule$1CloseResources@11a15a0) initialized.
2014-07-02 05:16:08.305 EDT [config-pusher] INFO o.o.c.c.y.c.t.i.TaskConsumerModule - TaskConsumerService (instance org.opendaylight.controller.config.yang.config.task_consumer.impl.TaskConsumerModule$1AutoCloseableService@56e83e5e) initialized.
If you see these info messages printed on the Karaf log then you have successfully deployed your bundles!
===========================
=== Overview of Bundles ===
===========================
Once the archetype creation completes, you will have 5 sub folders created.
1) generate
- This is a helper folder which is used immediately after generating these files. It allows for
us to more intelligently configure your MD-SAL project beyond what a basic maven archetype can
do. Follow the steps in the 'Quick Start - Follow Steps Before Editing Anything' section above
to finish the archetype creation.
2) model
- This folder contains the sample yang file which defines your "model". The generated file
contains sample contents of a yang file. *Generally* speaking, you will not need to add any
java code here (it is auto-generated from the yang file). There are a few exceptions when writing
complex yang files. For now, assume you do not have any need to make modifications there.
3) provider
- The provider bundle sets you up with a service that implements any RPC (remote procedure calls)
that were defined in the model's yang files. Additionally, it automatically sets your application
up with access to the follow MD-SAL services:
a) DataBroker for reading, writing and listening to changes on models in the store
b) RpcRegistryService for registering your RPC implementation, or, invoking other RpcImplementations defined else where.
c) NotificationProviderService - for sending any Notifications defined in your yang file.
4) consumer
- The consumer bundle illustrates how you could write an application which consumes the RPC services
that you provide with your provider bundle. In the consumer we only set up initial access to the
RpcRegistryService, however with a few modifications you can gain access to the DataBroker and
NotificationProviderService as well.
5) web
- The web bundle provides an application that allows you to define customer REST APIs. Remember,
you get access to RESTConf web services for your model automatically just for deploying your
model.
6) features
- The Karaf features directory provides a list of sample features to enable provider, consumer and web.
In addition to above folders/bundles we also generate:
i) a root parent pom.xml file which enables quick building of your projects bundles
ii) a .gitignore file, which is set up to automatically ignore a default set of files (target
directories, eclipse project files etc). Therefore running a 'git add .' command from the
root project should add only the files you want checked into source!
iii) This read me.
================================
=== Which Bundles do I Need? ===
================================
The bundles you need depend on your application. Refer to the above descriptions for details on
what each bundle provides for you. Most MD-SAL applications can probably make due with just the following
bundles to start:
model
provider
If you don't want to use the other bundles for now, simply modify the root pom.xml and comment out
the remaining bundles from the "modules" section at the end of the pom.xml file. Then open features.xml file
present in features/src/main/resources directory. Remove the feature of project that you are removing. Like web or consumer feature.
Note: The consumer and provider bundles depend on the model bundle. So if you are using either of
those bundles you must also use the model bundle.
========================
=== More Information ===
========================
For more information, view the Archetype wiki page on wiki.opendaylight.org.
https://wiki.opendaylight.org/view/OpenDaylight_Toolkit:MD-SAL-Simple_Archetype