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