Skip to content
Snippets Groups Projects
Commit 631d2eeb authored by Erik Reid's avatar Erik Reid
Browse files

updated documents

parent f7143983
Branches
No related tags found
No related merge requests found
...@@ -9,14 +9,17 @@ config_filename = os.path.join( ...@@ -9,14 +9,17 @@ config_filename = os.path.join(
os.path.dirname(__file__), os.path.dirname(__file__),
'..', 'config-example.json') '..', 'config-example.json')
output_filename = os.path.join(
os.path.dirname(__file__),
'source', '_static', 'openapi.json')
os.environ['SETTINGS_FILENAME'] = config_filename os.environ['SETTINGS_FILENAME'] = config_filename
app = resource_management.create_app() app = resource_management.create_app()
client = TestClient(app) client = TestClient(app)
rsp = client.get('/openapi.json') rsp = client.get('/openapi.json')
openapi_doc = json.dumps(rsp.json(), indent=2) openapi_doc = json.dumps(rsp.json(), indent=2)
if len(sys.argv) > 1 and sys.argv[1]: with open(output_filename, 'w') as f:
with open(sys.argv[1], 'w') as output: f.write(openapi_doc)
output.write(openapi_doc)
else: print(f'wrote {output_filename}')
print(openapi_doc)
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta
name="description"
content="SwaggerUI"
/>
<title>SwaggerUI</title>
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@4.5.0/swagger-ui.css" />
</head>
<body>
<div id="swagger-ui"></div>
<script src="https://unpkg.com/swagger-ui-dist@4.5.0/swagger-ui-bundle.js" crossorigin></script>
<script>
window.onload = () => {
window.ui = SwaggerUIBundle({
url: '_static/openapi.json',
dom_id: '#swagger-ui',
});
};
</script>
</body>
</html>
\ No newline at end of file
.. list of basic cli tools
CLI Tools
=========================
.. automodule:: resource_management.cli
.. automodule:: resource_management.hardware.juniper
docs/source/images/db-er.png

48.1 KiB | W: | H:

docs/source/images/db-er.png

54 KiB | W: | H:

docs/source/images/db-er.png
docs/source/images/db-er.png
docs/source/images/db-er.png
docs/source/images/db-er.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -6,43 +6,15 @@ ...@@ -6,43 +6,15 @@
NAT Resource Management NAT Resource Management
========================== ==========================
Documentation for the NAT Resource Management tools Documentation for the NAT Resource Management service
------------------
Configuration file format
---------------------------------
The following example indicates the schema for the configuration file required to call the Resource Management client::
{
"mysql":{
"username":"mydbuser",
"password":"mydbpass",
"hostname":"localhost",
"dbname":"mydb"
},
"ssh":{
"username":"user",
"password":"pass",
"private-key":"/path/to/private/key"
"ssh-config":"/path/to/ssh-config"
}
}
All "mysql" parameters are mandatory. For "ssh", username is mandatory, and either password or private-key must be provided. ssh-config is optional.
Excuting the client
---------------------
To create a new router from its fqdn::
python3 cli.py create --config /path/to/resource_management_config.json --fqdn test.example.com
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
:caption: Contents: :caption: Contents:
basic-tools quickstart
db db
`Swagger API Docs <_static/openapi.html>`__
.. db model intro & info
Quick Start
==================
*This is a quick setup guide for running
standalone on your local machine*
Create a Local Database
--------------------------
* set the value of `sqlalchemy.url`
in `alembic.ini` to point to a writeable file, e.g.
.. code-block:: python
sqlalchemy.url = sqlite:////absolute/path/to/foo.db
* create the database by running the alembic
migration from the module (`resource_management`) directory
.. code-block:: bash
alembic upgrade head
Running the App
-------------------
* create a settings filename
(see `config-example.json` for an example) ... something like:
.. code-block:: json
{
"db": "sqlite:////tmp/test.db",
"ssh": {
"username": "ro-username",
"private-key": "/absolute/path/to/private/key"
}
}
* run the app like this
(`app.py` starts the server on port 44444):
.. code-block:: bash
SETTINGS_FILENAME=/absolute/path/to/config.json python -m resource_management.app
Examples
* get the version
.. code-block:: bash
curl http://localhost:44444/api/version
* load interfaces from a router
.. code-block:: bash
curl -X POST http://localhost:44444/api/initialize-router/router.host.name
* view the docs by loading `http://localhost:44444/docs`
in your browser (there are requests for reserving
lags and physical lag interfaces)
...@@ -18,4 +18,9 @@ commands = ...@@ -18,4 +18,9 @@ commands =
coverage html coverage html
coverage report --fail-under 80 coverage report --fail-under 80
flake8 flake8
python docs/dump-openapi-spec.py
# to render the diagrams:
# pip install -r docs/requirements-er.txt
# ... and install dot on the system
# python docs/render_db_diagrams.py
sphinx-build -M html docs/source docs/build sphinx-build -M html docs/source docs/build
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment