Added JSON and XML payloads tabs with RFC 8040 URL
[bgpcep.git] / docs / bgp / bgp-user-guide-test-tools.rst
1 .. _bgp-user-guide-test-tools:
2
3 Test Tools
4 ==========
5 BGP test tools serves to test basic BGP functionality, scalability and performance.
6
7 .. contents:: Contents
8    :depth: 2
9    :local:
10
11 BGP Test Tool
12 ^^^^^^^^^^^^^
13 The BGP Test Tool is a stand-alone Java application purposed to simulate remote BGP peers, that are capable to advertise sample routes.
14 This application is not part of the OpenDaylight Karaf distribution, however it can be downloaded from OpenDaylight's Nexus (use latest release version):
15
16 ``https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/bgpcep/bgp-testtool``
17
18 Usage
19 '''''
20 The application can be run from command line:
21
22 .. code-block:: console
23
24    java -jar bgp-testtool-*-executable.jar
25
26
27 with optional input parameters:
28
29 .. code-block:: console
30
31    -i <BOOLEAN>, --active <BOOLEAN>
32       Active initialisation of the connection, by default false.
33
34    -ho <N>, --holdtimer <N>
35       In seconds, value of the desired holdtimer, by default 90.
36
37    -sc <N>, --speakersCount <N>
38       Number of simulated BGP speakers, when creating each speaker, uses incremented local-address for binding, by default 0.
39
40    -ra <IP_ADDRESS:PORT,...>, --remote-address <IP_ADDRESS:PORT,...>
41       A list of IP addresses of remote BGP peers, that the tool can accept or initiate connect to that address (based on the mode), by default 192.0.2.2:1790.
42
43    -la <IP_ADDRESS:PORT>, --localAddress <IP_ADDRESS:PORT>
44       IP address of BGP speakers which the tools simulates, by default 192.0.2.2:0.
45
46    -pr <N>, --prefixes <N>
47       Number of prefixes to be advertised by each simulated speaker
48
49    -mp <BOOLEAN>, --multiPathSupport <BOOLEAN>
50       Active ADD-PATH support, by default false.
51
52    -as <N>, --as <N>
53       Local AS Number, by default 64496.
54
55    -ec <EXTENDED_COMMUNITIES>, --extended_communities <EXTENDED_COMMUNITIES>
56       Extended communities to be send. Format: x,x,x  where  x  is  each  extended  community from bgp-types.yang, by default empty.
57
58    -ll <LOG_LEVEL>, --log_level <LOG_LEVEL>
59       Log level for console output, by default INFO.
60
61 BGP Application Peer Benchmark
62 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63 It is a simple OpenDaylight application which is capable to inject and remove specific amount of IPv4 routes.
64 This application is part of the OpenDaylight Karaf distribution.
65
66 Configuration
67 '''''''''''''
68 As a first step install BGP and RESTCONF, then configure *Application Peer*.
69 Install ``odl-bgpcep-bgp-benchmark`` feature and reconfigure BGP Application Peer Benchmark application as per following:
70
71 **URL:** ``/restconf/config/odl-bgp-app-peer-benchmark-config:config``
72
73 **RFC8040 URL:** ``/rests/data/odl-bgp-app-peer-benchmark-config:config``
74
75 **Method:** ``PUT``
76
77 .. tabs::
78
79    .. tab:: XML
80
81       **Content-Type:** ``application/xml``
82
83       **Request Body:**
84
85       .. code-block:: xml
86          :linenos:
87          :emphasize-lines: 2
88
89          <odl-bgp-app-peer-benchmark-config xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark-config">
90             <app-peer-id xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark-config">10.25.1.9</app-peer-id>
91          </odl-bgp-app-peer-benchmark-config>
92
93       @line 2: The *Application Peer* identifier.
94
95    .. tab:: JSON
96
97       **Content-Type:** ``application/json``
98
99       **Request Body:**
100
101       .. code-block:: json
102          :linenos:
103          :emphasize-lines: 3
104
105          {
106              "odl-bgp-app-peer-benchmark-config": {
107                  "app-peer-id": "10.25.1.9"
108              }
109          }
110
111       @line 3: The *Application Peer* identifier.
112
113 Inject routes
114 '''''''''''''
115 Routes injection can be invoked via RPC:
116
117 **URL:** ``/restconf/operations/odl-bgp-app-peer-benchmark:add-prefix``
118
119 **RFC8040 URL:** ``/rests/operations/odl-bgp-app-peer-benchmark:add-prefix``
120
121 **Method:** ``POST``
122
123 .. tabs::
124
125    .. tab:: XML
126
127       **Content-Type:** ``application/xml``
128
129       **Request Body:**
130
131       .. code-block:: xml
132          :linenos:
133          :emphasize-lines: 2,3,4,5
134
135          <input xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
136              <prefix>1.1.1.1/32</prefix>
137              <count>100000</count>
138              <batchsize>2000</batchsize>
139              <nexthop>192.0.2.2</nexthop>
140          </input>
141
142       @line 2: A initial IPv4 prefix carried in route. Value is incremented for following routes.
143
144       @line 3: An amount of routes to be added to *Application Peer's* programmable RIB.
145
146       @line 4: A size of the transaction batch.
147
148       @line 5: A NEXT_HOP attribute value used in all injected routes.
149
150       **Response Body:**
151
152       .. code-block:: xml
153          :linenos:
154          :emphasize-lines: 3,4,5
155
156          <output xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
157              <result>
158                  <duration>4301</duration>
159                  <rate>25000</rate>
160                  <count>100000</count>
161              </result>
162          </output>
163
164       @line 3: Request duration in milliseconds.
165
166       @line 4: Writes per second rate.
167
168       @line 5: An amount of routes added to *Application Peer's* programmable RIB.
169
170    .. tab:: JSON
171
172       **Content-Type:** ``application/json``
173
174       **Request Body:**
175
176       .. code-block:: json
177          :linenos:
178          :emphasize-lines: 3,4,5,6
179
180          {
181              "odl-bgp-app-peer-benchmark:input": {
182                  "prefix": "1.1.1.1/32",
183                  "count": 100000,
184                  "batchsize": 2000,
185                  "nexthop": "192.0.2.2"
186              }
187          }
188
189       @line 3: A initial IPv4 prefix carried in route. Value is incremented for following routes.
190
191       @line 4: An amount of routes to be added to *Application Peer's* programmable RIB.
192
193       @line 5: A size of the transaction batch.
194
195       @line 6: A NEXT_HOP attribute value used in all injected routes.
196
197       **Response Body:**
198
199       .. code-block:: json
200          :linenos:
201          :emphasize-lines: 4,5,6
202
203          {
204              "output": {
205                  "result": {
206                      "duration": 4757,
207                      "rate": 25000,
208                      "count": 100000
209                  }
210              }
211          }
212
213       @line 4: Request duration in milliseconds.
214
215       @line 5: Writes per second rate.
216
217       @line 6: An amount of routes added to *Application Peer's* programmable RIB.
218
219 Remove routes
220 '''''''''''''
221 Routes deletion can be invoked via RPC:
222
223 **URL:** ``/restconf/operations/odl-bgp-app-peer-benchmark:delete-prefix``
224
225 **RFC8040 URL:** ``/rests/operations/odl-bgp-app-peer-benchmark:delete-prefix``
226
227 **Method:** ``POST``
228
229 .. tabs::
230
231    .. tab:: XML
232
233       **Content-Type:** ``application/xml``
234
235       **Request Body:**
236
237       .. code-block:: xml
238          :linenos:
239          :emphasize-lines: 2,3,4
240
241          <input xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
242              <prefix>1.1.1.1/32</prefix>
243              <count>100000</count>
244              <batchsize>2000</batchsize>
245          </input>
246
247       @line 2: A initial IPv4 prefix carried in route to be removed. Value is incremented for following routes.
248
249       @line 3: An amount of routes to be removed from *Application Peer's* programmable RIB.
250
251       @line 4: A size of the transaction batch.
252
253       **Response Body:**
254
255       .. code-block:: xml
256
257          <output xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-app-peer-benchmark">
258              <result>
259                  <duration>1837</duration>
260                  <rate>54500</rate>
261                  <count>100000</count>
262              </result>
263          </output>
264
265    .. tab:: JSON
266
267       **Content-Type:** ``application/json``
268
269       **Request Body:**
270
271       .. code-block:: json
272          :linenos:
273          :emphasize-lines: 3,4,5
274
275          {
276              "odl-bgp-app-peer-benchmark:input": {
277                  "prefix": "1.1.1.1/32",
278                  "count": 100000,
279                  "batchsize": 2000
280              }
281          }
282
283       @line 3: A initial IPv4 prefix carried in route to be removed. Value is incremented for following routes.
284
285       @line 4: An amount of routes to be removed from *Application Peer's* programmable RIB.
286
287       @line 5: A size of the transaction batch.
288
289       **Response Body:**
290
291       .. code-block:: json
292
293          {
294              "odl-bgp-app-peer-benchmark:output": {
295                 "result": {
296                    "duration": 1837,
297                    "rate": 54500,
298                    "count": 100000
299                 }
300              }
301          }