Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Commit 0465140

Browse files
author
Michael Smith
committed
Added docs for REST API and logging
1 parent d960297 commit 0465140

1 file changed

Lines changed: 73 additions & 4 deletions

File tree

docs/source/intersite.rst

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ be called as shown below:
4141
-h, --help show this help message and exit
4242
--config CONFIG Configuration file
4343
--generateconfig Generate an empty example configuration file
44+
--maxlogfiles MAXLOGFILES
45+
Maximum number of log files (default is 10)
4446
--debug [{verbose,warnings,critical}]
4547
Enable debug messages.
4648

@@ -62,10 +64,8 @@ option will produce the following output and quit the application. The sample JS
6264
One site must have local set to 'True'
6365
Replicate the export JSON for each exported contract.
6466

65-
The ``--debug`` option allows the level to be set for the displaying of debugging messages. The lowest level is
66-
``critical`` and will only show the most critical messages. The next level is ``warnings`` and will display all of
67-
the ``critical`` messages as well as those deemed suspect. The ``verbose`` level gives the previous levels plus
68-
additional information that provides deep insight into what has occurred in the tool.
67+
The ``--debug`` and ``--maxlogfiles`` options are described in the `Logging`_ section.
68+
6969

7070
Configuration File
7171
------------------
@@ -194,6 +194,75 @@ with the tool. The following commands are available at the command prompt.
194194
help [cmd] Displays help for any command.
195195
quit Quit the Intersite tool.
196196

197+
REST API
198+
--------
199+
200+
The Intersite application can be accessed through a simple server application using a REST API. When run as a server,
201+
the application usage is run as follows:
202+
203+
::
204+
205+
python intersite_rest_server.py -h
206+
usage: intersite_rest_server.py [-h] [--config CONFIG]
207+
[--maxlogfiles MAXLOGFILES] [--generateconfig]
208+
[--debug [{verbose,warnings,critical}]]
209+
210+
ACI Multisite Tool
211+
212+
optional arguments:
213+
-h, --help show this help message and exit
214+
--config CONFIG Configuration file
215+
--maxlogfiles MAXLOGFILES
216+
Maximum number of log files (default is 10)
217+
--generateconfig Generate an empty example configuration file
218+
--debug [{verbose,warnings,critical}]
219+
Enable debug messages.
220+
--ip IP IP address to listen on.
221+
--port PORT Port number to listen on.
222+
223+
An example of running the application would be:
224+
225+
::
226+
227+
python intersite_rest_server.py --config my_config.json
228+
229+
By default, the server runs on the loopback IP address 127.0.0.1 and the port 5000. This can be changed via the
230+
``--ip`` and ``--port`` command line options.
231+
232+
The REST API allows retrieving and setting the configuration of the tool. This is done through a single URL, namely
233+
``/config``.
234+
235+
By sending HTTP GET requests to ``/config``, the configuration can be retrieved.
236+
237+
By sending JSON configuration in an HTTP POST or HTTP PUT to ``/config``, the configuration can be changed. This JSON
238+
configuration is the same format as decribed in the `Configuration File`_ section. If the configuration is not valid
239+
JSON, a 400 error response code will be returned.
240+
241+
The REST API is protected by basic HTTP authentication with the default username set to ``admin`` and the default
242+
password set to ``acitoolkit``.
243+
244+
Some examples using the REST API via curl:
245+
246+
::
247+
248+
curl –i –u admin:acitoolkit –H “Content-Type: application/json” -X PUT –d@my_config.json http://localhost:5000/config
249+
curl –i –u admin:acitoolkit –X GET http://localhost:5000/config
250+
251+
252+
Logging
253+
-------
254+
255+
The Intersite application supports logging of various debug messages. The messages are categorized by levels and the
256+
application allows the level to be set by the user through the ``--debug`` option. The lowest level is ``critical``
257+
and will only log the most critical messages. The next level is ``warnings`` and will log all of the ``critical``
258+
messages as well as those deemed suspect. The ``verbose`` level gives the previous levels plus additional information
259+
that provides deep insight into what has occurred in the tool.
260+
261+
The debug messages are stored in the file ``intersite.log``. When the file reaches 5 MB in size, the log file will
262+
rollover to a new file up to the configured maximum number of log files. By default, this maximum is 10 but the number
263+
can be changed by the user via the ``--maxlogfiles`` command line option. Once the maximum number of log files has been
264+
reached, the oldest log file will be deleted.
265+
197266
APIC Object Model
198267
-----------------
199268

0 commit comments

Comments
 (0)