Add documentation in the required format. 17/2617/5
authorTommy Carpenter <tc677g@att.com>
Fri, 28 Feb 2020 14:17:46 +0000 (09:17 -0500)
committerTommy Carpenter <tc677g@att.com>
Fri, 28 Feb 2020 15:32:59 +0000 (10:32 -0500)
Also twiddles the tox to name the code job so that the verify job can be
changed to not run docs.

Issue-ID: RIC-228
Change-Id: I5ded9ae6d421f0906f9fb544ee78dfbf9e8f4291
Signed-off-by: Tommy Carpenter <tc677g@att.com>
12 files changed:
.readthedocs.yaml [new file with mode: 0644]
docs/_static/logo.png [new file with mode: 0644]
docs/conf.py [new file with mode: 0644]
docs/conf.yaml [new file with mode: 0644]
docs/favicon.ico [new file with mode: 0644]
docs/index.rst [new file with mode: 0644]
docs/installation-guide.rst [new file with mode: 0755]
docs/logo.png [new file with mode: 0644]
docs/overview.rst [new file with mode: 0644]
docs/release-notes.rst [new file with mode: 0644]
docs/requirements-docs.txt [new file with mode: 0644]
tox.ini

diff --git a/.readthedocs.yaml b/.readthedocs.yaml
new file mode 100644 (file)
index 0000000..3797dc8
--- /dev/null
@@ -0,0 +1,20 @@
+---
+# .readthedocs.yml
+# Read the Docs configuration file
+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+# Required
+version: 2
+
+formats:
+  - htmlzip
+
+build:
+  image: latest
+
+python:
+  version: 3.7
+  install:
+    - requirements: docs/requirements-docs.txt
+
+sphinx:
+  configuration: docs/conf.py
diff --git a/docs/_static/logo.png b/docs/_static/logo.png
new file mode 100644 (file)
index 0000000..c3b6ce5
Binary files /dev/null and b/docs/_static/logo.png differ
diff --git a/docs/conf.py b/docs/conf.py
new file mode 100644 (file)
index 0000000..974c309
--- /dev/null
@@ -0,0 +1,3 @@
+from docs_conf.conf import *
+
+linkcheck_ignore = ["http://localhost.*", "http://127.0.0.1.*", "https://gerrit.o-ran-sc.org.*"]
diff --git a/docs/conf.yaml b/docs/conf.yaml
new file mode 100644 (file)
index 0000000..a98a7eb
--- /dev/null
@@ -0,0 +1,3 @@
+---
+project_cfg: oran
+project: xapp-frame-py
diff --git a/docs/favicon.ico b/docs/favicon.ico
new file mode 100644 (file)
index 0000000..00b0fd0
Binary files /dev/null and b/docs/favicon.ico differ
diff --git a/docs/index.rst b/docs/index.rst
new file mode 100644 (file)
index 0000000..131716b
--- /dev/null
@@ -0,0 +1,19 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. SPDX-License-Identifier: CC-BY-4.0
+.. Copyright (C) 2020 AT&T Intellectual Property
+
+
+Welcome to O-RAN SC xapp-frame-py Documentation
+===============================================
+
+.. toctree::
+   :maxdepth: 2
+   :caption: Contents:
+
+   overview.rst
+   release-notes.rst
+   installation-guide.rst
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/docs/installation-guide.rst b/docs/installation-guide.rst
new file mode 100755 (executable)
index 0000000..ea6090f
--- /dev/null
@@ -0,0 +1,16 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. SPDX-License-Identifier: CC-BY-4.0
+.. Copyright (C) 2020 AT&T Intellectual Property
+
+
+Installation Guide
+==================
+
+.. contents::
+   :depth: 3
+   :local:
+
+Installation
+------------
+
+[SOON THIS WILL BE TRUE] The `ricxappframe` is available in PyPi. Use pip to install the version you want.
diff --git a/docs/logo.png b/docs/logo.png
new file mode 100644 (file)
index 0000000..c3b6ce5
Binary files /dev/null and b/docs/logo.png differ
diff --git a/docs/overview.rst b/docs/overview.rst
new file mode 100644 (file)
index 0000000..eca1990
--- /dev/null
@@ -0,0 +1,50 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. SPDX-License-Identifier: CC-BY-4.0
+.. Copyright (C) 2020 AT&T Intellectual Property
+
+xapp-frame-py Overview
+======================
+
+This library is a framework for writing Xapps in python.
+There may or may not be many Xapps written in python; however rmr, sdl, and logging libraries all exist for python, and this framework brings them together.
+
+There are (at the time of writing) two "kinds" of Xapps one can instantiate with this framework that model "push" (RMR Xapps) and "pull" (Loop Xapps), as described below.
+
+RMR Xapps
+---------
+This class of Xapps are purely reactive to rmr; data is always "pushed" to it via rmr.
+That is, every time the Xapp receives an rmr message, they do something, then wait for the next message to arrive, end never need to execute functionality at another time (if they do, use the next class).
+This is represented by a very simple callback `consume` that is invoked every time an rmr message arrives (note, this is subject to change, with more callbacks for specific messages like `A1_POLICY_REQUEST`).
+An analogy of this is AWS Lambda: "execute this code every time an event comes in" (the code to execute can depend on the type of event).
+
+Loop Xapps
+----------
+In this class of Xapp the user simply provides a function that gets invoked, and typically that function has a `while (something)` in it.
+If the function returns, the Xapp will stop.
+In this type of Xapp, the Xapp must "pull" it's own data, typically from SDL, rmr (ie query another component for data), or other sources.
+The framework is "lighter" in this case then the former; it sets up an SDL connection, an rmr thread, and then calls the client provided function.
+This is to be used for Xapps that are not purely event driven.
+
+RMR Threading in the framework
+------------------------------
+NOTE: this is an implementation detail!
+We expose this for transparency but most users will not have to worry about this.
+
+In both types of Xapp, the framework launches a seperate thread whose only job is to read from rmr and deposit all messages (and their summaries) into a thread safe queue.
+When the client Xapp reads using the framework (this read is done by the framework itself in the RMR Xapp, but by the client in a Loop Xapp), the read is done from the queue.
+The framework is implemented this way so that a long running client function (e.g., consume) cannot block rmr reads.
+This is important because rmr is *not* a persistent message bus, if any rmr client does not read "fast enough", messages can be lost.
+So in this framework the client code is not in the same thread as the rmr reads, so that long running client code can never lead to lost messages.
+
+Examples
+--------
+There are two examples in the `examples` directory; `ping` which is a Loop Xapp, and `pong` which is an RMR Xapp. Ping sends a message, pong receives the message and use rts to reply. Ping then reads it's own mailbox and demonstrates other functionality. The highlight to note is that `pong` is purely reactive, it only does anything when a message is received. Ping is a general loop that also happens to read it's rmr mailbox inside.
+
+Current gaps
+------------
+The following are known gaps or potential enhancements at the time of writing.
+::
+
+    * a logger has to be provided to the xapp
+    * the ability to specify more callacks per message type?
+
diff --git a/docs/release-notes.rst b/docs/release-notes.rst
new file mode 100644 (file)
index 0000000..37e7c70
--- /dev/null
@@ -0,0 +1,21 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. SPDX-License-Identifier: CC-BY-4.0
+.. Copyright (C) 2020 AT&T Intellectual Property
+
+Release Notes
+===============
+
+All notable changes to this project will be documented in this file.
+
+The format is based on `Keep a Changelog <http://keepachangelog.com/>`__
+and this project adheres to `Semantic Versioning <http://semver.org/>`__.
+
+.. contents::
+   :depth: 3
+   :local:
+
+[0.1.0] - 2/27/2020
+-------------------
+::
+
+    * Initial commit
diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt
new file mode 100644 (file)
index 0000000..09a0c1c
--- /dev/null
@@ -0,0 +1,5 @@
+sphinx
+sphinx-rtd-theme
+sphinxcontrib-httpdomain
+recommonmark
+lfdocs-conf
diff --git a/tox.ini b/tox.ini
index c7fd69a..43a8d34 100644 (file)
--- a/tox.ini
+++ b/tox.ini
 #   limitations under the License.
 # ==================================================================================
 [tox]
