Merge "Update Java API doc links to reflect fluorine"
[docs.git] / docs / developer-guide / didm-developer-guide.rst
1 .. _didm-developer-guide:
2
3 DIDM Developer Guide
4 ====================
5
6 Overview
7 --------
8
9 The Device Identification and Driver Management (DIDM) project addresses
10 the need to provide device-specific functionality. Device-specific
11 functionality is code that performs a feature, and the code is
12 knowledgeable of the capability and limitations of the device. For
13 example, configuring VLANs and adjusting FlowMods are features, and
14 there may be different implementations for different device types.
15 Device-specific functionality is implemented as Device Drivers. Device
16 Drivers need to be associated with the devices they can be used with. To
17 determine this association requires the ability to identify the device
18 type.
19
20 DIDM Architecture
21 -----------------
22
23 The DIDM project creates the infrastructure to support the following
24 functions:
25
26 -  **Discovery** - Determination that a device exists in the controller
27    management domain and connectivity to the device can be established.
28    For devices that support the OpenFlow protocol, the existing
29    discovery mechanism in OpenDaylight suffices. Devices that do not
30    support OpenFlow will be discovered through manual means such as the
31    operator entering device information via GUI or REST API.
32
33 -  **Identification** – Determination of the device type.
34
35 -  **Driver Registration** – Registration of Device Drivers as routed
36    RPCs.
37
38 -  **Synchronization** – Collection of device information, device
39    configuration, and link (connection) information.
40
41 -  **Data Models for Common Features** – Data models will be defined to
42    perform common features such as VLAN configuration. For example,
43    applications can configure a VLAN by writing the VLAN data to the
44    data store as specified by the common data model.
45
46 -  **RPCs for Common Features** – Configuring VLANs and adjusting
47    FlowMods are example of features. RPCs will be defined that specify
48    the APIs for these features. Drivers implement features for specific
49    devices and support the APIs defined by the RPCs. There may be
50    different Driver implementations for different device types.
51
52 Key APIs and Interfaces
53 -----------------------
54
55 .. _didm-flow-objective-api:
56
57 FlowObjective API
58 ~~~~~~~~~~~~~~~~~
59
60 Following are the list of the APIs to create the flow objectives to
61 install the flow rule in OpenFlow switch in pipeline agnostic way.
62 Currently these APIs are getting consumed by Atrium project.
63
64 Install the Forwarding Objective:
65
66 ``http://<CONTROLLER-IP>:8181/restconf/operations/atrium-flow-objective:forward``
67
68 Install the Filter Objective
69
70 ``http://<CONTROLLER-IP>:8181/restconf/operations/atrium-flow-objective:filter``
71
72 Install the Next Objective:
73
74 ``http://<CONTROLLER-IP>:8181/restconf/operations/atrium-flow-objective:next``
75
76 Flow mod driver API
77 ~~~~~~~~~~~~~~~~~~~
78
79 This release includes a flow mod driver for the HP 3800. This
80 driver adjusts the flows and push the same to the device. This API takes
81 the flow to be adjusted as input and displays the adjusted flow as
82 output in the REST output container. Here is the REST API to adjust and
83 push flows to HP 3800 device:
84
85 ::
86
87     http://<CONTROLLER-IP:8181>/restconf/operations/openflow-feature:adjust-flow
88
89 Here is an example of an ARP flow and how it gets adjusted and pushed to
90 device HP3800:
91
92 **adjust-flow input.**
93
94 ::
95
96     <?xml version="1.0" encoding="UTF-8" standalone="no"?>
97     <input xmlns="urn:opendaylight:params:xml:ns:yang:didm:drivers:openflow" xmlns:opendaylight-inventory="urn:opendaylight:inventory">
98       <node>/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='openflow:673249119553088']</node>
99         <flow>
100           <match>
101             <ethernet-match>
102                 <ethernet-type>
103                     <type>2054</type>
104                 </ethernet-type>
105             </ethernet-match>
106           </match>
107           <flags>SEND_FLOW_REM</flags>
108           <priority>0</priority>
109           <flow-name>ARP_FLOW</flow-name>
110           <instructions>
111             <instruction>
112                 <order>0</order>
113                 <apply-actions>
114                     <action>
115                         <order>0</order>
116                         <output-action>
117                             <output-node-connector>CONTROLLER</output-node-connector>
118                             <max-length>65535</max-length>
119                         </output-action>
120                     </action>
121                     <action>
122                         <order>1</order>
123                         <output-action>
124                             <output-node-connector>NORMAL</output-node-connector>
125                             <max-length>65535</max-length>
126                         </output-action>
127                     </action>
128                 </apply-actions>
129             </instruction>
130           </instructions>
131           <idle-timeout>180</idle-timeout>
132           <hard-timeout>1800</hard-timeout>
133           <cookie>10</cookie>
134         </flow>
135     </input>
136
137 In the output, you can see that the table ID has been identified for the
138 given flow and two flow mods are created as a result of adjustment. The
139 first one is to catch ARP packets in Hardware table 100 with an action
140 to goto table 200. The second flow mod is in table 200 with actions:
141 output normal and output controller.
142
143 **adjust-flow output.**
144
145 ::
146
147     {
148       "output": {
149         "flow": [
150           {
151             "idle-timeout": 180,
152             "instructions": {
153               "instruction": [
154                 {
155                   "order": 0,
156                   "apply-actions": {
157                     "action": [
158                       {
159                         "order": 1,
160                         "output-action": {
161                           "output-node-connector": "NORMAL",
162                           "max-length": 65535
163                         }
164                       },
165                       {
166                         "order": 0,
167                         "output-action": {
168                           "output-node-connector": "CONTROLLER",
169                           "max-length": 65535
170                         }
171                       }
172                     ]
173                   }
174                 }
175               ]
176             },
177             "strict": false,
178             "table_id": 200,
179             "flags": "SEND_FLOW_REM",
180             "cookie": 10,
181             "hard-timeout": 1800,
182             "match": {
183               "ethernet-match": {
184                 "ethernet-type": {
185                   "type": 2054
186                 }
187               }
188             },
189             "flow-name": "ARP_FLOW",
190             "priority": 0
191           },
192           {
193             "idle-timeout": 180,
194             "instructions": {
195               "instruction": [
196                 {
197                   "order": 0,
198                   "go-to-table": {
199                     "table_id": 200
200                   }
201                 }
202               ]
203             },
204             "strict": false,
205             "table_id": 100,
206             "flags": "SEND_FLOW_REM",
207             "cookie": 10,
208             "hard-timeout": 1800,
209             "match": {},
210             "flow-name": "ARP_FLOW",
211             "priority": 0
212           }
213         ]
214       }
215     }
216
217 API Reference Documentation
218 ---------------------------
219
220 Go to
221 http://${controller-ip}:8181/apidoc/explorer/index.html,
222 and look under DIDM section to see all the available REST calls and
223 tables