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