-envlist = py37,flake8
-# ,docs,docs-linkcheck
+envlist = code,flake8,docs,docs-linkcheck
 minversion = 2.0
 
-[testenv]
+[testenv:code]
 basepython = python3.7
 deps=
     pytest
@@ -27,7 +26,6 @@ deps=
     pytest-cov
 setenv =
     LD_LIBRARY_PATH = /usr/local/lib/:/usr/local/lib64
-
 commands =
     pytest --junitxml xunit-results.xml --cov ricxappframe --cov-report xml --cov-report term-missing --cov-report html --cov-fail-under=50
     coverage xml -i
@@ -41,26 +39,27 @@ commands = flake8 setup.py ricxappframe tests
 [flake8]
 extend-ignore = E501,E741,E731
 
-# verbatim as asked for by the docs instructions: https://wiki.o-ran-sc.org/display/DOC/Configure+Repo+for+Documentation
-[testenv:docs]
-# basepython = python3.7
-# deps =
-#    sphinx
-#    sphinx-rtd-theme
-#    sphinxcontrib-httpdomain
-#    recommonmark
-#    lfdocs-conf
-
-#commands =
-#    sphinx-build -W -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html
-#    echo "Generated docs available in {toxinidir}/docs/_build/html"
-#whitelist_externals = echo
+# doc jobs
+[testenv:docs]
+whitelist_externals = echo
+skipsdist = true
+basepython = python3.7
+deps =
+    sphinx
+    sphinx-rtd-theme
+    sphinxcontrib-httpdomain
+    recommonmark
+    lfdocs-conf
+commands =
+    sphinx-build -W -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html
+    echo "Generated docs available in {toxinidir}/docs/_build/html"
 
-#[testenv:docs-linkcheck]
-#basepython = python3.7
-#deps = sphinx
-#       sphinx-rtd-theme
-#       sphinxcontrib-httpdomain
-#       recommonmark
-#       lfdocs-conf
-#commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck
+[testenv:docs-linkcheck]
+skipsdist = true
+basepython = python3.7
+deps = sphinx
+       sphinx-rtd-theme
+       sphinxcontrib-httpdomain
+       recommonmark
+       lfdocs-conf
+commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck