Updated git submodules
[docs.git] / docs / user-guide / snmp4sdn-user-guide.rst
1 SNMP4SDN User Guide
2 ===================
3
4 Overview
5 --------
6
7 We propose a southbound plugin that can control the off-the-shelf
8 commodity Ethernet switches for the purpose of building SDN using
9 Ethernet switches. For Ethernet switches, forwarding table, VLAN table,
10 and ACL are where one can install flow configuration on, and this is
11 done via SNMP and CLI in the proposed plugin. In addition, some settings
12 required for Ethernet switches in SDN, e.g., disabling STP and flooding,
13 are proposed.
14
15 .. figure:: ./images/snmp4sdn_in_odl_architecture.jpg
16    :alt: SNMP4SDN as an OpenDaylight southbound plugin
17
18    SNMP4SDN as an OpenDaylight southbound plugin
19
20 Configuration
21 -------------
22
23 Just follow the steps:
24
25 Prepare the switch list database file
26 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27
28 A sample is
29 `here <https://wiki.opendaylight.org/view/SNMP4SDN:switch_list_file>`__,
30 and we suggest to save it as */etc/snmp4sdn\_swdb.csv* so that SNMP4SDN
31 Plugin can automatically load this file. Note that the first line is
32 title and should not be removed.
33
34 Prepare the vendor-specific configuration file
35 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36
37 A sample is
38 `here <https://wiki.opendaylight.org/view/SNMP4SDN:snmp4sdn_VendorSpecificSwitchConfig_file>`__,
39 and we suggest to save it as
40 */etc/snmp4sdn\_VendorSpecificSwitchConfig.xml* so that SNMP4SDN Plugin
41 can automatically load this file.
42
43 Install SNMP4SDN Plugin
44 -----------------------
45
46 If using SNMP4SDN Plugin provided in OpenDaylight release, just do the
47 following from the Karaf CLI:
48
49 ::
50
51     feature:install odl-snmp4sdn-all
52
53 Troubleshooting
54 ---------------
55
56 Installation Troubleshooting
57 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58
59 Feature installation failure
60 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
61
62 When trying to install a feature, if the following failure occurs:
63
64 ::
65
66     Error executing command: Could not start bundle ...
67     Reason: Missing Constraint: Require-Capability: osgi.ee; filter="(&(osgi.ee=JavaSE)(version=1.7))"
68
69 A workaround: exit Karaf, and edit the file
70 <karaf\_directory>/etc/config.properties, remove the line
71 *${services-${karaf.framework}}* and the ", \\" in the line above.
72
73 Runtime Troubleshooting
74 ~~~~~~~~~~~~~~~~~~~~~~~
75
76 Problem starting SNMP Trap Interface
77 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
78
79 It is possible to get the following exception during controller startup.
80 (The error would not be printed in Karaf console, one may see it in
81 <karaf\_directory>/data/log/karaf.log)
82
83 ::
84
85     2014-01-31 15:00:44.688 CET [fileinstall-./plugins] WARN  o.o.snmp4sdn.internal.SNMPListener - Problem starting SNMP Trap Interface: {}
86      java.net.BindException: Permission denied
87             at java.net.PlainDatagramSocketImpl.bind0(Native Method) ~[na:1.7.0_51]
88             at java.net.AbstractPlainDatagramSocketImpl.bind(AbstractPlainDatagramSocketImpl.java:95) ~[na:1.7.0_51]
89             at java.net.DatagramSocket.bind(DatagramSocket.java:376) ~[na:1.7.0_51]
90             at java.net.DatagramSocket.<init>(DatagramSocket.java:231) ~[na:1.7.0_51]
91             at java.net.DatagramSocket.<init>(DatagramSocket.java:284) ~[na:1.7.0_51]
92             at java.net.DatagramSocket.<init>(DatagramSocket.java:256) ~[na:1.7.0_51]
93             at org.snmpj.SNMPTrapReceiverInterface.<init>(SNMPTrapReceiverInterface.java:126) ~[org.snmpj-1.4.3.jar:na]
94             at org.snmpj.SNMPTrapReceiverInterface.<init>(SNMPTrapReceiverInterface.java:99) ~[org.snmpj-1.4.3.jar:na]
95             at org.opendaylight.snmp4sdn.internal.SNMPListener.<init>(SNMPListener.java:75) ~[bundlefile:na]
96             at org.opendaylight.snmp4sdn.core.internal.Controller.start(Controller.java:174) [bundlefile:na]
97     ...
98
99 This indicates that the controller is being run as a user which does not
100 have sufficient OS privileges to bind the SNMPTRAP port (162/UDP)
101
102 Switch list file missing
103 ~~~~~~~~~~~~~~~~~~~~~~~~
104
105 The SNMP4SDN Plugin needs a switch list file, which is necessary for
106 topology discovery and should be provided by the administrator (so
107 please prepare one for the first time using SNMP4SDN Plugin, here is the
108 `sample <https://wiki.opendaylight.org/view/SNMP4SDN:switch_list_file>`__).
109 The default file path is /etc/snmp4sdn\_swdb.csv. SNMP4SDN Plugin would
110 automatically load this file and start topology discovery. If this file
111 is not ready there, the following message like this will pop up:
112
113 ::
114
115     2016-02-02 04:21:52,476 | INFO| Event Dispatcher | CmethUtil                        | 466 - org.opendaylight.snmp4sdn - 0.3.0.SNAPSHOT | CmethUtil.readDB() err: {}
116     java.io.FileNotFoundException: /etc/snmp4sdn_swdb.csv (No such file or directory)
117         at java.io.FileInputStream.open0(Native Method)[:1.8.0_65]
118         at java.io.FileInputStream.open(FileInputStream.java:195)[:1.8.0_65]
119         at java.io.FileInputStream.<init>(FileInputStream.java:138)[:1.8.0_65]
120         at java.io.FileInputStream.<init>(FileInputStream.java:93)[:1.8.0_65]
121         at java.io.FileReader.<init>(FileReader.java:58)[:1.8.0_65]
122         at org.opendaylight.snmp4sdn.internal.util.CmethUtil.readDB(CmethUtil.java:66)
123         at org.opendaylight.snmp4sdn.internal.util.CmethUtil.<init>(CmethUtil.java:43)
124     ...
125
126 Configuration
127 -------------
128
129 Just follow the steps:
130
131 1. Prepare the switch list database file
132 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133
134 A sample is
135 `here <https://wiki.opendaylight.org/view/SNMP4SDN:switch_list_file>`__,
136 and we suggest to save it as */etc/snmp4sdn\_swdb.csv* so that SNMP4SDN
137 Plugin can automatically load this file.
138
139 .. note::
140
141     The first line is title and should not be removed.
142
143 2. Prepare the vendor-specific configuration file
144 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145
146 A sample is
147 `here <https://wiki.opendaylight.org/view/SNMP4SDN:snmp4sdn_VendorSpecificSwitchConfig_file>`__,
148 and we suggest to save it as
149 */etc/snmp4sdn\_VendorSpecificSwitchConfig.xml* so that SNMP4SDN Plugin
150 can automatically load this file.
151
152 3. Install SNMP4SDN Plugin
153 ~~~~~~~~~~~~~~~~~~~~~~~~~~
154
155 If using SNMP4SDN Plugin provided in OpenDaylight release, just do the
156 following:
157
158 Launch Karaf in Linux console:
159
160 ::
161
162     cd <Boron_controller_directory>/bin
163     (for example, cd distribution-karaf-x.x.x-Boron/bin)
164
165 ::
166
167     ./karaf
168
169 Then in Karaf console, execute:
170
171 ::
172
173     feature:install odl-snmp4sdn-all
174
175 4. Load switch list
176 ~~~~~~~~~~~~~~~~~~~
177
178 For initialization, we need to feed SNMP4SDN Plugin the switch list.
179 Actually SNMP4SDN Plugin automatically try to load the switch list at
180 /etc/snmp4sdn\_swdb.csv if there is. If so, this step could be skipped.
181 In Karaf console, execute:
182
183 ::
184
185     snmp4sdn:ReadDB <switch_list_path>
186     (For example, snmp4sdn:ReadDB /etc/snmp4sdn_swdb.csv)
187     (in Windows OS, For example, snmp4sdn:ReadDB D://snmp4sdn_swdb.csv)
188
189 A sample is
190 `here <https://wiki.opendaylight.org/view/SNMP4SDN:switch_list_file>`__,
191 and we suggest to save it as */etc/snmp4sdn\_swdb.csv* so that SNMP4SDN
192 Plugin can automatically load this file.
193
194 .. note::
195
196     The first line is title and should not be removed.
197
198 5. Show switch list
199 ~~~~~~~~~~~~~~~~~~~
200
201 ::
202
203     snmp4sdn:PrintDB
204
205 Tutorial
206 --------
207
208 Topology Service
209 ~~~~~~~~~~~~~~~~
210
211 Execute topology discovery
212 ^^^^^^^^^^^^^^^^^^^^^^^^^^
213
214 The SNMP4SDN Plugin automatically executes topology discovery on
215 startup. One may use the following commands to invoke topology discovery
216 manually. Note that you may need to wait for seconds for itto complete.
217
218 .. note::
219
220     Currently, one needs to manually execute *snmp4sdn:TopoDiscover*
221     first (just once), then later the automatic topology discovery can
222     be successful. If switches change (switch added or removed),
223     *snmp4sdn:TopoDiscover* is also required. A future version will fix
224     it to eliminate these requirements.
225
226 ::
227
228     snmp4sdn:TopoDiscover
229
230 If one like to discover all inventory (i.e. switches and their ports)
231 but not edges, just execute "TopoDiscoverSwitches":
232
233 ::
234
235     snmp4sdn:TopoDiscoverSwitches
236
237 If one like to only discover all edges but not inventory, just execute
238 "TopoDiscoverEdges":
239
240 ::
241
242     snmp4sdn:TopoDiscoverEdges
243
244 You can also trigger topology discovery via the REST API by using
245 ``curl`` from the Linux console (or any other REST client):
246
247 ::
248
249     curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/topology:rediscover
250
251 You can change the periodic topology discovery interval via a REST API:
252
253 ::
254
255     curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/topology:set-discovery-interval -d "{"input":{"interval-second":'<interval_time>'}}"
256     For example, set the interval as 15 seconds:
257     curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/topology:set-discovery-interval -d "{"input":{"interval-second":'15'}}"
258
259 Show the topology
260 ^^^^^^^^^^^^^^^^^
261
262 SNMP4SDN Plugin supports to show topology via REST API:
263
264 -  Get topology
265
266    ::
267
268        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/topology:get-edge-list
269
270 -  Get switch list
271
272    ::
273
274        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/topology:get-node-list
275
276 -  Get switches' ports list
277
278    ::
279
280        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/topology:get-node-connector-list
281
282 -  The three commands above are just for user to get the latest topology
283    discovery result, it does not trigger SNMP4SDN Plugin to do topology
284    discovery.
285
286 -  To trigger SNMP4SDN Plugin to do topology discover, as described in
287    aforementioned *Execute topology discovery*.
288
289 Flow configuration
290 ~~~~~~~~~~~~~~~~~~
291
292 FDB configuration
293 ^^^^^^^^^^^^^^^^^
294
295 SNMP4SDN supports to add entry on FDB table via REST API:
296
297 -  Get FDB table
298
299    ::
300
301        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/fdb:get-fdb-table -d "{input:{"node-id":<switch-mac-address-in-number>}}"
302
303        For example:
304        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/fdb:get-fdb-table -d "{input:{"node-id":158969157063648}}"
305
306 -  Get FDB table entry
307
308    ::
309
310        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/fdb:get-fdb-entry -d "{input:{"node-id":<switch-mac-address-in-number>, "vlan-id":<vlan-id-in-number>, "dest-mac-addr":<destination-mac-address-in-number>}}"
311
312        For example:
313        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/fdb:get-fdb-entry -d "{input:{"node-id":158969157063648, "vlan-id":1, "dest-mac-addr":158969157063648}}"
314
315 -  Set FDB table entry
316
317    (Notice invalid value: (1) non unicast mac (2) port not in the VLAN)
318
319    ::
320
321        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/fdb:set-fdb-entry -d "{input:{"node-id":<switch-mac-address-in-number>, "vlan-id":<vlan-id-in-number>, "dest-mac-addr":<destination-mac-address-in-number>, "port":<port-in-number>, "type":'<type>'}}"
322
323        For example:
324        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/fdb:set-fdb-entry -d "{input:{"node-id":158969157063648, "vlan-id":1, "dest-mac-addr":187649984473770, "port":23, "type":'MGMT'}}"
325
326 -  Delete FDB table entry
327
328    ::
329
330        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/fdb:del-fdb-entry -d "{input:{"node-id":<switch-mac-address-in-number>, "vlan-id":<vlan-id-in-number>, "dest-mac-addr":<destination-mac-address-in-number>}}"
331
332        For example:
333        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/fdb:del-fdb-entry -d "{input:{"node-id":158969157063648, "vlan-id":1, "dest-mac-addr":187649984473770}}"
334
335 VLAN configuration
336 ^^^^^^^^^^^^^^^^^^
337
338 SNMP4SDN supports to add entry on VLAN table via REST API:
339
340 -  Get VLAN table
341
342    ::
343
344        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/vlan:get-vlan-table -d "{input:{node-id:<switch-mac-address-in-number>}}"
345
346        For example:
347        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vlan:get-vlan-table -d "{input:{node-id:158969157063648}}"
348
349 -  Add VLAN
350
351    ::
352
353        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/vlan:add-vlan -d "{"input":{"node-id":<switch-mac-address-in-number>, "vlan-id":<vlan-id-in-number>, "vlan-name":'<vlan-name>'}}"
354
355        For example:
356        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vlan:add-vlan -d "{"input":{"node-id":158969157063648, "vlan-id":123, "vlan-name":'v123'}}"
357
358 -  Delete VLAN
359
360    ::
361
362        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/vlan:delete-vlan -d "{"input":{"node-id":<switch-mac-address-in-number>, "vlan-id":<vlan-id-in-number>}}"
363
364        For example:
365        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vlan:delete-vlan -d "{"input":{"node-id":158969157063648, "vlan-id":123}}"
366
367 -  Add VLAN and set ports
368
369    ::
370
371        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/vlan:add-vlan-and-set-ports -d "{"input":{"node-id":<switch-mac-address-in-number>, "vlan-id":<vlan-id-in-number>, "vlan-name":'<vlan-name>', "tagged-port-list":'<tagged-ports-separated-by-comma>', "untagged-port-list":'<untagged-ports-separated-by-comma>'}}"
372
373        For example:
374        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vlan:add-vlan-and-set-ports -d "{"input":{"node-id":158969157063648, "vlan-id":123, "vlan-name":'v123', "tagged-port-list":'1,2,3', "untagged-port-list":'4,5,6'}}"
375
376 -  Set VLAN ports
377
378    ::
379
380        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/vlan:set-vlan-ports -d "{"input":{"node-id":<switch-mac-address-in-number>, "vlan-id":<vlan-id-in-number>, "tagged-port-list":'<tagged-ports-separated-by-comma>', "untagged-port-list":'<untagged-ports-separated-by-comma>'}}"
381
382        For example:
383        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vlan:set-vlan-ports -d "{"input":{"node-id":"158969157063648", "vlan-id":"123", "tagged-port-list":'4,5', "untagged-port-list":'2,3'}}"
384
385 ACL configuration
386 ^^^^^^^^^^^^^^^^^
387
388 SNMP4SDN supports to add flow on ACL table via REST API. However, it is
389 so far only implemented for the D-Link DGS-3120 switch.
390
391 ACL configuration via CLI is vendor-specific, and SNMP4SDN will support
392 configuration with vendor-specific CLI in future release.
393
394 To do ACL configuration using the REST APIs, use commands like the
395 following:
396
397 -  Clear ACL table
398
399    ::
400
401        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/acl:clear-acl-table -d "{"input":{"nodeId":<switch-mac-address-in-number>}}"
402
403        For example:
404        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/acl:clear-acl-table -d "{"input":{"nodeId":158969157063648}}"
405
406 -  Create ACL profile (IP layer)
407
408    ::
409
410        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/acl:create-acl-profile -d "{input:{"nodeId":<switch-mac-address-in-number>,"profile-id":<profile_id_in_number>,"profile-name":'<profile_name>',"acl-layer":'IP',"vlan-mask":<vlan_mask_in_number>,"src-ip-mask":'<src_ip_mask>',"dst-ip-mask":"<destination_ip_mask>"}}"
411
412        For example:
413        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/acl:create-acl-profile -d "{input:{"nodeId":158969157063648,"profile-id":1,"profile-name":'profile_1',"acl-layer":'IP',"vlan-mask":1,"src-ip-mask":'255.255.0.0',"dst-ip-mask":'255.255.255.255'}}"
414
415 -  Create ACL profile (MAC layer)
416
417    ::
418
419        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/acl:create-acl-profile -d "{input:{"nodeId":<switch-mac-address-in-number>,"profile-id":<profile_id_in_number>,"profile-name":'<profile_name>',"acl-layer":'ETHERNET',"vlan-mask":<vlan_mask_in_number>}}"
420
421        For example:
422        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/acl:create-acl-profile -d "{input:{"nodeId":158969157063648,"profile-id":2,"profile-name":'profile_2',"acl-layer":'ETHERNET',"vlan-mask":4095}}"
423
424 -  Delete ACL profile
425
426    ::
427
428        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/acl:del-acl-profile -d "{input:{"nodeId":<switch-mac-address-in-number>,"profile-id":<profile_id_in_number>}}"
429
430        For example:
431        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/acl:del-acl-profile -d "{input:{"nodeId":158969157063648,"profile-id":1}}"
432
433    ::
434
435        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/acl:del-acl-profile -d "{input:{"nodeId":<switch-mac-address-in-number>,"profile-name":"<profile_name>"}}"
436
437        For example:
438        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/acl:del-acl-profile -d "{input:{"nodeId":158969157063648,"profile-name":'profile_2'}}"
439
440 -  Set ACL rule
441
442    ::
443
444        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/acl:set-acl-rule -d "{input:{"nodeId":<switch-mac-address-in-number>,"profile-id":<profile_id_in_number>,"profile-name":'<profile_name>',"rule-id":<rule_id_in_number>,"port-list":[<port_number>,<port_number>,...],"acl-layer":'<acl_layer>',"vlan-id":<vlan_id_in_number>,"src-ip":"<src_ip_address>","dst-ip":'<dst_ip_address>',"acl-action":'<acl_action>'}}"
445        (<acl_layer>: IP or ETHERNET)
446        (<acl_action>: PERMIT as permit, DENY as deny)
447
448        For example:
449        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/acl:set-acl-rule -d "{input:{"nodeId":158969157063648,"profile-id":1,"profile-name":'profile_1',"rule-id":1,"port-list":[1,2,3],"acl-layer":'IP',"vlan-id":2,"src-ip":'1.1.1.1',"dst-ip":'2.2.2.2',"acl-action":'PERMIT'}}"
450
451 -  Delete ACL rule
452
453    ::
454
455        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/acl:del-acl-rule -d "{input:{"nodeId":<switch-mac-address-in-number>,"profile-id":<profile_id_in_number>,"profile-name":'<profile_name>',"rule-id":<rule_id_in_number>}}"
456
457        For example:
458        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/acl:del-acl-rule -d "{input:{"nodeId":158969157063648,"profile-id":1,"profile-name":'profile_1',"rule-id":1}}"
459
460 Special configuration
461 ~~~~~~~~~~~~~~~~~~~~~
462
463 SNMP4SDN supports setting the following special configurations via REST
464 API:
465
466 -  Set STP port state
467
468    ::
469
470        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/config:set-stp-port-state -d "{input:{"node-id":<switch-mac-address-in-number>, "port":<port_number>, enable:<true_or_false>}}"
471        (true: enable, false: disable)
472
473        For example:
474        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/config:set-stp-port-state -d "{input:{"node-id":158969157063648, "port":2, enable:false}}"
475
476 -  Get STP port state
477
478    ::
479
480        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/config:get-stp-port-state -d "{input:{"node-id":<switch-mac-address-in-number>, "port":<port_number>}}"
481
482        For example:
483        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/config:get-stp-port-state -d "{input:{"node-id":158969157063648, "port":2}}"
484
485 -  Get STP port root
486
487    ::
488
489        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/config:get-stp-port-root -d "{input:{"node-id":<switch-mac-address-in-number>, "port":<port_number>}}"
490
491        For example:
492        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/config:get-stp-port-root -d "{input:{"node-id":158969157063648, "port":2}}"
493
494 -  Enable STP
495
496    ::
497
498        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/config:enable-stp -d "{input:{"node-id":<switch-mac-address-in-number>}}"
499
500        For example:
501        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/config:enable-stp -d "{input:{"node-id":158969157063648}}"
502
503 -  Disable STP
504
505    ::
506
507        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/config:disable-stp -d "{input:{"node-id":<switch-mac-address-in-number>}}"
508
509        For example:
510        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/config:disable-stp -d "{input:{"node-id":158969157063648}}"
511
512 -  Get ARP table
513
514    ::
515
516        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/config:get-arp-table -d "{input:{"node-id":<switch-mac-address-in-number>}}"
517
518        For example:
519        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/config:get-arp-table -d "{input:{"node-id":158969157063648}}"
520
521 -  Set ARP entry
522
523    (Notice to give IP address with subnet prefix)
524
525    ::
526
527        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/config:set-arp-entry -d "{input:{"node-id":<switch-mac-address-in-number>, "ip-address":'<ip_address>', "mac-address":<mac_address_in_number>}}"
528
529        For example:
530        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/config:set-arp-entry -d "{input:{"node-id":158969157063648, "ip-address":'10.217.9.9', "mac-address":1}}"
531
532 -  Get ARP entry
533
534    ::
535
536        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/config:get-arp-entry -d "{input:{"node-id":<switch-mac-address-in-number>, "ip-address":'<ip_address>'}}"
537
538        For example:
539        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/config:get-arp-entry -d "{input:{"node-id":158969157063648, "ip-address":'10.217.9.9'}}"
540
541 -  Delete ARP entry
542
543    ::
544
545        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://<controller_ip_address>:8181/restconf/operations/config:delete-arp-entry -d "{input:{"node-id":<switch-mac-address-in-number>, "ip-address":'<ip_address>'}}"
546
547        For example:
548        curl --user "admin":"admin" -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/config:delete-arp-entry -d "{input:{"node-id":158969157063648, "ip-address":'10.217.9.9'}}"
549
550 Using Postman to invoke REST API
551 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
552
553 Besides using the curl tool to invoke REST API, like the examples
554 aforementioned, one can also use GUI tool like Postman for better data
555 display.
556
557 -  Install Postman: `Install Postman in the Chrome
558    browser <https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en>`__
559
560 -  In the chrome browser bar enter
561
562    ::
563
564        chrome://apps/
565
566 -  Click on Postman.
567
568 Example: Get VLAN table using Postman
569 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
570
571 As the screenshot shown below, one needs to fill in required fields.
572
573 ::
574
575     URL:
576     http://<controller_ip_address>:8181/restconf/operations/vlan:get-vlan-table
577
578     Accept header:
579     application/json
580
581     Content-type:
582     application/json
583
584     Body:
585     {input:{"node-id":<node_id>}}
586     for example:
587     {input:{"node-id":158969157063648}}
588
589 .. figure:: ./images/snmp4sdn_getvlantable_postman.jpg
590    :alt: Example: Get VLAN table using Postman
591
592    Example: Get VLAN table using Postman
593
594 Multi-vendor support
595 --------------------
596
597 So far the supported vendor-specific configurations:
598
599 -  Add VLAN and set ports
600
601 -  (More functions are TBD)
602
603 The SNMP4SDN Plugin would examine whether the configuration is described
604 in the vendor-specific configuration file. If yes, the configuration
605 description would be adopted, otherwise just use the default
606 configuration. For example, adding VLAN and setting the ports is
607 supported via SNMP standard MIB. However we found some special cases,
608 for example, certain Accton switch requires to add VLAN first and then
609 allows to set the ports. So one may describe this in the vendor-specific
610 configuration file.
611
612 A vendor-specific configuration file sample is
613 `here <https://wiki.opendaylight.org/view/SNMP4SDN:snmp4sdn_VendorSpecificSwitchConfig_file>`__,
614 and we suggest to save it as
615 */etc/snmp4sdn\_VendorSpecificSwitchConfig.xml* so that SNMP4SDN Plugin
616 can automatically load it.
617
618 Help
619 ----
620
621 -  `SNMP4SDN Wiki <https://wiki.opendaylight.org/view/SNMP4SDN:Main>`__
622
623 -  SNMP4SDN Mailing Lists:
624    (`user <https://lists.opendaylight.org/mailman/listinfo/snmp4sdn-users>`__,
625    `developer <https://lists.opendaylight.org/mailman/listinfo/snmp4sdn-dev>`__)
626
627 -  Latest
628    `troubleshooting <https://wiki.opendaylight.org/view/SNMP4SDN:User_Guide#Troubleshooting>`__
629    in Wiki
630