Added JSON and XML payloads tabs with RFC 8040 URL
[bgpcep.git] / docs / pcep / pcep-user-guide-test-tools.rst
1 .. _pcep-user-guide-test-tools:
2
3 Test tools
4 ==========
5
6 PCC Mock
7 ^^^^^^^^
8 The PCC Mock is a stand-alone Java application purposed to simulate a PCC(s).
9 The simulator is capable to report sample LSPs, respond to delegation, LSP management operations and synchronization optimization procedures.
10 This application is not part of the OpenDaylight Karaf distribution, however it can be downloaded from OpenDaylight's Nexus (use latest release version):
11
12 ``https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/bgpcep/pcep-pcc-mock``
13
14 Usage
15 '''''
16 The application can be run from command line:
17
18 .. code-block:: console
19
20    java -jar pcep-pcc-mock-*-executable.jar
21
22
23 with optional input parameters:
24
25 .. code-block:: console
26
27    --local-address <Address:Port> (optional, default 127.0.0.1)
28       The first PCC IP address. If more PCCs are required, the IP address will be incremented. Port number can be optionally specified.
29
30    --remote-address <Address1:Port1,Address2:Port2,Address3:Port3,...> (optional, default 127.0.0.1:4189)
31       The list of IP address for the PCE servers. Port number can be optionally specified, otherwise default port number 4189 is used.
32
33    --pcc <N> (optional, default 1)
34       Number of mocked PCC instances.
35
36    --lsp <N> (optional, default 1)
37       Number of tunnels (LSPs) reported per PCC, might be zero.
38
39    --pcerr (optional flag)
40       If the flag is present, response with PCErr, otherwise PCUpd.
41
42    --log-level <LEVEL> (optional, default INFO)
43       Set logging level for pcc-mock.
44
45    -d, --deadtimer <0..255> (optional, default 120)
46       DeadTimer value in seconds.
47
48    -ka, --keepalive <0.255> (optional, default 30)
49       KeepAlive timer value in seconds.
50
51    --password <password> (optional)
52       If the password is present, it is used in TCP MD5 signature, otherwise plain TCP is used.
53
54    --reconnect <seconds> (optional)
55       If the argument is present, the value in seconds, is used as a delay before each new reconnect (initial connect or connection re-establishment) attempt.
56       The number of reconnect attempts is unlimited. If the argument is omitted, pcc-mock is not trying to reconnect.
57
58    --redelegation-timeout <seconds> (optional, default 0)
59       The timeout starts when LSP delegation is returned or PCE fails, stops when LSP is re-delegated to PCE.
60       When timeout expires, LSP delegation is revoked and held by PCC.
61
62    --state-timeout <seconds> (optional, default -1 (disabled))
63       The timeout starts when LSP delegation is returned or PCE fails, stops when LSP is re-delegated to PCE.
64       When timeout expires, PCE-initiated LSP is removed.
65
66    --state-sync-avoidance <disconnect_after_x_seconds> <reconnect_after_x_seconds> <dbVersion>
67       Synchronization avoidance capability enabled.
68          - disconnect_after_x_seconds: seconds that will pass until disconnections is forced. If set to smaller number than 1, disconnection wont be performed.
69          - reconnect_after_x_seconds: seconds that will pass between disconnection and new connection attempt. Only happens if disconnection has been performed.
70          - dbVersion: dbVersion used in new Open and must be always equal or bigger than LSP. If equal than LSP skip synchronization will be performed,
71            if not full synchronization will be performed taking in account new starting dbVersion desired.
72     --incremental-sync-procedure <disconnect_after_x_seconds> <reconnect_after_x_seconds> <dbVersion>
73       Incremental synchronization capability enabled.
74          - dbVersion: dbVersion used in new Open and must be always bigger than LSP. Incremental synchronization will be performed taking in account new starting dbVersion desired.
75
76     --triggered-initial-sync
77       PCE-triggered synchronization capability enabled. Can be combined combined with state-sync-avoidance/incremental-sync-procedure.
78
79     --triggered-re-sync
80       PCE-triggered re-synchronization capability enabled.
81
82 Data Change Counter Tool
83 ^^^^^^^^^^^^^^^^^^^^^^^^
84
85 Data Change Counter tool registers a Data Change Listener to a specified topology's subtree.
86 This will allow us to know the quantity of changes produced under it, with each data change event counter will be incremented.
87
88 Installation
89 ''''''''''''
90 Installing data change counter tool
91
92 .. code-block:: console
93
94    feature:install odl-restconf odl-bgpcep-data-change-counter
95
96 Configuration
97 '''''''''''''
98 Once we set the configuration, a new data change counter will be created and registers to example-linkstate-topology.
99
100 .. important:: **Clustering** - Each Counter Identifier should be unique.
101
102 **URL:** ``/restconf/config/odl-data-change-counter-config:data-change-counter-config/data-change-counter``
103
104 **RFC8040 URL:** ``/rests/data/odl-data-change-counter-config:data-change-counter-config=data-change-counter``
105
106 **Method:** ``PUT``
107
108 .. tabs::
109
110    .. tab:: XML
111
112       **Content-Type:** ``application/xml``
113
114       **Request Body:**
115
116       .. code-block:: xml
117          :linenos:
118          :emphasize-lines: 2,3
119
120          <data-change-counter-config xmlns="urn:opendaylight:params:xml:ns:yang:bgpcep:data-change-counter-config">
121              <counter-id>data-change-counter</counter-id>
122              <topology-name>example-linkstate-topology</topology-name>
123          </data-change-counter-config>
124
125       @line 2: **Counter Id** - Unique counter change identifier.
126
127       @line 3: **Topology Name** - An identifier for a topology.
128
129    .. tab:: JSON
130
131       **Content-Type:** ``application/json``
132
133       **Request Body:**
134
135       .. code-block:: json
136          :linenos:
137          :emphasize-lines: 4,5
138
139          {
140              "odl-data-change-counter-config:data-change-counter-config": [
141                  {
142                      "counter-id": "data-change-counter",
143                      "topology-name": "example-linkstate-topology"
144                  }
145              ]
146          }
147
148       @line 4: **Counter Id** - Unique counter change identifier.
149
150       @line 5: **Topology Name** - An identifier for a topology.
151
152 Usage
153 '''''
154
155 Counter state for topology
156
157 **URL:** ``/restconf/operational/data-change-counter:data-change-counter/counter/data-change-counter``
158
159 **RFC8040 URL:** ``/rests/data/data-change-counter:data-change-counter/counter=data-change-counter?content=nonconfig``
160
161 **Method:** ``GET``
162
163 .. tabs::
164
165    .. tab:: XML
166
167       **Response Body:**
168
169       .. code-block:: xml
170          :linenos:
171          :emphasize-lines: 2,3
172
173          <counter xmlns="urn:opendaylight:params:xml:ns:yang:bgp-data-change-counter">
174              <id>data-change-counter</id>
175              <count>0</count>
176          </counter>
177
178       @line 2: **Counter Id** - Unique counter change identifier.
179
180       @line 3: **Count** - Number of changes under registered topology's subtree.
181
182    .. tab:: JSON
183
184       **Response Body:**
185
186       .. code-block:: json
187          :linenos:
188          :emphasize-lines: 4,5
189
190          {
191              "data-change-counter:counter": [
192                  {
193                      "id": "data-change-counter",
194                      "count": 0
195                  }
196              ]
197          }
198
199       @line 4: **Counter Id** - Unique counter change identifier.
200
201       @line 5: **Count** - Number of changes under registered topology's subtree.