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