Retire stackforge/graffiti
This commit is contained in:
parent
fa4d4231f9
commit
ce23db0a96
@ -1,7 +0,0 @@
|
||||
[run]
|
||||
branch = True
|
||||
source = graffiti
|
||||
omit = graffiti/tests/*,graffiti/openstack/*
|
||||
|
||||
[report]
|
||||
ignore-errors = True
|
52
.gitignore
vendored
52
.gitignore
vendored
@ -1,52 +0,0 @@
|
||||
*.py[cod]
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist
|
||||
build
|
||||
eggs
|
||||
parts
|
||||
bin
|
||||
var
|
||||
sdist
|
||||
develop-eggs
|
||||
.installed.cfg
|
||||
lib
|
||||
lib64
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
.tox
|
||||
nosetests.xml
|
||||
.testrepository
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
|
||||
# Mr Developer
|
||||
.mr.developer.cfg
|
||||
.project
|
||||
.pydevproject
|
||||
|
||||
# Complexity
|
||||
output/*.html
|
||||
output/*/index.html
|
||||
|
||||
# Sphinx
|
||||
doc/build
|
||||
|
||||
# pbr generates these
|
||||
AUTHORS
|
||||
ChangeLog
|
||||
|
||||
# Editors
|
||||
*~
|
||||
.*.swp
|
||||
.idea
|
@ -1,4 +0,0 @@
|
||||
[gerrit]
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=stackforge/graffiti.git
|
3
.mailmap
3
.mailmap
@ -1,3 +0,0 @@
|
||||
# Format is:
|
||||
# <preferred e-mail> <other e-mail 1>
|
||||
# <preferred e-mail> <other e-mail 2>
|
@ -1,7 +0,0 @@
|
||||
[DEFAULT]
|
||||
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
||||
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
||||
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
|
||||
${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
@ -1,16 +0,0 @@
|
||||
If you would like to contribute to the development of OpenStack,
|
||||
you must follow the steps in this page:
|
||||
|
||||
http://docs.openstack.org/infra/manual/developers.html
|
||||
|
||||
Once those steps have been completed, changes to OpenStack
|
||||
should be submitted for review via the Gerrit tool, following
|
||||
the workflow documented at:
|
||||
|
||||
http://docs.openstack.org/infra/manual/developers.html#development-workflow
|
||||
|
||||
Pull requests submitted through GitHub will be ignored.
|
||||
|
||||
Bugs should be filed on Launchpad, not GitHub:
|
||||
|
||||
https://bugs.launchpad.net/graffiti
|
@ -1,4 +0,0 @@
|
||||
graffiti Style Commandments
|
||||
===============================================
|
||||
|
||||
Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/
|
175
LICENSE
175
LICENSE
@ -1,175 +0,0 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
@ -1,6 +0,0 @@
|
||||
include AUTHORS
|
||||
include ChangeLog
|
||||
exclude .gitignore
|
||||
exclude .gitreview
|
||||
|
||||
global-exclude *.pyc
|
16
README.rst
16
README.rst
@ -1,13 +1,7 @@
|
||||
===============================
|
||||
graffiti
|
||||
===============================
|
||||
This project is no longer maintained.
|
||||
|
||||
Cloud Capability Service
|
||||
The contents of this repository are still available in the Git source code
|
||||
management system. To see the contents of this repository before it reached
|
||||
its end of life, please check out the previous commit with
|
||||
"git checkout HEAD^1".
|
||||
|
||||
* Free software: Apache license
|
||||
* Documentation: http://docs.openstack.org/developer/graffiti
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* TODO
|
156
config.py
156
config.py
@ -1,156 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from graffiti.common import driver_factory
|
||||
from graffiti.common import utils
|
||||
|
||||
# Server Specific Configurations
|
||||
server = {
|
||||
'port': '21075',
|
||||
'host': '0.0.0.0'
|
||||
}
|
||||
|
||||
# Pecan Application Configurations
|
||||
app = {
|
||||
'root': 'graffiti.api.controllers.root.RootController',
|
||||
'modules': ['graffiti.api'],
|
||||
'static_root': '%(confdir)s/public',
|
||||
'template_path': '%(confdir)s/graffiti/templates',
|
||||
'debug': False,
|
||||
'errors': {
|
||||
404: '/error/404',
|
||||
'__force_dict__': True
|
||||
}
|
||||
}
|
||||
|
||||
logging = {
|
||||
'loggers': {
|
||||
'root': {'level': 'DEBUG', 'handlers': ['console']},
|
||||
'graffiti': {'level': 'DEBUG', 'handlers': ['console']},
|
||||
'wsme.api': {'level': 'DEBUG', 'handlers': ['console']},
|
||||
'py.warnings': {'handlers': ['console']},
|
||||
'__force_dict__': True
|
||||
},
|
||||
'handlers': {
|
||||
'console': {
|
||||
'level': 'DEBUG',
|
||||
'class': 'logging.StreamHandler',
|
||||
'formatter': 'simple'
|
||||
}
|
||||
},
|
||||
'formatters': {
|
||||
'simple': {
|
||||
'format': ('%(asctime)s %(levelname)-5.5s [%(name)s]'
|
||||
'[%(threadName)s] %(message)s')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wsme = {
|
||||
'debug': True
|
||||
}
|
||||
|
||||
|
||||
# Custom Configurations must be in Python dictionary format::
|
||||
#
|
||||
# foo = {'bar':'baz'}
|
||||
#
|
||||
# All configurations are accessible at::
|
||||
# pecan.conf
|
||||
|
||||
# oslo config
|
||||
keystone_group = cfg.OptGroup('keystone')
|
||||
keystone_opts = [
|
||||
cfg.StrOpt('auth_url',
|
||||
default='http://127.0.0.1:5000/v2.0',
|
||||
help='keystone authorization url'),
|
||||
cfg.StrOpt('username',
|
||||
default='admin',
|
||||
help='keystone username'),
|
||||
cfg.StrOpt('password',
|
||||
default='secretword',
|
||||
help='keystone password'),
|
||||
cfg.StrOpt('tenant_name',
|
||||
default='admin',
|
||||
help='keystone tenant name')
|
||||
|
||||
]
|
||||
cfg.CONF.register_group(keystone_group)
|
||||
cfg.CONF.register_opts(keystone_opts, group=keystone_group)
|
||||
|
||||
# DEFAULT group
|
||||
default_group = cfg.OptGroup('DEFAULT')
|
||||
default_opts = [
|
||||
cfg.StrOpt(
|
||||
'persistence_type',
|
||||
default="memory",
|
||||
help=("persistence options. "
|
||||
"values = 'memory' or 'file' or 'db"))
|
||||
]
|
||||
|
||||
cfg.CONF.register_group(default_group)
|
||||
cfg.CONF.register_opts(default_opts,
|
||||
group=default_group)
|
||||
|
||||
# FILE_PERSISTENCE group
|
||||
file_group = cfg.OptGroup('FILE_PERSISTENCE')
|
||||
file_opts = [
|
||||
cfg.StrOpt(
|
||||
'dictionary_folder',
|
||||
default="/tmp/graffiti-dictionary/",
|
||||
help=("Absolute path of the file for persisting dictionary")
|
||||
)
|
||||
]
|
||||
|
||||
cfg.CONF.register_group(file_group)
|
||||
cfg.CONF.register_opts(file_opts,
|
||||
group=file_group)
|
||||
|
||||
|
||||
# Used for remote debugging, like pychcharms or pydev
|
||||
# To enable remote debugging in pycharms, requires that you put the
|
||||
# pycharm-debug.egg in the python path. E.g.
|
||||
#
|
||||
# Include the pycharm-debug.egg archive.
|
||||
# e.g. /home/<USERNAME>/pycharm-3.1.1/pycharm-debug.egg
|
||||
# You can do it in a number of ways, for example:
|
||||
# Add the archive to PYTHONPATH.e,g,
|
||||
# export PYTHONPATH+=.:/home/<USERNAME>/pycharm-3.1.1/pycharm-debug.egg
|
||||
# Append the archive to sys.path. e.g.
|
||||
# import sys
|
||||
# sys.path.append('/home/<USERNANE>/pycharm-3.1.1/pycharm-debug.egg')
|
||||
# Just copy the pydev from the archive to the directory where your remote
|
||||
# script resides.
|
||||
#
|
||||
# You will need to setup a debug configuration in your pycharms and start the
|
||||
# debugger BEFORE starting pecan
|
||||
# This is because the following code connects from here to your pycharms
|
||||
# (or your pydev)
|
||||
pydevd = {
|
||||
'enabled': False,
|
||||
'port': 22075,
|
||||
'bindhost': 'localhost'
|
||||
}
|
||||
|
||||
|
||||
# Discover and load drivers
|
||||
df = driver_factory.DriverFactory()
|
||||
|
||||
# Load Out of the box Dictionary
|
||||
#specify url kwarg to load from URL. Or load from file system
|
||||
utils.load_dictionary(url='http://localhost:21071/1/capability_type/all/')
|
||||
#utils.load_dictionary()
|
@ -1,75 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.abspath('../..'))
|
||||
# -- General configuration ----------------------------------------------------
|
||||
|
||||
# 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',
|
||||
'oslo.sphinx'
|
||||
]
|
||||
|
||||
# autodoc generation is a bit aggressive and a nuisance when doing heavy
|
||||
# text edit cycles.
|
||||
# execute "export SPHINX_DEBUG=1" in your terminal to disable
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'graffiti'
|
||||
copyright = u'2013, OpenStack Foundation'
|
||||
|
||||
# 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
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# -- Options for HTML output --------------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. Major themes that come with
|
||||
# Sphinx are currently 'default' and 'sphinxdoc'.
|
||||
# html_theme_path = ["."]
|
||||
# html_theme = '_theme'
|
||||
# html_static_path = ['static']
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = '%sdoc' % project
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass
|
||||
# [howto/manual]).
|
||||
latex_documents = [
|
||||
('index',
|
||||
'%s.tex' % project,
|
||||
u'%s Documentation' % project,
|
||||
u'OpenStack Foundation', 'manual'),
|
||||
]
|
||||
|
||||
# Example configuration for intersphinx: refer to the Python standard library.
|
||||
#intersphinx_mapping = {'http://docs.python.org/': None}
|
@ -1 +0,0 @@
|
||||
.. include:: ../../CONTRIBUTING.rst
|
@ -1,24 +0,0 @@
|
||||
.. graffiti documentation master file, created by
|
||||
sphinx-quickstart on Tue Jul 9 22:26:36 2013.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Welcome to graffiti's documentation!
|
||||
========================================================
|
||||
|
||||
Contents:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
readme
|
||||
installation
|
||||
usage
|
||||
contributing
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
@ -1,12 +0,0 @@
|
||||
============
|
||||
Installation
|
||||
============
|
||||
|
||||
At the command line::
|
||||
|
||||
$ pip install graffiti
|
||||
|
||||
Or, if you have virtualenvwrapper installed::
|
||||
|
||||
$ mkvirtualenv graffiti
|
||||
$ pip install graffiti
|
@ -1 +0,0 @@
|
||||
.. include:: ../README.rst
|
@ -1,7 +0,0 @@
|
||||
========
|
||||
Usage
|
||||
========
|
||||
|
||||
To use graffiti in a project::
|
||||
|
||||
import graffiti
|
@ -1,196 +0,0 @@
|
||||
{ "capability_type_list" :
|
||||
[
|
||||
{
|
||||
"name": "Apache",
|
||||
"namespace": "SAMPLES",
|
||||
"description": "The Apache HTTP Server Project is a collaborative software development effort aimed at creating a robust, commercial-grade, featureful, and freely-available source code implementation of an HTTP (Web) server. The project is jointly managed by a group of volunteers located around the world, using the Internet and the Web to communicate, plan, and develop the server and its related documentation. This project is part of the Apache Software Foundation. In addition, hundreds of users have contributed ideas, code, and documentation to the project. This file is intended to briefly describe the history of the Apache HTTP Server and recognize the many contributors.",
|
||||
"derived_from": {
|
||||
"name": "Software",
|
||||
"namespace": "SAMPLES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "Database",
|
||||
"namespace": "SAMPLES",
|
||||
"description": "Database management systems (DBMSs) are specially designed software applications that interact with the user, other applications, and the database itself to capture and analyze data. A general-purpose DBMS is a software system designed to allow the definition, creation, querying, update, and administration of databases.",
|
||||
"derived_from": {
|
||||
"name": "Software",
|
||||
"namespace": "SAMPLES"
|
||||
},
|
||||
"properties": {
|
||||
"listen_port": {
|
||||
"type": "integer",
|
||||
"description": "",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"minimum": 1,
|
||||
"maximum": 65535
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "GPU",
|
||||
"namespace": "SAMPLES",
|
||||
"description": "",
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "LAMP",
|
||||
"namespace": "SAMPLES",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "SoftwareStack",
|
||||
"namespace": "SAMPLES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "MediaWiki",
|
||||
"namespace": "SAMPLES",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "Software",
|
||||
"namespace": "SAMPLES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "MongoDB",
|
||||
"namespace": "SAMPLES",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "BigData",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "MySQL",
|
||||
"namespace": "SAMPLES",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "Database",
|
||||
"namespace": "SAMPLES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "php",
|
||||
"namespace": "SAMPLES",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "Runtime",
|
||||
"namespace": "SAMPLES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "PropertyTypesSamples",
|
||||
"namespace": "SAMPLES",
|
||||
"description": "Sample Description",
|
||||
"properties": {
|
||||
"Property1": {
|
||||
"type": "string",
|
||||
"description": "Property1 blah",
|
||||
"defaultValue": "BLAh",
|
||||
"required": true,
|
||||
"confidential": true,
|
||||
"minLength": 1,
|
||||
"maxLength": 45,
|
||||
"pattern": "[A-Z]{3}.*"
|
||||
},
|
||||
"Property2": {
|
||||
"type": "integer",
|
||||
"description": "Property2 blah",
|
||||
"defaultValue": 4,
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"minimum": 1,
|
||||
"maximum": 6
|
||||
},
|
||||
"Property3": {
|
||||
"type": "double",
|
||||
"description": "Property3 blah",
|
||||
"defaultValue": 4.5,
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"minimum": 3,
|
||||
"maximum": 7.64
|
||||
},
|
||||
"Property4": {
|
||||
"type": "boolean",
|
||||
"description": "Property4 blah",
|
||||
"defaultValue": true,
|
||||
"required": false,
|
||||
"confidential": false
|
||||
},
|
||||
"Property5": {
|
||||
"type": "choice",
|
||||
"description": "Property5 blah",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"itemType": "string",
|
||||
"items": [
|
||||
"choice1",
|
||||
"choice2",
|
||||
"choice3"
|
||||
]
|
||||
},
|
||||
"Property6": {
|
||||
"type": "date",
|
||||
"description": "Property6 blah",
|
||||
"required": true,
|
||||
"confidential": false
|
||||
},
|
||||
"Property7": {
|
||||
"type": "resource_id",
|
||||
"description": "Property7 blah",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
},
|
||||
"Property8": {
|
||||
"type": "string",
|
||||
"description": "Property8 blah",
|
||||
"required": true,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Runtime",
|
||||
"namespace": "SAMPLES",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "Software",
|
||||
"namespace": "SAMPLES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "Software",
|
||||
"namespace": "SAMPLES",
|
||||
"description": "",
|
||||
"properties": {
|
||||
"version": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "SoftwareStack",
|
||||
"namespace": "SAMPLES",
|
||||
"description": "",
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "SSD",
|
||||
"namespace": "SAMPLES",
|
||||
"description": "SSD Drive",
|
||||
"properties": {}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,268 +0,0 @@
|
||||
{ "capability_type_list" :
|
||||
[
|
||||
{
|
||||
"name": "aes",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "CPU feature flag used in ComputeCapabilitiesFilter matching extra_spec (k,v) = ('capabilities : cpu_info : features', '<in> 'lahf_lm'')",
|
||||
"derived_from": {
|
||||
"name": "features",
|
||||
"namespace": "OS::COMPUTE::CPU"
|
||||
},
|
||||
"properties": {
|
||||
"features": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "aes",
|
||||
"required": true,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "AMD",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "CPU vendor name used in ComputeCapabilitiesFilter matching extra_spec (k,v) = ('capabilities : cpu_info : vendor', 'AMD')",
|
||||
"derived_from": {
|
||||
"name": "vendor",
|
||||
"namespace": "OS::COMPUTE::CPU"
|
||||
},
|
||||
"properties": {
|
||||
"vendor": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "AMD",
|
||||
"required": true,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "arch",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "",
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "Conroe",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "CPU model name used in ComputeCapabilitiesFilter matching extra_spec (k,v) = ('capabilities : cpu_info : model', 'core2duo')",
|
||||
"derived_from": {
|
||||
"name": "model",
|
||||
"namespace": "OS::COMPUTE::CPU"
|
||||
},
|
||||
"properties": {
|
||||
"model": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "Conroe",
|
||||
"required": true,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Core2duo",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "CPU model name used in ComputeCapabilitiesFilter matching extra_spec (k,v) = ('capabilities : cpu_info : model', 'core2duo')",
|
||||
"derived_from": {
|
||||
"name": "model",
|
||||
"namespace": "OS::COMPUTE::CPU"
|
||||
},
|
||||
"properties": {
|
||||
"model": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "Core2duo",
|
||||
"required": true,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "cores",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "Number of cores used in ComputeCapabilitiesFilter matching extra_spec (k,v) = ('capabilities : cpu_info : topology : cores', '1')",
|
||||
"derived_from": {
|
||||
"name": "topology",
|
||||
"namespace": "OS::COMPUTE::CPU"
|
||||
},
|
||||
"properties": {
|
||||
"cores": {
|
||||
"type": "integer",
|
||||
"description": "",
|
||||
"defaultValue": 1,
|
||||
"required": true,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "features",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "",
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "i686",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "CPU arch code used in ComputeCapabilitiesFilter matching extra_spec (k,v) = ('capabilities : cpu_info : arch', 'x86_64')",
|
||||
"derived_from": {
|
||||
"name": "arch",
|
||||
"namespace": "OS::COMPUTE::CPU"
|
||||
},
|
||||
"properties": {
|
||||
"arch": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "i686",
|
||||
"required": true,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Intel",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "CPU vendor name used in ComputeCapabilitiesFilter matching extra_spec (k,v) = ('capabilities : cpu_info : vendor', 'Intel')",
|
||||
"derived_from": {
|
||||
"name": "vendor",
|
||||
"namespace": "OS::COMPUTE::CPU"
|
||||
},
|
||||
"properties": {
|
||||
"vendor": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "Intel",
|
||||
"required": true,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "mmx",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "CPU feature flag used in ComputeCapabilitiesFilter matching extra_spec (k,v) = ('capabilities : cpu_info : features', '<in> 'lahf_lm'')",
|
||||
"derived_from": {
|
||||
"name": "features",
|
||||
"namespace": "OS::COMPUTE::CPU"
|
||||
},
|
||||
"properties": {
|
||||
"features": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "mmx",
|
||||
"required": true,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "model",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "",
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "rdtscp",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "CPU feature flag used in ComputeCapabilitiesFilter matching extra_spec (k,v) = ('capabilities : cpu_info : features', '<in> 'lahf_lm'')",
|
||||
"derived_from": {
|
||||
"name": "features",
|
||||
"namespace": "OS::COMPUTE::CPU"
|
||||
},
|
||||
"properties": {
|
||||
"features": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "rdtscp",
|
||||
"required": true,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sockets",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "Number of cores used in ComputeCapabilitiesFilter matching extra_spec (k,v) = ('capabilities : cpu_info : topology : cores', '1')",
|
||||
"derived_from": {
|
||||
"name": "topology",
|
||||
"namespace": "OS::COMPUTE::CPU"
|
||||
},
|
||||
"properties": {
|
||||
"sockets": {
|
||||
"type": "integer",
|
||||
"description": "",
|
||||
"defaultValue": 1,
|
||||
"required": true,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "threads",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "Number of cores used in ComputeCapabilitiesFilter matching extra_spec (k,v) = ('capabilities : cpu_info : topology : cores', '1')",
|
||||
"derived_from": {
|
||||
"name": "topology",
|
||||
"namespace": "OS::COMPUTE::CPU"
|
||||
},
|
||||
"properties": {
|
||||
"threads": {
|
||||
"type": "integer",
|
||||
"description": "",
|
||||
"defaultValue": 1,
|
||||
"required": true,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "topology",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "Number of cores used in ComputeCapabilitiesFilter matching extra_spec (k,v) = ('capabilities : cpu_info : topology : cores', '1')",
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "vendor",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "",
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "Westmere",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "CPU model name used in ComputeCapabilitiesFilter matching extra_spec (k,v) = ('capabilities : cpu_info : model', 'core2duo')",
|
||||
"derived_from": {
|
||||
"name": "model",
|
||||
"namespace": "OS::COMPUTE::CPU"
|
||||
},
|
||||
"properties": {
|
||||
"model": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "Westmere",
|
||||
"required": true,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x86_64",
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"description": "CPU arch code used in ComputeCapabilitiesFilter matching extra_spec (k,v) = ('capabilities : cpu_info : arch', 'x86_64')",
|
||||
"derived_from": {
|
||||
"name": "arch",
|
||||
"namespace": "OS::COMPUTE::CPU"
|
||||
},
|
||||
"properties": {
|
||||
"arch": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "x86_64",
|
||||
"required": true,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,861 +0,0 @@
|
||||
{ "capability_type_list" :
|
||||
[
|
||||
{
|
||||
"name": "alpha",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ArchLinux",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Arch Linux is a Linux-based operating system for i686 and x86-64 computers.It is composed predominantly of free and open source software, and supports community involvement.",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "arch",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "armv71",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CENTOS",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Community Enterprise Operating System CentOS (abbreviated from Community Enterprise Operating System) is a Linux distribution that attempts to provide a free enterprise class computing platform which aims to be 100% binary compatible with its upstream source, Red Hat Enterprise Linux (RHEL).",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "centos",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose. The ImagePropertiesFilter filters compute nodes that satisfy any architecture, hypervisor type, or virtual machine mode properties specified on the instance's image properties. Image properties are contained in the image dictionary in the request_spec.",
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "cris",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Debian",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Debian is an operating system composed of free software mostly carrying the GNU General Public License. The operating system is developed by an internet collaboration of volunteers aligned with The Debian Project. \n\nDebian systems can use either the Linux kernel (known as the Debian GNU/Linux distribution), the FreeBSD kernel (known as the Debian GNU/kFreeBSD distribution) or, more recently, the GNU Hurd kernel (more precisely, the GNU Mach microkernel and its servers; known as the Debian GNU/Hurd distribution).",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "debian",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Fedora",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Fedora (formerly Fedora Core) is an operating system based on the Linux kernel, developed by the community-supported Fedora Project and owned by Red Hat. Fedora contains software distributed under a free and open source license and aims to be on the leading edge of such technologies.",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "fedora",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "FreeBSD",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "FreeBSD is a free Unix-like operating system descended from AT&T Unix via BSD. Although for legal reasons FreeBSD cannot be called \"Unix,\" it is a direct descendant from BSD, which was historically also called \"BSD Unix\" or \"Berkeley Unix.\"",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "freebsd",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "GentooLinux",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Gentoo Linux is a computer operating system based on the Linux kernel and built using the Portage package management system. It is distributed as free and open source software. Unlike a binary software distribution, the source code is compiled locally according to the user's preferences and is often optimized for the specific type of computer. Precompiled binaries are available for some very large packages and for packages whose source code has not been released.",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "gentoo",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "i686",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ia64",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "lm32",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "m68k",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "MandrakeLinux",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Mandriva Linux (result of fusion of the French distribution Mandrakelinux or Mandrake Linux and the Brazilian distribution Conectiva Linux) is a Linux distribution distributed by Mandriva. It uses the RPM Package Manager.",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "mandrake",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "MandrivaEnterpriseServer",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Mandriva Linux (result of fusion of the French distribution Mandrakelinux or Mandrake Linux and the Brazilian distribution Conectiva Linux) is a Linux distribution distributed by Mandriva. It uses the RPM Package Manager.",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "mes",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "MandrivaLinux",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "mandriva",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "microblaze",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "microblazeel",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "mips",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "mips64",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "mips64el",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "mipsel",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "MS-DOS",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Microsoft Disc Operating System",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "msdos",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "NetBSD",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "NetBSD is an open-source Unix-like operating system descended from Berkeley Software Distribution (BSD), a Unix derivative developed at the University of California, Berkeley.",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "netbsd",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "OpenBSD",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "OpenBSD is a Unix-like computer operating system descended from Berkeley Software Distribution (BSD), a Unix derivative developed at the University of California, Berkeley.",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "openbsd",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "openrisc",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "OpenSolaris",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "OpenSolaris was an open source computer operating system based on Solaris created by Sun Microsystems. It was also the name of the project initiated by Sun to build a developer and user community around the software. After the acquisition of Sun Microsystems in 2010, Oracle decided to discontinue open development of the core software, and replaced the OpenSolaris distribution model with the proprietary Solaris Express.",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "opensolaris",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "OpenSUSE",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "openSUSE is a general purpose operating system built on top of the Linux kernel, developed by the community-supported openSUSE Project and sponsored by SUSE and a number of other companies.",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "opensuse",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "",
|
||||
"properties": {
|
||||
"os_version": {
|
||||
"type": "string",
|
||||
"description": "The operating system version as specified by the distributor (for example, 12.04).",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "parisc",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "parisc64",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ppc",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ppc64",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ppcemb",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "RedHatEnterpriseLinux",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Red Hat Enterprise Linux (RHEL) is a Linux distribution developed by Red Hat and targeted toward the commercial market.",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "rhel",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "s390",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "s390x",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sh4",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sh4eb",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sparc",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sparc64",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "SUSELinuxEnterpriseDesktop",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "SUSE Linux Enterprise Desktop (SLED), formerly introduced as Novell Linux Desktop, is a Linux distribution supplied by SUSE and targeted at the business market. It is targeted for desktops.",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "sled",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Ubuntu",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Ubuntu is a Debian-based Linux operating system.",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "ubuntu",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "unicore32",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Windows",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "A series of graphical interface operating systems developed, marketed, and sold by Microsoft.",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "The common name of the operating system distribution in lowercase (uses the same data vocabulary as the libosinfo project).",
|
||||
"defaultValue": "windows",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "windows"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x86_64",
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"description": "Compute architecture. x86-64 (also known as x64, x86_64 and AMD64) is the 64-bit version of the x86 instruction set. It supports vastly larger amounts of virtual memory and physical memory than is possible on its predecessors, allowing programs to store larger amounts of data in memory. x86-64 also provides 64-bit general purpose registers and numerous other enhancements. The original specification was created by AMD, and has been implemented by AMD, Intel, VIA, and others. It is fully backwards compatible with 16-bit and 32-bit x86 code.",
|
||||
"derived_from": {
|
||||
"name": "CPUArchitecture",
|
||||
"namespace": "OS::COMPUTE::GUEST"
|
||||
},
|
||||
"properties": {
|
||||
"architecture": {
|
||||
"type": "string",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"defaultValue": "x86_64",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "x86_64"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,354 +0,0 @@
|
||||
{ "capability_type_list" :
|
||||
[
|
||||
{
|
||||
"name": "ComputeDriverOptions",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "",
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "ContainerVirtualization",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "Executables in containers. This is the virtual machine mode (vm_mode) used by LXC. It may be used by the host properties filter for scheduling.",
|
||||
"derived_from": {
|
||||
"name": "VirtualizationMode",
|
||||
"namespace": "OS::COMPUTE::HOST"
|
||||
},
|
||||
"properties": {
|
||||
"vm_mode": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "exe",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "exe"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "FullVirtualization",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "hvm Fully virtualized. This is the virtual machine mode (vm_mode) used by QEMU and KVM. It may be used by the host properties filter for scheduling.",
|
||||
"derived_from": {
|
||||
"name": "VirtualizationMode",
|
||||
"namespace": "OS::COMPUTE::HOST"
|
||||
},
|
||||
"properties": {
|
||||
"vm_mode": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "hvm",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "hvm"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "HyperV",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "The hypervisor type (hypervisor_type). It may be used by the host properties filter for scheduling.",
|
||||
"derived_from": {
|
||||
"name": "HypervisorType",
|
||||
"namespace": "OS::COMPUTE::HOST"
|
||||
},
|
||||
"properties": {
|
||||
"hypervisor_type": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "hyperv",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "hyperv"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "HypervisorType",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "The hypervisor type. It may be used by the host properties filter for scheduling. The ImagePropertiesFilter filters compute nodes that satisfy any architecture, hypervisor type, or virtual machine mode properties specified on the instance's image properties. Image properties are contained in the image dictionary in the request_spec.",
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "KVM",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "The hypervisor type (hypervisor_type). It may be used by the host properties filter for scheduling.",
|
||||
"derived_from": {
|
||||
"name": "HypervisorType",
|
||||
"namespace": "OS::COMPUTE::HOST"
|
||||
},
|
||||
"properties": {
|
||||
"hypervisor_type": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "kvm",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "kvm"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "libvirtDriverOptions",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "The libvirt compute driver options. Sets hw_rng_model, hw_machine_type, hw_video_model, hw_video_ram, hw_watchdog_action, os_command_line properties.\n\nThese are properties specific to compute drivers. For a list of all hypervisors, see here: https://wiki.openstack.org/wiki/HypervisorSupportMatrix",
|
||||
"derived_from": {
|
||||
"name": "ComputeDriverOptions",
|
||||
"namespace": "OS::COMPUTE::HOST"
|
||||
},
|
||||
"properties": {
|
||||
"hw_video_model": {
|
||||
"type": "choice",
|
||||
"description": "The video image driver used.",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"itemType": "string",
|
||||
"items": [
|
||||
"vga",
|
||||
"cirrus",
|
||||
"vmvga",
|
||||
"xen",
|
||||
"gxl"
|
||||
]
|
||||
},
|
||||
"hw_machine_type": {
|
||||
"type": "string",
|
||||
"description": "Enables booting an ARM system using the specified machine type. By default, if an ARM image is used and its type is not specified, Compute uses vexpress-a15 (for ARMv7) or virt (for AArch64) machine types.\n\nLibvirt machine type. Valid types can be viewed by using the virsh capabilities command (machine types are displayed in the machine tag).",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
},
|
||||
"hw_rng_model": {
|
||||
"type": "string",
|
||||
"description": "Adds a random-number generator device to the image's instances. The cloud administrator can enable and control device behavior by configuring the instance's flavor. By default, the generator device is disabled.",
|
||||
"defaultValue": "virtio",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
},
|
||||
"hw_watchdog_action": {
|
||||
"type": "choice",
|
||||
"description": "Enables a virtual hardware watchdog device that carries out the specified action if the server hangs. The watchdog uses the i6300esb device (emulating a PCI Intel 6300ESB). If hw_watchdog_action is not specified, the watchdog is disabled.",
|
||||
"defaultValue": "disabled",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"itemType": "string",
|
||||
"items": [
|
||||
"disabled",
|
||||
"reset",
|
||||
"poweroff",
|
||||
"pause",
|
||||
"none"
|
||||
]
|
||||
},
|
||||
"os_command_line": {
|
||||
"type": "string",
|
||||
"description": "The kernel command line to be used by the libvirt driver, instead of the default. For linux containers (LXC), the value is used as arguments for initialization.",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "LXC",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "The hypervisor type (hypervisor_type). It may be used by the host properties filter for scheduling.",
|
||||
"derived_from": {
|
||||
"name": "HypervisorType",
|
||||
"namespace": "OS::COMPUTE::HOST"
|
||||
},
|
||||
"properties": {
|
||||
"hypervisor_type": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "lxc",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "lxc"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Qemu",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "The hypervisor type (hypervisor_type). It may be used by the host properties filter for scheduling.",
|
||||
"derived_from": {
|
||||
"name": "HypervisorType",
|
||||
"namespace": "OS::COMPUTE::HOST"
|
||||
},
|
||||
"properties": {
|
||||
"hypervisor_type": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "qemu",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "qemu"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "UserModeLinux-UML",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "The uml hypervisor type (hypervisor_type). It may be used by the host properties filter for scheduling.",
|
||||
"derived_from": {
|
||||
"name": "HypervisorType",
|
||||
"namespace": "OS::COMPUTE::HOST"
|
||||
},
|
||||
"properties": {
|
||||
"hypervisor_type": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "uml",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "uml"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "UserModeLinuxParavirtualization",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "uml<6D>User Mode Linux paravirtualized virtual machine mode (vm_mode). It may be used by the host properties filter for scheduling.",
|
||||
"derived_from": {
|
||||
"name": "VirtualizationMode",
|
||||
"namespace": "OS::COMPUTE::HOST"
|
||||
},
|
||||
"properties": {
|
||||
"vm_mode": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "uml",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "uml"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "VirtualizationMode",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "The virtual machine mode. This represents the host/guest ABI (application binary interface) used for the virtual machine. The ImagePropertiesFilter filters compute nodes that satisfy any architecture, hypervisor type, or virtual machine mode properties specified on the instance's image properties. Image properties are contained in the image dictionary in the request_spec.",
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "VMWare",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "The hypervisor type (hypervisor_type). It may be used by the host properties filter for scheduling.",
|
||||
"derived_from": {
|
||||
"name": "HypervisorType",
|
||||
"namespace": "OS::COMPUTE::HOST"
|
||||
},
|
||||
"properties": {
|
||||
"hypervisor_type": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "vmware",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "vmware"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "VMwareDriverOptions",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "The VMWare compute driver. Sets vmware_adaptertype, vmware_ostype, vmware_image_version properties.\n\nThese are properties specific to compute drivers. For a list of all hypervisors, see here: https://wiki.openstack.org/wiki/HypervisorSupportMatrix",
|
||||
"derived_from": {
|
||||
"name": "ComputeDriverOptions",
|
||||
"namespace": "OS::COMPUTE::HOST"
|
||||
},
|
||||
"properties": {
|
||||
"vmware_adaptertype": {
|
||||
"type": "choice",
|
||||
"description": "Indicates the virtual SCSI or IDE controller used by the hypervisor.",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"itemType": "string",
|
||||
"items": [
|
||||
"lsiLogic",
|
||||
" busLogic",
|
||||
"ide"
|
||||
]
|
||||
},
|
||||
"vmware_ostype": {
|
||||
"type": "string",
|
||||
"description": "A VMware GuestID which describes the operating system installed in the image. This will be passed to the hypervisor when creating a virtual machine. See thinkvirt.com for a list of valid values. If this is not specified, it will default to otherGuest.",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
},
|
||||
"vmware_image_version": {
|
||||
"type": "string",
|
||||
"description": "Currently unused, set it to 1.",
|
||||
"defaultValue": "1",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Xen",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "The hypervisor type (hypervisor_type). It may be used by the host properties filter for scheduling.",
|
||||
"derived_from": {
|
||||
"name": "HypervisorType",
|
||||
"namespace": "OS::COMPUTE::HOST"
|
||||
},
|
||||
"properties": {
|
||||
"hypervisor_type": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "xen",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "xen"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "XenDriverOptions",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "The XenAPI Driver. Sets auto_disk_config and os_type.\n\nThese are properties specific to compute drivers. For a list of all hypervisors, see here: https://wiki.openstack.org/wiki/HypervisorSupportMatrix",
|
||||
"derived_from": {
|
||||
"name": "ComputeDriverOptions",
|
||||
"namespace": "OS::COMPUTE::HOST"
|
||||
},
|
||||
"properties": {
|
||||
"auto_disk_config": {
|
||||
"type": "boolean",
|
||||
"description": "If true, the root partition on the disk is automatically resized before the instance boots. This value is only taken into account by the Compute service when using a Xen-based hypervisor with the XenAPI driver. The Compute service will only attempt to resize if there is a single partition on the image, and only if the partition is in ext3 or ext4 format.",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
},
|
||||
"os_type": {
|
||||
"type": "choice",
|
||||
"description": "The operating system installed on the image. The XenAPI driver contains logic that takes different actions depending on the value of the os_type parameter of the image. For example, for os_type=windows images, it creates a FAT32-based swap partition instead of a Linux swap partition, and it limits the injected host name to less than 16 characters.",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"itemType": "string",
|
||||
"items": [
|
||||
"linux",
|
||||
"windows"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "XenParavirtualization",
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"description": "xen<65>Xen 3.0 paravirtualized virtual machine mode (vm_mode). It may be used by the host properties filter for scheduling.",
|
||||
"derived_from": {
|
||||
"name": "VirtualizationMode",
|
||||
"namespace": "OS::COMPUTE::HOST"
|
||||
},
|
||||
"properties": {
|
||||
"vm_mode": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "xen",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "xen"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
{ "capability_type_list" :
|
||||
[
|
||||
{
|
||||
"name": "Image",
|
||||
"namespace": "OS::GLANCE",
|
||||
"description": "A collection of files for a specific operating system (OS) that you use to create or rebuild a server. OpenStack provides pre-built images. You can also create custom images, or snapshots, from servers that you have launched. Custom images can be used for data backups or as \"gold\" images for additional servers.",
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "ImageSnapshot",
|
||||
"namespace": "OS::GLANCE",
|
||||
"description": "The OpenStack snapshot mechanism allows you to create new images from running instances. This is very convenient for upgrading base images or for taking a published image and customizing it for local use. However, an instance snapshot is an image. The only difference between an image that you upload directly to the Image Service and an image that you create by snapshot is that an image created by snapshot has additional properties in the glance database.",
|
||||
"properties": {
|
||||
"image_type": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "snapshot",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "snapshot"
|
||||
},
|
||||
"instance_uuid": {
|
||||
"type": "string",
|
||||
"description": "uuid of instance that was snapshotted",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
},
|
||||
"base_image_ref": {
|
||||
"type": "string",
|
||||
"description": "uuid of original image of instance that was snapshotted",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
},
|
||||
"image_location": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "snapshot",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "snapshot"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
{ "capability_type_list" :
|
||||
[
|
||||
{
|
||||
"name": "BIOSTXT",
|
||||
"namespace": "TRUST",
|
||||
"description": "BIOS Trusted Execution Technology",
|
||||
"derived_from": {
|
||||
"name": "Trusted",
|
||||
"namespace": "TRUST"
|
||||
},
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"description": "",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
},
|
||||
"verified": {
|
||||
"type": "boolean",
|
||||
"description": "",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "HypervisorTXT",
|
||||
"namespace": "TRUST",
|
||||
"description": "Hypervisor Trusted Execution Technology",
|
||||
"derived_from": {
|
||||
"name": "Trusted",
|
||||
"namespace": "TRUST"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "Trusted",
|
||||
"namespace": "TRUST",
|
||||
"description": "",
|
||||
"properties": {}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,252 +0,0 @@
|
||||
{ "capability_type_list" :
|
||||
[
|
||||
{
|
||||
"name": "ApplicationDevelopment",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Application Development",
|
||||
"derived_from": {
|
||||
"name": "SoftwareInfrastructure",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "ApplicationServers",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Application Servers",
|
||||
"derived_from": {
|
||||
"name": "SoftwareInfrastructure",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "ApplicationStacks",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Application Stacks",
|
||||
"derived_from": {
|
||||
"name": "SoftwareInfrastructure",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "BigData",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Big Data",
|
||||
"derived_from": {
|
||||
"name": "SoftwareInfrastructure",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "BusinessIntelligence",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Business Intelligence",
|
||||
"derived_from": {
|
||||
"name": "BusinessSoftware",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "BusinessSoftware",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Business Software",
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "Collaboration",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Collaboration",
|
||||
"derived_from": {
|
||||
"name": "BusinessSoftware",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "ContentManagement",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Content Management",
|
||||
"derived_from": {
|
||||
"name": "BusinessSoftware",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "CRM",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "CRM",
|
||||
"derived_from": {
|
||||
"name": "BusinessSoftware",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "DatabasesAndCaching",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Databases & Caching",
|
||||
"derived_from": {
|
||||
"name": "SoftwareInfrastructure",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "DeveloperTools",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Developer Tools",
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "eCommerce",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "eCommerce",
|
||||
"derived_from": {
|
||||
"name": "BusinessSoftware",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "FinancialServices",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Financial Services",
|
||||
"derived_from": {
|
||||
"name": "BusinessSoftware",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "HighPerformanceComputing",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "High Performance Computing",
|
||||
"derived_from": {
|
||||
"name": "BusinessSoftware",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "IssuesAndBugTracking",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Issue & Bug Tracking",
|
||||
"derived_from": {
|
||||
"name": "DeveloperTools",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "LogAnalysis",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Log Analysis",
|
||||
"derived_from": {
|
||||
"name": "DeveloperTools",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "Media",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Media",
|
||||
"derived_from": {
|
||||
"name": "BusinessSoftware",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "Monitoring",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Monitoring",
|
||||
"derived_from": {
|
||||
"name": "DeveloperTools",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "NetworkInfrastructure",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Network Infrastructure",
|
||||
"derived_from": {
|
||||
"name": "SoftwareInfrastructure",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "OperatingSystems",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Operating Systems",
|
||||
"derived_from": {
|
||||
"name": "SoftwareInfrastructure",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "ProjectManagement",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Project Management",
|
||||
"derived_from": {
|
||||
"name": "BusinessSoftware",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "Security",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Security",
|
||||
"derived_from": {
|
||||
"name": "SoftwareInfrastructure",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "SoftwareInfrastructure",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Software Infrastructure",
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "SourceControl",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Source Control",
|
||||
"derived_from": {
|
||||
"name": "DeveloperTools",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "StorageAndBackup",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Storage & Backup",
|
||||
"derived_from": {
|
||||
"name": "BusinessSoftware",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "Testing",
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"description": "Testing",
|
||||
"derived_from": {
|
||||
"name": "DeveloperTools",
|
||||
"namespace": "APPLICATION::CATEGORIES"
|
||||
},
|
||||
"properties": {}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
[
|
||||
{
|
||||
"namespace": "APPLICATION::CATEGORIES",
|
||||
"resource_types": [ "OS::GLANCE::IMAGE", "OS::GLANCE::SNAPSHOT", "OS::CINDER::VOLUME", "OS::CINDER::VOLUMESNAPSHOT" ],
|
||||
"property_format" : "P"
|
||||
},
|
||||
{
|
||||
"namespace": "OS::CINDER",
|
||||
"resource_types": [ "OS::GLANCE::IMAGE", "OS::GLANCE::SNAPSHOT", "OS::CINDER::VOLUME", "OS::CINDER::VOLUMESNAPSHOT" ],
|
||||
"property_format" : "P"
|
||||
},
|
||||
{
|
||||
"namespace": "OS::COMPUTE::CPU",
|
||||
"resource_types": [ "OS::GLANCE::IMAGE", "OS::GLANCE::SNAPSHOT", "OS::CINDER::VOLUME", "OS::CINDER::VOLUMESNAPSHOT" ],
|
||||
"property_format" : "P"
|
||||
},
|
||||
{
|
||||
"namespace": "SAMPLES",
|
||||
"resource_types": [ "OS::GLANCE::IMAGE", "OS::GLANCE::SNAPSHOT", "OS::CINDER::VOLUME", "OS::CINDER::VOLUMESNAPSHOT" ],
|
||||
"property_format" : "P"
|
||||
},
|
||||
{
|
||||
"namespace": "OS::COMPUTE::HOST",
|
||||
"resource_types": [ "OS::GLANCE::IMAGE", "OS::GLANCE::SNAPSHOT", "OS::CINDER::VOLUME", "OS::CINDER::VOLUMESNAPSHOT" ],
|
||||
"property_format" : "P"
|
||||
},
|
||||
{
|
||||
"namespace": "OS::COMPUTE::GUEST",
|
||||
"resource_types": [ "OS::GLANCE::IMAGE", "OS::GLANCE::SNAPSHOT", "OS::CINDER::VOLUME", "OS::CINDER::VOLUMESNAPSHOT" ],
|
||||
"property_format" : "P"
|
||||
},
|
||||
{
|
||||
"namespace": "OS::COMPUTE",
|
||||
"resource_types": [ "OS::GLANCE::IMAGE", "OS::GLANCE::SNAPSHOT", "OS::CINDER::VOLUME", "OS::CINDER::VOLUMESNAPSHOT" ],
|
||||
"property_format" : "P"
|
||||
},
|
||||
{
|
||||
"namespace": "SERVICE::ASSURANCE",
|
||||
"resource_types": [ "OS::NOVA::FLAVOR", "OS::NOVA::HOSTAGGREGATE" ],
|
||||
"property_format" : "P"
|
||||
}
|
||||
]
|
@ -1,11 +0,0 @@
|
||||
[DEFAULT]
|
||||
|
||||
#Allowed values= memory, file, db. Default value is memory
|
||||
persistence_type=memory
|
||||
|
||||
[FILE_PERSISTENCE]
|
||||
dictionary_folder=/tmp/graffiti-dictionary/
|
||||
|
||||
[DATABASE]
|
||||
#connection = sqlite:////var/tmp/graffiti.db
|
||||
#connection = mysql://graffiti:graffiti@127.0.0.1:3306/graffiti
|
@ -1 +0,0 @@
|
||||
{ "id": "12341234123412341234123412341234", "user_id": "12341234123412341234123412341234", "project_id": "12341234123412341234123412341234","domain_id": "12341234123412341234123412341234","roles": ["admin"] }
|
@ -1,57 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from pecan import make_app
|
||||
|
||||
from graffiti.api import model
|
||||
from graffiti.api.service import prepare_service
|
||||
|
||||
from graffiti.api.hooks import CorsHook
|
||||
|
||||
from oslo.config import cfg
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
||||
def setup_app(config):
|
||||
|
||||
if hasattr(config, 'pydevd') and config.pydevd.enabled:
|
||||
try:
|
||||
print(
|
||||
'Remote debug set to true(config.pydevd). '
|
||||
'Attempting connection'
|
||||
)
|
||||
import pydevd
|
||||
pydevd.settrace(
|
||||
config.pydevd.bindhost,
|
||||
port=config.pydevd.port,
|
||||
stdoutToServer=True,
|
||||
stderrToServer=True,
|
||||
suspend=False)
|
||||
except BaseException as be:
|
||||
print "Debug Connection Error (Ignoring): %s" % be
|
||||
|
||||
model.init_model()
|
||||
app_conf = dict(config.app)
|
||||
|
||||
prepare_service()
|
||||
|
||||
app_hooks = [CorsHook()]
|
||||
|
||||
return make_app(
|
||||
app_conf.pop('root'),
|
||||
logging=getattr(config, 'logging', {}),
|
||||
hooks=app_hooks,
|
||||
**app_conf
|
||||
)
|
@ -1,33 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from pecan import expose
|
||||
from webob.exc import status_map
|
||||
|
||||
from graffiti.api.controllers.versions import V1Controller
|
||||
|
||||
|
||||
class RootController(object):
|
||||
|
||||
v1 = V1Controller()
|
||||
|
||||
@expose('error.html')
|
||||
def error(self, status):
|
||||
try:
|
||||
status = int(status)
|
||||
except ValueError: # pragma: no cover
|
||||
status = 500
|
||||
message = getattr(status_map.get(status), 'explanation', '')
|
||||
return dict(status=status, message=message)
|
@ -1,144 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from pecan.rest import RestController
|
||||
|
||||
from wsme.api import Response
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
from graffiti.api.controllers.v1.capability_type_batch import\
|
||||
CapabilityTypeBatchController
|
||||
from graffiti.api.controllers.v1.capability_type_derived import\
|
||||
CapabilityTypeDerivedController
|
||||
from graffiti.api.model.v1.capability_type import CapabilityType
|
||||
from graffiti.api.model.v1.dao.captype_dao_factory \
|
||||
import CapabilityTypeDAOFactory
|
||||
from graffiti.api.model.v1.dao.ns_dao_factory import NSDAOFactory
|
||||
from oslo.config import cfg
|
||||
|
||||
|
||||
import six
|
||||
|
||||
|
||||
class CapabilityTypeController(RestController):
|
||||
|
||||
batch = CapabilityTypeBatchController()
|
||||
derived_properties = CapabilityTypeDerivedController()
|
||||
|
||||
def __init__(self):
|
||||
super(RestController, self).__init__()
|
||||
self.status = 200
|
||||
self._cap_controller = None
|
||||
self._ns_controller = None
|
||||
self._load_controller()
|
||||
|
||||
def _load_controller(self):
|
||||
dao_type = cfg.CONF.DEFAULT.persistence_type
|
||||
self._cap_controller = CapabilityTypeDAOFactory.create(dao_type)
|
||||
self._ns_controller = NSDAOFactory.get()
|
||||
|
||||
@wsexpose
|
||||
def options():
|
||||
pass
|
||||
|
||||
@wsexpose(CapabilityType, six.text_type, six.text_type)
|
||||
def get_one(self, name, namespace):
|
||||
captype = self._cap_controller.get_capability_type(name, namespace)
|
||||
return captype
|
||||
|
||||
@wsexpose([CapabilityType], six.text_type)
|
||||
def get_all(self, query_string=None):
|
||||
captype_list = self._cap_controller.find_capability_types(query_string)
|
||||
return captype_list
|
||||
|
||||
@wsexpose(CapabilityType, body=CapabilityType)
|
||||
def post(self, capability_type):
|
||||
"""Create Capability Type
|
||||
@type capability_type:
|
||||
graffiti.api.model.v1.capability_type.CapabilityType
|
||||
@param capability_type: Capability type
|
||||
"""
|
||||
|
||||
# Check if namespace exists
|
||||
namespace_found = self.__check_existing_namespace(
|
||||
capability_type.namespace
|
||||
)
|
||||
|
||||
# Check if derived capability type exists
|
||||
derived_checked = self.__check_derived_capability(
|
||||
capability_type.derived_from
|
||||
)
|
||||
|
||||
if namespace_found and derived_checked:
|
||||
self._cap_controller.set_capability_type(
|
||||
capability_type
|
||||
)
|
||||
return capability_type
|
||||
else:
|
||||
res = Response(
|
||||
CapabilityType(),
|
||||
status_code=404,
|
||||
error="Provided namespace %s doesnt exist" %
|
||||
capability_type.namespace)
|
||||
return res
|
||||
|
||||
@wsexpose(CapabilityType, six.text_type, six.text_type,
|
||||
body=CapabilityType)
|
||||
def put(self, name, namespace, capability_type):
|
||||
|
||||
# Check if namespace exists
|
||||
namespace_found = self.__check_existing_namespace(
|
||||
capability_type.namespace
|
||||
)
|
||||
|
||||
# Check if derived capability type exists
|
||||
derived_checked = self.__check_derived_capability(
|
||||
capability_type.derived_from
|
||||
)
|
||||
|
||||
if namespace_found and derived_checked:
|
||||
self._cap_controller.put_capability_type(
|
||||
name, namespace, capability_type
|
||||
)
|
||||
return capability_type
|
||||
else:
|
||||
res = Response(
|
||||
CapabilityType(),
|
||||
status_code=404,
|
||||
error="Provided namespace %s doesnt exist" %
|
||||
capability_type.namespace)
|
||||
return res
|
||||
|
||||
@wsexpose(CapabilityType, six.text_type, six.text_type)
|
||||
def delete(self, name, namespace):
|
||||
captype = self._cap_controller.delete_capability_type(
|
||||
name,
|
||||
namespace
|
||||
)
|
||||
return captype
|
||||
|
||||
def __check_derived_capability(self, derived_from):
|
||||
derived_checked = True
|
||||
if derived_from:
|
||||
derived_checked = False
|
||||
derived_cap_found = self._cap_controller.get_capability_type(
|
||||
derived_from.name, derived_from.namespace)
|
||||
if derived_cap_found:
|
||||
derived_checked = True
|
||||
|
||||
return derived_checked
|
||||
|
||||
def __check_existing_namespace(self, namespace_name):
|
||||
return self._ns_controller.get_namespace(namespace_name)
|
@ -1,102 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from graffiti.api.model.v1.capability_type import CapabilityType
|
||||
from graffiti.api.model.v1.dao.captype_dao_factory \
|
||||
import CapabilityTypeDAOFactory
|
||||
from graffiti.api.model.v1.dao.ns_dao_factory import NSDAOFactory
|
||||
|
||||
from graffiti.common import exception as exc
|
||||
from graffiti.common.utilities.capability_type_tree import CapabilityTypeTree
|
||||
|
||||
from oslo.config import cfg
|
||||
from pecan.rest import RestController
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
|
||||
class CapabilityTypeBatchController(RestController):
|
||||
def __init__(self):
|
||||
super(RestController, self).__init__()
|
||||
self.status = 200
|
||||
self._cap_controller = None
|
||||
self._ns_controller = None
|
||||
self._load_controller()
|
||||
|
||||
def _load_controller(self):
|
||||
dao_type = cfg.CONF.DEFAULT.persistence_type
|
||||
self._cap_controller = CapabilityTypeDAOFactory.create(dao_type)
|
||||
self._ns_controller = NSDAOFactory.get()
|
||||
|
||||
@wsexpose
|
||||
def options(self):
|
||||
pass
|
||||
|
||||
@wsexpose([CapabilityType], body=[CapabilityType])
|
||||
def post(self, capability_types):
|
||||
"""Batch create capability types
|
||||
@param capability_types: list of CapabilityTypes
|
||||
"""
|
||||
|
||||
cap_types = []
|
||||
# Verify all namespaces exists
|
||||
self.__verify_namespaces(capability_types)
|
||||
|
||||
tree = CapabilityTypeTree()
|
||||
tree.build(capability_types)
|
||||
|
||||
# TODO(wko): verify external derived roots
|
||||
# self.__verify_external_derived_roots_exist(
|
||||
# tree.types_with_external_root)
|
||||
|
||||
for cap_key, cap_node in tree.root_types.iteritems():
|
||||
self.create_capability_type_recursively(cap_node, cap_types)
|
||||
|
||||
return cap_types
|
||||
|
||||
def create_capability_type_recursively(self, tree_node, cap_types):
|
||||
if tree_node:
|
||||
capability_type = tree_node.cap_type
|
||||
exists_ct = self._cap_controller.get_capability_type(
|
||||
capability_type.name, capability_type.namespace)
|
||||
|
||||
if exists_ct:
|
||||
# update
|
||||
self._cap_controller.put_capability_type(
|
||||
capability_type.name, capability_type.namespace,
|
||||
capability_type
|
||||
)
|
||||
cap_types.append(capability_type)
|
||||
else:
|
||||
# add
|
||||
new_ct = self._cap_controller.set_capability_type(
|
||||
capability_type)
|
||||
cap_types.append(new_ct)
|
||||
|
||||
for cap_key, child_node in tree_node.children.iteritems():
|
||||
self.create_capability_type_recursively(child_node, cap_types)
|
||||
|
||||
def __verify_namespaces(self, capability_types):
|
||||
namespaces = []
|
||||
for ct in capability_types:
|
||||
if ct.namespace not in namespaces:
|
||||
namespaces.append(ct.namespace)
|
||||
|
||||
found_namespace = False
|
||||
for namespace in namespaces:
|
||||
found_namespace = self._ns_controller.get_namespace(namespace)
|
||||
if not found_namespace:
|
||||
raise exc.NotFound("namespace:{0} - does not exist".
|
||||
format(namespace))
|
@ -1,50 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from pecan.rest import RestController
|
||||
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
from graffiti.api.model.v1.capability_type_derived_prop import \
|
||||
CapabilityTypeDerivedProperties
|
||||
from graffiti.api.model.v1.dao.captype_dao_factory \
|
||||
import CapabilityTypeDAOFactory
|
||||
from oslo.config import cfg
|
||||
|
||||
|
||||
import six
|
||||
|
||||
|
||||
class CapabilityTypeDerivedController(RestController):
|
||||
|
||||
def __init__(self):
|
||||
super(RestController, self).__init__()
|
||||
self.status = 200
|
||||
self._cap_controller = None
|
||||
self._load_controller()
|
||||
|
||||
def _load_controller(self):
|
||||
dao_type = cfg.CONF.DEFAULT.persistence_type
|
||||
self._cap_controller = CapabilityTypeDAOFactory.create(dao_type)
|
||||
|
||||
@wsexpose
|
||||
def options():
|
||||
pass
|
||||
|
||||
@wsexpose(CapabilityTypeDerivedProperties, six.text_type, six.text_type)
|
||||
def get_one(self, name, namespace):
|
||||
captype = self._cap_controller.\
|
||||
get_capability_type_with_derived_properties(name, namespace)
|
||||
return captype
|
@ -1,71 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from pecan.rest import RestController
|
||||
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
from graffiti.api.model.v1.dao.ns_dao_factory \
|
||||
import NSDAOFactory
|
||||
from graffiti.api.model.v1.namespace import Namespace
|
||||
from oslo.config import cfg
|
||||
import six
|
||||
|
||||
|
||||
class NamespaceController(RestController):
|
||||
def __init__(self):
|
||||
super(RestController, self).__init__()
|
||||
self.status = 200
|
||||
self._controller = self._load_controller()
|
||||
|
||||
def _load_controller(self):
|
||||
controller_type = cfg.CONF.DEFAULT.persistence_type
|
||||
_controller = NSDAOFactory.create(controller_type)
|
||||
return _controller
|
||||
|
||||
@wsexpose
|
||||
def options(self):
|
||||
pass
|
||||
|
||||
@wsexpose(Namespace, six.text_type)
|
||||
def get_one(self, namespace_name):
|
||||
namespace = self._controller.get_namespace(namespace_name)
|
||||
return namespace
|
||||
|
||||
@wsexpose([Namespace])
|
||||
def get_all(self, query_string=None):
|
||||
namespace_list = self._controller.find_namespaces(query_string)
|
||||
return namespace_list
|
||||
|
||||
@wsexpose(Namespace, body=Namespace)
|
||||
def post(self, namespace):
|
||||
"""Create Namespace
|
||||
:namespace param:
|
||||
graffiti.api.model.v1.namespace.Namespace
|
||||
"""
|
||||
|
||||
self._controller.set_namespace(namespace)
|
||||
return namespace
|
||||
|
||||
@wsexpose(Namespace, six.text_type, body=Namespace)
|
||||
def put(self, namespace_name, namespace):
|
||||
self._controller.put_namespace(namespace_name, namespace)
|
||||
return namespace
|
||||
|
||||
@wsexpose(Namespace, six.text_type)
|
||||
def delete(self, namespace_name):
|
||||
print "namespace", namespace_name
|
||||
namespace = self._controller.delete_namespace(namespace_name)
|
||||
return namespace
|
@ -1,229 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import json
|
||||
|
||||
import pecan
|
||||
from pecan.rest import RestController
|
||||
|
||||
|
||||
from wsme.api import Response
|
||||
from wsme.rest.json import fromjson
|
||||
from wsmeext.pecan import wsexpose
|
||||
|
||||
|
||||
from graffiti.api.model.v1.resource import Resource
|
||||
from graffiti.api.model.v1.resource_query import ResourceQuery
|
||||
from graffiti.common import driver_factory
|
||||
from graffiti.common.exception import DriverNotFound
|
||||
from graffiti.common.exception import DriverNotFoundForResourceType
|
||||
|
||||
import six
|
||||
|
||||
|
||||
class ResourceController(RestController):
|
||||
|
||||
def __init__(self):
|
||||
super(ResourceController, self).__init__()
|
||||
self.status = 200
|
||||
self.default_resource_type = "GFT::Local"
|
||||
|
||||
@wsexpose(None, six.text_type, six.text_type, six.text_type)
|
||||
def options(self, param1, param2=None, param3=None):
|
||||
return Response(None, status_code=204)
|
||||
|
||||
@wsexpose(Resource, six.text_type, six.text_type, six.text_type)
|
||||
def get_one(self, param1, param2=None, param3=None):
|
||||
"""Retrieve the resource based on the passed parameters
|
||||
Depending on the number of parameters passed, the meaning
|
||||
of the parameter is determined.
|
||||
|
||||
Use case #1: only param1 is set
|
||||
eg. /v1/resource/12345
|
||||
param1 is treated as resource id and resource type is defaulted
|
||||
to graffiti local resource
|
||||
|
||||
Use case #2: param1 and param2 are set
|
||||
eg /v1/resource/OS::Glance::Image/d24a33343
|
||||
param1 = resource type
|
||||
param2 = resource id
|
||||
|
||||
Use case #3: param1, param2 and param3 are set
|
||||
eg /v1/resource/OS::Glance::Image/d24a33343/e8dd383a838c83
|
||||
param1 = resource type
|
||||
param2 = resource id
|
||||
param3 = endpoint id
|
||||
|
||||
"""
|
||||
print "args:", param1, param2, param3
|
||||
auth_token = pecan.request.headers.get('X-Auth-Token')
|
||||
endpoint_id = None
|
||||
|
||||
if not param2:
|
||||
#Use case #1
|
||||
resource_id = param1
|
||||
resource_type = self.default_resource_type
|
||||
else:
|
||||
#Use case #2
|
||||
resource_type = param1
|
||||
resource_id = param2
|
||||
|
||||
if param3:
|
||||
endpoint_id = param3
|
||||
|
||||
driver = driver_factory.get_driver(resource_type)
|
||||
if driver.resource:
|
||||
res = driver.resource.get_resource(
|
||||
resource_type,
|
||||
resource_id,
|
||||
auth_token,
|
||||
endpoint_id
|
||||
)
|
||||
return res
|
||||
else:
|
||||
error_str = "Driver not found for the resource type %s", \
|
||||
resource_type
|
||||
|
||||
res = Response(Resource(), status_code=404, error=error_str)
|
||||
return res
|
||||
|
||||
@wsexpose([Resource], six.text_type, six.text_type)
|
||||
def get_all(self, resource_type=None, query_string=None):
|
||||
print "args: resource_type=%s, query_string=%s" % \
|
||||
(resource_type, query_string)
|
||||
auth_token = pecan.request.headers.get('X-Auth-Token')
|
||||
|
||||
resource_types = []
|
||||
if query_string:
|
||||
doc = json.loads(query_string)
|
||||
resource_query = fromjson(ResourceQuery, doc)
|
||||
resource_types = resource_query.resource_types
|
||||
else:
|
||||
if not resource_type:
|
||||
resource_types.append(self.default_resource_type)
|
||||
else:
|
||||
resource_types.append(resource_type)
|
||||
|
||||
driver_resources = ResourceController.__group_resource_types_by_driver(
|
||||
driver_factory.get_resource_types(),
|
||||
resource_types
|
||||
)
|
||||
|
||||
all_resource_list = []
|
||||
for driver_name in driver_resources.keys():
|
||||
req_resource_types = driver_resources[driver_name]
|
||||
resource_query = ResourceQuery()
|
||||
resource_query.resource_types = req_resource_types
|
||||
try:
|
||||
print "Invoking driver(%s) for resource types(%s):" % \
|
||||
(driver_name, req_resource_types)
|
||||
driver = driver_factory.get_driver_by_name(driver_name)
|
||||
except DriverNotFound:
|
||||
resource = Response(
|
||||
Resource(),
|
||||
status_code=404,
|
||||
error="Driver not found for the resource type")
|
||||
return resource
|
||||
|
||||
if driver.resource:
|
||||
res_list = driver.resource.find_resources(
|
||||
resource_query,
|
||||
auth_token
|
||||
)
|
||||
if res_list:
|
||||
all_resource_list += res_list.values()
|
||||
|
||||
if all_resource_list:
|
||||
return all_resource_list
|
||||
|
||||
return []
|
||||
|
||||
@wsexpose(Resource, six.text_type, body=Resource)
|
||||
def put(self, resource_id, resource):
|
||||
"""Modify resource
|
||||
:resource param: graffiti.api.model.v1.resource.Resource
|
||||
"""
|
||||
|
||||
auth_token = pecan.request.headers.get('X-Auth-Token')
|
||||
endpoint_id = resource.provider.id
|
||||
|
||||
if not resource.type:
|
||||
resource_type = self.default_resource_type
|
||||
else:
|
||||
resource_type = resource.type
|
||||
|
||||
driver = driver_factory.get_driver(resource_type)
|
||||
if driver.resource:
|
||||
driver.resource.update_resource(
|
||||
resource_type,
|
||||
resource_id,
|
||||
resource,
|
||||
auth_token,
|
||||
endpoint_id=endpoint_id
|
||||
)
|
||||
else:
|
||||
resource = Response(
|
||||
Resource(),
|
||||
status_code=404,
|
||||
error="Driver not found for the resource type"
|
||||
)
|
||||
|
||||
return resource
|
||||
|
||||
@wsexpose(Resource, body=Resource)
|
||||
def post(self, resource):
|
||||
auth_token = pecan.request.headers.get('X-Auth-Token')
|
||||
|
||||
if not resource.type:
|
||||
resource_type = self.default_resource_type
|
||||
else:
|
||||
resource_type = resource.type
|
||||
|
||||
driver = driver_factory.get_driver(resource_type)
|
||||
if driver.resource:
|
||||
resource = driver.resource.create_resource(
|
||||
resource_type,
|
||||
resource,
|
||||
auth_token
|
||||
)
|
||||
|
||||
return resource
|
||||
|
||||
@staticmethod
|
||||
def __group_resource_types_by_driver(
|
||||
all_resource_types,
|
||||
request_resource_types):
|
||||
driver_resource_types = dict()
|
||||
for resource_type in request_resource_types:
|
||||
|
||||
if resource_type in all_resource_types.keys():
|
||||
driver_name = all_resource_types[resource_type]
|
||||
else:
|
||||
raise DriverNotFoundForResourceType(
|
||||
resource_type=resource_type
|
||||
)
|
||||
|
||||
resource_list = []
|
||||
if driver_name in driver_resource_types.keys():
|
||||
resource_list = driver_resource_types[driver_name]
|
||||
if not resource_list:
|
||||
resource_list = []
|
||||
resource_list.append(resource_type)
|
||||
driver_resource_types[driver_name] = resource_list
|
||||
else:
|
||||
resource_list.append(resource_type)
|
||||
driver_resource_types[driver_name] = resource_list
|
||||
|
||||
return driver_resource_types
|
@ -1,25 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from graffiti.api.controllers.v1.capability_type import \
|
||||
CapabilityTypeController
|
||||
from graffiti.api.controllers.v1.namespace import NamespaceController
|
||||
from graffiti.api.controllers.v1.resource import ResourceController
|
||||
|
||||
|
||||
class V1Controller(object):
|
||||
namespace = NamespaceController()
|
||||
capability_type = CapabilityTypeController()
|
||||
resource = ResourceController()
|
@ -1,37 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# import json
|
||||
|
||||
from pecan.hooks import PecanHook
|
||||
|
||||
|
||||
class CorsHook(PecanHook):
|
||||
def after(self, state):
|
||||
state.response.headers['Access-Control-Allow-Origin'] = '*'
|
||||
state.response.headers['Access-Control-Allow-Methods'] = \
|
||||
'GET, PUT, POST, DELETE, OPTIONS'
|
||||
state.response.headers['Access-Control-Allow-Headers'] = \
|
||||
'origin, authorization, accept, content-type, X-Auth-Token'
|
||||
|
||||
if not state.response.headers['Content-Length']:
|
||||
state.response.headers['Content-Length'] = \
|
||||
str(len(state.response.body))
|
||||
|
||||
# TODO(lakshmi): this fails in Python 3.3, don't know why
|
||||
# if state.response.headers['Content-Type'].find('json') != -1:
|
||||
# Sort the Response Body's JSON
|
||||
# json_str = json.loads(state.response.body)
|
||||
# state.response.body = json.dumps(json_str, sort_keys=True)
|
@ -1,18 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
def init_model():
|
||||
pass
|
@ -1,29 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import wsme
|
||||
from wsme import types
|
||||
|
||||
|
||||
class Capability(types.Base):
|
||||
properties = wsme.wsattr({types.text: types.text}, mandatory=True)
|
||||
capability_type = wsme.wsattr(types.text, mandatory=True)
|
||||
capability_type_namespace = wsme.wsattr(types.text, mandatory=True)
|
||||
|
||||
_wsme_attr_order = ('properties', 'capability_type',
|
||||
'capability_type_namespace')
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(Capability, self).__init__(**kwargs)
|
@ -1,33 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import wsme
|
||||
from wsme import types
|
||||
|
||||
from graffiti.api.model.v1.derived_type import DerivedType
|
||||
from graffiti.api.model.v1.property_type import PropertyType
|
||||
from graffiti.common.db_utils import DbTransformer
|
||||
|
||||
|
||||
class CapabilityType(types.Base, DbTransformer):
|
||||
|
||||
name = wsme.wsattr(types.text, mandatory=True)
|
||||
namespace = wsme.wsattr(types.text, mandatory=True)
|
||||
description = wsme.wsattr(types.text, mandatory=False)
|
||||
properties = wsme.wsattr({types.text: PropertyType}, mandatory=False)
|
||||
derived_from = wsme.wsattr(DerivedType, mandatory=False)
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(CapabilityType, self).__init__(**kwargs)
|
@ -1,36 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import wsme
|
||||
from wsme import types
|
||||
|
||||
from graffiti.api.model.v1.derived_property_type import DerivedPropertyType
|
||||
from graffiti.api.model.v1.derived_type import DerivedType
|
||||
from graffiti.api.model.v1.property_type import PropertyType
|
||||
from graffiti.common.db_utils import DbTransformer
|
||||
|
||||
|
||||
class CapabilityTypeDerivedProperties(types.Base, DbTransformer):
|
||||
|
||||
name = wsme.wsattr(types.text, mandatory=True)
|
||||
namespace = wsme.wsattr(types.text, mandatory=True)
|
||||
description = wsme.wsattr(types.text, mandatory=False)
|
||||
properties = wsme.wsattr({types.text: PropertyType}, mandatory=False)
|
||||
derived_properties = wsme.wsattr({types.text: DerivedPropertyType},
|
||||
mandatory=False)
|
||||
derived_from = wsme.wsattr(DerivedType, mandatory=False)
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(CapabilityTypeDerivedProperties, self).__init__(**kwargs)
|
@ -1,33 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import wsme
|
||||
from wsme import types
|
||||
|
||||
|
||||
class CapabilityTypeKey(types.Base):
|
||||
name = wsme.wsattr(types.text, mandatory=True)
|
||||
namespace = wsme.wsattr(types.text, mandatory=True)
|
||||
|
||||
_wsme_attr_order = ('name', 'namespace')
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(CapabilityTypeKey, self).__init__(**kwargs)
|
||||
|
||||
def __hash__(self):
|
||||
return hash((self.name, self.namespace))
|
||||
|
||||
def __eq__(self, other):
|
||||
return (self.name, self.namespace) == (other.name, other.namespace)
|
@ -1,42 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
class CapabilityTypeDAOBase(object):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(CapabilityTypeDAOBase, self).__init__(**kwargs)
|
||||
self._type = "CapabilityTypeDAOBase"
|
||||
|
||||
def get_type(self):
|
||||
return self._type
|
||||
|
||||
def get_capability_type(self, name, namespace):
|
||||
return None
|
||||
|
||||
def get_capability_type_with_derived_properties(self, name, namespace):
|
||||
return None
|
||||
|
||||
def find_capability_types(self, query_string):
|
||||
return []
|
||||
|
||||
def set_capability_type(self, capability_type=None):
|
||||
pass
|
||||
|
||||
def put_capability_type(self, name, namespace, capability_type=None):
|
||||
pass
|
||||
|
||||
def delete_capability_type(self, name, namespace):
|
||||
pass
|
@ -1,41 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from graffiti.api.model.v1.dao.captype_db_dao \
|
||||
import DBCapabilityTypeDAO
|
||||
from graffiti.api.model.v1.dao.captype_file_dao \
|
||||
import FileCapabilityTypeDAO
|
||||
from graffiti.api.model.v1.dao.captype_mem_dao \
|
||||
import MemCapabilityTypeDAO
|
||||
|
||||
|
||||
class CapabilityTypeDAOFactory(object):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(CapabilityTypeDAOFactory, self).__init__(**kwargs)
|
||||
|
||||
@staticmethod
|
||||
def create(dao_type, **kwargs):
|
||||
if dao_type.lower() == 'memory':
|
||||
print "Dictionary persistence = memory"
|
||||
return MemCapabilityTypeDAO(**kwargs)
|
||||
elif dao_type.lower() == "db":
|
||||
print "Dictionary persistence = db"
|
||||
return DBCapabilityTypeDAO(**kwargs)
|
||||
elif dao_type.lower() == "file":
|
||||
print "Dictionary persistence = File"
|
||||
return FileCapabilityTypeDAO(**kwargs)
|
||||
|
||||
return None
|
@ -1,157 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from graffiti.api.model.v1.capability_type import CapabilityType
|
||||
from graffiti.api.model.v1.capability_type_derived_prop import \
|
||||
CapabilityTypeDerivedProperties
|
||||
from graffiti.api.model.v1.dao.captype_dao import CapabilityTypeDAOBase
|
||||
from graffiti.api.model.v1.derived_property_type import DerivedPropertyType
|
||||
from graffiti.api.model.v1.derived_type import DerivedType
|
||||
from graffiti.api.model.v1.property_type import PropertyType
|
||||
|
||||
from graffiti.db import api as dbapi
|
||||
import json
|
||||
from wsme.rest.json import fromjson
|
||||
from wsme.rest.json import tojson
|
||||
|
||||
|
||||
class DBCapabilityTypeDAO(CapabilityTypeDAOBase):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(DBCapabilityTypeDAO, self).__init__(**kwargs)
|
||||
self._type = "DBCapabilityTypeDAO"
|
||||
|
||||
def get_type(self):
|
||||
return self._type
|
||||
|
||||
def _to_model(self, db_captype):
|
||||
model_captype = CapabilityType.to_model(db_captype)
|
||||
if db_captype.parent_name == 'null':
|
||||
model_captype.derived_from = None
|
||||
else:
|
||||
model_captype.derived_from = DerivedType(
|
||||
name=db_captype.parent_name,
|
||||
namespace=db_captype.parent_namespace)
|
||||
|
||||
property_types = {}
|
||||
db_properties = json.loads(db_captype.properties_text)
|
||||
for id in db_properties:
|
||||
property_types[id] = fromjson(PropertyType, db_properties[id])
|
||||
model_captype.properties = property_types
|
||||
|
||||
return model_captype
|
||||
|
||||
def _to_model_derived(self, db_captype, derived_props):
|
||||
model_captype = CapabilityTypeDerivedProperties.to_model(db_captype)
|
||||
|
||||
if db_captype.parent_name == 'null':
|
||||
model_captype.derived_from = None
|
||||
else:
|
||||
model_captype.derived_from = DerivedType(
|
||||
name=db_captype.parent_name,
|
||||
namespace=db_captype.parent_namespace)
|
||||
|
||||
property_types = {}
|
||||
db_properties = json.loads(db_captype.properties_text)
|
||||
for id in db_properties:
|
||||
property_types[id] = fromjson(PropertyType, db_properties[id])
|
||||
model_captype.properties = property_types
|
||||
|
||||
if derived_props:
|
||||
derived_property_types = {}
|
||||
for key in derived_props:
|
||||
props = derived_props[key]
|
||||
db_properties = json.loads(props)
|
||||
for id in db_properties:
|
||||
derived_props_model = fromjson(
|
||||
DerivedPropertyType,
|
||||
db_properties[id])
|
||||
derived_props_model.derived_from_capability_namespace =\
|
||||
key.namespace
|
||||
derived_props_model.derived_from_capability_name = key.name
|
||||
derived_property_types[id] = derived_props_model
|
||||
|
||||
model_captype.derived_properties = derived_property_types
|
||||
|
||||
return model_captype
|
||||
|
||||
def _to_dict(self, model_captype):
|
||||
captype_dict = model_captype.to_dict()
|
||||
|
||||
properties = model_captype.properties
|
||||
db_property_types = {}
|
||||
if properties:
|
||||
for k, v in properties.items():
|
||||
json_data = tojson(PropertyType, v)
|
||||
db_property_types[k] = json_data
|
||||
captype_dict['properties_text'] = json.dumps(db_property_types)
|
||||
|
||||
derived_from = model_captype.derived_from
|
||||
if derived_from:
|
||||
captype_dict["parent_name"] = model_captype.derived_from.name
|
||||
captype_dict["parent_namespace"] =\
|
||||
model_captype.derived_from.namespace
|
||||
|
||||
return captype_dict
|
||||
|
||||
def get_capability_type(self, name, namespace):
|
||||
db_capability_type = dbapi.capability_type_get(name, namespace)
|
||||
if not db_capability_type:
|
||||
return None
|
||||
|
||||
return self._to_model(db_capability_type)
|
||||
|
||||
def get_capability_type_with_derived_properties(self, name, namespace):
|
||||
cap_type_prop_dict = dbapi.capability_type_get_with_derived_properties(
|
||||
name,
|
||||
namespace)
|
||||
db_capability_type = cap_type_prop_dict['cap_type']
|
||||
|
||||
derived_props = None
|
||||
if 'derived_properties' in cap_type_prop_dict.keys():
|
||||
derived_props = cap_type_prop_dict['derived_properties']
|
||||
|
||||
if not db_capability_type:
|
||||
res = CapabilityType(CapabilityType(), status_code=404,
|
||||
error="CapabilityType Not Found")
|
||||
return res
|
||||
|
||||
return self._to_model_derived(db_capability_type, derived_props)
|
||||
|
||||
def find_capability_types(self, query_string):
|
||||
# TODO(wko): add support for query_string
|
||||
db_capability_types = dbapi.capability_type_get_all()
|
||||
capability_types = []
|
||||
for db_ct in db_capability_types:
|
||||
capability_types.append(self._to_model(db_ct))
|
||||
return capability_types
|
||||
|
||||
def set_capability_type(self, capability_type=None):
|
||||
created_capability_type = dbapi.capability_type_create(
|
||||
self._to_dict(capability_type))
|
||||
return self._to_model(created_capability_type)
|
||||
|
||||
def put_capability_type(self, name, namespace, capability_type=None):
|
||||
# Update a Capability Type
|
||||
if capability_type:
|
||||
db_capability_type = dbapi.capability_type_update(
|
||||
name, namespace, self._to_dict(capability_type))
|
||||
return self._to_model(db_capability_type)
|
||||
|
||||
def delete_capability_type(self, name, namespace):
|
||||
db_capability_type = dbapi.capability_type_get(name, namespace)
|
||||
if db_capability_type:
|
||||
dbapi.capability_type_delete(name, namespace)
|
||||
return self._to_model(db_capability_type)
|
@ -1,87 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from graffiti.api.model.v1.capability_type import CapabilityType
|
||||
from graffiti.api.model.v1.dao.captype_dao import CapabilityTypeDAOBase
|
||||
import json
|
||||
from oslo.config import cfg
|
||||
from wsme.rest.json import fromjson
|
||||
from wsme.rest.json import tojson
|
||||
|
||||
|
||||
class FileCapabilityTypeDAO(CapabilityTypeDAOBase):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(FileCapabilityTypeDAO, self).__init__(**kwargs)
|
||||
self._graffiti_folder = cfg.CONF.FILE_PERSISTENCE.dictionary_folder
|
||||
self._filename = "dictionary.json"
|
||||
self._dictionaryfile = self._graffiti_folder + self._filename
|
||||
self._capability_types = self.__file_to_memory()
|
||||
self._type = "FileCapabilityTypeDAO"
|
||||
|
||||
def get_type(self):
|
||||
return self._type
|
||||
|
||||
def get_capability_type(self, name, namespace):
|
||||
id = namespace + ":" + name
|
||||
return self._capability_types[id]
|
||||
|
||||
def find_capability_types(self, query_string):
|
||||
return self._capability_types.itervalues()
|
||||
|
||||
def set_capability_type(self, capability_type):
|
||||
id = capability_type.namespace + ":" + capability_type.name
|
||||
self._capability_types[id] = capability_type
|
||||
self.__memory_to_file()
|
||||
return capability_type
|
||||
|
||||
def put_capability_type(self, name, namespace, capability_type):
|
||||
id = namespace + ":" + name
|
||||
self._capability_types[id] = capability_type
|
||||
self.__memory_to_file()
|
||||
return capability_type
|
||||
|
||||
def delete_capability_type(self, name, namespace):
|
||||
id = namespace + ":" + name
|
||||
capability_type = None
|
||||
if self._capability_types[id]:
|
||||
capability_type = self._capability_types[id]
|
||||
self._capability_types.pop(id)
|
||||
self.__memory_to_file()
|
||||
return capability_type
|
||||
|
||||
def __file_to_memory(self):
|
||||
try:
|
||||
capability_types = {}
|
||||
with open(self._dictionaryfile, "r") as gfile:
|
||||
doc = json.load(gfile)
|
||||
for id in doc:
|
||||
capability_types[id] = fromjson(CapabilityType, doc[id])
|
||||
return capability_types
|
||||
|
||||
except IOError:
|
||||
with open(self._dictionaryfile, "w+") as gfile:
|
||||
gfile.write("")
|
||||
return {}
|
||||
|
||||
def __memory_to_file(self):
|
||||
file_capability_types = {}
|
||||
for (id, capability_type) in self._capability_types.items():
|
||||
json_data = tojson(CapabilityType, capability_type)
|
||||
file_capability_types[id] = json_data
|
||||
|
||||
with open(self._dictionaryfile, "w+") as gfile:
|
||||
json.dump(file_capability_types, gfile)
|
@ -1,55 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from graffiti.api.model.v1.dao.captype_dao import CapabilityTypeDAOBase
|
||||
|
||||
|
||||
class MemCapabilityTypeDAO(CapabilityTypeDAOBase):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(MemCapabilityTypeDAO, self).__init__(**kwargs)
|
||||
self._capability_types = {}
|
||||
self._type = "MemCapabilityTypeDAO"
|
||||
|
||||
def get_type(self):
|
||||
return self._type
|
||||
|
||||
def get_capability_type(self, name, namespace):
|
||||
id = namespace + ":" + name
|
||||
return self._capability_types[id]
|
||||
|
||||
def find_capability_types(self, query_string):
|
||||
return self._capability_types.itervalues()
|
||||
|
||||
def set_capability_type(self, capability_type):
|
||||
id = capability_type.namespace + ":" + capability_type.name
|
||||
self._capability_types[id] = capability_type
|
||||
|
||||
return capability_type
|
||||
|
||||
def put_capability_type(self, name, namespace, capability_type):
|
||||
id = namespace + ":" + name
|
||||
self._capability_types[id] = capability_type
|
||||
|
||||
return capability_type
|
||||
|
||||
def delete_capability_type(self, name, namespace):
|
||||
id = namespace + ":" + name
|
||||
capability_type = None
|
||||
if self._capability_types[id]:
|
||||
capability_type = self._capability_types[id]
|
||||
self._capability_types.pop(id)
|
||||
|
||||
return capability_type
|
@ -1,39 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
class NSDAOBase(object):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(NSDAOBase, self).__init__(**kwargs)
|
||||
self._type = "NSDAOBase"
|
||||
|
||||
def get_type(self):
|
||||
return self._type
|
||||
|
||||
def get_namespace(self, namespace_name):
|
||||
return None
|
||||
|
||||
def find_namespaces(self, query_string):
|
||||
return []
|
||||
|
||||
def set_namespace(self, namespace):
|
||||
pass
|
||||
|
||||
def put_namespace(self, namespace_name, namespace):
|
||||
pass
|
||||
|
||||
def delete_namespace(self, namespace_name):
|
||||
pass
|
@ -1,57 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from graffiti.api.model.v1.dao.ns_db_dao \
|
||||
import DBNSDAO
|
||||
from graffiti.api.model.v1.dao.ns_file_dao \
|
||||
import FileNSDAO
|
||||
from graffiti.api.model.v1.dao.ns_mem_dao \
|
||||
import MemNSDAO
|
||||
from oslo.config import cfg
|
||||
|
||||
|
||||
class NSDAOFactory(object):
|
||||
|
||||
__dao = None
|
||||
__dao_type = cfg.CONF.DEFAULT.persistence_type
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(NSDAOFactory, self).__init__(**kwargs)
|
||||
|
||||
@staticmethod
|
||||
def create(dao_type, **kwargs):
|
||||
if dao_type.lower() == 'memory':
|
||||
print "Namespace persistence = memory"
|
||||
NSDAOFactory.__dao = MemNSDAO(**kwargs)
|
||||
return NSDAOFactory.__dao
|
||||
elif dao_type.lower() == "db":
|
||||
print "Namespace persistence = db"
|
||||
NSDAOFactory.__dao = DBNSDAO(**kwargs)
|
||||
return NSDAOFactory.__dao
|
||||
elif dao_type.lower() == "file":
|
||||
print "Namespace persistence = File"
|
||||
NSDAOFactory.__dao = FileNSDAO(**kwargs)
|
||||
return NSDAOFactory.__dao
|
||||
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def get():
|
||||
if NSDAOFactory.__dao:
|
||||
return NSDAOFactory.__dao
|
||||
else:
|
||||
return NSDAOFactory.create(
|
||||
NSDAOFactory.__dao_type)
|
@ -1,57 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from graffiti.api.model.v1.dao.ns_dao import NSDAOBase
|
||||
from graffiti.api.model.v1.namespace import Namespace
|
||||
from graffiti.db import api as dbapi
|
||||
|
||||
|
||||
class DBNSDAO(NSDAOBase):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(DBNSDAO, self).__init__(**kwargs)
|
||||
self._type = "DBNSDAO"
|
||||
|
||||
def get_type(self):
|
||||
return self._type
|
||||
|
||||
def get_namespace(self, namespace_name):
|
||||
db_namespace = dbapi.namespace_get(namespace_name)
|
||||
if not db_namespace:
|
||||
res = Namespace(Namespace(), status_code=404,
|
||||
error="Namespace Not Found")
|
||||
return res
|
||||
|
||||
return Namespace.to_model(db_namespace)
|
||||
|
||||
def find_namespaces(self, query_string):
|
||||
dbnamespaces = dbapi.namespace_get_all()
|
||||
namespaces = []
|
||||
for ns in dbnamespaces:
|
||||
namespaces.append(Namespace.to_model(ns))
|
||||
return namespaces
|
||||
|
||||
def set_namespace(self, namespace):
|
||||
created_namespace = dbapi.namespace_create(namespace.to_dict())
|
||||
return Namespace.to_model(created_namespace)
|
||||
|
||||
def put_namespace(self, namespace_name, namespace):
|
||||
dbapi.namespace_update(namespace_name, namespace.to_dict())
|
||||
|
||||
def delete_namespace(self, namespace_name):
|
||||
db_namespace = dbapi.namespace_get(namespace_name)
|
||||
if db_namespace:
|
||||
dbapi.namespace_delete(namespace_name)
|
||||
return Namespace.to_model(db_namespace)
|
@ -1,86 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from graffiti.api.model.v1.dao.ns_dao import NSDAOBase
|
||||
from graffiti.api.model.v1.namespace import Namespace
|
||||
|
||||
import json
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from wsme.rest.json import fromjson
|
||||
from wsme.rest.json import tojson
|
||||
|
||||
|
||||
class FileNSDAO(NSDAOBase):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(FileNSDAO, self).__init__(**kwargs)
|
||||
self._graffiti_folder = cfg.CONF.FILE_PERSISTENCE.dictionary_folder
|
||||
self._filename = "namespaces.json"
|
||||
self._namespacefile = self._graffiti_folder + self._filename
|
||||
self._namespaces = self.__file_to_memory()
|
||||
self._type = "FileNSDAO"
|
||||
|
||||
def get_type(self):
|
||||
return self._type
|
||||
|
||||
def get_namespace(self, namespace_name):
|
||||
return self._namespaces[namespace_name]
|
||||
|
||||
def find_namespaces(self, query_string):
|
||||
return self._namespaces.itervalues()
|
||||
|
||||
def set_namespace(self, namespace):
|
||||
self._namespaces[namespace.name] = namespace
|
||||
self.__memory_to_file()
|
||||
return namespace
|
||||
|
||||
def put_namespace(self, namespace_name, namespace):
|
||||
self._namespaces[namespace_name] = namespace
|
||||
self.__memory_to_file()
|
||||
return namespace
|
||||
|
||||
def delete_namespace(self, namespace_name):
|
||||
namespace = None
|
||||
if self._namespaces[namespace_name]:
|
||||
namespace = self._namespaces[namespace_name]
|
||||
self._namespaces.pop(namespace_name)
|
||||
self.__memory_to_file()
|
||||
return namespace
|
||||
|
||||
def __file_to_memory(self):
|
||||
try:
|
||||
namespaces = {}
|
||||
with open(self._namespacefile, "r") as gfile:
|
||||
doc = json.load(gfile)
|
||||
for namespace in doc:
|
||||
namespaces[namespace] = fromjson(Namespace, doc[namespace])
|
||||
return namespaces
|
||||
|
||||
except IOError:
|
||||
with open(self._namespacefile, "w+") as gfile:
|
||||
gfile.write("")
|
||||
return {}
|
||||
|
||||
def __memory_to_file(self):
|
||||
namespaces = {}
|
||||
for (namespace_name, namespace) in self._namespaces.items():
|
||||
json_data = tojson(Namespace, namespace)
|
||||
namespaces[namespace_name] = json_data
|
||||
|
||||
with open(self._namespacefile, "w+") as gfile:
|
||||
json.dump(namespaces, gfile)
|
@ -1,49 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from graffiti.api.model.v1.dao.ns_dao import NSDAOBase
|
||||
|
||||
|
||||
class MemNSDAO(NSDAOBase):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(MemNSDAO, self).__init__(**kwargs)
|
||||
self._namespaces = {}
|
||||
self._type = "MemNSDAO"
|
||||
|
||||
def get_type(self):
|
||||
return self._type
|
||||
|
||||
def get_namespace(self, namespace_name):
|
||||
return self._namespaces[namespace_name]
|
||||
|
||||
def find_namespaces(self, query_string):
|
||||
return self._namespaces.itervalues()
|
||||
|
||||
def set_namespace(self, namespace):
|
||||
self._namespaces[namespace.name] = namespace
|
||||
return namespace
|
||||
|
||||
def put_namespace(self, namespace_name, namespace):
|
||||
self._namespaces[namespace.name] = namespace
|
||||
return namespace
|
||||
|
||||
def delete_namespace(self, namespace_name):
|
||||
namespace = None
|
||||
if self._namespaces[namespace_name]:
|
||||
namespace = self._namespaces[namespace_name]
|
||||
self._namespaces.pop(namespace_name)
|
||||
|
||||
return namespace
|
@ -1,36 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
class ResourceDAOBase(object):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(ResourceDAOBase, self).__init__(**kwargs)
|
||||
self._type = "ResourceDAOBase"
|
||||
|
||||
def get_type(self):
|
||||
return self._type
|
||||
|
||||
def get_resource(self, id):
|
||||
return None
|
||||
|
||||
def find_resources(self, query_string):
|
||||
return []
|
||||
|
||||
def set_resource(self, id, resource):
|
||||
pass
|
||||
|
||||
def delete_resource(self, id):
|
||||
pass
|
@ -1,38 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from graffiti.api.model.v1.dao.resource_db_dao import DBResourceDAO
|
||||
from graffiti.api.model.v1.dao.resource_file_dao import FileResourceDAO
|
||||
from graffiti.api.model.v1.dao.resource_mem_dao import MemResourceDAO
|
||||
|
||||
|
||||
class ResourceDAOFactory(object):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(ResourceDAOFactory, self).__init__(**kwargs)
|
||||
|
||||
@staticmethod
|
||||
def create(dao_type, **kwargs):
|
||||
if dao_type.lower() == 'memory':
|
||||
print "Directory persistence = memory"
|
||||
return MemResourceDAO(**kwargs)
|
||||
elif dao_type.lower() == 'file':
|
||||
print "Directory persistence = file"
|
||||
return FileResourceDAO(**kwargs)
|
||||
elif dao_type.lower() == 'db':
|
||||
print "Directory persistence = db"
|
||||
return DBResourceDAO(**kwargs)
|
||||
|
||||
return None
|
@ -1,40 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from graffiti.api.model.v1.dao.resource_dao import ResourceDAOBase
|
||||
|
||||
|
||||
#TODO(Lakshmi): Implement db persistence for resource
|
||||
class DBResourceDAO(ResourceDAOBase):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(DBResourceDAO, self).__init__(**kwargs)
|
||||
self._type = "DBResourceDAO"
|
||||
|
||||
def get_type(self):
|
||||
return self._type
|
||||
|
||||
def get_resource(self, id):
|
||||
pass
|
||||
|
||||
def find_resources(self, resource_query):
|
||||
pass
|
||||
|
||||
def set_resource(self, id=None, resource_definition=None):
|
||||
pass
|
||||
|
||||
def delete_resource(self, id):
|
||||
pass
|
@ -1,42 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from graffiti.api.model.v1.dao.resource_dao import ResourceDAOBase
|
||||
|
||||
|
||||
class FileResourceDAO(ResourceDAOBase):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(FileResourceDAO, self).__init__(**kwargs)
|
||||
self._type = "FileResourceDAO"
|
||||
|
||||
def get_type(self):
|
||||
return self._type
|
||||
|
||||
def get_resource(self, id):
|
||||
pass
|
||||
|
||||
def find_resources(self, query_string):
|
||||
pass
|
||||
|
||||
def set_resource(self, id=None, resource_definition=None):
|
||||
pass
|
||||
|
||||
def delete_resource(self, id):
|
||||
pass
|
||||
|
||||
def _generate_id(self):
|
||||
pass
|
@ -1,51 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from graffiti.api.model.v1.dao.resource_dao import ResourceDAOBase
|
||||
|
||||
|
||||
class MemResourceDAO(ResourceDAOBase):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(MemResourceDAO, self).__init__(**kwargs)
|
||||
self._resources = dict()
|
||||
self._last_id = 0
|
||||
self._type = "MemResourceDAO"
|
||||
|
||||
def get_type(self):
|
||||
return self._type
|
||||
|
||||
def get_resource(self, id):
|
||||
return self._resources[id]
|
||||
|
||||
def find_resources(self, query_string):
|
||||
return self._resources
|
||||
|
||||
def set_resource(self, id=None, resource=None):
|
||||
if not id:
|
||||
id = self._generate_id()
|
||||
|
||||
self._resources[id] = resource
|
||||
return id
|
||||
|
||||
def delete_resource(self, id):
|
||||
pass
|
||||
|
||||
def _generate_id(self):
|
||||
return_value = self._last_id
|
||||
self._last_id += 1
|
||||
|
||||
return return_value
|
@ -1,37 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from graffiti.api.model.v1.property_type import PropertyType
|
||||
import wsme
|
||||
from wsme import types
|
||||
|
||||
|
||||
class DerivedPropertyType(PropertyType):
|
||||
'''mandatory is set to False instead of True, since wsme will complain
|
||||
while deserializing the properties to model. derived properties are
|
||||
dynamically added after the model is deserialized from persistence
|
||||
'''
|
||||
derived_from_capability_namespace = wsme.wsattr(
|
||||
types.text, mandatory=False)
|
||||
derived_from_capability_name = wsme.wsattr(types.text, mandatory=False)
|
||||
|
||||
_wsme_attr_order = ('type', 'description', 'default', 'required',
|
||||
'minimum', 'maximum', 'minLength', 'maxLength',
|
||||
'pattern', 'confidential', 'items', 'uniqueItems',
|
||||
'additionalItems', 'derived_from_capability_name',
|
||||
'derived_from_capability_namespace')
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(DerivedPropertyType, self).__init__(**kwargs)
|
@ -1,27 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import wsme
|
||||
from wsme import types
|
||||
|
||||
|
||||
class DerivedType(types.Base):
|
||||
name = wsme.wsattr(types.text, mandatory=True)
|
||||
namespace = wsme.wsattr(types.text, mandatory=True)
|
||||
|
||||
_wsme_attr_order = ('name', 'namespace')
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(DerivedType, self).__init__(**kwargs)
|
@ -1,29 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
import wsme
|
||||
from wsme import types
|
||||
|
||||
from graffiti.common.db_utils import DbTransformer
|
||||
|
||||
|
||||
class Namespace(types.Base, DbTransformer):
|
||||
name = wsme.wsattr(types.text, mandatory=True)
|
||||
scope = wsme.wsattr(types.text, mandatory=True)
|
||||
owner = wsme.wsattr(types.text, mandatory=False)
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(Namespace, self).__init__(**kwargs)
|
@ -1,27 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import wsme
|
||||
from wsme import types
|
||||
|
||||
|
||||
class Property(types.Base):
|
||||
name = wsme.wsattr(types.text, mandatory=True)
|
||||
value = wsme.wsattr(types.text, mandatory=True)
|
||||
|
||||
_wsme_attr_order = ('name', 'value')
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(Property, self).__init__(**kwargs)
|
@ -1,27 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import wsme
|
||||
from wsme import types
|
||||
|
||||
|
||||
class ItemType(types.Base):
|
||||
type = wsme.wsattr(types.text, mandatory=True)
|
||||
enum = wsme.wsattr([types.text], mandatory=False)
|
||||
|
||||
_wsme_attr_order = ('type', 'enum')
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(ItemType, self).__init__(**kwargs)
|
@ -1,50 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from graffiti.api.model.v1.property_item_type import ItemType
|
||||
import wsme
|
||||
from wsme import types
|
||||
|
||||
|
||||
class PropertyType(types.Base):
|
||||
type = wsme.wsattr(types.text, mandatory=True)
|
||||
description = wsme.wsattr(types.text, mandatory=False)
|
||||
default = wsme.wsattr(types.text, mandatory=False)
|
||||
required = wsme.wsattr(bool, mandatory=False, default=False)
|
||||
|
||||
# fields for type = string
|
||||
minimum = wsme.wsattr(int, mandatory=False)
|
||||
maximum = wsme.wsattr(int, mandatory=False)
|
||||
|
||||
# fields for type = integer, number
|
||||
minLength = wsme.wsattr(int, mandatory=False)
|
||||
maxLength = wsme.wsattr(int, mandatory=False)
|
||||
pattern = wsme.wsattr(types.text, mandatory=False)
|
||||
confidential = wsme.wsattr(bool, mandatory=False)
|
||||
|
||||
# fields for type = array
|
||||
items = wsme.wsattr(ItemType, mandatory=False)
|
||||
uniqueItems = wsme.wsattr(bool, mandatory=False)
|
||||
minItems = wsme.wsattr(int, mandatory=False)
|
||||
maxItems = wsme.wsattr(int, mandatory=False)
|
||||
additionalItems = wsme.wsattr(bool, mandatory=False)
|
||||
|
||||
_wsme_attr_order = ('type', 'description', 'default', 'required',
|
||||
'minimum', 'maximum', 'minLength', 'maxLength',
|
||||
'pattern', 'confidential', 'items', 'uniqueItems',
|
||||
'additionalItems')
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(PropertyType, self).__init__(**kwargs)
|
@ -1,26 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import wsme
|
||||
from wsme import types
|
||||
|
||||
|
||||
class Provider(types.Base):
|
||||
id = wsme.wsattr(types.text, mandatory=True)
|
||||
|
||||
_wsme_attr_order = ('id',)
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(Provider, self).__init__(**kwargs)
|
@ -1,29 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import wsme
|
||||
from wsme import types
|
||||
|
||||
|
||||
class Requirement(types.Base):
|
||||
criterion = wsme.wsattr(types.text, mandatory=True)
|
||||
capability_type = wsme.wsattr(types.text, mandatory=True)
|
||||
capability_type_namespace = wsme.wsattr(types.text, mandatory=True)
|
||||
|
||||
_wsme_attr_order = ('criterion', 'capability_type',
|
||||
'capability_type_namespace')
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(Requirement, self).__init__(**kwargs)
|
@ -1,39 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import wsme
|
||||
from wsme import types
|
||||
|
||||
from graffiti.api.model.v1.capability import Capability
|
||||
from graffiti.api.model.v1.provider import Provider
|
||||
from graffiti.api.model.v1.requirement import Requirement
|
||||
|
||||
|
||||
class Resource(types.Base):
|
||||
id = wsme.wsattr(types.text, mandatory=True)
|
||||
type = wsme.wsattr(types.text, mandatory=True)
|
||||
name = wsme.wsattr(types.text, mandatory=True)
|
||||
description = wsme.wsattr(types.text, mandatory=False)
|
||||
provider = wsme.wsattr(Provider, mandatory=True)
|
||||
properties = wsme.wsattr({types.text: types.text}, mandatory=False)
|
||||
capabilities = wsme.wsattr([Capability], mandatory=True)
|
||||
requirements = wsme.wsattr([Requirement], mandatory=True)
|
||||
|
||||
_wsme_attr_order = ('id', 'name', 'description', 'type',
|
||||
'provider', 'properties', 'capabilities',
|
||||
'requirements')
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(Resource, self).__init__(**kwargs)
|
@ -1,26 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import wsme
|
||||
from wsme import types
|
||||
|
||||
|
||||
class ResourceQuery(types.Base):
|
||||
resource_types = wsme.wsattr([types.text], mandatory=False)
|
||||
|
||||
#_wsme_attr_order = ('resource_types')
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(ResourceQuery, self).__init__(**kwargs)
|
@ -1,31 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import sys
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
|
||||
def prepare_service(argv=None):
|
||||
if argv is None:
|
||||
argv = sys.argv
|
||||
|
||||
# when running unit tests, argv is inaccessible for some unknown
|
||||
# reason; need to revisit this logic again running under Apache2
|
||||
# TODO(lakshmi): figure this out
|
||||
try:
|
||||
cfg.CONF(argv[3:], project='graffiti')
|
||||
except BaseException:
|
||||
pass
|
@ -1,14 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
@ -1,82 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2010-2011 OpenStack Foundation
|
||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
|
||||
import fixtures
|
||||
from oslo.config import cfg
|
||||
import testtools
|
||||
|
||||
_TRUE_VALUES = ('True', 'true', '1', 'yes')
|
||||
|
||||
# DEFAULT group
|
||||
default_controller_group = cfg.OptGroup('DEFAULT')
|
||||
default_controller_opts = [
|
||||
cfg.StrOpt(
|
||||
'persistence_type',
|
||||
default="memory",
|
||||
help=("persistence options. "
|
||||
"values = 'memory' or 'file' or 'db"))
|
||||
]
|
||||
|
||||
cfg.CONF.register_group(default_controller_group)
|
||||
cfg.CONF.register_opts(default_controller_opts,
|
||||
group=default_controller_group)
|
||||
|
||||
# FILE_PERSISTENCE group
|
||||
file_controller_group = cfg.OptGroup('FILE_PERSISTENCE')
|
||||
file_controller_opts = [
|
||||
cfg.StrOpt(
|
||||
'dictionary_folder',
|
||||
default="/tmp/graffiti-dictionary-test/",
|
||||
help=("Absolute path of the file for persisting dictionary")
|
||||
)
|
||||
]
|
||||
|
||||
cfg.CONF.register_group(file_controller_group)
|
||||
cfg.CONF.register_opts(file_controller_opts,
|
||||
group=file_controller_group)
|
||||
|
||||
|
||||
class TestCase(testtools.TestCase):
|
||||
|
||||
"""Test case base class for all unit tests."""
|
||||
|
||||
def setUp(self):
|
||||
"""Run before each test method to initialize test environment."""
|
||||
|
||||
super(TestCase, self).setUp()
|
||||
test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0)
|
||||
try:
|
||||
test_timeout = int(test_timeout)
|
||||
except ValueError:
|
||||
# If timeout value is invalid do not set a timeout.
|
||||
test_timeout = 0
|
||||
if test_timeout > 0:
|
||||
self.useFixture(fixtures.Timeout(test_timeout, gentle=True))
|
||||
|
||||
self.useFixture(fixtures.NestedTempfile())
|
||||
self.useFixture(fixtures.TempHomeDir())
|
||||
|
||||
if os.environ.get('OS_STDOUT_CAPTURE') in _TRUE_VALUES:
|
||||
stdout = self.useFixture(fixtures.StringStream('stdout')).stream
|
||||
self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout))
|
||||
if os.environ.get('OS_STDERR_CAPTURE') in _TRUE_VALUES:
|
||||
stderr = self.useFixture(fixtures.StringStream('stderr')).stream
|
||||
self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr))
|
||||
|
||||
self.log_fixture = self.useFixture(fixtures.FakeLogger())
|
@ -1,119 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
pecan_base
|
||||
-----------------------------------
|
||||
|
||||
Tests through the pecan framework.
|
||||
"""
|
||||
import os
|
||||
|
||||
import pecan
|
||||
import pecan.testing
|
||||
|
||||
#from oslo.config import cfg
|
||||
|
||||
from graffiti.api.tests import base
|
||||
from graffiti.common import driver_factory
|
||||
|
||||
|
||||
class TestCase(base.TestCase):
|
||||
PATH_PREFIX = '/v1'
|
||||
|
||||
def setUp(self):
|
||||
super(TestCase, self).setUp()
|
||||
self.app = self._make_app()
|
||||
#cfg.CONF.set_override(name='type', override='Local',
|
||||
# group='resource_controller')
|
||||
driver_factory.DriverFactory()
|
||||
|
||||
def _make_app(self):
|
||||
root_dir = self.path_get()
|
||||
self.config = {
|
||||
'app': {
|
||||
'root': 'graffiti.api.controllers.root.RootController',
|
||||
'modules': ['graffiti.api'],
|
||||
'template_path': '%s/graffiti/templates' % root_dir,
|
||||
},
|
||||
}
|
||||
|
||||
return pecan.testing.load_test_app(self.config)
|
||||
|
||||
def tearDown(self):
|
||||
super(TestCase, self).tearDown()
|
||||
pecan.set_config({}, overwrite=True)
|
||||
|
||||
def path_get(self, project_file=None):
|
||||
root = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
||||
'..',
|
||||
'..', ))
|
||||
if project_file:
|
||||
return os.path.join(root, project_file)
|
||||
else:
|
||||
return root
|
||||
|
||||
def delete(self, path, expect_errors=False, headers=None,
|
||||
extra_environ=None, status=None):
|
||||
full_path = self.PATH_PREFIX + path
|
||||
response = self.app.delete(
|
||||
str(full_path), headers=headers, status=status,
|
||||
extra_environ=extra_environ, expect_errors=expect_errors)
|
||||
|
||||
return response
|
||||
|
||||
def get_json(self, path, expect_errors=False, headers=None,
|
||||
extra_environ=None, q=[], **params):
|
||||
full_path = self.PATH_PREFIX + path
|
||||
query_params = {'q.field': [],
|
||||
'q.value': [],
|
||||
'q.op': [], }
|
||||
for query in q:
|
||||
for name in ['field', 'op', 'value']:
|
||||
query_params['q.%s' % name].append(query.get(name, ''))
|
||||
|
||||
all_params = {}
|
||||
all_params.update(params)
|
||||
if q:
|
||||
all_params.update(query_params)
|
||||
|
||||
response = self.app.get(full_path,
|
||||
params=all_params,
|
||||
headers=headers,
|
||||
extra_environ=extra_environ,
|
||||
expect_errors=expect_errors)
|
||||
|
||||
if not expect_errors:
|
||||
response = response
|
||||
|
||||
return response
|
||||
|
||||
def post_json(self, path, params, expect_errors=False, headers=None,
|
||||
method="post", extra_environ=None, status=None):
|
||||
full_path = self.PATH_PREFIX + path
|
||||
|
||||
response = getattr(self.app, "%s_json" % method)(
|
||||
str(full_path), params=params, headers=headers,
|
||||
status=status, extra_environ=extra_environ,
|
||||
expect_errors=expect_errors)
|
||||
|
||||
return response
|
||||
|
||||
def put_json(self, path, params, expect_errors=False, headers=None,
|
||||
extra_environ=None, status=None):
|
||||
return self.post_json(path=path, params=params,
|
||||
expect_errors=expect_errors, headers=headers,
|
||||
extra_environ=extra_environ, status=status,
|
||||
method="put")
|
@ -1,555 +0,0 @@
|
||||
{ "capability_type_list" :
|
||||
[
|
||||
{
|
||||
"name": "ArchLinux",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "arch",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CENTOS",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "Community Enterprise Operating System",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "centos",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Debian",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "Debian",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "debian",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Fedora",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "fedora",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "FreeBSD",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "freebsd",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "GentooLinux",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "gentoo",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "MS-DOS",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "Microsoft Disc Operating System",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "msdos",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "MandrakeLinux",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "mandrake",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "MandrivaEnterpriseServer",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "mes",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "MandrivaLinux",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "mandriva",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "MicrosoftWindows",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "windows",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "NetBSD",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "netbsd",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "NovellNetWare",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "netware",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "OpenBSD",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "openbsd",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "OpenSUSE",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "opensuse",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "OpenSolaris",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "opensolaris",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "RedHatEnterpriseLinux",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "rhel",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "SUSELinuxEnterpriseDesktop",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "sled",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Ubuntu",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"defaultValue": "ubuntu",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ComputeDriver",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "These are properties specific to compute drivers. For a list of all hypervisors, see here: https://wiki.openstack.org/wiki/HypervisorSupportMatrix",
|
||||
"properties": {}
|
||||
},
|
||||
{
|
||||
"name": "VMwareComputeDriver",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "ComputeDriver",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"vmware_adaptertype": {
|
||||
"type": "choice",
|
||||
"description": "Indicates the virtual SCSI or IDE controller used by the hypervisor.",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"itemType": "string",
|
||||
"items": [
|
||||
"lsiLogic",
|
||||
" busLogic",
|
||||
"ide"
|
||||
]
|
||||
},
|
||||
"vmware_ostype": {
|
||||
"type": "string",
|
||||
"description": "A VMware GuestID which describes the operating system installed in the image. This will be passed to the hypervisor when creating a virtual machine. See thinkvirt.com for a list of valid values. If this is not specified, it will default to otherGuest.",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
},
|
||||
"vmware_image_version": {
|
||||
"type": "string",
|
||||
"description": "Currently unused, set it to 1.",
|
||||
"defaultValue": "1",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "XenComputeDriver",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "ComputeDriver",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"auto_disk_config": {
|
||||
"type": "boolean",
|
||||
"description": "A boolean option. If true, the root partition on the disk will be automatically resized before the instance boots. This value is only taken into account by the Compute service when using a Xen-based hypervisor with the XenAPI driver. The Compute service will only attempt to resize if there is a single partition on the image, and only if the partition is in ext3 or ext4 format.",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
},
|
||||
"os_type": {
|
||||
"type": "choice",
|
||||
"description": "The operating system installed on the image. For example, linux or windows. The XenAPI driver contains logic that will take different actions depending on the value of the os_type parameter of the image. For example, for images where os_type=windows, it creates a FAT32-based swap partition instead of a Linux swap partition, and it limits the injected host name to less than 16 characters.",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"itemType": "string",
|
||||
"items": [
|
||||
"linux",
|
||||
"windows"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "libvirtDriver",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"derived_from": {
|
||||
"name": "ComputeDriver",
|
||||
"namespace": "OS:GLANCE:2014-1"
|
||||
},
|
||||
"properties": {
|
||||
"hw_video_model": {
|
||||
"type": "choice",
|
||||
"description": "The video image driver used.",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"itemType": "string",
|
||||
"items": [
|
||||
"vga",
|
||||
"cirrus",
|
||||
"vmvga",
|
||||
"xen",
|
||||
"gxl"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Image",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "A collection of files for a specific operating system (OS) that you use to create or rebuild a server. OpenStack provides pre-built images. You can also create custom images, or snapshots, from servers that you have launched. Custom images can be used for data backups or as \"gold\" images for additional servers.",
|
||||
"properties": {
|
||||
"instance_uuid": {
|
||||
"type": "string",
|
||||
"description": "For snapshot images, this is the UUID of the server used to create this image.",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$"
|
||||
},
|
||||
"kernel_id": {
|
||||
"type": "string",
|
||||
"description": "The ID of image stored in Glance that should be used as the kernel when booting an AMI-style image.",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$"
|
||||
},
|
||||
"ramdisk_id": {
|
||||
"type": "string",
|
||||
"description": "The ID of image stored in Glance that should be used as the ramdisk when booting an AMI-style image.",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ImagePropertiesFilter",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "The ImagePropertiesFilter filters compute nodes that satisfy any architecture, hypervisor type, or virtual machine mode properties specified on the instance's image properties. Image properties are contained in the image dictionary in the request_spec.",
|
||||
"properties": {
|
||||
"hypervisor_type": {
|
||||
"type": "choice",
|
||||
"description": "The hypervisor type.",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"itemType": "string",
|
||||
"items": [
|
||||
"xem",
|
||||
"qemu",
|
||||
"kvm",
|
||||
"lxc",
|
||||
"uml",
|
||||
"vmware",
|
||||
"hyperv"
|
||||
]
|
||||
},
|
||||
"vm_mode": {
|
||||
"type": "choice",
|
||||
"description": "The virtual machine mode. This represents the host/guest ABI (application binary interface) used for the virtual machine.",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"itemType": "string",
|
||||
"items": [
|
||||
"hvm",
|
||||
"xen",
|
||||
"uml",
|
||||
"exe"
|
||||
]
|
||||
},
|
||||
"architecture": {
|
||||
"type": "choice",
|
||||
"description": "The CPU architecture that must be supported by the hypervisor. For example, x86_64, arm, or ppc64. Run uname -m to get the architecture of a machine. We strongly recommend using the architecture data vocabulary defined by the libosinfo project for this purpose.",
|
||||
"required": false,
|
||||
"confidential": false,
|
||||
"itemType": "string",
|
||||
"items": [
|
||||
"alpha",
|
||||
"armv71",
|
||||
"cris",
|
||||
"i686",
|
||||
"ia64",
|
||||
"lm32",
|
||||
"m68k",
|
||||
"microblaze",
|
||||
"microblazeel",
|
||||
"mips",
|
||||
"mipsel",
|
||||
"mips64",
|
||||
"mips64el",
|
||||
"openrisc",
|
||||
"parisc",
|
||||
"parisc64",
|
||||
"ppc",
|
||||
"ppc64",
|
||||
"ppcemb",
|
||||
"s390",
|
||||
"s390x",
|
||||
"sh4",
|
||||
"sh4eb",
|
||||
"sparc",
|
||||
"sparc64",
|
||||
"unicore32",
|
||||
"x86_64",
|
||||
"xtensa",
|
||||
"xtensaeb"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "OperatingSystem",
|
||||
"namespace": "OS:GLANCE:2014-1",
|
||||
"description": "",
|
||||
"properties": {
|
||||
"os_version": {
|
||||
"type": "string",
|
||||
"description": "",
|
||||
"required": false,
|
||||
"confidential": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
{"resource_list": [
|
||||
{
|
||||
"name": "StandardResource",
|
||||
"id": "0000-0000-0000-0000",
|
||||
"description": "This is a standard resource definition",
|
||||
"provider": {
|
||||
"id": "1111-0000-0000-0000"
|
||||
},
|
||||
"capabilities": [
|
||||
{
|
||||
"capability_type": "StandardCapability1",
|
||||
"capability_type_namespace": "TEST:RESOURCE:2014-1",
|
||||
"properties":
|
||||
{
|
||||
"StandardCapabilityProperty1": "SCP1",
|
||||
"StandardCapabilityProperty2": "SCP2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"capability_type": "StandardCapability2",
|
||||
"capability_type_namespace": "TEST:RESOURCE:2014-1",
|
||||
"properties":
|
||||
{
|
||||
"StandardCapabilityProperty3": "SCP3",
|
||||
"StandardCapabilityProperty4": "SCP4"
|
||||
}
|
||||
}],
|
||||
"properties":
|
||||
{
|
||||
"StandardResourceProperty1": "SRP1",
|
||||
"StandardResourceProperty2": "SRP2"
|
||||
},
|
||||
"requirements": [
|
||||
{
|
||||
"capability_type": "StandardRequirement1",
|
||||
"capability_type_namespace": "TEST:RESOURCE:2014-1",
|
||||
"criterion": "StandardCriterion1"
|
||||
},
|
||||
{
|
||||
"capability_type": "StandardRequirement2",
|
||||
"capability_type_namespace": "TEST:RESOURCE:2014-1",
|
||||
"criterion": "StandardCriterion2"
|
||||
}],
|
||||
"type": "GFT::Local"
|
||||
}]
|
||||
}
|
||||
|
@ -1,94 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
test_controller_v1
|
||||
----------------------------------
|
||||
|
||||
Tests for `graffiti` module.
|
||||
"""
|
||||
|
||||
from graffiti.api.tests import base
|
||||
|
||||
from graffiti.api.controllers.root import RootController
|
||||
from graffiti.api.controllers.versions import V1Controller
|
||||
|
||||
from graffiti.api.model.v1.dao.captype_dao_factory \
|
||||
import CapabilityTypeDAOFactory
|
||||
from graffiti.api.model.v1.dao.ns_dao_factory \
|
||||
import NSDAOFactory
|
||||
from graffiti.api.model.v1.dao.resource_dao_factory \
|
||||
import ResourceDAOFactory
|
||||
|
||||
|
||||
class TestControllerV1(base.TestCase):
|
||||
|
||||
def test_v1_exists(self):
|
||||
root = RootController()
|
||||
self.assertIn(hasattr(root, 'v1'), [True])
|
||||
|
||||
def test_v1_namespace_exists(self):
|
||||
v1 = V1Controller()
|
||||
self.assertIn(hasattr(v1, 'namespace'), [True])
|
||||
|
||||
def test_v1_namespace_controller_factory__memory(self):
|
||||
rc = NSDAOFactory.create('memory')
|
||||
self.assertEquals(rc.get_type(), 'MemNSDAO')
|
||||
|
||||
# TODO(Lakshmi): Create folder before any tests run
|
||||
# def test_v1_namespace_controller_factory__file(self):
|
||||
# rc = NSControllerFactory.create('file')
|
||||
# self.assertEquals(rc.get_type(), 'FileNSDAO')
|
||||
|
||||
def test_v1_namespace_controller_factory__db(self):
|
||||
rc = NSDAOFactory.create('db')
|
||||
self.assertEquals(rc.get_type(), 'DBNSDAO')
|
||||
|
||||
def test_v1_capability_type_exists(self):
|
||||
v1 = V1Controller()
|
||||
self.assertIn(hasattr(v1, 'capability_type'), [True])
|
||||
|
||||
def test_v1_capability_type_dao_factory__memory(self):
|
||||
rc = CapabilityTypeDAOFactory.create('memory')
|
||||
self.assertEquals(rc.get_type(), 'MemCapabilityTypeDAO')
|
||||
|
||||
# TODO(Lakshmi): Create folder before any tests run
|
||||
# def test_v1_capability_type_dao_factory__file(self):
|
||||
# rc = CapabilityTypeDAOFactory.create('file')
|
||||
# self.assertEquals(rc.get_type(), 'FileCapabilityTypeDAO')
|
||||
|
||||
def test_v1_capability_type_dao_factory__db(self):
|
||||
rc = CapabilityTypeDAOFactory.create('db')
|
||||
self.assertEquals(rc.get_type(), 'DBCapabilityTypeDAO')
|
||||
|
||||
def test_v1_resource_exists(self):
|
||||
v1 = V1Controller()
|
||||
self.assertIn(hasattr(v1, 'resource'), [True])
|
||||
|
||||
def test_v1_resource_dao_factory__memory(self):
|
||||
rc = ResourceDAOFactory.create('memory')
|
||||
self.assertEquals(rc.get_type(), 'MemResourceDAO')
|
||||
|
||||
def test_v1_resource_dao_factory__file(self):
|
||||
rc = ResourceDAOFactory.create('file')
|
||||
self.assertEquals(rc.get_type(), 'FileResourceDAO')
|
||||
|
||||
def test_v1_resource_dao_factory__db(self):
|
||||
rc = ResourceDAOFactory.create('db')
|
||||
self.assertEquals(rc.get_type(), 'DBResourceDAO')
|
||||
|
||||
def test_v1_resource_controller_factory__unknown(self):
|
||||
rc = ResourceDAOFactory.create('invalid_controller')
|
||||
self.assertTrue(rc is None)
|
@ -1,68 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
test_graffiti
|
||||
----------------------------------
|
||||
|
||||
Tests for `graffiti` module.
|
||||
"""
|
||||
import json
|
||||
|
||||
from graffiti.api.tests import pecan_base
|
||||
|
||||
TEST_DATA_FILE = "graffiti/api/tests/samples/resource_2014-1.json"
|
||||
|
||||
|
||||
def get_resource_list():
|
||||
json_data_file = open(TEST_DATA_FILE)
|
||||
json_data = json_data_file.read()
|
||||
json_data_file.close()
|
||||
resource_list_json = json.loads(json_data)['resource_list']
|
||||
return resource_list_json
|
||||
|
||||
|
||||
class TestGraffiti(pecan_base.TestCase):
|
||||
|
||||
def test_get_all_empty(self):
|
||||
response = self.get_json('/resource')
|
||||
self.assertEqual(response.status_int, 200)
|
||||
self.assertEqual(response.content_type, 'application/json')
|
||||
self.assertEqual(response.json, [])
|
||||
|
||||
def test_post(self):
|
||||
standard_resource_json = get_resource_list()[0]
|
||||
response = self.post_json('/resource', params=standard_resource_json)
|
||||
self.assertEqual(response.status_int, 200)
|
||||
self.assertEqual(response.content_type, 'application/json')
|
||||
self.assertEqual(response.json, standard_resource_json)
|
||||
|
||||
def test_get_one(self):
|
||||
standard_resource_json = get_resource_list()[0]
|
||||
self.post_json('/resource', params=standard_resource_json)
|
||||
response = self.get_json('/resource/%s' % standard_resource_json['id'])
|
||||
self.assertEqual(response.status_int, 200)
|
||||
self.assertEqual(response.content_type, 'application/json')
|
||||
self.assertEqual(response.json, standard_resource_json)
|
||||
|
||||
def test_put(self):
|
||||
standard_resource_json = get_resource_list()[0]
|
||||
self.post_json('/resource', params=standard_resource_json)
|
||||
standard_resource_json['name'] = 'RENAMED'
|
||||
response = self.put_json('/resource/%s' % standard_resource_json['id'],
|
||||
params=standard_resource_json)
|
||||
self.assertEqual(response.status_int, 200)
|
||||
self.assertEqual(response.content_type, 'application/json')
|
||||
self.assertEqual(response.json, standard_resource_json)
|
@ -1,44 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# look at heat/openstack/common/gettextutils.py when we actually need
|
||||
# to implement this method
|
||||
|
||||
|
||||
from wsme import types as wtypes
|
||||
|
||||
|
||||
class DbTransformer():
|
||||
|
||||
@classmethod
|
||||
def to_model(model, db_entity):
|
||||
# Transform a db_entity to model object
|
||||
db_items = db_entity.as_dict().items()
|
||||
items = dict((key, value) for key, value in db_items)
|
||||
return model(**items)
|
||||
|
||||
def to_dict(self):
|
||||
# Return the wsme_attributes names:values as a dict
|
||||
names = []
|
||||
for attribute in self._wsme_attributes:
|
||||
names.append(attribute.name)
|
||||
|
||||
values = {}
|
||||
for name in names:
|
||||
value = getattr(self, name)
|
||||
if value == wtypes.Unset:
|
||||
value = None
|
||||
values.update({name: value})
|
||||
return values
|
@ -1,149 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from graffiti.common import exception
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from stevedore import dispatch
|
||||
|
||||
driver_opts = [
|
||||
cfg.ListOpt('enabled_drivers',
|
||||
default=['local', 'glance', 'nova', 'cinder'],
|
||||
help='List of drivers to enable. Missing drivers, or '
|
||||
'drivers which can not be loaded will be '
|
||||
'treated as a fatal exception.'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(driver_opts)
|
||||
|
||||
|
||||
def get_driver(resource_type):
|
||||
"""Simple method to get a ref to an instance of a driver by the
|
||||
supported resource type.
|
||||
|
||||
Driver loading is handled by the DriverFactory class. This method
|
||||
conveniently wraps that class and returns the actual driver object.
|
||||
|
||||
:param resource_type: the resource type supported by a driver
|
||||
:returns: An instance of a class which implements
|
||||
graffiti.drivers.base.BaseResourceDriver
|
||||
:raises: DriverNotFound if the requested driver_name could not be
|
||||
found in the "graffiti.drivers" namespace.
|
||||
|
||||
"""
|
||||
|
||||
try:
|
||||
factory = DriverFactory()
|
||||
print "resource types", factory.resource_types
|
||||
print "resource type", resource_type
|
||||
if resource_type in factory.resource_types.keys():
|
||||
driver_name = factory.resource_types[resource_type]
|
||||
return factory[driver_name].obj
|
||||
else:
|
||||
raise exception.DriverNotFoundForResourceType(
|
||||
resource_type=resource_type
|
||||
)
|
||||
|
||||
except KeyError:
|
||||
raise exception.DriverNotFound(driver_name=driver_name)
|
||||
|
||||
|
||||
def get_driver_by_name(driver_name):
|
||||
"""Simple method to get a ref to an instance of a driver by the
|
||||
name.
|
||||
|
||||
Driver loading is handled by the DriverFactory class. This method
|
||||
conveniently wraps that class and returns the actual driver object.
|
||||
|
||||
:param driver_name: name of the registered driver
|
||||
:returns: An instance of a class which implements
|
||||
graffiti.drivers.base.BaseResourceDriver
|
||||
:raises: DriverNotFound if the requested driver_name could not be
|
||||
found in the "graffiti.drivers" namespace.
|
||||
|
||||
"""
|
||||
|
||||
try:
|
||||
factory = DriverFactory()
|
||||
return factory[driver_name].obj
|
||||
except KeyError:
|
||||
raise exception.DriverNotFound(driver_name=driver_name)
|
||||
|
||||
|
||||
def get_resource_types():
|
||||
"""Returns a dictionary of resource type and driver name
|
||||
:returns:dictionary with resource type as key and driver name
|
||||
as its value
|
||||
"""
|
||||
return DriverFactory()._resource_types
|
||||
|
||||
|
||||
class DriverFactory(object):
|
||||
"""Discover, load and manage the drivers available."""
|
||||
|
||||
_driver_manager = None
|
||||
_resource_types = {}
|
||||
|
||||
def __init__(self):
|
||||
if not DriverFactory._driver_manager:
|
||||
DriverFactory._init_driver_manager()
|
||||
print "Loaded drivers:", self.names
|
||||
|
||||
def __getitem__(self, name):
|
||||
return self._driver_manager[name]
|
||||
|
||||
@classmethod
|
||||
def _init_driver_manager(self):
|
||||
if self._driver_manager:
|
||||
return
|
||||
|
||||
def _catch_driver_not_found(mgr, ep, exc):
|
||||
if (isinstance(exc, exception.DriverLoadError) and
|
||||
ep.name not in CONF.enabled_drivers):
|
||||
return
|
||||
raise exc
|
||||
|
||||
def _check_func(ext):
|
||||
return ext.name in CONF.enabled_drivers
|
||||
|
||||
self._driver_manager = dispatch.NameDispatchExtensionManager(
|
||||
'graffiti.drivers',
|
||||
_check_func,
|
||||
invoke_on_load=True,
|
||||
on_load_failure_callback=_catch_driver_not_found
|
||||
)
|
||||
|
||||
#Get supported resource types
|
||||
for driver_name in self._driver_manager.names():
|
||||
driver = self._driver_manager[driver_name].obj
|
||||
driver_resource_types = driver.get_resource_types()
|
||||
for type in driver_resource_types:
|
||||
self._resource_types[type] = driver_name
|
||||
|
||||
@property
|
||||
def names(self):
|
||||
"""The list of driver names available."""
|
||||
return self._driver_manager.names()
|
||||
|
||||
@property
|
||||
def resource_types(self):
|
||||
"""Returns all resource types supported by all the drivers
|
||||
:returns dictionary with resource type as key and driver name
|
||||
as its value
|
||||
"""
|
||||
return self._resource_types
|
@ -1,87 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import sys
|
||||
|
||||
from graffiti.openstack.common.gettextutils import _
|
||||
from graffiti.openstack.common.log import logging
|
||||
|
||||
_FATAL_EXCEPTION_FORMAT_ERRORS = False
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class GraffitiException(Exception):
|
||||
"""Base Graffiti Exception
|
||||
|
||||
To correctly use this class, inherit from it and define
|
||||
a 'msg_fmt' property. That msg_fmt will get printf'd
|
||||
with the keyword arguments provided to the constructor.
|
||||
|
||||
"""
|
||||
message = _("An unknown exception occurred.")
|
||||
|
||||
def __str__(self):
|
||||
return self.message
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.kwargs = kwargs
|
||||
|
||||
try:
|
||||
self.message = self.msg_fmt % kwargs
|
||||
except KeyError:
|
||||
exc_info = sys.exc_info()
|
||||
#kwargs doesn't match a variable in the message
|
||||
#log the issue and the kwargs
|
||||
logger.exception(_('Exception in string format operation'))
|
||||
for name, value in kwargs.iteritems():
|
||||
logger.error("%s: %s" % (name, value))
|
||||
|
||||
if _FATAL_EXCEPTION_FORMAT_ERRORS:
|
||||
raise exc_info[0], exc_info[1], exc_info[2]
|
||||
|
||||
#def __str__(self):
|
||||
# return unicode(self.message).encode('UTF-8')
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.message)
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
return self.__class__(**self.kwargs)
|
||||
|
||||
|
||||
class NotFound(GraffitiException):
|
||||
msg_fmt = _("Object not found")
|
||||
|
||||
|
||||
class DuplicateEntry(GraffitiException):
|
||||
msg_fmt = _("Database object already exists")
|
||||
|
||||
|
||||
class DriverNotFound(NotFound):
|
||||
msg_fmt = _("Failed to load driver %(driver_name)s.")
|
||||
|
||||
|
||||
class DriverLoadError(GraffitiException):
|
||||
msg_fmt = _("Driver %(driver)s could not be loaded. Reason: %(reason)s.")
|
||||
|
||||
|
||||
class MethodNotSupported(GraffitiException):
|
||||
msg_fmt = _("Method %(method)s is not supported by this driver")
|
||||
|
||||
|
||||
class DriverNotFoundForResourceType(NotFound):
|
||||
msg_fmt = _("Cannot find a registered driver for the resource "
|
||||
"type %(resource_type)s")
|
@ -1,133 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from graffiti.api.model.v1.capability_type_key import CapabilityTypeKey
|
||||
from graffiti.common.utilities.capability_type_tree_node \
|
||||
import CapabilityTypeTreeNode
|
||||
|
||||
|
||||
class CapabilityTypeTree():
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.root_types = {}
|
||||
self.types_with_external_root = {}
|
||||
|
||||
def build(self, capability_type_list):
|
||||
capability_types = {}
|
||||
for cap_type in capability_type_list:
|
||||
# todo(wko): raise error if duplicate found
|
||||
key = CapabilityTypeKey(name=cap_type.name,
|
||||
namespace=cap_type.namespace)
|
||||
capability_types[key] = cap_type
|
||||
|
||||
# Handle: 1) No parent 2) No children (no-op)
|
||||
# 3) Parent in tree
|
||||
# 4) Parent not processed, yet
|
||||
# 5) More than one root in input (not common ancestor)
|
||||
# 6) Type has parent, but not in input (external parent)
|
||||
types_with_unmapped_parents = {}
|
||||
for current_key, current_cap_type in capability_types.iteritems():
|
||||
current_node = CapabilityTypeTreeNode()
|
||||
current_node.cap_type = current_cap_type
|
||||
|
||||
# Scenario 1 & 5
|
||||
if not current_cap_type.derived_from \
|
||||
or not current_cap_type.derived_from.name:
|
||||
self.root_types[current_key] = current_node
|
||||
continue
|
||||
|
||||
if self.insert_node(self.root_types, current_key, current_node):
|
||||
# Scenario 3
|
||||
continue
|
||||
elif self.insert_node(types_with_unmapped_parents,
|
||||
current_key, current_node):
|
||||
# Scenario 3 (not converged)
|
||||
continue
|
||||
else:
|
||||
# Scenario 4 part a
|
||||
types_with_unmapped_parents[current_key] = current_node
|
||||
|
||||
# Scenario 4 part b
|
||||
# Perform eventual convergence on roots
|
||||
self.converge_unmapped_types(self.root_types,
|
||||
types_with_unmapped_parents)
|
||||
|
||||
# Perform eventual convergence on types_with_unmapped_parents
|
||||
self.converge_unmapped_types(types_with_unmapped_parents,
|
||||
types_with_unmapped_parents)
|
||||
|
||||
# Scenario 6
|
||||
self.types_with_external_root.update(types_with_unmapped_parents)
|
||||
|
||||
def insert_node(self, cap_types, current_key, current_node):
|
||||
# For each cap_type
|
||||
# if it is the parent of the current_node.cap_type
|
||||
# set root_node as the current_node.parent_node
|
||||
# add the current_node to root_node.children
|
||||
# break
|
||||
# else
|
||||
# recursively check if parent is in root_node.children
|
||||
# break if found
|
||||
result = False
|
||||
if cap_types:
|
||||
i = 0
|
||||
for root_key, root_node in cap_types.iteritems():
|
||||
# todo(wko): derived_from should be a CapabilityTypeKey
|
||||
current_parent_name = current_node.cap_type.derived_from.name
|
||||
current_parent_namesp = \
|
||||
current_node.cap_type.derived_from.namespace
|
||||
|
||||
if root_key.name == current_parent_name and\
|
||||
root_key.namespace == current_parent_namesp:
|
||||
current_node.parent_node = root_node
|
||||
root_node.children[current_key] = current_node
|
||||
result = True
|
||||
break
|
||||
|
||||
result = self.insert_node(root_node.children, current_key,
|
||||
current_node)
|
||||
if result:
|
||||
break
|
||||
i += 1
|
||||
|
||||
return result
|
||||
|
||||
def converge_unmapped_types(self, root_types, types_with_unmapped_parents):
|
||||
|
||||
previous_loop_unmapped_parents = 0
|
||||
num_loops_without_change = 0
|
||||
|
||||
while len(types_with_unmapped_parents) > 0 \
|
||||
and num_loops_without_change < 2:
|
||||
types_with_found_parent = []
|
||||
for unmapped_key, unmapped_node in \
|
||||
types_with_unmapped_parents.iteritems():
|
||||
result = self.insert_node(root_types, unmapped_key,
|
||||
unmapped_node)
|
||||
if result:
|
||||
types_with_found_parent.append(unmapped_key)
|
||||
continue
|
||||
|
||||
for mapped_parent in types_with_found_parent:
|
||||
del types_with_unmapped_parents[mapped_parent]
|
||||
|
||||
this_loop_unmapped_parents = len(types_with_unmapped_parents)
|
||||
if previous_loop_unmapped_parents == this_loop_unmapped_parents:
|
||||
num_loops_without_change += 1
|
||||
else:
|
||||
num_loops_without_change = 0
|
||||
|
||||
previous_loop_unmapped_parents = this_loop_unmapped_parents
|
@ -1,22 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
class CapabilityTypeTreeNode():
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.children = {}
|
||||
self.parent_node = None
|
||||
self.cap_type = None
|
@ -1,202 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# look at heat/openstack/common/gettextutils.py when we actually need
|
||||
# to implement this method
|
||||
|
||||
import glob
|
||||
import httplib2
|
||||
import json
|
||||
import os
|
||||
|
||||
from graffiti.api.model.v1.capability import Capability
|
||||
from graffiti.api.model.v1.derived_type import DerivedType
|
||||
|
||||
|
||||
DICTIONARY_DATA_FOLDER = "etc/dictionary"
|
||||
NAMESPACE_STRING = "Namespace*"
|
||||
CAPABILITY_TYPE_STRING = "CapabilityType*"
|
||||
|
||||
__namespace_resource_type_dict = dict()
|
||||
__namespace_property_format_dict = dict()
|
||||
__namespace_list = []
|
||||
|
||||
__namespace_dict = dict()
|
||||
__property_dict = dict()
|
||||
|
||||
TAG_IDENTIFIER = "_TAG"
|
||||
|
||||
|
||||
# TODO(travis): need localization strategy
|
||||
def _(msg):
|
||||
return msg
|
||||
|
||||
|
||||
def load_dictionary(**kwargs):
|
||||
cur_dir = os.getcwd()
|
||||
os.chdir(DICTIONARY_DATA_FOLDER)
|
||||
|
||||
for namespace_file in glob.glob(NAMESPACE_STRING):
|
||||
print "Loading Namespace file: %s" % namespace_file
|
||||
load_namespace(namespace_file)
|
||||
|
||||
if kwargs.get('url'):
|
||||
for namespace in __namespace_list:
|
||||
print "Loading Capability types for namespace: %s" % \
|
||||
namespace['namespace']
|
||||
load_capability_type_http(kwargs.get('url'),
|
||||
namespace['namespace'])
|
||||
else:
|
||||
for cap_type_file in glob.glob(CAPABILITY_TYPE_STRING):
|
||||
print "Loading Capability type file: %s" % cap_type_file
|
||||
load_capability_type(cap_type_file)
|
||||
|
||||
os.chdir(cur_dir)
|
||||
|
||||
|
||||
def load_namespace(namespacefile):
|
||||
with open(namespacefile) as json_file:
|
||||
json_data = json.load(json_file)
|
||||
#print(json_data)
|
||||
|
||||
for namespace in json_data:
|
||||
__namespace_resource_type_dict[namespace['namespace']] = \
|
||||
namespace['resource_types']
|
||||
__namespace_property_format_dict[namespace['namespace']] = \
|
||||
namespace['property_format']
|
||||
__namespace_list.append(namespace)
|
||||
|
||||
|
||||
def load_capability_type(cap_type_file):
|
||||
with open(cap_type_file) as json_file:
|
||||
json_data = json.load(json_file)
|
||||
capability_type_list = json_data['capability_type_list']
|
||||
load_capability_type_list(capability_type_list)
|
||||
|
||||
|
||||
def load_capability_type_http(url, namespace, **kwargs):
|
||||
token = ""
|
||||
with open("../temp-token.txt") as tokenfile:
|
||||
token = tokenfile.readline()
|
||||
kwargs.setdefault('headers', {})['X-Auth-Token'] = token
|
||||
http_client = httplib2.Http()
|
||||
resp, body = http_client.request(url + namespace,
|
||||
'GET', **kwargs)
|
||||
json_data = json.loads(body)
|
||||
load_capability_type_list(json_data)
|
||||
|
||||
|
||||
def load_capability_type_list(capability_type_list):
|
||||
for cap_type in capability_type_list:
|
||||
derived_type = DerivedType()
|
||||
derived_type.name = cap_type['name']
|
||||
derived_type.namespace = cap_type['namespace']
|
||||
|
||||
key_names = []
|
||||
for key in cap_type['properties'].keys():
|
||||
property_name = key
|
||||
if cap_type['properties'][key]['type'] == "choice":
|
||||
#Property name and item in each choice as key
|
||||
for item in cap_type['properties'][key]['items']:
|
||||
dict_key = property_name + item
|
||||
key_names.append(dict_key)
|
||||
else:
|
||||
if 'defaultValue' in cap_type['properties'][key].keys():
|
||||
#Property name and default value as key
|
||||
dict_key = property_name + \
|
||||
str(cap_type['properties'][key]
|
||||
['defaultValue'])
|
||||
key_names.append(dict_key)
|
||||
else:
|
||||
#Just use the property name as key
|
||||
dict_key = property_name
|
||||
key_names.append(dict_key)
|
||||
|
||||
property_dict = dict()
|
||||
if derived_type.namespace in __namespace_dict.keys():
|
||||
property_dict = __namespace_dict[derived_type.namespace]
|
||||
|
||||
for key in key_names:
|
||||
property_dict[key.lower()] = derived_type
|
||||
|
||||
#Add capability itself as property - behaves as a TAG
|
||||
tag_name = cap_type['name'] + TAG_IDENTIFIER
|
||||
property_dict[tag_name.lower()] = derived_type
|
||||
|
||||
__namespace_dict[derived_type.namespace] = property_dict
|
||||
|
||||
|
||||
def get_namespace_resource_type_dict():
|
||||
return __namespace_resource_type_dict
|
||||
|
||||
|
||||
def get_namespace_property_format_dict():
|
||||
return __namespace_property_format_dict
|
||||
|
||||
|
||||
def get_qualifier(property_name, property_value):
|
||||
if property_value:
|
||||
key1 = property_name.lower() + property_value.lower()
|
||||
key2 = property_name.lower()
|
||||
else:
|
||||
key1 = property_name.lower()
|
||||
|
||||
#First loop. Make sure key1 is not found anywhere
|
||||
for namespace in __namespace_dict.keys():
|
||||
property_dict = __namespace_dict[namespace]
|
||||
if key1 in property_dict.keys():
|
||||
return property_dict[key1]
|
||||
|
||||
if property_value:
|
||||
#Second loop. If not found first, use key2
|
||||
for namespace in __namespace_dict.keys():
|
||||
property_dict = __namespace_dict[namespace]
|
||||
if key2 in property_dict.keys():
|
||||
return property_dict[key2]
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def resolve_capability(key, value, target_resource,
|
||||
default_namespace=None,
|
||||
default_name=None):
|
||||
resolved_type = None
|
||||
resolved_namespace = None
|
||||
|
||||
cap_and_namespace = get_qualifier(
|
||||
key,
|
||||
value
|
||||
)
|
||||
if cap_and_namespace:
|
||||
resolved_type = cap_and_namespace.name
|
||||
resolved_namespace = cap_and_namespace.namespace
|
||||
else:
|
||||
resolved_namespace = target_resource.type + "::Default"
|
||||
resolved_type = "AdditionalProperties"
|
||||
|
||||
resolved_capability = None
|
||||
for capability in target_resource.capabilities:
|
||||
if capability.capability_type_namespace == resolved_namespace \
|
||||
and capability.capability_type == resolved_type:
|
||||
resolved_capability = capability
|
||||
|
||||
if not resolved_capability:
|
||||
resolved_capability = Capability()
|
||||
resolved_capability.capability_type_namespace = resolved_namespace
|
||||
resolved_capability.capability_type = resolved_type
|
||||
resolved_capability.properties = {}
|
||||
target_resource.capabilities.append(resolved_capability)
|
||||
|
||||
resolved_capability.properties[key] = value
|
@ -1,263 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# WKO: testing branch dependency
|
||||
# Lakshmi : testing branch dependency on db
|
||||
# import copy
|
||||
from oslo.config import cfg
|
||||
|
||||
from graffiti.api.model.v1.derived_type import DerivedType
|
||||
from graffiti.common import exception as exc
|
||||
from graffiti.db import models
|
||||
from graffiti.openstack.common.db import exception as db_exc
|
||||
from graffiti.openstack.common.db.sqlalchemy import session as db_session
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_group("database", "graffiti.openstack.common.db.options")
|
||||
_FACADE = None
|
||||
|
||||
BASE = models.Base
|
||||
|
||||
|
||||
def setup_db():
|
||||
try:
|
||||
engine = get_engine()
|
||||
BASE.metadata.create_all(engine)
|
||||
except Exception:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def drop_db():
|
||||
try:
|
||||
BASE.metadata.drop_all(get_engine())
|
||||
except Exception:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def _get_facade_instance():
|
||||
"""Generate an instance of the DB Facade.
|
||||
"""
|
||||
global _FACADE
|
||||
if _FACADE is None:
|
||||
if CONF.database.connection is None:
|
||||
print("Warning: [database] connection not configured.")
|
||||
_FACADE = db_session.EngineFacade(
|
||||
CONF.database.connection,
|
||||
**dict(CONF.database.iteritems()))
|
||||
return _FACADE
|
||||
|
||||
|
||||
def _destroy_facade_instance():
|
||||
"""Destroys the db facade instance currently in use.
|
||||
"""
|
||||
global _FACADE
|
||||
_FACADE = None
|
||||
|
||||
|
||||
def get_engine():
|
||||
"""Returns the global instance of our database engine.
|
||||
"""
|
||||
facade = _get_facade_instance()
|
||||
return facade.get_engine()
|
||||
|
||||
|
||||
def get_session(autocommit=True, expire_on_commit=False):
|
||||
"""Returns a database session from our facade.
|
||||
"""
|
||||
facade = _get_facade_instance()
|
||||
return facade.get_session(autocommit=autocommit,
|
||||
expire_on_commit=expire_on_commit)
|
||||
|
||||
|
||||
def cleanup():
|
||||
"""Manually clean up our database engine.
|
||||
"""
|
||||
_destroy_facade_instance()
|
||||
|
||||
|
||||
def model_query(model, session=None):
|
||||
"""Query helper.
|
||||
|
||||
:param model: base model to query
|
||||
"""
|
||||
session = session or get_session()
|
||||
query = session.query(model)
|
||||
return query
|
||||
|
||||
|
||||
def __entity_get_by_name(kls, entity_name, session):
|
||||
query = model_query(kls, session)
|
||||
return query.filter_by(name=entity_name).first()
|
||||
|
||||
|
||||
def __entity_get_by_name_namespace(kls, entity_name, entity_namespace,
|
||||
session):
|
||||
query = model_query(kls, session)
|
||||
return query.filter_by(name=entity_name,
|
||||
namespace=entity_namespace).first()
|
||||
|
||||
|
||||
def _entity_get_all(kls, **kwargs):
|
||||
kwargs = dict((k, v) for k, v in kwargs.iteritems() if v)
|
||||
|
||||
query = model_query(kls)
|
||||
entities = query.filter_by(**kwargs).all()
|
||||
|
||||
return entities
|
||||
|
||||
|
||||
def named_entity_update(kls, entity_name, values):
|
||||
session = get_session()
|
||||
|
||||
with session.begin():
|
||||
entity = __entity_get_by_name(kls, entity_name, session)
|
||||
if entity is None:
|
||||
raise exc.NotFound("%s %s not found" % (kls.__name__, entity_name))
|
||||
|
||||
entity.update(values.copy())
|
||||
session.add(entity)
|
||||
|
||||
return entity
|
||||
|
||||
|
||||
def named_namespace_entity_update(kls, entity_name, entity_namespace, values):
|
||||
session = get_session()
|
||||
|
||||
with session.begin():
|
||||
entity = __entity_get_by_name_namespace(kls, entity_name,
|
||||
entity_namespace, session)
|
||||
if entity is None:
|
||||
raise exc.NotFound(
|
||||
"%s %s %s not found" % (kls.__name__, entity_namespace,
|
||||
entity_name))
|
||||
|
||||
entity.update(values.copy())
|
||||
session.add(entity)
|
||||
|
||||
return entity
|
||||
|
||||
|
||||
# BEGIN Namespace
|
||||
def namespace_get(name):
|
||||
query = model_query(models.Namespace, get_session())
|
||||
return query.filter_by(name=name).first()
|
||||
|
||||
|
||||
def namespace_get_all():
|
||||
return _entity_get_all(models.Namespace)
|
||||
|
||||
|
||||
def namespace_create(values):
|
||||
namespace = models.Namespace()
|
||||
namespace.update(values.copy())
|
||||
|
||||
session = get_session()
|
||||
with session.begin():
|
||||
try:
|
||||
namespace.save(session=session)
|
||||
except db_exc.DBDuplicateEntry as e:
|
||||
raise exc.DuplicateEntry("Duplicate entry for Namespace: %s"
|
||||
% e.columns)
|
||||
|
||||
return namespace
|
||||
|
||||
|
||||
def namespace_update(name, values):
|
||||
return named_entity_update(models.Namespace, name, values)
|
||||
|
||||
|
||||
def namespace_delete(name):
|
||||
namespace = namespace_get(name)
|
||||
|
||||
if namespace:
|
||||
session = get_session()
|
||||
with session.begin():
|
||||
session.delete(namespace)
|
||||
|
||||
|
||||
# BEGIN CapabilityType
|
||||
def capability_type_get(name, namespace):
|
||||
query = model_query(models.CapabilityType, get_session())
|
||||
return query.filter_by(name=name, namespace=namespace).first()
|
||||
|
||||
|
||||
def capability_type_get_with_derived_properties(name, namespace):
|
||||
cap_type_prop_dict = dict()
|
||||
db_capability_type = capability_type_get(name, namespace)
|
||||
if db_capability_type.parent_name and db_capability_type.parent_namespace:
|
||||
property_dict = dict()
|
||||
property_dict = __get_derived_properties(
|
||||
db_capability_type.parent_name,
|
||||
db_capability_type.parent_namespace,
|
||||
property_dict
|
||||
)
|
||||
cap_type_prop_dict['derived_properties'] = property_dict
|
||||
|
||||
cap_type_prop_dict['cap_type'] = db_capability_type
|
||||
return cap_type_prop_dict
|
||||
|
||||
|
||||
def __get_derived_properties(name, namespace, property_dict):
|
||||
db_capability_type = capability_type_get(name, namespace)
|
||||
properties_text = db_capability_type.properties_text
|
||||
if properties_text:
|
||||
derived_type = DerivedType()
|
||||
derived_type.name = name
|
||||
derived_type.namespace = namespace
|
||||
property_dict[derived_type] = properties_text
|
||||
|
||||
if db_capability_type.parent_name and db_capability_type.parent_namespace:
|
||||
__get_derived_properties(
|
||||
db_capability_type.parent_name,
|
||||
db_capability_type.parent_namespace,
|
||||
property_dict
|
||||
)
|
||||
|
||||
return property_dict
|
||||
|
||||
|
||||
def capability_type_get_all():
|
||||
return _entity_get_all(models.CapabilityType)
|
||||
|
||||
|
||||
def capability_type_create(values):
|
||||
capability_type = models.CapabilityType()
|
||||
capability_type.update(values.copy())
|
||||
|
||||
session = get_session()
|
||||
with session.begin():
|
||||
try:
|
||||
capability_type.save(session=session)
|
||||
except db_exc.DBDuplicateEntry as e:
|
||||
raise exc.DuplicateEntry("Duplicate entry for CapabilityType: %s"
|
||||
% e.columns)
|
||||
|
||||
return capability_type
|
||||
|
||||
|
||||
def capability_type_update(name, namespace, values):
|
||||
return named_namespace_entity_update(models.CapabilityType,
|
||||
name, namespace, values)
|
||||
|
||||
|
||||
def capability_type_delete(name, namespace):
|
||||
capability_type = capability_type_get(name, namespace)
|
||||
|
||||
if capability_type:
|
||||
session = get_session()
|
||||
with session.begin():
|
||||
session.delete(capability_type)
|
@ -1,80 +0,0 @@
|
||||
# Copyright 2012 New Dream Network, LLC (DreamHost)
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
The migrations in the alembic_migrations/versions contain the changes needed
|
||||
to migrate from older graffiti releases to newer versions. A migration occurs
|
||||
by executing a script that details the changes needed to upgrade/downgrade
|
||||
the database. The migration scripts are ordered so that multiple scripts
|
||||
can run sequentially to update the database. The scripts are executed by
|
||||
graffiti's migration wrapper which uses the Alembic library to manage the
|
||||
migration.
|
||||
|
||||
|
||||
You can upgrade to the latest database version via:
|
||||
$ graffiti-db-manage --config-file /path/to/graffiti.conf upgrade head
|
||||
|
||||
To check the current database version:
|
||||
$ graffiti-db-manage --config-file /path/to/graffiti.conf current
|
||||
|
||||
To create a script to run the migration offline:
|
||||
$ graffiti-db-manage --config-file /path/to/graffiti.conf upgrade head --sql
|
||||
|
||||
To run the offline migration between specific migration versions:
|
||||
$ graffiti-db-manage --config-file /path/to/graffiti.conf \
|
||||
upgrade <start version>:<end version> --sql
|
||||
|
||||
Upgrade the database incrementally:
|
||||
$ graffiti-db-manage --config-file /path/to/graffiti.conf \
|
||||
upgrade --delta <# of revs>
|
||||
|
||||
Downgrade the database by a certain number of revisions:
|
||||
$ graffiti-db-manage --config-file /path/to/graffiti.conf \
|
||||
downgrade --delta <# of revs>
|
||||
|
||||
This utility should be also used to load Project Groups and Projects form a .yaml
|
||||
file description. The description sample is provided in etc/projects.yaml.
|
||||
$ graffiti-db-manage --config-file /path/to/graffiti.conf \
|
||||
load_projects /path/to/projects.yaml
|
||||
|
||||
|
||||
DEVELOPERS:
|
||||
A database migration script is required when you submit a change to graffiti
|
||||
that alters the database model definition. The migration script is a special
|
||||
python file that includes code to update/downgrade the database to match the
|
||||
changes in the model definition. Alembic will execute these scripts in order to
|
||||
provide a linear migration path between revision. The graffiti-db-manage
|
||||
command can be used to generate migration template for you to complete. The
|
||||
operations in the template are those supported by the Alembic migration library.
|
||||
|
||||
$ graffiti-db-manage --config-file /path/to/graffiti.conf \
|
||||
revision -m "description of revision" --autogenerate
|
||||
|
||||
This generates a prepopulated template with the changes needed to match the
|
||||
database state with the models. You should inspect the autogenerated template
|
||||
to ensure that the proper models have been altered.
|
||||
|
||||
In rare circumstances, you may want to start with an empty migration template
|
||||
and manually author the changes necessary for an upgrade/downgrade. You can
|
||||
create a blank file via:
|
||||
|
||||
$ graffiti-db-manage --config-file /path/to/graffiti.conf \
|
||||
revision -m "description of revision"
|
||||
|
||||
The migration timeline should remain linear so that there is a clear path when
|
||||
upgrading/downgrading. To verify that the timeline does branch, you can run
|
||||
this command:
|
||||
$ graffiti-db-manage --config-file /path/to/graffiti.conf check_migration
|
||||
|
||||
If the migration path does branch, you can find the branch point via:
|
||||
$ graffiti-db-manage --config-file /path/to/graffiti.conf history
|
@ -1,60 +0,0 @@
|
||||
# A generic, single database configuration.
|
||||
|
||||
[alembic]
|
||||
# path to migration_graffiti scripts
|
||||
script_location = alembic_migrations
|
||||
|
||||
# template used to generate migration_graffiti files
|
||||
# file_template = %%(rev)s_%%(slug)s
|
||||
|
||||
# max length of characters to apply to the
|
||||
# "slug" field
|
||||
#truncate_slug_length = 40
|
||||
|
||||
# set to 'true' to run the environment during
|
||||
# the 'revision' command, regardless of autogenerate
|
||||
# revision_environment = false
|
||||
|
||||
# default to an empty string because the graffiti migration_graffiti cli will
|
||||
# extract the correct value and set it programatically before alembic is fully
|
||||
# invoked.
|
||||
#sqlalchemy.url = driver://user:pass@localhost/dbname
|
||||
sqlalchemy.url = mysql://graffiti:graffiti@127.0.0.1:3306/graffiti
|
||||
#sqlalchemy.url = sqlite:///graffiti.db
|
||||
#sqlalchemy.url = sqlite://
|
||||
|
||||
|
||||
# Logging configuration
|
||||
[loggers]
|
||||
keys = root,sqlalchemy,alembic
|
||||
|
||||
[handlers]
|
||||
keys = console
|
||||
|
||||
[formatters]
|
||||
keys = generic
|
||||
|
||||
[logger_root]
|
||||
level = WARN
|
||||
handlers = console
|
||||
qualname =
|
||||
|
||||
[logger_sqlalchemy]
|
||||
level = WARN
|
||||
handlers =
|
||||
qualname = sqlalchemy.engine
|
||||
|
||||
[logger_alembic]
|
||||
level = INFO
|
||||
handlers =
|
||||
qualname = alembic
|
||||
|
||||
[handler_console]
|
||||
class = StreamHandler
|
||||
args = (sys.stderr,)
|
||||
level = NOTSET
|
||||
formatter = generic
|
||||
|
||||
[formatter_generic]
|
||||
format = %(levelname)-5.5s [%(name)s] %(message)s
|
||||
datefmt = %H:%M:%S
|
@ -1 +0,0 @@
|
||||
Generic single-database configuration.
|
@ -1,86 +0,0 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
#
|
||||
# Copyright 2012 New Dream Network, LLC (DreamHost)
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from alembic import context
|
||||
from sqlalchemy import engine_from_config, pool
|
||||
from logging.config import fileConfig
|
||||
|
||||
# this is the Alembic Config object, which provides
|
||||
# access to the values within the .ini file in use.
|
||||
config = context.config
|
||||
|
||||
# Interpret the config file for Python logging.
|
||||
# This line sets up loggers basically.
|
||||
fileConfig(config.config_file_name)
|
||||
|
||||
# add your model's MetaData object here
|
||||
# for 'autogenerate' support
|
||||
# from myapp import mymodel
|
||||
# target_metadata = mymodel.Base.metadata
|
||||
target_metadata = None
|
||||
|
||||
# other values from the config, defined by the needs of env.py,
|
||||
# can be acquired:
|
||||
# my_important_option = config.get_main_option("my_important_option")
|
||||
# ... etc.
|
||||
|
||||
|
||||
def run_migrations_offline():
|
||||
"""Run migrations in 'offline' mode.
|
||||
|
||||
This configures the context with just a URL
|
||||
and not an Engine, though an Engine is acceptable
|
||||
here as well. By skipping the Engine creation
|
||||
we don't even need a DBAPI to be available.
|
||||
|
||||
Calls to context.execute() here emit the given string to the
|
||||
script output.
|
||||
|
||||
"""
|
||||
url = config.get_main_option("sqlalchemy.url")
|
||||
context.configure(url=url)
|
||||
|
||||
with context.begin_transaction():
|
||||
context.run_migrations()
|
||||
|
||||
|
||||
def run_migrations_online():
|
||||
"""Run migrations in 'online' mode.
|
||||
|
||||
In this scenario we need to create an Engine
|
||||
and associate a connection with the context.
|
||||
|
||||
"""
|
||||
engine = engine_from_config(
|
||||
config.get_section(config.config_ini_section),
|
||||
prefix='sqlalchemy.',
|
||||
poolclass=pool.NullPool)
|
||||
|
||||
connection = engine.connect()
|
||||
context.configure(
|
||||
connection=connection,
|
||||
target_metadata=target_metadata)
|
||||
|
||||
try:
|
||||
with context.begin_transaction():
|
||||
context.run_migrations()
|
||||
finally:
|
||||
connection.close()
|
||||
|
||||
if context.is_offline_mode():
|
||||
run_migrations_offline()
|
||||
else:
|
||||
run_migrations_online()
|
@ -1,22 +0,0 @@
|
||||
"""${message}
|
||||
|
||||
Revision ID: ${up_revision}
|
||||
Revises: ${down_revision}
|
||||
Create Date: ${create_date}
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = ${repr(up_revision)}
|
||||
down_revision = ${repr(down_revision)}
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
${imports if imports else ""}
|
||||
|
||||
def upgrade():
|
||||
${upgrades if upgrades else "pass"}
|
||||
|
||||
|
||||
def downgrade():
|
||||
${downgrades if downgrades else "pass"}
|
@ -1,59 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""create dictionary tables
|
||||
|
||||
Revision ID: 001
|
||||
Revises: None
|
||||
Create Date: 2014-03-18 07:36:33.498311
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '001'
|
||||
down_revision = None
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'namespaces',
|
||||
sa.Column('name', sa.String(length=255), nullable=False),
|
||||
sa.Column('scope', sa.String(length=255), nullable=False),
|
||||
sa.Column('owner', sa.String(length=2000), nullable=False),
|
||||
sa.PrimaryKeyConstraint('name')
|
||||
)
|
||||
op.create_table(
|
||||
'capability_types',
|
||||
sa.Column('name', sa.String(length=255), nullable=False),
|
||||
sa.Column('namespace', sa.String(length=255),
|
||||
sa.ForeignKey('namespaces.name', onupdate="CASCADE",
|
||||
ondelete="CASCADE"),
|
||||
nullable=False),
|
||||
sa.Column('description', sa.String(length=2000), nullable=True),
|
||||
sa.Column('parent_name', sa.String(length=255), nullable=True),
|
||||
sa.Column('parent_namespace', sa.String(length=255), nullable=True),
|
||||
sa.Column('properties_text', sa.UnicodeText(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('name', 'namespace'),
|
||||
sa.ForeignKeyConstraint(['parent_name', 'parent_namespace'],
|
||||
['capability_types.name',
|
||||
'capability_types.namespace'],
|
||||
onupdate="CASCADE", ondelete="CASCADE")
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_table('capability_types')
|
||||
op.drop_table('namespaces')
|
@ -1,86 +0,0 @@
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# WKO: testing branch dependencies
|
||||
|
||||
"""
|
||||
SQLAlchemy Models for storing graffiti
|
||||
"""
|
||||
|
||||
from oslo.config import cfg
|
||||
import six.moves.urllib.parse as urlparse
|
||||
from sqlalchemy.ext import declarative
|
||||
from sqlalchemy.orm import relationship
|
||||
# from sqlalchemy import schema
|
||||
|
||||
# from sqlalchemy import Boolean
|
||||
from sqlalchemy import Column
|
||||
# from sqlalchemy import DateTime
|
||||
# from sqlalchemy import Enum
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy import String
|
||||
from sqlalchemy import Unicode
|
||||
from sqlalchemy import UnicodeText
|
||||
|
||||
from graffiti.openstack.common.db.sqlalchemy import models
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
||||
def table_args():
|
||||
engine_name = urlparse.urlparse(cfg.CONF.database_connection).scheme
|
||||
if engine_name == 'mysql':
|
||||
return {'mysql_engine': cfg.CONF.mysql_engine,
|
||||
'mysql_charset': "utf8"}
|
||||
return None
|
||||
|
||||
|
||||
class DictionaryBase(models.ModelBase):
|
||||
metadata = None
|
||||
|
||||
@declarative.declared_attr
|
||||
def __tablename__(cls):
|
||||
# NOTE(jkoelker) use the pluralized name of the class as the table
|
||||
return cls.__name__.lower() + 's'
|
||||
|
||||
def as_dict(self):
|
||||
d = {}
|
||||
for c in self.__table__.columns:
|
||||
d[c.name] = self[c.name]
|
||||
return d
|
||||
|
||||
|
||||
Base = declarative.declarative_base(cls=DictionaryBase)
|
||||
|
||||
|
||||
class CapabilityType(Base):
|
||||
__tablename__ = 'capability_types'
|
||||
|
||||
name = Column(String(255), primary_key=True)
|
||||
namespace = Column(String(255), ForeignKey('namespaces.name'))
|
||||
description = Column(String(2000))
|
||||
parent_name = Column(String(255))
|
||||
parent_namespace = Column(String(255))
|
||||
properties_text = Column(UnicodeText())
|
||||
|
||||
|
||||
class Namespace(Base):
|
||||
|
||||
name = Column(String(255), primary_key=True)
|
||||
scope = Column(Unicode(255))
|
||||
owner = Column(String(2000))
|
||||
capability_types =\
|
||||
relationship("CapabilityType",
|
||||
primaryjoin=name == CapabilityType.namespace,
|
||||
cascade="all, delete")
|
@ -1 +0,0 @@
|
||||
__author__ = 'lakshmi'
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user