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

added msr route doc

parent 3c62b9bf
No related branches found
No related tags found
No related merge requests found
......@@ -5,66 +5,8 @@ acts as a single point of truth for
information about the GÉANT network, exposed by
by an HTTP API.
Sphinx documentation is generated in `/docs`.
Documentation can be generated by running sphinx:
* [Inventory Provider](#inventory-provider)
* [Protocol Specification](#protocol-specification)
* [/jobs/update](#jobsupdate)
* [/jobs/log](#jobslog)
* [/jobs/reload-router-config](#jobsreload-router-config)
* [/jobs/check-task-status](#jobscheck-task-status)
* [/msr/access-services](#msraccess-services)
* [/testing/flushdb](#testingflushdb)
* [/testing/infinera-dna-addresses](#testinginfinera-dna-addresses)
* [/testing/coriant-tnms-addresses](#testingcoriant-tnms-addresses)
* [/testing/juniper-server-addresses](#testingjuniper-server-addresses)
# Inventory Provider
## Protocol Specification
The following resources can be requested from the webservice.
### resources
Any non-empty responses are JSON formatted messages.
### Testing utilities
The following routes are only available if the server
was started with the `ENABLE_TESTING_ROUTES` flag. These routes
are present only for testing, or for deprectated routes that
are intended to be deleted.
#### /testing/flushdb
* /testing/flushdb
This method erases all data in the backend redis
database.
#### /testing/infinera-dna-addresses
#### /testing/coriant-tnms-addresses
#### /testing/juniper-server-addresses
* /testing/infinera-dna-addresses
* /testing/coriant-tnms-addresses
* /testing/juniper-server-addresses
All of these resources return lists of source addresses
of known senders of snmp traps. Responses will be
formatted as follows:
```json
{
"$schema": "http://json-schema.org/raft-07/schema#",
"type": "array",
"items": {"type": "string"}
}
```
```bash
sphinx-build -M html docs/source docs/build
```
\ No newline at end of file
......@@ -14,7 +14,7 @@ These endpoints are temporary and will be removed.
/data/interfaces
---------------------------------
.. autofunction:: inventory_provider.routes.data.interfaces
.. autofunction:: inventory_provider.routes.data.router_interfaces
/data/pop
---------------------------------
......
......@@ -33,3 +33,4 @@ API modules
lg
data
jobs
msr
\ No newline at end of file
.. LG endpoint docs
LG Endpoints
LG Support Endpoints
=========================
These endpoints are intended for use by LG.
......
.. poller endpoint docs
MSR Support Endpoints
=========================
These endpoints are intended for use by MSR.
/msr/access-services
---------------------------------
.. autofunction:: inventory_provider.routes.msr.access_services
.. poller endpoint docs
Poller Endpoints
BRIAN support Endpoints
=========================
These endpoints are intended for use by BRIAN.
......
......@@ -7,6 +7,37 @@ from inventory_provider.routes import common
routes = Blueprint("msr-query-routes", __name__)
ACCESS_SERVICES_LIST_SCHEMA = {
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"service": {
"type": "object",
"properties": {
"id": {"type": "integer"},
"name": {"type": "string"},
"equipment": {"type": "string"},
"pop_name": {"type": "string"},
"other_end_equipment": {"type": "string"},
"other_end_pop_name": {"type": "string"},
"speed_value": {"type": "integer"},
"speed_unit": {"type": "string"}
},
"required": [
"id", "name",
"pop_name", "equipment",
"other_end_pop_name", "other_end_equipment",
"speed_value", "speed_unit"
],
"additionalProperties": False
}
},
"type": "array",
"items": {"$ref": "#/definitions/service"}
}
@routes.after_request
def after_request(resp):
return common.after_request(resp)
......@@ -15,7 +46,18 @@ def after_request(resp):
@routes.route("/access-services", methods=['GET', 'POST'])
@common.require_accepts_json
def access_services():
"""
Handler for `/msr/access-services`.
This method is in development, not yet used.
The response will be formatted according to the following schema:
.. asjson::
inventory_provider.routes.msr.ACCESS_SERVICES_LIST_SCHEMA
:return:
"""
redis = common.get_current_redis()
def _services():
......
import json
import jsonschema
from inventory_provider.routes.msr import ACCESS_SERVICES_LIST_SCHEMA
DEFAULT_REQUEST_HEADERS = {
"Content-type": "application/json",
"Accept": ["application/json"]
}
ACCESS_SERVICES_LIST_SCHEMA = {
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"service": {
"type": "object",
"properties": {
"id": {"type": "integer"},
"name": {"type": "string"},
"equipment": {"type": "string"},
"pop_name": {"type": "string"},
"other_end_equipment": {"type": "string"},
"other_end_pop_name": {"type": "string"},
"speed_value": {"type": "integer"},
"speed_unit": {"type": "string"}
},
"required": [
"id", "name",
"pop_name", "equipment",
"other_end_pop_name", "other_end_equipment",
"speed_value", "speed_unit"
],
"additionalProperties": False
}
},
"type": "array",
"items": {"$ref": "#/definitions/service"}
}
def test_access_services(client):
rv = client.get(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment