From c6c047aa87cade421b21a45b4ea8a5d61bfabae9 Mon Sep 17 00:00:00 2001 From: Denis Makogon Date: Wed, 6 Jul 2016 16:08:35 +0300 Subject: [PATCH] Provide OpenStack plugin documentation Implements: #42 #41 Partially implements: #44 --- docs/Makefile | 225 +++++++++ docs/source/artifacts.rst | 35 ++ docs/source/capabilities.rst | 0 docs/source/conf.py | 428 ++++++++++++++++++ docs/source/index.rst | 27 ++ docs/source/introduction.rst | 34 ++ docs/source/nodes.rst | 289 ++++++++++++ docs/source/relationships.rst | 101 +++++ docs/source/types.rst | 74 +++ ...mpute-with-file-injection-alternative.yaml | 2 +- ...openstack-compute-with-file-injection.yaml | 2 +- .../orchestra-openstack-compute-with-ssh.yaml | 2 +- ...estra-openstack-compute-with-userdata.yaml | 2 +- examples/orchestra-openstack-compute.yaml | 2 +- ...tack-vrouter-mgmt-net-external-access.yaml | 289 ++++++++++++ openstack_plugin/tasks/compute.py | 10 +- requirements-docs.txt | 1 + tox.ini | 7 +- types.yaml | 28 +- 19 files changed, 1521 insertions(+), 37 deletions(-) create mode 100644 docs/Makefile create mode 100644 docs/source/artifacts.rst create mode 100644 docs/source/capabilities.rst create mode 100644 docs/source/conf.py create mode 100644 docs/source/index.rst create mode 100644 docs/source/introduction.rst create mode 100644 docs/source/nodes.rst create mode 100644 docs/source/relationships.rst create mode 100644 docs/source/types.rst create mode 100644 examples/orchestra-openstack-vrouter-mgmt-net-external-access.yaml create mode 100644 requirements-docs.txt diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..39eb2aa --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,225 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source + +.PHONY: help +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " applehelp to make an Apple Help Book" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " epub3 to make an epub3" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + @echo " coverage to run coverage check of the documentation (if enabled)" + @echo " dummy to check syntax errors of document sources" + +.PHONY: clean +clean: + rm -rf $(BUILDDIR)/* + +.PHONY: html +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +.PHONY: dirhtml +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +.PHONY: singlehtml +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +.PHONY: pickle +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +.PHONY: json +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +.PHONY: htmlhelp +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +.PHONY: qthelp +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/AIOrchestraOpenStackplugin.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/AIOrchestraOpenStackplugin.qhc" + +.PHONY: applehelp +applehelp: + $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp + @echo + @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." + @echo "N.B. You won't be able to view it unless you put it in" \ + "~/Library/Documentation/Help or install it in your application" \ + "bundle." + +.PHONY: devhelp +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/AIOrchestraOpenStackplugin" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/AIOrchestraOpenStackplugin" + @echo "# devhelp" + +.PHONY: epub +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +.PHONY: epub3 +epub3: + $(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3 + @echo + @echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3." + +.PHONY: latex +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +.PHONY: latexpdf +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +.PHONY: latexpdfja +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +.PHONY: text +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +.PHONY: man +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +.PHONY: texinfo +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +.PHONY: info +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +.PHONY: gettext +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +.PHONY: changes +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +.PHONY: linkcheck +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +.PHONY: doctest +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +.PHONY: coverage +coverage: + $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage + @echo "Testing of coverage in the sources finished, look at the " \ + "results in $(BUILDDIR)/coverage/python.txt." + +.PHONY: xml +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +.PHONY: pseudoxml +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." + +.PHONY: dummy +dummy: + $(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy + @echo + @echo "Build finished. Dummy builder generates no files." diff --git a/docs/source/artifacts.rst b/docs/source/artifacts.rst new file mode 100644 index 0000000..6c4b53d --- /dev/null +++ b/docs/source/artifacts.rst @@ -0,0 +1,35 @@ +AIOrchestra. OpenSource OpenStack TOSCA orchestration plugin. Artifacts. +======================================================================== + + +tosca.artifacts.openstack.image +------------------------------- + +Artifact `tosca.artifacts.openstack.image`_ represents Glance image. +Properties:: + + image - Glane image ID + + +tosca.artifacts.openstack.compute.injection_file +------------------------------------------------ + +Artifact `tosca.artifacts.openstack.compute.injection_file`_ represents injection file (alternative to file injection node type). +Properties:: + + source - local file path + destination - remote path to inject source file + + +tosca.artifacts.openstack.compute.userdata +------------------------------------------ + +Artifact `tosca.artifacts.openstack.compute.userdata`_ represents Nova boot user data script. +Properties:: + + script - local file script path + + +.. _tosca.artifacts.openstack.image: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L680-L684 +.. _tosca.artifacts.openstack.compute.injection_file: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L686-L692 +.. _tosca.artifacts.openstack.compute.userdata: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L694-L698 diff --git a/docs/source/capabilities.rst b/docs/source/capabilities.rst new file mode 100644 index 0000000..e69de29 diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..f1f438c --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,428 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# AIOrchestra OpenStack plugin documentation build configuration file, created by +# sphinx-quickstart on Wed Jul 6 11:12:34 2016. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.intersphinx', + 'sphinx.ext.coverage', + 'sphinx.ext.imgmath', + 'sphinx.ext.githubpages', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The encoding of source files. +# +# source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = 'AIOrchestra OpenStack plugin' +copyright = '2016, Denys Makogon' +author = 'Denys Makogon' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '0.1.3' +# The full version, including alpha/beta/rc tags. +release = '0.1.3' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +# +# today = '' +# +# Else, today_fmt is used as the format for a strftime call. +# +# today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = [] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# +# default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +# +# add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +# +# add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +# +# show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +# modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +# keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +# html_theme_path = [] + +# The name for this set of Sphinx documents. +# " v documentation" by default. +# +# html_title = 'AIOrchestra OpenStack plugin v0.1.3' + +# A shorter title for the navigation bar. Default is the same as html_title. +# +# html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +# +# html_logo = None + +# The name of an image file (relative to this directory) to use as a favicon of +# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +# +# html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +# +# html_extra_path = [] + +# If not None, a 'Last updated on:' timestamp is inserted at every page +# bottom, using the given strftime format. +# The empty string is equivalent to '%b %d, %Y'. +# +# html_last_updated_fmt = None + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +# +# html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +# +# html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +# +# html_additional_pages = {} + +# If false, no module index is generated. +# +# html_domain_indices = True + +# If false, no index is generated. +# +# html_use_index = True + +# If true, the index is split into individual pages for each letter. +# +# html_split_index = False + +# If true, links to the reST sources are added to the pages. +# +# html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +# +# html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +# +# html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +# +# html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +# html_file_suffix = None + +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh' +# +# html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# 'ja' uses this config value. +# 'zh' user can custom change `jieba` dictionary path. +# +# html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +# +# html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'AIOrchestraOpenStackplugindoc' + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'AIOrchestraOpenStackplugin.tex', 'AIOrchestra OpenStack plugin Documentation', + 'Denys Makogon', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +# +# latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +# +# latex_use_parts = False + +# If true, show page references after internal links. +# +# latex_show_pagerefs = False + +# If true, show URL addresses after external links. +# +# latex_show_urls = False + +# Documents to append as an appendix to all manuals. +# +# latex_appendices = [] + +# If false, no module index is generated. +# +# latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'aiorchestraopenstackplugin', 'AIOrchestra OpenStack plugin Documentation', + [author], 1) +] + +# If true, show URL addresses after external links. +# +# man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'AIOrchestraOpenStackplugin', 'AIOrchestra OpenStack plugin Documentation', + author, 'AIOrchestraOpenStackplugin', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +# +# texinfo_appendices = [] + +# If false, no module index is generated. +# +# texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# +# texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +# +# texinfo_no_detailmenu = False + + +# -- Options for Epub output ---------------------------------------------- + +# Bibliographic Dublin Core info. +epub_title = project +epub_author = author +epub_publisher = author +epub_copyright = copyright + +# The basename for the epub file. It defaults to the project name. +# epub_basename = project + +# The HTML theme for the epub output. Since the default themes are not +# optimized for small screen space, using the same theme for HTML and epub +# output is usually not wise. This defaults to 'epub', a theme designed to save +# visual space. +# +# epub_theme = 'epub' + +# The language of the text. It defaults to the language option +# or 'en' if the language is not set. +# +# epub_language = '' + +# The scheme of the identifier. Typical schemes are ISBN or URL. +# epub_scheme = '' + +# The unique identifier of the text. This can be a ISBN number +# or the project homepage. +# +# epub_identifier = '' + +# A unique identification for the text. +# +# epub_uid = '' + +# A tuple containing the cover image and cover page html template filenames. +# +# epub_cover = () + +# A sequence of (type, uri, title) tuples for the guide element of content.opf. +# +# epub_guide = () + +# HTML files that should be inserted before the pages created by sphinx. +# The format is a list of tuples containing the path and title. +# +# epub_pre_files = [] + +# HTML files that should be inserted after the pages created by sphinx. +# The format is a list of tuples containing the path and title. +# +# epub_post_files = [] + +# A list of files that should not be packed into the epub file. +epub_exclude_files = ['search.html'] + +# The depth of the table of contents in toc.ncx. +# +# epub_tocdepth = 3 + +# Allow duplicate toc entries. +# +# epub_tocdup = True + +# Choose between 'default' and 'includehidden'. +# +# epub_tocscope = 'default' + +# Fix unsupported image types using the Pillow. +# +# epub_fix_images = False + +# Scale large images. +# +# epub_max_image_width = 0 + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# +# epub_show_urls = 'inline' + +# If false, no index is generated. +# +# epub_use_index = True + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'https://docs.python.org/': None} diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..858d848 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,27 @@ +.. AIOrchestra OpenStack plugin documentation master file, created by + sphinx-quickstart on Wed Jul 6 11:12:34 2016. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to AIOrchestra OpenStack plugin's documentation! +======================================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + introduction.rst + types.rst + nodes.rst + artifacts.rst + relationships.rst + capabilities.rst + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/docs/source/introduction.rst b/docs/source/introduction.rst new file mode 100644 index 0000000..89fdd86 --- /dev/null +++ b/docs/source/introduction.rst @@ -0,0 +1,34 @@ +AIOrchestra. OpenSource OpenStack TOSCA orchestration +===================================================== + + +What is TOSCA? +-------------- + +The TOSCA Simple Profile in `YAML`_ specifies a rendering of TOSCA which aims +to provide a more accessible syntax as well as a more concise and incremental +expressiveness of the TOSCA DSL in order to minimize the learning curve and +speed the adoption of the use of TOSCA to portably describe cloud applications. +This proposal describes a `YAML`_ rendering for TOSCA. `YAML`_ is a human friendly data +serialization standard with a syntax much easier to read and edit +than XML. As there are a number of DSLs encoded in `YAML`_, a `YAML`_ encoding of the TOSCA +DSL makes TOSCA more accessible by these communities. +This proposal prescribes an isomorphic rendering in `YAML`_ of a subset of the +TOSCA v1.0 ensuring that TOSCA semantics are preserved and can be transformed +from XML to `YAML`_ or from `YAML`_ to XML. Additionally, in order to streamline the +expression of TOSCA semantics, the `YAML`_ rendering is sought to be more concise and +compact through the use of the `YAML`_ syntax. + +More information can be regarding TOSCA simple profile can be found at its `home page`_. + + +What is OpenStack? +------------------ + +Feel free to find lots of articles and posts regarding this question. +But the most authoritative is `OpenStack official web site`_. + + +.. _YAML: http://yaml.org/ +.. _home page: http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.0/TOSCA-Simple-Profile-YAML-v1.0.pdf +.. _OpenStack official web site: https://opensource.com/resources/what-is-openstack diff --git a/docs/source/nodes.rst b/docs/source/nodes.rst new file mode 100644 index 0000000..774599b --- /dev/null +++ b/docs/source/nodes.rst @@ -0,0 +1,289 @@ +AIOrchestra. OpenSource OpenStack TOSCA orchestration plugin. Nodes. +==================================================================== + + +tosca.nodes.openstack.authorization +----------------------------------- + +This node represents authorization mechanism for OpenStack using Keystone and its service catalog. +Type definition: `tosca.nodes.openstack.authorization`_ + +Properties:: + + username - OpenStack user name + password - OpenStack user password + project_name - OpenStack user project name + auth_url - OpenStack Keystone auth URL + region_name - OpenStack auth region + user_domain_name - OpenStack user domain name + project_domain_name - OpenStack user project domain name + +Attributes:: + + auth_properties - represents auth properties mapping for further authorization purposes + auth_token - represents auth token for passwordless authorization + +Capabilities:: + + tosca.capabilities.openstack.auth.attachable - means that this node can be attached to any other node + + + +tosca.nodes.openstack.ssh_keypair +--------------------------------- + +This node represents OpenStack Nova SSH key pair. +Type definition: `tosca.nodes.openstack.ssh_keypair`_ +Properties:: + + use_connection_pool - this property passed not Nova client + compute_api_version - Nova compute API version + use_existing - weather to use existing key or create a new one + name - SSH key pair name + public_key - SSH public key + +Attributes:: + + id - SSH key ID + name - SSH key name + public_key - SSH public key + private_key_content - SSH private key content + + +tosca.nodes.openstack.compute +----------------------------- + +This node represents OpenStack Nova compute instance. +Type definition: `tosca.nodes.openstack.compute`_ +Properties:: + + use_connection_pool - this property passed not Nova client + compute_api_version - Nova compute API version + compute_name - Nova Compute instance future name + compute_id - existing Nova compute instance ID + availability_zone - Nova compute instance availability zone + config_drive - weather to use config drive during boot or not + +Attributes:: + + compute_id - Nova compute instance ID + networks - attached networks + ports - attached network ports + + +Capabilities:: + + host - represents capacity details (i.e - flavor) + binding - represents network binding + os - represents Operating system distron details + scalable - weather node is scalable or not + + +Artifacts:: + + image_ref - represents Glance image ID + userdata - represents Nova boot userdata script + + +tosca.nodes.openstack.network +----------------------------- + +This node represents OpenStack Neutron network. +Type definition: `tosca.nodes.openstack.network`_ +Properties:: + + is_external - weather network is has access to internet + network_name - Neutron network name + network_id - existing Neutron network ID + +Attributes:: + + network_id - Neutron network ID + network_name - Neutron network name + subnets - Neutron network subnets + +Capabilities:: + + link - meas that this node can be linked to others + +tosca.nodes.openstack.network.subnet +------------------------------------ + +This node represents OpenStack Neutron network subnet. +Type definition: `tosca.nodes.openstack.network.subnet`_ +Properties:: + + ip_version - subnet IP version + cidr - subnet CIDR + start_ip - pool range start IP + end_ip - pool range end IP + gateway_ip - subnet gateway IP + network_name - subnet name + network_id - existing subnet ID + segmentation_id - subnet segmentation ID + network_type - network type + physical_network - physical network + dhcp_enabled - weather is to enable DHCP for subnet or not + dns_nameservers - DNS name servers + +Attributes:: + + link_id - linked network ID + network_id - subnet ID + network_name - subnet name + + +Capabilities:: + + link - meas that this node can be linked to others + +Requirements:: + + link - network link requirement + +tosca.nodes.openstack.network.port +---------------------------------- + +This node represents OpenStack Neutron network port. +Type definition: `tosca.nodes.openstack.network.port`_ +Properties:: + + port_name - name to assign + port_id - existing port ID + ip_address - IP address to assign + order - assign order to compute instance + is_default - weather if this port is default + ip_range_start - lower bound of IP address + ip_range_end - upper bound of IP address + +Attributes:: + + ip_address - port IP address + +Requirements:: + + binding - to which node port must be assigned + link - to each network/subnet this port belongs + +tosca.nodes.openstack.network.router +------------------------------------ + +This node represents OpenStack Neutron network router. +Type definition: `tosca.nodes.openstack.network.router`_ +Properties:: + + router_name - name to assign + router_id - existing router ID + +Attributes:: + + router_id - router ID + +Capabilities:: + + link - means router can be assigned to networks + +Requirements:: + + link - actual network link + + +tosca.nodes.openstack.network.floating_ip +----------------------------------------- + +This node represents OpenStack Neutron network floating IP. +Type definition: `tosca.nodes.openstack.network.floating_ip`_ +Properties:: + + floating_ip_id - existing floatin IP ID + +Attributes:: + + fixed_ip_address - port internal fixed IP address + floating_ip_address - floating IP address + port_id - assigned port ID + router_id - router ID to which network with floating pool attached + +Capabilities:: + + binding - means floating IP can be attached + +Requirements:: + + link - network with floating pool + binding - port to attach floating IP + + +tosca.nodes.openstack.network.port.security_group +------------------------------------------------- + +This node represents OpenStack Neutron network port security group. +Type definition: `tosca.nodes.openstack.network.port.security_group`_ +Properties:: + + security_group_name - name to assign + security_group_id - existing security group ID + description - security group description + +Attributes:: + + security_group_id - security group ID + + +tosca.nodes.openstack.network.port.security_group.rule +------------------------------------------------------ + +This node represents OpenStack Neutron network port security group rule. +Type definition: `tosca.nodes.openstack.network.port.security_group.rule`_ +Properties:: + + direction - ingress or egress direction + ethertype - IP version + port_range_min - access port range lower bound + port_range_max - access port range upper bound + protocol - OSI transport layer protocol + remote_ip_prefix - CIDR + + +tosca.nodes.openstack.network.load_balancer +------------------------------------------- + +This node represents OpenStack Neutron subnet IP range load balancer. +Type definition: `tosca.nodes.openstack.network.load_balancer`_ +Properties:: + + algorithm + protocol + protocol_port + +Capabilities:: + + client - means load balancer can be used by specific network link + +Requirements:: + + application - compute instance + +tosca.nodes.openstack.compute.file +---------------------------------- + +This node represents OpenStack Nova injection file. +Type definition: `tosca.nodes.openstack.compute.file`_ +Properties:: + + source - local file path + destination - remote file path where source file will be injected + + +.. _tosca.nodes.openstack.authorization: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L9-L47 +.. _tosca.nodes.openstack.ssh_keypair: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L53-L90 +.. _tosca.nodes.openstack.compute: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L96-L180 +.. _tosca.nodes.openstack.network: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L187-L235 +.. _tosca.nodes.openstack.network.subnet: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L241-L357 +.. _tosca.nodes.openstack.network.port: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L363-L449 +.. _tosca.nodes.openstack.network.router: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L455-L504 +.. _tosca.nodes.openstack.network.floating_ip: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L510-L549 +.. _tosca.nodes.openstack.network.port.security_group: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L555-L576 +.. _tosca.nodes.openstack.network.port.security_group.rule: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L578-L615 +.. _tosca.nodes.openstack.network.load_balancer: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L621-L655 +.. _tosca.nodes.openstack.compute.file: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L661-L674 diff --git a/docs/source/relationships.rst b/docs/source/relationships.rst new file mode 100644 index 0000000..ef6b165 --- /dev/null +++ b/docs/source/relationships.rst @@ -0,0 +1,101 @@ +AIOrchestra. OpenSource OpenStack TOSCA orchestration plugin. Relationships. +============================================================================ + + +tosca.relationships.openstack.inject_auth +----------------------------------------- + +This relationship must be used with every OpenStack node type in requirements for authorization purposes +Allowed target type: `tosca.nodes.openstack.authorization`_ + +tosca.relationships.openstack.ssh_keypair_provider +-------------------------------------------------- + +This relationship must be used whenever SSH key attributes are required +Allowed target type: `tosca.nodes.openstack.ssh_keypair`_ + +tosca.relationships.openstack.compute.injected_with +--------------------------------------------------- + +This relationship must be used for compute boot file injection +Allowed target type: `tosca.nodes.openstack.compute.file`_ + +tosca.relationships.openstack.network.linked +-------------------------------------------- + +This relationship must be used for network linkin +Allowed target type: `tosca.nodes.openstack.network`_, `tosca.nodes.openstack.network.subnet`_ + +tosca.relationships.openstack.compute.port.bind +----------------------------------------------- + +This relationship must be used for port binding to compute instance +Allowed target type: `tosca.nodes.openstack.compute`_ + +tosca.relationships.openstack.network.port.bind +----------------------------------------------- + +This relationship must be used for binding compute instance to port +Allowed target type: `tosca.nodes.openstack.network.port`_ + +tosca.relationships.openstack.network.router.bind +------------------------------------------------- + +This relationship must used for binding network to router +Allowed target type: `tosca.nodes.openstack.network`_ + +tosca.relationships.openstack.network.router.link +------------------------------------------------- + +This relationship must be used for linking subnet to router +Allowed target type: `tosca.nodes.openstack.network.subnet`_ + +tosca.relationships.openstack.network.floating_ip.provider +---------------------------------------------------------- + +This relationship must be used whenever floating IP address is needed +Allowed target types: `tosca.nodes.openstack.network.floating_ip`_ + +tosca.relationships.openstack.network.floating_ip +------------------------------------------------- + +This relationship must be used when picking network with floating pool +Allowed target type: `tosca.nodes.openstack.network`_ + +tosca.relationships.openstack.network.port.floating_ip +------------------------------------------------------ + +This relationship must be used for attaching floating IP to port +Allowed target type: `tosca.nodes.openstack.network.port`_ + +tosca.relationships.openstack.network.port.security_group.rule +-------------------------------------------------------------- + +This relationship must be used for attaching rule to security group +Allowed target types: `tosca.nodes.openstack.network.port.security_group.rule`_ + +tosca.relationships.openstack.network.port.security_group.attached +------------------------------------------------------------------ + +This relationship must be used for attaching security group to port +Allowed target type: `tosca.nodes.openstack.network.port.security_group`_ + +tosca.relationships.openstack.network.load_balancer.member +---------------------------------------------------------- + +This relationship must be used for attaching compute instances to load balancer +Allowed target types: `tosca.nodes.openstack.compute`_ + + +.. _tosca.nodes.openstack.authorization: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L9-L47 +.. _tosca.nodes.openstack.ssh_keypair: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L53-L90 +.. _tosca.nodes.openstack.compute: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L96-L180 +.. _tosca.nodes.openstack.network: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L187-L235 +.. _tosca.nodes.openstack.network.subnet: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L241-L357 +.. _tosca.nodes.openstack.network.port: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L363-L449 +.. _tosca.nodes.openstack.network.router: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L455-L504 +.. _tosca.nodes.openstack.network.floating_ip: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L510-L549 +.. _tosca.nodes.openstack.network.port.security_group: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L555-L576 +.. _tosca.nodes.openstack.network.port.security_group.rule: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L578-L615 +.. _tosca.nodes.openstack.network.load_balancer: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L621-L655 +.. _tosca.nodes.openstack.compute.file: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml#L661-L674 diff --git a/docs/source/types.rst b/docs/source/types.rst new file mode 100644 index 0000000..a83ae04 --- /dev/null +++ b/docs/source/types.rst @@ -0,0 +1,74 @@ +AIOrchestra. OpenSource OpenStack TOSCA orchestration plugin +============================================================ + + +TOSCA simple profile +-------------------- + +AIOrchestra OpenStack plugin relays on `TOSCA simple profile`_ as bases. +Plugin has several categories of types:: + + node types + artifacts + capabilities + relationships + + +Types +----- + +AIOrchestra OpenStack plugin implements next node types:: + + tosca.nodes.openstack.authorization + tosca.nodes.openstack.ssh_keypair + tosca.nodes.openstack.compute + tosca.nodes.openstack.network + tosca.nodes.openstack.network.subnet + tosca.nodes.openstack.network.port + tosca.nodes.openstack.network.router + tosca.nodes.openstack.network.floating_ip + tosca.nodes.openstack.network.port.security_group + tosca.nodes.openstack.network.port.security_group.rule + tosca.nodes.openstack.network.load_balancer + tosca.nodes.openstack.compute.file + +AIOrchestra OpenStack plugin implements next artifacts:: + + tosca.artifacts.openstack.image + tosca.artifacts.openstack.compute.injection_file + tosca.artifacts.openstack.compute.userdata + +AIOrchestra OpenStack plugin implements next ralationships:: + + tosca.relationships.openstack.inject_auth + tosca.relationships.openstack.ssh_keypair_provider + tosca.relationships.openstack.compute.injected_with + tosca.relationships.openstack.network.linked + tosca.relationships.openstack.compute.port.bind + tosca.relationships.openstack.network.port.bind + tosca.relationships.openstack.network.router.bind + tosca.relationships.openstack.network.router.link + tosca.relationships.openstack.network.floating_ip.provider + tosca.relationships.openstack.network.floating_ip + tosca.relationships.openstack.network.port.floating_ip + tosca.relationships.openstack.network.port.security_group.rule + tosca.relationships.openstack.network.port.security_group.attached + tosca.relationships.openstack.network.load_balancer.member + +AIOrchestra OpenStack plugin implements next ralationships:: + + tosca.capabilities.openstack.network.load_balancer.endpoint + tosca.capabilities.openstack.network.load_balancer.member.endpoint + tosca.capabilities.openstack.network.port.bindable + tosca.capabilities.openstack.network.port.security_group.attachable + tosca.capabilities.openstack.network.port.security_group.rule.attachable + tosca.capabilities.openstack.auth.attachable + tosca.capabilities.openstack.compute.ssh.attachable + tosca.capabilities.openstack.flavor + + +Types definition can be found `here`_. + + +.. _TOSCA simple profile: http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.0/TOSCA-Simple-Profile-YAML-v1.0.pdf +.. _here: https://github.com/aiorchestra/aiorchestra-openstack-plugin/blob/master/types.yaml diff --git a/examples/orchestra-openstack-compute-with-file-injection-alternative.yaml b/examples/orchestra-openstack-compute-with-file-injection-alternative.yaml index 1a0eec6..e5a0a5d 100644 --- a/examples/orchestra-openstack-compute-with-file-injection-alternative.yaml +++ b/examples/orchestra-openstack-compute-with-file-injection-alternative.yaml @@ -98,4 +98,4 @@ topology_template: auth_token: value: { get_attribute: [aiorchestra.openstack.authorization, auth_token ] } server: - value: { get_attribute: [aiorchestra.openstack.compute, id] } + value: { get_attribute: [aiorchestra.openstack.compute, compute_id] } diff --git a/examples/orchestra-openstack-compute-with-file-injection.yaml b/examples/orchestra-openstack-compute-with-file-injection.yaml index df0e9b7..0c37dce 100644 --- a/examples/orchestra-openstack-compute-with-file-injection.yaml +++ b/examples/orchestra-openstack-compute-with-file-injection.yaml @@ -89,4 +89,4 @@ topology_template: auth_token: value: { get_attribute: [aiorchestra.openstack.authorization, auth_token ] } server: - value: { get_attribute: [aiorchestra.openstack.compute, id] } + value: { get_attribute: [aiorchestra.openstack.compute, compute_id] } diff --git a/examples/orchestra-openstack-compute-with-ssh.yaml b/examples/orchestra-openstack-compute-with-ssh.yaml index 977bcb7..53aec52 100644 --- a/examples/orchestra-openstack-compute-with-ssh.yaml +++ b/examples/orchestra-openstack-compute-with-ssh.yaml @@ -95,7 +95,7 @@ topology_template: auth_token: value: { get_attribute: [aiorchestra.openstack.authorization, auth_token ] } server: - value: { get_attribute: [aiorchestra.openstack.compute, id] } + value: { get_attribute: [aiorchestra.openstack.compute, compute_id] } ssh_pubic: value: { get_attribute: [aiorchestra.openstack.keypair, public_key] } ssh_private: diff --git a/examples/orchestra-openstack-compute-with-userdata.yaml b/examples/orchestra-openstack-compute-with-userdata.yaml index 899ec68..8cc9477 100644 --- a/examples/orchestra-openstack-compute-with-userdata.yaml +++ b/examples/orchestra-openstack-compute-with-userdata.yaml @@ -95,4 +95,4 @@ topology_template: auth_token: value: { get_attribute: [aiorchestra.openstack.authorization, auth_token ] } server: - value: { get_attribute: [aiorchestra.openstack.compute, id] } + value: { get_attribute: [aiorchestra.openstack.compute, compute_id] } diff --git a/examples/orchestra-openstack-compute.yaml b/examples/orchestra-openstack-compute.yaml index f2ae79e..54c231b 100644 --- a/examples/orchestra-openstack-compute.yaml +++ b/examples/orchestra-openstack-compute.yaml @@ -79,4 +79,4 @@ topology_template: auth_token: value: { get_attribute: [aiorchestra.openstack.authorization, auth_token] } server: - value: { get_attribute: [aiorchestra.openstack.compute, id] } + value: { get_attribute: [aiorchestra.openstack.compute, compute_id] } diff --git a/examples/orchestra-openstack-vrouter-mgmt-net-external-access.yaml b/examples/orchestra-openstack-vrouter-mgmt-net-external-access.yaml new file mode 100644 index 0000000..93a4ca3 --- /dev/null +++ b/examples/orchestra-openstack-vrouter-mgmt-net-external-access.yaml @@ -0,0 +1,289 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: vRouter base + + +##################################################################### +# Imports +##################################################################### + +imports: + + - ../types.yaml + +topology_template: +##################################################################### +# Inputs +##################################################################### + + inputs: + + keystone_username: + type: string + + keystone_password: + type: string + + keystone_project_name: + type: string + + keystone_url: + type: string + + openstack_region: + type: string + +######################################## + external_network_id: + type: string +######################################## + mgmt_subnet_name: + type: string + + mgmt_subnet_cidr: + type: string + + mgmt_subnet_pool_start_ip: + type: string + + mgmt_subnet_pool_end_ip: + type: string + + mgmt_subnet_gateway_ip: + type: string + + mgmt_network_subnet_port: + type: string + + mgmt_network_name: + type: string +######################################## + subnet_dns_nameserver: + type: list + + subnet_ip_version: + type: integer + default: 4 +######################################## + compute_name: + type: string + + compute_image: + type: string + + compute_flavor: + type: string + + ssh_keypair_name: + type: string +######################################## + router_name: + type: string +######################################## + +##################################################################### +# Node templates +##################################################################### + + node_templates: + +######################################################################################## +######################################################################################## + + aiorchestra.openstack.authorization: + type: tosca.nodes.openstack.authorization + properties: + username: { get_input: keystone_username } + password: { get_input: keystone_password } + project_name: { get_input: keystone_project_name } + auth_url: { get_input: keystone_url } + region_name: { get_input: openstack_region } + +######################################################################################## +######################################################################################## + + aiorchestra.openstack.network.mgmt: + type: tosca.nodes.openstack.network + properties: + network_name: { get_input: mgmt_network_name } + requirements: + - auth: + capability: tosca.capabilities.openstack.auth.attachable + node: aiorchestra.openstack.authorization + relationship: tosca.relationships.openstack.inject_auth + + aiorchestra.openstack.network.external: + type: tosca.nodes.openstack.network + properties: + is_external: true + network_id: { get_input: external_network_id } + requirements: + - auth: + capability: tosca.capabilities.openstack.auth.attachable + node: aiorchestra.openstack.authorization + relationship: tosca.relationships.openstack.inject_auth + +######################################################################################## +######################################################################################## + + aiorchestra.openstack.network.router: + type: tosca.nodes.openstack.network.router + properties: + router_name: { get_input: router_name } + requirements: + - auth: + capability: tosca.capabilities.openstack.auth.attachable + node: aiorchestra.openstack.authorization + relationship: tosca.relationships.openstack.inject_auth + - link: aiorchestra.openstack.network.external + +######################################################################################## +######################################################################################## + + aiorchestra.openstack.network.subnet.mgmt: + type: tosca.nodes.openstack.network.subnet + properties: + ip_version: { get_input: subnet_ip_version } + cidr: { get_input: mgmt_subnet_cidr } + start_ip: { get_input: mgmt_subnet_pool_start_ip } + end_ip: { get_input: mgmt_subnet_pool_end_ip } + gateway_ip: { get_input: mgmt_subnet_gateway_ip } + network_name: { get_input: mgmt_subnet_name } + dns_nameservers: { get_input: subnet_dns_nameserver } + requirements: + - auth: + capability: tosca.capabilities.openstack.auth.attachable + node: aiorchestra.openstack.authorization + relationship: tosca.relationships.openstack.inject_auth + - link: aiorchestra.openstack.network.mgmt + - router_link: + capability: tosca.capabilities.network.Linkable + node: aiorchestra.openstack.network.router + relationship: tosca.relationships.openstack.network.router.link + +######################################################################################## +######################################################################################## + + aiorchestra.openstack.network.port.mgmt: + type: tosca.nodes.openstack.network.port + properties: + port_name: { get_input: mgmt_network_subnet_port } + requirements: + - auth: + capability: tosca.capabilities.openstack.auth.attachable + node: aiorchestra.openstack.authorization + relationship: tosca.relationships.openstack.inject_auth + - link: aiorchestra.openstack.network.subnet.mgmt + - security_groups: + capability: tosca.capabilities.openstack.network.port.security_group.attachable + node: aiorchestra.openstack.network.port.security_group + relationship: tosca.relationships.openstack.network.port.security_group.attached + +######################################################################################## +######################################################################################## + + aiorchestra.openstack.network.port.security_group.ingress: + type: tosca.nodes.openstack.network.port.security_group.rule + properties: + direction: 'ingress' + ethertype: 'IPv4' + port_range_min: 1 + port_range_max: 65535 + protocol: 'tcp' + remote_ip_prefix: '0.0.0.0/0' + + aiorchestra.openstack.network.port.security_group.egress: + type: tosca.nodes.openstack.network.port.security_group.rule + properties: + direction: 'egress' + ethertype: 'IPv4' + port_range_min: 1 + port_range_max: 65535 + protocol: 'tcp' + remote_ip_prefix: '0.0.0.0/0' + + aiorchestra.openstack.network.port.security_group: + type: tosca.nodes.openstack.network.port.security_group + properties: + security_group_name: { get_input: mgmt_network_subnet_port } + requirements: + - auth: + capability: tosca.capabilities.openstack.auth.attachable + node: aiorchestra.openstack.authorization + relationship: tosca.relationships.openstack.inject_auth + - egress: + capability: tosca.capabilities.openstack.network.port.security_group.rule.attachable + node: aiorchestra.openstack.network.port.security_group.egress + relationship: tosca.relationships.openstack.network.port.security_group.rule + - ingress: + capability: tosca.capabilities.openstack.network.port.security_group.rule.attachable + node: aiorchestra.openstack.network.port.security_group.ingress + relationship: tosca.relationships.openstack.network.port.security_group.rule + +######################################################################################## +######################################################################################## + + aiorchestra.openstack.network.floating_ip: + type: tosca.nodes.openstack.network.floating_ip + requirements: + - auth: + capability: tosca.capabilities.openstack.auth.attachable + node: aiorchestra.openstack.authorization + relationship: tosca.relationships.openstack.inject_auth + - link: aiorchestra.openstack.network.external + - binding: aiorchestra.openstack.network.port.mgmt + +######################################################################################## +######################################################################################## + + aiorchestra.openstack.keypair: + type: tosca.nodes.openstack.ssh_keypair + properties: + name: { get_input: ssh_keypair_name } + requirements: + - auth: + capability: tosca.capabilities.openstack.auth.attachable + node: aiorchestra.openstack.authorization + relationship: tosca.relationships.openstack.inject_auth + +######################################################################################## +######################################################################################## + + aiorchestra.openstack.compute: + type: tosca.nodes.openstack.compute + properties: + compute_name: { get_input: compute_name } + capabilities: + host: + properties: + flavor: { get_input: compute_flavor} + artifacts: + image_ref: + type: tosca.artifacts.openstack.image + id: { get_input: compute_image } + requirements: + - auth: + capability: tosca.capabilities.openstack.auth.attachable + node: aiorchestra.openstack.authorization + relationship: tosca.relationships.openstack.inject_auth + - binding_mgmt: + capability: tosca.capabilities.network.Bindable + node: aiorchestra.openstack.network.port.mgmt + relationship: tosca.relationships.openstack.compute.port.bind + - ssh: + capability: tosca.capabilities.openstack.compute.ssh.attachable + node: aiorchestra.openstack.keypair + relationship: tosca.relationships.openstack.ssh_keypair_provider + +######################################################################################## +######################################################################################## + + outputs: + mgmt_port_internal_address: + value: { get_attribute: [ aiorchestra.openstack.network.port.mgmt, ip_address ] } + mgmt_port_external_address: + value: { get_attribute: [ aiorchestra.openstack.network.floating_ip, floating_ip_address ] } + ssh_pubic: + value: { get_attribute: [aiorchestra.openstack.keypair, public_key] } + ssh_private: + value: { get_attribute: [aiorchestra.openstack.keypair, private_key_content] } diff --git a/openstack_plugin/tasks/compute.py b/openstack_plugin/tasks/compute.py index 85cf151..c62fe57 100644 --- a/openstack_plugin/tasks/compute.py +++ b/openstack_plugin/tasks/compute.py @@ -75,7 +75,7 @@ async def create(node, inputs): networks = [port['net-id'] for port in nics] node.batch_update_runtime_properties(**{ - 'id': instance.id, + 'compute_id': instance.id, 'server': instance.__dict__, 'status': instance.status, 'networks': networks, @@ -130,7 +130,7 @@ async def start(node, inputs): task_retry_interval = inputs.get('task_retry_interval', 10) nova = clients.openstack.nova(node) use_existing = True if node.properties.get('compute_id') else False - name_or_id = node.runtime_properties['server']['id'] + name_or_id = node.runtime_properties['compute_id'] node.context.logger.info('[{0}] - Attempting to start ' 'compute instance.'.format(node.name)) await instances.start( @@ -148,7 +148,7 @@ async def delete(node, inputs): task_retries = inputs.get('task_retries', 10) task_retry_interval = inputs.get('task_retry_interval', 10) use_existing = True if node.properties.get('compute_id') else False - name_or_id = node.runtime_properties['server']['id'] + name_or_id = node.runtime_properties['compute_id'] nova = clients.openstack.nova(node) await instances.delete(node.context, nova, name_or_id, @@ -164,11 +164,13 @@ async def delete(node, inputs): @utils.operation async def stop(node, inputs): + node.context.logger.info('[{0}] - Attempting to stop compute ' + 'instance.'.format(node.name)) task_retries = inputs.get('task_retries', 10) task_retry_interval = inputs.get('task_retry_interval', 10) nova = clients.openstack.nova(node) use_existing = True if node.properties.get('compute_id') else False - name_or_id = node.runtime_properties['id'] + name_or_id = node.runtime_properties['compute_id'] await instances.stop(node.context, nova, name_or_id, use_existing=use_existing, diff --git a/requirements-docs.txt b/requirements-docs.txt new file mode 100644 index 0000000..2806c16 --- /dev/null +++ b/requirements-docs.txt @@ -0,0 +1 @@ +Sphinx diff --git a/tox.ini b/tox.ini index dbf3f87..89b59de 100644 --- a/tox.ini +++ b/tox.ini @@ -18,10 +18,15 @@ deps = git+https://github.com/aiorchestra/aiorchestra.git#egg=aiorchestra -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt + -r{toxinidir}/requirements-docs.txt basepython = python3.5 + +[testenv:sphinx-docs] +commands = sphinx-build -b html docs/source docs/build + [testenv:pep8] -commands=flake8 openstack_plugin +commands = flake8 openstack_plugin [testenv:auth] commands = python -m testtools.run openstack_plugin/tests/integration/test_auth.py diff --git a/types.yaml b/types.yaml index 235e828..e09aa0f 100644 --- a/types.yaml +++ b/types.yaml @@ -140,9 +140,7 @@ node_types: scalable: type: tosca.capabilities.Scalable attributes: - id: - type: string - status: + compute_id: type: string networks: type: list @@ -242,10 +240,6 @@ node_types: derived_from: tosca.nodes.network.Network description: The TOSCA OpenStack Network subnet node type properties: - use_existing: - type: boolean - required: false - default: false ip_version: type: integer required: false @@ -956,23 +950,3 @@ node_types: type: scalar-unit.size constraints: - greater_or_equal: 0 MB - -################################################################################################## -# OpenStack datatypes -################################################################################################## - - tosca.datatypes.network.openstack.PortInfo: - derived_from: tosca.datatypes.network.PortInfo - properties: - port_name: - type: string - port_id: - type: string - network_id: - type: string - mac_address: - type: string - addresses: - type: list - entry_schema: - type: string