Retire repo

Depends-On: If89b02e92f3a2f4196c0d2dc10395c9b1c30d62a
Change-Id: I5cd8828ac82c28681bd5009ead8123f387e01b12
This commit is contained in:
Rob Cresswell 2018-02-01 12:22:23 +00:00
parent 0de9f299da
commit dfa791ac4b
79 changed files with 8 additions and 4541 deletions

15
.gitignore vendored
View File

@ -1,15 +0,0 @@
*.pyc
.DS_STORE
.venv
.tox
*.secret_key_store
*.secret_key_store.lock
*.test_secret_key_store.lock
node_modules
npm-debug.log
doc/build
*.egg-info/
.eggs/
doc/source/sourcecode
*.swp
ChangeLog

View File

@ -1,4 +0,0 @@
[gerrit]
host=review.openstack.org
port=29418
project=openstack/horizon-cisco-ui.git

View File

@ -1,3 +0,0 @@
Rob Cresswell <robert.cresswell@outlook.com>
Saksham Varma <sakvarma@cisco.com>
Chirag Tayal <chiragtayal@gmail.com>

View File

@ -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/horizon-cisco-ui

176
LICENSE
View File

@ -1,176 +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.

View File

@ -1,60 +1,10 @@
========================
Team and repository tags
========================
This project is no longer maintained.
.. image:: http://governance.openstack.org/badges/horizon-cisco-ui.svg
:target: http://governance.openstack.org/reference/tags/index.html
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".
.. Change things from this point on
===============================================================
Cisco UI: Cisco Extension for the OpenStack Dashboard (Horizon)
===============================================================
* Release management: https://launchpad.net/horizon-cisco-ui
* Blueprints and feature specifications: https://blueprints.launchpad.net/horizon-cisco-ui
* Issue tracking: https://bugs.launchpad.net/horizon-cisco-ui
Cisco UI is a Horizon Dashboard for interacting with Cisco Systems hardware.
It uses the standard Horizon extension systems, and maintains code and styling
consistency where possible.
Most of the developer information, as well as an overview of Horizon, can be
found in the `Horizon documentation online`_.
.. _Horizon documentation online: http://docs.openstack.org/developer/horizon/index.html
Getting Started
===============
The quickest way to get up and running is:
1. Setup a basic `Devstack installation`_
2. Clone `Cisco UI`_ with ``git clone https://github.com/openstack/horizon-cisco-ui``
3. Enter the ``horizon-cisco-ui`` directory, and run ``./dev_install.sh``.
Follow the on screen instructions. Often the default settings will be
adequate, so you can just hit enter twice.
.. _Devstack installation: http://docs.openstack.org/developer/devstack/
.. _Cisco UI: https://github.com/openstack/horizon-cisco-ui
Building Documentation
======================
This documentation is written by contributors, for contributors.
The source is maintained in the ``doc/source`` directory using
`reStructuredText`_ and built by `Sphinx`_
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
.. _Sphinx: http://sphinx-doc.org/
* Building Automatically::
$ ./run_tests.sh --docs
* Building Manually::
$ tools/with_venv.sh sphinx-build doc/source doc/build/html
Results are in the ``doc/build/html`` directory
For any further questions, please email
openstack-dev@lists.openstack.org or join #openstack-dev on
Freenode.

View File

@ -1,6 +0,0 @@
[extractors]
django = django_babel.extract:extract_django
[python: **.py]
[django: templates/**.html]
[django: **/templates/**.csv]

View File

@ -1,14 +0,0 @@
[extractors]
# We use a custom extractor to find translatable strings in AngularJS
# templates. The extractor is included in horizon.utils for now.
# See http://babel.pocoo.org/docs/messages/#referencing-extraction-methods for
# details on how this works.
angular = horizon.utils.babel_extract_angular:extract_angular
[javascript: **.js]
# We need to look into all static folders for HTML files.
# The **/static ensures that we also search within
# /openstack_dashboard/dashboards/XYZ/static which will ensure
# that plugins are also translated.
[angular: **/static/**.html]

View File

@ -1,131 +0,0 @@
#!/bin/sh
# Small script for installing Horizon plugins
# Defaults to Horizon IS installed at opt/stack/horizon
### Variables
# Change these for your specific plugin
DASHBOARD_FILE="horizon_cisco_ui/enabled/_6000_cisco.py" # Relative path
N1K_PANEL_FILE="horizon_cisco_ui/enabled/_6010_nexus1000v.py" # Relative path
# These are defaults, may be useful to change but can normally be left alone
HORIZON_DIR="/opt/stack/horizon"
### Functions
setup_horizon () {
echo "Is Horizon installed? [Y/n] ?"
read INSTALLED
case $INSTALLED in
[yY]|"")
set_directory
;;
[nN])
STACK_DIR="/opt/stack"
echo "Checking for presence of $STACK_DIR..."
if [ ! -d "$STACK_DIR" ] ; then
echo "$STACK_DIR not found. Creating (requires sudo)..."
sudo mkdir -p $STACK_DIR
sudo chown -R $USER $STACK_DIR
chmod 0755 $STACK_DIR
fi
echo "Checking for git..."
if command -v git >/dev/null 2>&1 ; then
git clone https://github.com/openstack/horizon.git /opt/stack/horizon
else
echo "Git is not available, but is required. Please install git."
exit 1
fi
;;
*)
echo "Input not recognised"
setup_horizon
;;
esac
}
set_directory () {
echo "Please enter your Horizon root directory. Leave blank for default [$HORIZON_DIR]:"
read CUSTOM_DIR
if [ ! -z "${CUSTOM_DIR// }" ] ; then
if [ $CUSTOM_DIR == /*/ ] ; then
HORIZON_DIR=$CUSTOM_DIR
elif [ $CUSTOM_DIR == */ ] ; then
HORIZON_DIR=/$CUSTOM_DIR
elif [ $CUSTOM_DIR == /* ] ; then
HORIZON_DIR=$CUSTOM_DIR/
else
HORIZON_DIR=/$CUSTOM_DIR/
fi
fi
}
copy_enabled_file () {
ENABLED_DIR=$HORIZON_DIR"/openstack_dashboard/enabled/"
if [ -d "$ENABLED_DIR" ] ; then
echo "\nCopying $DASHBOARD_FILE to $ENABLED_DIR..."
if cp $DASHBOARD_FILE $ENABLED_DIR ; then
echo "Copy succeeded"
else
echo "Copy failed"
exit 1
fi
fi
if [ -d "$ENABLED_DIR" ] ; then
echo "\nCopying $N1K_PANEL_FILE to $ENABLED_DIR..."
if cp $N1K_PANEL_FILE $ENABLED_DIR ; then
echo "Copy succeeded"
else
echo "Copy failed"
exit 1
fi
fi
}
install_plugin () {
echo "\nChecking for existing venv..."
if [ ! -d $HORIZON_DIR"/.venv" ] ; then
echo "No venv found"
python $HORIZON_DIR"/tools/install_venv.py"
else
echo "Existing venv found [$HORIZON_DIR/.venv]"
fi
echo "\nInstalling plugin..."
if $HORIZON_DIR/tools/with_venv.sh pip install -e . ; then
echo "Plugin installed"
else
echo "Plugin installation failed"
exit 1
fi
}
launch_horizon () {
cd $HORIZON_DIR
echo "\nChecking for settings file..."
if [ -f openstack_dashboard/local/local_settings.py ] ; then
echo "Settings file found [$PWD/openstack_dashboard/local/local_settings.py]"
else
echo "Settings file not found. Using default..."
cp openstack_dashboard/local/local_settings.py.example openstack_dashboard/local/local_settings.py
fi
echo "\nLaunching Horizon at 127.0.0.1:8080..."
./run_tests.sh --runserver 127.0.0.1:8080
}
### Execution
setup_horizon
install_plugin
copy_enabled_file
launch_horizon

View File

@ -1,153 +0,0 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Cisco.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Cisco.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/Cisco"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Cisco"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

View File

@ -1,443 +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.
#
# Horizon documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 27 11:38:59 2011.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
from __future__ import print_function
import django
import os
import subprocess
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.abspath(os.path.join(BASE_DIR, "..", ".."))
sys.path.insert(0, ROOT)
# This is required for ReadTheDocs.org, but isn't a bad idea anyway.
os.environ.setdefault('DJANGO_SETTINGS_MODULE',
'horizon_cisco_ui.test.settings')
from horizon_cisco_ui \
import version as cisco_ver
django.setup()
def write_autodoc_index():
def find_autodoc_modules(module_name, sourcedir):
"""returns a list of modules in the SOURCE directory."""
modlist = []
os.chdir(os.path.join(sourcedir, module_name))
print("SEARCHING %s" % sourcedir)
for root, dirs, files in os.walk("."):
for filename in files:
if filename == 'tests.py':
continue
if filename.endswith(".py"):
# remove the pieces of the root
elements = root.split(os.path.sep)
# replace the leading "." with the module name
elements[0] = module_name
# and get the base module name
base, extension = os.path.splitext(filename)
if not (base == "__init__"):
elements.append(base)
result = ".".join(elements)
# print result
modlist.append(result)
return modlist
RSTDIR = os.path.abspath(os.path.join(BASE_DIR, "sourcecode"))
SRCS = [('horizon_cisco_ui', ROOT), ]
EXCLUDED_MODULES = ('horizon_cisco_ui.enabled',)
CURRENT_SOURCES = {}
if not(os.path.exists(RSTDIR)):
os.mkdir(RSTDIR)
CURRENT_SOURCES[RSTDIR] = ['autoindex.rst']
INDEXOUT = open(os.path.join(RSTDIR, "autoindex.rst"), "w")
INDEXOUT.write("""
=================
Source Code Index
=================
.. contents::
:depth: 1
:local:
""")
for modulename, path in SRCS:
sys.stdout.write("Generating source documentation for %s\n" %
modulename)
INDEXOUT.write("\n%s\n" % modulename.capitalize())
INDEXOUT.write("%s\n" % ("=" * len(modulename),))
INDEXOUT.write(".. toctree::\n")
INDEXOUT.write(" :maxdepth: 1\n")
INDEXOUT.write("\n")
MOD_DIR = os.path.join(RSTDIR, modulename)
CURRENT_SOURCES[MOD_DIR] = []
if not(os.path.exists(MOD_DIR)):
os.mkdir(MOD_DIR)
for module in find_autodoc_modules(modulename, path):
if any([module.startswith(exclude) for exclude
in EXCLUDED_MODULES]):
print("Excluded module %s." % module)
continue
mod_path = os.path.join(path, *module.split("."))
generated_file = os.path.join(MOD_DIR, "%s.rst" % module)
INDEXOUT.write(" %s/%s\n" % (modulename, module))
# Find the __init__.py module if this is a directory
if os.path.isdir(mod_path):
source_file = ".".join((os.path.join(mod_path, "__init__"),
"py",))
else:
source_file = ".".join((os.path.join(mod_path), "py"))
CURRENT_SOURCES[MOD_DIR].append("%s.rst" % module)
# Only generate a new file if the source has changed or we don't
# have a doc file to begin with.
if not os.access(generated_file, os.F_OK) or (
os.stat(generated_file).st_mtime <
os.stat(source_file).st_mtime):
print("Module %s updated, generating new documentation."
% module)
FILEOUT = open(generated_file, "w")
header = "The :mod:`%s` Module" % module
FILEOUT.write("%s\n" % ("=" * len(header),))
FILEOUT.write("%s\n" % header)
FILEOUT.write("%s\n" % ("=" * len(header),))
FILEOUT.write(".. automodule:: %s\n" % module)
FILEOUT.write(" :members:\n")
FILEOUT.write(" :undoc-members:\n")
FILEOUT.write(" :show-inheritance:\n")
FILEOUT.write(" :noindex:\n")
FILEOUT.close()
INDEXOUT.close()
# Delete auto-generated .rst files for sources which no longer exist
for directory, subdirs, files in list(os.walk(RSTDIR)):
for old_file in files:
if old_file not in CURRENT_SOURCES.get(directory, []):
print("Removing outdated file for %s" % old_file)
os.remove(os.path.join(directory, old_file))
write_autodoc_index()
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings.
# They can be extensions coming with Sphinx (named 'sphinx.ext.*')
# or your custom ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.viewcode',
'oslosphinx',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Horizon Cisco UI'
copyright = u'2015, Cisco Systems, Inc.'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = cisco_ver.version_info.version_string()
# The full version, including alpha/beta/rc tags.
release = cisco_ver.version_info.release_string()
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
# today = ''
# Else, today_fmt is used as the format for a strftime call.
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['**/#*', '**~', '**/#*#']
# The reST default role (used for this markup: `text`)
# to use for all documents.
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
primary_domain = 'py'
nitpicky = False
# -- Options for HTML output --------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
# html_theme_path = ['.']
# html_theme = '_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
"nosidebar": "false"
}
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
# html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
# html_last_updated_fmt = '%b %d, %Y'
git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local",
"-n1"]
html_last_updated_fmt = subprocess.Popen(
git_cmd, stdout=subprocess.PIPE).communicate()[0]
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
# html_additional_pages = {}
# If false, no module index is generated.
# html_domain_indices = True
# If false, no index is generated.
# html_use_index = True
# If true, the index is split into individual pages for each letter.
# html_split_index = False
# If true, links to the reST sources are added to the pages.
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'Horizondoc'
# -- Options for LaTeX output -------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
# 'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass
# [howto/manual]).
latex_documents = [
('index', 'Horizon.tex', u'Horizon Documentation',
u'OpenStack Foundation', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
# latex_use_parts = False
# If true, show page references after internal links.
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
# latex_appendices = []
# If false, no module index is generated.
# latex_domain_indices = True
# -- Options for manual page output -------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', u'Cisco UI Documentation',
'Documentation for the Cisco plugin to the Openstack Dashboard (Horizon)',
[u'OpenStack'], 1)
]
# If true, show URL addresses after external links.
# man_show_urls = False
# -- Options for Texinfo output -----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'Horizon', u'Horizon Documentation', u'OpenStack',
'Horizon', 'One line description of project.', 'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
# texinfo_appendices = []
# If false, no module index is generated.
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
# texinfo_show_urls = 'footnote'
# -- Options for Epub output --------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = u'Horizon'
epub_author = u'OpenStack'
epub_publisher = u'OpenStack'
epub_copyright = u'2012, OpenStack'
# The language of the text. It defaults to the language option
# or en if the language is not set.
# epub_language = ''
# The scheme of the identifier. Typical schemes are ISBN or URL.
# epub_scheme = ''
# The unique identifier of the text. This can be an ISBN number
# or the project homepage.
# epub_identifier = ''
# A unique identification for the text.
# epub_uid = ''
# A tuple containing the cover image and cover page html template filenames.
# epub_cover = ()
# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
# epub_pre_files = []
# HTML files shat should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title.
# epub_post_files = []
# A list of files that should not be packed into the epub file.
# epub_exclude_files = []
# The depth of the table of contents in toc.ncx.
# epub_tocdepth = 3
# Allow duplicate toc entries.
# epub_tocdup = True

View File

@ -1,61 +0,0 @@
===============================================================
Cisco UI: Cisco Extension for the OpenStack Dashboard (Horizon)
===============================================================
Introduction
============
Cisco UI is a Horizon Dashboard for interacting with Cisco Systems hardware.
It uses the standard Horizon extension systems, and maintains code and styling
consistency where possible.
Most of the developer information, as well as an overview of Horizon, can be
found in the `Horizon documentation online`_.
.. _Horizon documentation online: http://docs.openstack.org/developer/horizon/index.html
Getting Started
===============
The quickest way to get up and running is:
1. Setup a basic `Devstack installation`_
2. Clone `Cisco UI`_ with ``git clone https://github.com/openstack/horizon-cisco-ui``
3. Enter the ``horizon-cisco-ui`` directory, and run ``./dev_install.sh``.
Follow the on screen instructions. Often the default settings will be
adequate, so you can just hit enter twice.
.. _Devstack installation: http://docs.openstack.org/developer/devstack/
.. _Cisco UI: https://github.com/openstack/horizon-cisco-ui
Contributing
============
File `bugs`_ and `blueprints`_ on Launchpad, as with other OpenStack projects.
Use the existing `Horizon blueprint template`_ when adding blueprints. This
helps with consistency.
.. _bugs: https://bugs.launchpad.net/horizon-cisco-ui/
.. _blueprints: https://blueprints.launchpad.net/horizon-cisco-ui/
.. _Horizon blueprint template: https://blueprints.launchpad.net/horizon-cisco-ui/+spec/template
Release Notes
=============
.. toctree::
:glob:
:maxdepth: 1
releases/*
Source Code Reference
=====================
.. toctree::
:glob:
:maxdepth: 1
sourcecode/autoindex

View File

@ -1,2 +0,0 @@
Cisco UI 1.0.0
==============

View File

@ -1,25 +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.
from django.utils.translation import ugettext_lazy as _
import horizon
class Cisco(horizon.Dashboard):
name = _("Cisco")
slug = "cisco"
default_panel = 'nexus1000v'
permissions = ('openstack.roles.admin',)
horizon.register(Cisco)

View File

@ -1,202 +0,0 @@
# Copyright 2014 Cisco Systems, Inc.
# All Rights Reserved.
#
# 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 ConfigParser
import logging
import platform
from django.utils.translation import ugettext_lazy as _
try:
import oslo_messaging as messaging
except ImportError:
from oslo import messaging
try:
from oslo_config import cfg
except ImportError:
from oslo.config import cfg
from horizon import exceptions
from horizon.utils.memoized import memoized
LOG = logging.getLogger(__name__)
class DFAClient(object):
"""Represents Nexus Fabric Enabler RPC Client."""
def __init__(self):
self.setup_client()
@memoized
def setup_client(self):
cfgfile = '/etc/saf/enabler_conf.ini'
config = ConfigParser.ConfigParser()
res = config.read(cfgfile)
if not res:
return None
url = config.get('dfa_rpc', 'transport_url')
self.ctl_host = platform.node()
url = url % ({'ip': self.ctl_host})
transport = messaging.get_transport(cfg.CONF, url=url)
target = messaging.Target(exchange='dfa',
topic='dfa_server_q', fanout=False)
self.clnt = messaging.RPCClient(transport, target)
return self.clnt
@memoized
def dfaclient():
return DFAClient().clnt
def associate_profile_with_network(network):
'''Associate Network Profile with network'''
try:
resp = dfaclient().call({}, 'associate_profile_with_network',
msg=network)
return resp
except (messaging.MessagingException, messaging.RemoteError,
messaging.MessagingTimeout):
LOG.error("RPC: Request to associate_profile_with_network failed.")
raise exceptions.NotAvailable("RPC to Fabric Enabler failed")
def do_associate_dci_id_to_project(tenant):
'''Associate DCI ID to Project'''
try:
resp = dfaclient().cast({}, 'associate_dci_id_to_project',
msg=tenant)
return resp
except (messaging.MessagingException, messaging.RemoteError,
messaging.MessagingTimeout):
LOG.error("RPC: Request to associate DCI_ID to Project failed.")
raise exceptions.NotAvailable("RPC to Fabric Enabler failed")
def get_fabric_summary():
'''Get fabric details from the Fabric Enabler'''
try:
resp = dfaclient().call({}, 'get_fabric_summary', msg={})
return resp
except (messaging.MessagingException, messaging.RemoteError,
messaging.MessagingTimeout):
LOG.error("RPC: Request for Fabric Summary failed.")
raise exceptions.NotAvailable("RPC to Fabric Enabler failed")
def get_per_config_profile_detail(cfg_profile):
'''Get all config Profiles details from the Fabric Enabler'''
try:
resp = dfaclient().call({}, 'get_per_config_profile_detail',
msg=cfg_profile)
return resp
except Exception as e:
mess = (_('%(reason)s') % {"reason": e})
LOG.error(mess)
reason = mess.partition("Traceback")[0]
raise exceptions.NotAvailable(reason)
def get_config_profiles_detail():
'''Get all config Profiles details from the Fabric Enabler'''
try:
resp = dfaclient().call({}, 'get_config_profiles_detail', msg={})
return resp
except Exception as e:
mess = (_('%(reason)s') % {"reason": e})
reason = mess.partition("Traceback")[0]
raise exceptions.NotAvailable(reason)
def get_project_details(tenant):
'''Get project details for a tenant from the Fabric Enabler'''
try:
resp = dfaclient().call({}, 'get_project_detail', msg=tenant)
if not resp:
raise exceptions.NotFound("Project Not Found in Fabric \
Enabler")
return resp
except (messaging.MessagingException, messaging.RemoteError,
messaging.MessagingTimeout):
LOG.error("RPC: Request for project details failed.")
raise exceptions.NotAvailable("RPC to Fabric Enabler failed")
def get_network_by_tenant_id(tenant):
'''Get all networks for a tenant from the Fabric Enabler'''
try:
resp = dfaclient().call({}, 'get_all_networks_for_tenant', msg=tenant)
if resp is False:
raise exceptions.NotFound("Project Not Found in Fabric \
Enabler")
return resp
except (messaging.MessagingException, messaging.RemoteError,
messaging.MessagingTimeout):
LOG.error("RPC: Request for project details failed.")
raise exceptions.NotAvailable("RPC to Fabric Enabler failed")
def get_instance_by_tenant_id(tenant):
'''Get all instances for a tenant from the Fabric Enabler'''
try:
resp = dfaclient().call({}, 'get_instance_by_tenant_id', msg=tenant)
if resp is False:
raise exceptions.NotFound("Project Not Found in Fabric \
Enabler")
return resp
except (messaging.MessagingException, messaging.RemoteError,
messaging.MessagingTimeout):
LOG.error("RPC: Request for project details failed.")
raise exceptions.NotAvailable("RPC to Fabric Enabler failed")
def get_agents_details():
'''Get all Enabler agents from the Fabric Enabler'''
try:
resp = dfaclient().call({}, 'get_agents_details', msg={})
if not resp:
raise exceptions.NotFound("No Agents found for Fabric Enabler")
return resp
except (messaging.MessagingException, messaging.RemoteError,
messaging.MessagingTimeout):
LOG.error("RPC: Request for project details failed.")
raise exceptions.NotAvailable("RPC to Fabric Enabler failed")
def get_agent_details_per_host(agent):
'''Get Enabler agent for a host from the Fabric Enabler'''
try:
resp = dfaclient().call({}, 'get_agent_details_per_host', msg=agent)
if not resp:
raise exceptions.NotFound("No Agent found for Fabric Enabler")
return resp
except (messaging.MessagingException, messaging.RemoteError,
messaging.MessagingTimeout):
LOG.error("RPC: Request for project details failed.")
raise exceptions.NotAvailable("RPC to Fabric Enabler failed")

View File

@ -1,63 +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.
import logging
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon_cisco_ui.cisco.dfa import dfa_client
LOG = logging.getLogger(__name__)
class AssociateDCI(forms.SelfHandlingForm):
project_id = forms.CharField(label=_("Project ID "),
widget=forms.TextInput(
attrs={'readonly': 'readonly'}))
dci_id = forms.IntegerField(label=_("DCI ID"), min_value=1,
max_value=1600000)
def handle(self, request, data):
try:
LOG.debug('request = %(req)s, params = %(params)s',
{'req': request, 'params': data})
tenant = dict(tenant_id=request.user.project_id,
tenant_name=request.user.project_name,
dci_id=data['dci_id'])
dfa_client.do_associate_dci_id_to_project(tenant)
except Exception:
redirect = reverse('horizon:cisco:dfa:index')
msg = _('Failed to associate DCI ID to project')
exceptions.handle(request, msg, redirect=redirect)
return True
class DisassociateDCI(forms.SelfHandlingForm):
def handle(self, request, data):
try:
LOG.debug('request = %(req)s, params = %(params)s',
{'req': request, 'params': data})
tenant = dict(tenant_id=request.user.project_id,
tenant_name=request.user.project_name,
dci_id=0)
dfa_client.do_associate_dci_id_to_project(tenant)
except Exception:
redirect = reverse('horizon:cisco:dfa:index')
msg = _('Failed to disassociate DCI ID from project')
exceptions.handle(request, msg, redirect=redirect)
return True

View File

@ -1,43 +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.
from django.utils.translation import ugettext_lazy as _
import horizon
from horizon_cisco_ui.cisco import dashboard
import logging
import os.path
LOG = logging.getLogger(__name__)
class DFA(horizon.Panel):
name = _("Programmable Fabric")
slug = "dfa"
permissions = ('openstack.services.network',)
def allowed(self, context):
request = context['request']
if not request.user.has_perms(self.permissions):
return False
try:
if not os.path.isfile('/etc/saf/enabler_conf.ini'):
return False
except Exception:
LOG.error("Exception occurred trying to find the Nexus Fabric "
"Enabler Configuration File")
return False
if not super(DFA, self).allowed(context):
return False
return True
dashboard.Cisco.register(DFA)

View File

@ -1,234 +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.
from django import template
from django.utils.translation import ugettext_lazy as _
from horizon import tables
import logging
LOG = logging.getLogger(__name__)
class AssociateDCIAction(tables.LinkAction):
name = "associate"
verbose_name = _("Associate DCI ID")
url = "horizon:cisco:dfa:associate"
classes = ("ajax-modal",)
icon = "link"
class DisassociateDCIAction(tables.LinkAction):
name = "disassociate"
verbose_name = _("Disassociate DCI ID")
url = "horizon:cisco:dfa:disassociate"
classes = ("ajax-modal",)
icon = "link"
class SearchFilterAction(tables.FilterAction):
name = "searchfilter"
def get_vdp(obj):
if obj.get('vdp_vlan') > 0:
return obj.get('vdp_vlan')
if 'reason' in obj:
template_name = 'cisco/dfa/_vdp_reason.html'
context = {
"vdp": obj.get('vdp_vlan'),
"id": obj.get('port_id'),
"reason": obj.get('reason')
}
return template.loader.render_to_string(template_name, context)
return obj.get('vdp_vlan')
def get_result(obj):
if obj.get('result') == 'SUCCESS':
return obj.get('result')
if 'network_id' in obj:
obj_id = obj.get('network_id')
elif 'project_id' in obj:
obj_id = obj.get('project_id')
elif 'port_id' in obj:
obj_id = obj.get('port_id')
else:
obj_id = 'none'
if 'reason' in obj:
template_name = 'cisco/dfa/_reason.html'
context = {
"result": obj.get('result'),
"id": obj_id,
"reason": obj.get('reason')
}
return template.loader.render_to_string(template_name, context)
return obj.get('result')
def get_instance_info(obj):
if 'instance_id' and 'veth_intf' in obj:
template_name = 'cisco/dfa/_instance.html'
context = {
"name": obj.get('name'),
"nw_name": obj.get('network_name'),
"id": ''.join(e for e in obj.get('instance_id') if e.isalnum()),
"mac": obj.get('mac'),
"ip": obj.get('ip'),
"port": obj.get('port_id'),
"host_port": ', '.join((obj.get('host'), obj.get('veth_intf'))),
"TOR_port": ', '.join((obj.get('remote_system_name'),
obj.get('remote_port')))
}
return template.loader.render_to_string(template_name, context)
return obj.get('name')
class FabricSummaryTable(tables.DataTable):
key = tables.Column("key", sortable=False,
verbose_name=_("Fabric Property"))
value = tables.Column("value",
verbose_name=_("Value"))
def get_object_id(self, obj):
return obj.get('key')
class Meta(object):
name = "fabricsummary"
verbose_name = _("Fabric Summary")
table_actions = (SearchFilterAction, )
multi_select = False
class CFGProfileTable(tables.DataTable):
profile_name = tables.Column("profileName", sortable=False,
verbose_name=_("Profile Name"),
link='horizon:cisco:dfa:detailprofile')
def get_object_id(self, obj):
return ':'.join((obj.get('profileName'), obj.get('profileType')))
class Meta(object):
name = "cfgprofile"
verbose_name = _("CFGProfile")
table_actions = (SearchFilterAction, )
multi_select = False
class ProjectTable(tables.DataTable):
project_name = tables.Column("project_name",
verbose_name=_("Project Name"))
project_id = tables.Column("project_id", verbose_name=_("Project ID"))
seg_id = tables.Column("seg_id", verbose_name=_("L3 VNI"))
dci_id = tables.Column("dci_id", verbose_name=_("DCI ID"))
result = tables.Column(get_result, verbose_name=_("Result"))
def get_object_id(self, obj):
return obj.get('project_id')
class Meta(object):
name = "projecttable"
hidden_title = False
verbose_name = _("Projects")
row_actions = (AssociateDCIAction, DisassociateDCIAction, )
class NetworkTable(tables.DataTable):
network_name = tables.Column("network_name", verbose_name=_("Name"))
network_id = tables.Column("network_id", verbose_name=_("ID"))
config_profile = tables.Column("config_profile",
verbose_name=_("Network Profile"))
seg_id = tables.Column("seg_id", verbose_name=_("Segmentation ID"))
vlan_id = tables.Column("vlan_id", verbose_name=_("Vlan ID"))
result = tables.Column(get_result, verbose_name=_("Result"))
def get_object_id(self, obj):
return obj.get('network_id')
class Meta(object):
name = "networktable"
hidden_title = False
verbose_name = _("Networks")
table_actions = (SearchFilterAction,)
multi_select = False
class InstanceTable(tables.DataTable):
instance_name = tables.Column(get_instance_info, verbose_name=_("Name"))
host = tables.Column("host", verbose_name=_("Host"))
tor = tables.Column("remote_system_name", verbose_name=_("TOR"))
network_name = tables.Column("network_name",
verbose_name=_("Network Name"))
local_vlan = tables.Column("local_vlan", verbose_name=_("Local Vlan"))
vdp_vlan = tables.Column(get_vdp, verbose_name=_("Link Local Vlan"))
seg_id = tables.Column("seg_id", verbose_name=_("Segmentation ID"))
result = tables.Column(get_result, verbose_name=_("Result"))
def get_object_id(self, obj):
return obj.get('port_id')
class Meta(object):
name = "instancetable"
hidden_title = False
verbose_name = _("Instances")
table_actions = (SearchFilterAction,)
multi_select = False
class AgentsTable(tables.DataTable):
host = tables.Column("host", verbose_name=_("Host"),
link='horizon:cisco:dfa:detail')
created = tables.Column("created", verbose_name=_("Created"))
heartbeat = tables.Column("heartbeat", verbose_name=_("Heartbeat"))
agent_status = tables.Column("agent_status",
verbose_name=_("Agent Status"))
def get_object_id(self, obj):
return obj.get('host')
class Meta(object):
name = "agentstable"
verbose_name = _("Agents Table")
table_actions = (SearchFilterAction,)
multi_select = False
class TopologyTable(tables.DataTable):
interface = tables.Column("interface", verbose_name=_("Interface"))
remote_port = tables.Column("remote_port", verbose_name=_("Remote Port"))
bond_intf = tables.Column("bond_intf", verbose_name=_("Bond Interface"))
remote_evb_cfgd = tables.Column("remote_evb_cfgd",
verbose_name=_("Remote EVB Configured"))
remote_system_desc = tables.Column("remote_system_desc",
verbose_name=_("Remote System"))
remote_chassis_mac = tables.Column("remote_chassis_mac",
verbose_name=_("Remote Chassis Mac"))
remote_mgmt_addr = tables.Column("remote_mgmt_addr",
verbose_name=_("Remote Mgmt Address"))
remote_system_name = tables.Column("remote_system_name",
verbose_name=_("Remote Sys Name"))
remote_evb_mode = tables.Column("remote_evb_mode",
verbose_name=_("Remote EVB Mode"))
def get_object_id(self, obj):
return obj.get('interface')
class Meta(object):
name = "topology"
hidden_title = False
verbose_name = _("Topology")
multi_select = False

View File

@ -1,133 +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.
import dateutil.parser
import json
import logging
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tabs
from horizon_cisco_ui.cisco.dfa import dfa_client
from horizon_cisco_ui.cisco.dfa import tables
LOG = logging.getLogger(__name__)
class FabricSummaryTab(tabs.TableTab):
name = _("Fabric Summary")
slug = "fabric_summary_tab"
table_classes = (tables.FabricSummaryTable,)
template_name = ("horizon/common/_detail_table.html")
def get_fabricsummary_data(self):
summary = []
try:
summary = dfa_client.get_fabric_summary()
except Exception as exc:
exceptions.handle(self.request, exc.message)
return summary
class CFGProfileTab(tabs.TableTab):
name = _("Network Profiles")
slug = "cfgprofile_tab"
table_classes = (tables.CFGProfileTable,)
template_name = ("horizon/common/_detail_table.html")
def get_cfgprofile_data(self):
try:
cfgplist = dfa_client.get_config_profiles_detail()
profile_list = [p for p in cfgplist
if (p.get('profileSubType') ==
'network:universal')]
except Exception as exc:
profile_list = []
exceptions.handle(self.request, exc.message)
return profile_list
class NFEInfoTab(tabs.TableTab):
name = _("Fabric View")
slug = "nfe_info_tab"
table_classes = (tables.ProjectTable, tables.NetworkTable,
tables.InstanceTable, )
template_name = 'cisco/dfa/enablerinfo_tables.html'
def get_projecttable_data(self):
try:
tenant = dict(tenant_id=self.request.user.project_id)
project_list = dfa_client.get_project_details(tenant)
except Exception as exc:
project_list = []
exceptions.handle(self.request, exc.message)
return project_list
def get_networktable_data(self):
try:
tenant = dict(tenant_id=self.request.user.project_id)
netlist = dfa_client.get_network_by_tenant_id(tenant)
except Exception as exc:
netlist = []
exceptions.handle(self.request, exc.message)
return netlist
def get_instancetable_data(self):
try:
tenant = dict(tenant_id=self.request.user.project_id)
instance_list = dfa_client.get_instance_by_tenant_id(tenant)
agent_list = dfa_client.get_agents_details()
port = {}
for agent in agent_list:
cfg = json.loads(agent.get('config'))
topo = cfg.get('topo')
intf = topo.get(cfg.get('veth_intf'))
host = agent.get('host')
if not intf:
continue
port.update({host: dict(veth_intf=cfg.get('uplink'),
remote_system_name=intf.get('remote_system_name'),
remote_port=intf.get('remote_port'))})
if port:
for instance in instance_list:
instance.update(port.get(instance.get('host')))
except Exception as exc:
instance_list = []
exceptions.handle(self.request, exc.message)
return instance_list
class NFEAgentTab(tabs.TableTab):
name = _("Topology View")
slug = "nfe_agents_tab"
table_classes = (tables.AgentsTable,)
template_name = ("horizon/common/_detail_table.html")
def get_agentstable_data(self):
try:
agent_list = dfa_client.get_agents_details()
for agent in agent_list:
agent["heartbeat"] = dateutil.parser.parse(
agent.get('heartbeat'))
agent["created"] = dateutil.parser.parse(agent.get('created'))
except Exception as exc:
agent_list = []
exceptions.handle(self.request, exc.message)
return agent_list
class DFATabs(tabs.TabGroup):
slug = "dfa_tabs"
tabs = (FabricSummaryTab, CFGProfileTab, NFEInfoTab, NFEAgentTab)
sticky = True

View File

@ -1,7 +0,0 @@
{% extends "horizon/common/_modal_form.html" %}
{% load i18n %}
{% block modal-body-right %}
<p><strong>{% trans "Data Center Interconnect:" %}</strong> {% blocktrans %} Cisco DCI solutions extend LAN and SAN connectivity across geographically dispersed active data centers.{% endblocktrans %}</p>
<p><strong>{% trans "DCI ID:" %}</strong> {% blocktrans %} 1 - 1600000{% endblocktrans %}</p>
{% endblock %}

View File

@ -1,19 +0,0 @@
{% load i18n sizeformat parse_date %}
<div class="detail">
<dl class="dl-horizontal">
<dt>{% trans "Host Name" %}</dt>
<dd>{{ agent.host }}</dd>
<dt>{% trans "Created At" %}</dt>
<dd>{{ agent.created|parse_date }}</dd>
<dt>{% trans "Heartbeat" %}</dt>
<dd>{{ agent.heartbeat|parse_date }}</dd>
<dt>{% trans "Uplink" %}</dt>
<dd>{{ uplink |default:_("None")}}</dd>
<dt>{% trans "veth Interface" %}</dt>
<dd>{{ veth_intf |default:_("None")}}</dd>
<dt>{% trans "Member Ports" %}</dt>
<dd>{{ memb_ports |default:_("None")}}</dd>
</dl>
</div>

View File

@ -1,18 +0,0 @@
{% load i18n %}
<div class="detail">
<p> {% trans Network Profile is an autoconfiguration template consisting of collection of commands which instantiates day-1 tenant-related configurations on CISCO Nexus switches.<br> Profiles can be added or modified only from DCNM %}</p><br>
<dl class="dl-horizontal">
<dt>{% trans "Profile Name: " %}</dt>
<dd>{{ Profile_Name }}</dd>
<dt>{% trans "Profile Type: " %}</dt>
<dd>{{ Profile_Type }}</dd>
<dt>{% trans "Forwarding Mode: " %}</dt>
<dd>{{ fwding_mode }}</dd>
<dt>{% trans "Description: " %}</dt>
<dd>{{ description }}</dd><br>
<dt>{% trans "Commands: " %}</dt>
<dd>{% autoescape off %}{{ commands }}{% endautoescape %}</dd>
</dl>
</div>

View File

@ -1,6 +0,0 @@
{% extends "horizon/common/_modal_form.html" %}
{% load i18n %}
{% block modal-body%}
<p>{% blocktrans %}Are you sure to dis-associate DCI ID to Project?{% endblocktrans %}</p>
{% endblock %}

View File

@ -1,19 +0,0 @@
{% load i18n %}
<a href="#" id="instance_{{ id }}_{{ nw_name }}" class="link-popover" rel="popover" tabindex="0" data-placement="right" data-trigger="focus" data-content="
<table class='table table-bordered'>
<tr><th>{% trans 'IP' %}</th><td>{{ ip }}</td></tr>
<tr><th>{% trans 'MAC' %}</th><td>{{ mac }}</td></tr>
<tr><th>{% trans 'PORT' %}</th><td>{{ port }}</td></tr>
<tr><th>{% trans 'HOST, Port' %}</th><td>{{ host_port }}</td></tr>
<tr><th>{% trans 'TOR, Port' %}</th><td>{{ TOR_port }}</td></tr>
</table>
" data-original-title="{% blocktrans %}Instance Details: {{ name }}">{{ name }}{% endblocktrans %}</a>
<script type="text/javascript" charset="utf-8">
$(function () {
var $instance = $("#instance_{{ id }}_{{ nw_name }}");
if ( $instance.popover ) {
$instance.popover({html:true});
}
});
</script>

View File

@ -1,4 +0,0 @@
{% load i18n %}
<a href="#" data-toggle="tooltip" data-placement="right" data-trigger="focus" data-original-title="
{{ description }}
">{{ name }}</a>

View File

@ -1,14 +0,0 @@
{% load i18n %}
<a href="#" id="result_{{ result }}_{{ id }}" class="link-popover" rel="popover" tabindex="0" data-placement="left" data-trigger="focus" data-content="
<table class='table table-bordered'>
<tr><th>{% trans 'Reason' %}</th><td>{{ reason }}</td></tr>
</table>
" data-original-title="{% blocktrans %}">{{ result }}{% endblocktrans %}</a>
<script type="text/javascript" charset="utf-8">
$(function () {
var $result = $("#result_{{ result }}_{{ id }}");
if ( $result.popover ) {
$result.popover({html:true});
}
});
</script>

View File

@ -1,7 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Associate DCI ID to Project" %}{% endblock %}
{% block main %}
{% include "cisco/dfa/_associate.html" %}
{% endblock %}

View File

@ -1,16 +0,0 @@
{% extends 'base.html' %}
{% load i18n breadcrumb_nav %}
{% block title %}{% trans "Fabric Enabler Hosts"%}{% endblock %}
{% block main %}
<div class="row">
<div class="col-sm-12">
{% include "cisco/dfa/_detail_overview.html" %}
<hr>
<div id="topology">
{{ topology_table.render }}
</div>
</div>
</div>
{% endblock %}

View File

@ -1,12 +0,0 @@
{% extends 'base.html' %}
{% load i18n breadcrumb_nav %}
{% block title %}{% trans "Network Profiles"%}{% endblock %}
{% block main %}
<div class="row">
<div class="col-sm-12">
{% include "cisco/dfa/_detail_profile_overview.html" %}
</div>
</div>
{% endblock %}

View File

@ -1,7 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Disassociate DCI ID from Project" %}{% endblock %}
{% block main %}
{% include "cisco/dfa/_disassociate.html" %}
{% endblock %}

View File

@ -1,14 +0,0 @@
{% block main %}
<div id="project_id">
{{ projecttable_table.render }}
</div>
<div id="network">
{{ networktable_table.render }}
</div>
<div id="instance">
{{ instancetable_table.render }}
</div>
{% endblock %}

View File

@ -1,12 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% block title %} {% trans "DFA" %} {% endblock %}
{% block main %}
<div class="row">
<div class="col-sm-12">
{{ tab_group.render }}
</div>
</div>
{% endblock %}

View File

@ -1,150 +0,0 @@
# Copyright 2014 Cisco Systems, Inc.
# All Rights Reserved.
#
# 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 mock
import platform
from horizon_cisco_ui.cisco.dfa import dfa_client
from openstack_dashboard.test import helpers as test
class DFAClientTestCase(test.BaseAdminViewTests):
def setUp(self):
'''Setup routine '''
super(DFAClientTestCase, self).setUp()
self.ip = platform.node()
self._test_dfa_client_init()
def _test_dfa_client_init(self):
with mock.patch('horizon_cisco_ui.cisco.dfa.dfa_client.ConfigParser.ConfigParser'), \
mock.patch('oslo_messaging.RPCClient'), \
mock.patch('oslo_messaging.get_transport'):
self.client = dfa_client.DFAClient()
def test_do_associate_profile_with_network(self):
network = dict(id='1125-as45-afg5f-3457',
cfgp='defaultNetworkL2Profile',
name='net1',
tenant_id=1)
with mock.patch('horizon_cisco_ui.cisco.dfa.dfa_client.dfaclient') as \
mock_client:
mock_client.return_value.call = mock.MagicMock()
dfa_client.associate_profile_with_network(network)
mock_client.return_value.call.assert_called_with(
{}, 'associate_profile_with_network', msg=network)
def test_associate_profile_with_network_rpc_exception(self):
network = dict(id='1125-as45-afg5f-3457',
cfgp='defaultNetworkL2Profile',
name='net1',
tenant_id=1)
with mock.patch('horizon_cisco_ui.cisco.dfa.dfa_client.dfaclient') as mock_client, \
self.assertRaises(dfa_client.exceptions.NotAvailable) as cm:
mock_client.return_value.call = mock.MagicMock(
side_effect=dfa_client.messaging.MessagingException)
dfa_client.associate_profile_with_network(network)
self.assertEqual('RPC to Fabric Enabler failed',
str(cm.exception))
def test_do_associate_dci_id_to_project(self):
tenant = dict(tenant_id=1,
tenant_name='Project1',
dci_id=1001)
with mock.patch('horizon_cisco_ui.cisco.dfa.dfa_client.dfaclient') as \
mock_client:
mock_client.return_value.cast = mock.MagicMock()
dfa_client.do_associate_dci_id_to_project(tenant)
mock_client.return_value.cast.assert_called_with(
{}, 'associate_dci_id_to_project', msg=tenant)
def test_get_fabric_summary(self):
with mock.patch('horizon_cisco_ui.cisco.dfa.dfa_client.dfaclient') as \
mock_client:
mock_client.return_value.call = mock.MagicMock()
resp = dfa_client.get_fabric_summary()
mock_client.return_value.call.assert_called_with(
{}, 'get_fabric_summary', msg={})
self.assertEqual(resp, mock_client.return_value.call.return_value)
def test_get_config_profiles_detail(self):
with mock.patch('horizon_cisco_ui.cisco.dfa.dfa_client.dfaclient') as \
mock_client:
mock_client.return_value.call = mock.MagicMock()
resp = dfa_client.get_config_profiles_detail()
mock_client.return_value.call.assert_called_with(
{}, 'get_config_profiles_detail', msg={})
self.assertEqual(resp, mock_client.return_value.call.return_value)
def test_get_project_details(self):
tenant = dict(tenant_id=1)
with mock.patch('horizon_cisco_ui.cisco.dfa.dfa_client.dfaclient') as \
mock_client:
mock_client.return_value.call = mock.MagicMock()
resp = dfa_client.get_project_details(tenant)
mock_client.return_value.call.assert_called_with(
{}, 'get_project_detail', msg=tenant)
self.assertEqual(resp, mock_client.return_value.call.return_value)
def test_get_network_by_tenant_id(self):
tenant = dict(tenant_id=1)
with mock.patch('horizon_cisco_ui.cisco.dfa.dfa_client.dfaclient') as \
mock_client:
mock_client.return_value.call = mock.MagicMock()
resp = dfa_client.get_network_by_tenant_id(tenant)
mock_client.return_value.call.assert_called_with(
{}, 'get_all_networks_for_tenant', msg=tenant)
self.assertEqual(resp, mock_client.return_value.call.return_value)
def test_get_instance_by_tenant_id(self):
tenant = dict(tenant_id=1)
with mock.patch('horizon_cisco_ui.cisco.dfa.dfa_client.dfaclient') as \
mock_client:
mock_client.return_value.call = mock.MagicMock()
resp = dfa_client.get_instance_by_tenant_id(tenant)
mock_client.return_value.call.assert_called_with(
{}, 'get_instance_by_tenant_id', msg=tenant)
self.assertEqual(resp, mock_client.return_value.call.return_value)
def test_get_agents_details(self):
with mock.patch('horizon_cisco_ui.cisco.dfa.dfa_client.dfaclient') as \
mock_client:
mock_client.return_value.call = mock.MagicMock()
resp = dfa_client.get_agents_details()
mock_client.return_value.call.assert_called_with(
{}, 'get_agents_details', msg={})
self.assertEqual(resp, mock_client.return_value.call.return_value)
def test_get_agent_details_per_host(self):
agent = dict(tenant_id=1)
with mock.patch('horizon_cisco_ui.cisco.dfa.dfa_client.dfaclient') as \
mock_client:
mock_client.return_value.call = mock.MagicMock()
resp = dfa_client.get_agent_details_per_host(agent)
mock_client.return_value.call.assert_called_with(
{}, 'get_agent_details_per_host', msg=agent)
self.assertEqual(resp, mock_client.return_value.call.return_value)

View File

@ -1,132 +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.
from django.core.urlresolvers import reverse
from horizon_cisco_ui.cisco.dfa.tabs import dfa_client as dc
from horizon_cisco_ui.cisco.dfa.test import test_data
import mock
from openstack_dashboard.test import helpers as test
class DFATestCase(test.BaseAdminViewTests):
def setUp(self):
super(DFATestCase, self).setUp()
self.dfa_client = dc.DFAClient
def _setup_test_data(self):
super(DFATestCase, self)._setup_test_data()
test_data.data(self)
def _test_base_index(self):
profiles = self.dfa_config_profile.list()
projects = self.dfa_project.list()
networks = self.dfa_network.list()
instances = self.dfa_instance.list()
agents = self.dfa_agent.list()
summary = self.dfa_summary.list()[0]
with mock.patch('horizon_cisco_ui.cisco.dfa.tabs.dfa_client'
'.get_config_profiles_detail', return_value=profiles), \
mock.patch('horizon_cisco_ui.cisco.dfa.tabs.dfa_client'
'.get_network_by_tenant_id',
return_value=networks), \
mock.patch('horizon_cisco_ui.cisco.dfa.tabs.dfa_client'
'.get_instance_by_tenant_id',
return_value=instances), \
mock.patch('horizon_cisco_ui.cisco.dfa.tabs.dfa_client'
'.get_project_details',
return_value=projects), \
mock.patch('horizon_cisco_ui.cisco.dfa.tabs.dfa_client'
'.get_fabric_summary',
return_value=summary), \
mock.patch('horizon_cisco_ui.cisco.dfa.tabs.dfa_client'
'.get_agents_details',
return_value=agents):
res = self.client.get(reverse('horizon:cisco:dfa:index'))
self.assertTemplateUsed(res, 'cisco/dfa/index.html')
return res
def test_fabric_summary_tab_index(self):
res = self._test_base_index()
services_tab = res.context['tab_group'].get_tab('fabric_summary_tab')
self.assertEqual(
services_tab._tables['fabricsummary'].data,
[summary for summary in self.dfa_summary.list()[0]])
def test_cfg_profile_index(self):
res = self._test_base_index()
services_tab = res.context['tab_group'].get_tab('cfgprofile_tab')
self.assertEqual(
services_tab._tables['cfgprofile'].data,
[profiles for profiles in self.dfa_config_profile.list()])
def test_nfe_info_index(self):
res = self._test_base_index()
services_tab = res.context['tab_group'].get_tab('nfe_info_tab')
self.assertEqual(
services_tab._tables['projecttable'].data,
[project for project in self.dfa_project.list()])
self.assertEqual(
services_tab._tables['networktable'].data,
[network for network in self.dfa_network.list()])
def test_nfe_agents_index(self):
res = self._test_base_index()
services_tab = res.context['tab_group'].get_tab('nfe_agents_tab')
self.assertEqual(
services_tab._tables['agentstable'].data,
[agent for agent in self.dfa_agent.list()])
def test_agent_detail(self):
agent = self.dfa_agent.list()
with mock.patch('horizon_cisco_ui.cisco.dfa.tabs.dfa_client'
'.get_agent_details_per_host',
return_value=agent):
res = self.client.get(reverse('horizon:cisco:dfa:detail',
args=['compute0']))
self.assertTemplateUsed(res, 'cisco/dfa/detail.html')
def test_agent_detail_exception(self):
with mock.patch('horizon_cisco_ui.cisco.dfa.tabs.dfa_client'
'.get_agent_details_per_host',
side_effect=dc.exceptions.NotAvailable):
url = reverse('horizon:cisco:dfa:detail', args=['compute0'])
res = self.client.get(url)
redir_url = reverse('horizon:cisco:dfa:index')
self.assertRedirectsNoFollow(res, redir_url)
def test_associate_dci_to_project(self):
formdata = {'project_id': 123456, 'dci_id': 1001}
with mock.patch('horizon_cisco_ui.cisco.dfa.tabs.dfa_client'
'.do_associate_dci_id_to_project'):
url = reverse('horizon:cisco:dfa:associate', args=['123456'])
res = self.client.post(url, formdata)
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res, '/cisco/dfa/')
def test_disassociate_dci_to_project(self):
formdata = {'project_id': 123456, 'dci_id': 0}
with mock.patch('horizon_cisco_ui.cisco.dfa.tabs.dfa_client'
'.do_associate_dci_id_to_project'):
url = reverse('horizon:cisco:dfa:disassociate', args=['123456'])
res = self.client.post(url, formdata)
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res, '/cisco/dfa/')

View File

@ -1,98 +0,0 @@
# Copyright 2012 Nebula, Inc.
#
# 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 openstack_dashboard.test.test_data import utils
def data(TEST):
# Test DataContainers for DFA Workflow
TEST.dfa_precreate_network = utils.TestDataContainer()
TEST.dfa_config_profile = utils.TestDataContainer()
TEST.dfa_project = utils.TestDataContainer()
TEST.dfa_network = utils.TestDataContainer()
TEST.dfa_instance = utils.TestDataContainer()
TEST.dfa_agent = utils.TestDataContainer()
TEST.dfa_summary = utils.TestDataContainer()
precreate_dict = {'tenant_id': '1',
'nwk_name': 'net1',
'subnet': '10.0.0.0/24',
'cfgp': 'defaultNetworkL2Profile'}
TEST.dfa_precreate_network.add(precreate_dict)
cfg_profile_dict = {'profileSubType': 'network:universal',
'description': 'native dhcp EF Profile',
'editable': 'yes',
'configCommands': 'vlan $vlanId',
'profileType': 'IPBD',
'profileName': 'nativeDhcpEfProfile',
'forwardingMode': 'proxy-gateway',
'modifyTimestamp': 'Wed Mar 30 212631 PDT 2016'}
TEST.dfa_config_profile.add(cfg_profile_dict)
project_dict = {'project_id': 'cc073fa35b544e27b6a7802e9919afb1',
'dci_id': 12344,
'project_name': 'Cisco',
'result': 'SUCCESS'}
TEST.dfa_project.add(project_dict)
network_dict = {'network_id': '05df940e-7a68-4ead-9618-ae199c4dc289',
'reason': 'Request to DCNM failed: [500] Segment ID: \
76388 already exists.',
'seg_id': 76388,
'result': 'CREATE_FAIL',
'config_profile': 'defaultNetworkL2Profile',
'network_name': 'net2',
'vlan_id': None}
TEST.dfa_network.add(network_dict)
network_dict = {'network_id': '7c67bc14-8b7b-44ea-9ed5-c3fb36d7bfd9',
'reason': None,
'seg_id': 76377,
'result': 'SUCCESS',
'config_profile': 'defaultNetworkUniversalEfProfile',
'network_name': 'network1',
'vlan_id': 10}
TEST.dfa_network.add(network_dict)
instance_dict = {'local_vlan': 10,
'name': 'INS1',
'network_id': '7c67bc14-8b7b-44ea-9ed5-c3fb36d7bfd9',
'instance_id': 'e7cd03bed37b4de48f19fc5232056025',
'host': 'ctayal-openstack',
'veth_intf': 'eth1',
'remote_system_name': 'N6k-75',
'remote_port': 'Ethernet1/47',
'seg_id': 76377,
'result': 'SUCCESS',
'vdp_vlan': 110,
'port_id': '6672d670-9ba9-4889-8754-367bd51165fd'}
TEST.dfa_instance.add(instance_dict)
agent_dict = {'heartbeat': '2016-09-01T04:40:17.000000',
'host': 'compute0',
'config': '{"memb_ports": null, "veth_intf": "", \
"uplink": ""}',
'created': u'2016-07-27T06:34:48.000000'}
TEST.dfa_agent.add(agent_dict)
summary_dict = [{u'value': 2.0, u'key': u'Fabric Enabler Version'},
{u'value': u'10.0(1)', u'key': u'DCNM Version'},
{u'value': u'172.28.11.151', u'key': u'DCNM IP'},
{u'value': u'n6k', u'key': u'Switch Type'},
{u'value': u'fabricpath', u'key': u'Fabric Type'},
{u'value': u'2', u'key': u'Fabric ID'},
{u'value': u'76345-76545', u'key': u'Segment ID Range'}]
TEST.dfa_summary.add(summary_dict)

View File

@ -1,33 +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.
from django.conf.urls import patterns
from django.conf.urls import url
from horizon_cisco_ui.cisco.dfa import views
AGENTS = r'^(?P<host>[^/]+)/%s$'
PROJECT = r'^(?P<project_id>[^/]+)/%s$'
PROFILE = r'^(?P<profile_name>[^/]+)/%s$'
urlpatterns = patterns(
'',
url(r'^$', views.IndexView.as_view(), name='index'),
url(AGENTS % 'detail', views.DetailView.as_view(), name='detail'),
url(PROFILE % 'detailprofile', views.DetailProfileView.as_view(),
name='detailprofile'),
url(PROJECT % 'associate', views.AssociateDCIToProjectView.as_view(),
name='associate'),
url(PROJECT % 'disassociate', views.DisssociateDCIToProjectView.as_view(),
name='disassociate'),
)

View File

@ -1,191 +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.
from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
import json
import logging
import re
from horizon import exceptions
from horizon import forms
from horizon import tables
from horizon import tabs
from horizon.utils import memoized
from horizon import views
from horizon_cisco_ui.cisco.dfa import dfa_client
from horizon_cisco_ui.cisco.dfa import forms as dfaforms
from horizon_cisco_ui.cisco.dfa import tables as dfatables
from horizon_cisco_ui.cisco.dfa import tabs as dfatab
LOG = logging.getLogger(__name__)
class IndexView(tabs.TabbedTableView):
tab_group_class = dfatab.DFATabs
template_name = 'cisco/dfa/index.html'
page_title = _("Programmable Fabric")
class AssociateDCIToProjectView(forms.ModalFormView):
form_class = dfaforms.AssociateDCI
form_id = "associate_form"
modal_header = _("Associate DCI ID to Project")
template_name = 'cisco/dfa/associate.html'
submit_label = _("ASSOCIATE")
submit_url = "horizon:cisco:dfa:associate"
success_url = reverse_lazy('horizon:cisco:dfa:index')
page_title = _("ASSOCIATE DCI ID")
def get_context_data(self, **kwargs):
context = super(AssociateDCIToProjectView,
self).get_context_data(**kwargs)
args = (self.kwargs['project_id'],)
context["project_id"] = self.kwargs['project_id']
context["submit_url"] = reverse(self.submit_url, args=args)
return context
@memoized.memoized_method
def _get_object(self, *args, **kwargs):
return self.kwargs["project_id"]
def get_initial(self):
return {'project_id': self._get_object()}
class DisssociateDCIToProjectView(forms.ModalFormView):
form_class = dfaforms.DisassociateDCI
form_id = "disassociate_form"
modal_header = _("Disassociate DCI ID to Project")
template_name = 'cisco/dfa/disassociate.html'
submit_label = _("DISASSOCIATE")
submit_url = "horizon:cisco:dfa:disassociate"
success_url = reverse_lazy('horizon:cisco:dfa:index')
def get_context_data(self, **kwargs):
context = super(DisssociateDCIToProjectView,
self).get_context_data(**kwargs)
args = (self.kwargs['project_id'],)
context["project_id"] = self.kwargs['project_id']
context["submit_url"] = reverse(self.submit_url, args=args)
return context
@memoized.memoized_method
def _get_object(self, *args, **kwargs):
return self.kwargs["project_id"]
def get_initial(self):
return {'project_id': self._get_object()}
class DetailProfileView(views.HorizonTemplateView):
template_name = 'cisco/dfa/detailprofile.html'
page_title = "{{ profile_name }}"
def get_context_data(self, **kwargs):
context = super(DetailProfileView, self).get_context_data(**kwargs)
data = self._get_data()
rep = {'\r': '<br>', ' ': '&nbsp;'}
rep = dict((re.escape(k), v) for k, v in rep.iteritems())
pattern = re.compile("|".join(rep.keys()))
commands = pattern.sub(lambda m: rep[re.escape(m.group(0))],
data.get('configCommands'))
context['Profile_Name'] = self.kwargs['profile_name'].split(":")[0]
context['Profile_Type'] = self.kwargs['profile_name'].split(":")[1]
context['fwding_mode'] = data.get('forwardingMode')
context['description'] = data.get('description')
context['commands'] = commands
return context
@memoized.memoized_method
def _get_data(self):
try:
profile_name = self.kwargs['profile_name']
cfg_profile = {'profile': profile_name.split(":")[0],
'ftype': profile_name.split(":")[1]}
data = dfa_client.get_per_config_profile_detail(cfg_profile)
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve host details.'),
redirect=self.get_redirect_url())
return data
@staticmethod
def get_redirect_url():
return reverse_lazy('horizon:cisco:dfa:index')
class DetailView(tables.MultiTableView):
table_classes = (dfatables.TopologyTable, )
template_name = 'cisco/dfa/detail.html'
page_title = "{{ agent.host }}"
def get_topology_data(self):
try:
topology = []
agent = self._get_data()
cfg = json.loads(agent.get('config'))
topo = cfg.get('topo')
for key in topo.keys():
intf = topo.get(key)
if not intf.get('remote_evb_cfgd'):
continue
topology.append(
dict(
interface=cfg.get('uplink'),
remote_port=intf.get('remote_port'),
bond_intf=intf.get('bond_intf'),
remote_port_mac=intf.get('remote_port_id_mac'),
remote_evb_cfgd=intf.get('remote_evb_cfgd'),
remote_system_desc=intf.get('remote_system_desc'),
remote_chassis_mac=intf.get('remote_chassis_id_mac'),
remote_mgmt_addr=intf.get('remote_mgmt_addr'),
remote_system_name=intf.get('remote_system_name'),
remote_evb_mode=intf.get('remote_evb_mode')))
except Exception:
topology = []
msg = _('Neighborship is not established for this server')
exceptions.handle(self.request, msg)
return topology
def get_context_data(self, **kwargs):
context = super(DetailView, self).get_context_data(**kwargs)
agent = self._get_data()
context["agent"] = agent
cfg = json.loads(agent.get('config'))
context["uplink"] = cfg.get('uplink')
context["memb_ports"] = cfg.get('memb_ports')
context["veth_intf"] = cfg.get('veth_intf')
context["url"] = self.get_redirect_url()
return context
@memoized.memoized_method
def _get_data(self):
try:
host_name = self.kwargs['host']
NFEhost = dict(host=host_name)
agent = (dfa_client.get_agent_details_per_host(NFEhost))[0]
agent["heartbeat"] = agent.get('heartbeat').replace('T', ' ')[:-7]
agent["created"] = agent.get('created').replace('T', ' ')[:-7]
except Exception:
exceptions.handle(self.request,
_('Unable to retrieve host details.'),
redirect=self.get_redirect_url())
return agent
@staticmethod
def get_redirect_url():
return reverse_lazy('horizon:cisco:dfa:index')

View File

@ -1,102 +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.
from django.utils.translation import ugettext_lazy as _
import logging
from horizon import exceptions
from horizon import forms
from horizon import workflows
from horizon_cisco_ui.cisco.dfa import dfa_client
from openstack_dashboard.dashboards.project.networks import \
workflows as upstream_networks_workflows
LOG = logging.getLogger(__name__)
class DFAConfigProfileAction(workflows.Action):
cfg_profile = forms.ChoiceField(label=_("Network Profile"), required=False,
help_text=_("Select network profile to "
"associate with Network."))
class Meta(object):
name = _("Programmable Fabric")
''' This function call get_config_profiles_detail api of DFA Client
which fetches the profile list from Fabric Enabler using RPC,
and return profile names filtered by the profile Sub Type
p is an iterator over profile list that we got from the API
q is a filtered list of profileNames based on the condition
'''
def _get_cfg_profiles(self, request):
profiles = []
try:
cfgplist = dfa_client.get_config_profiles_detail()
profiles = [q for p in cfgplist
if (p.get('profileSubType') == 'network:universal')
for q in [p.get('profileName')]]
except Exception as exc:
exceptions.handle(request, exc.message)
return profiles
def populate_cfg_profile_choices(self, request, context):
profile_choices = [('', _("Select a config profile"))]
for profile in self._get_cfg_profiles(request):
profile_choices.append((profile, profile))
return profile_choices
def get_help_text(self, extra_context=None):
text = ("Network Profile:"
" An autoconfiguration template consisting of collection of"
" commands which instantiates day-1 tenant-related"
" configurations on CISCO Nexus switches.")
return text
class DFAConfigProfileInfo(workflows.Step):
action_class = DFAConfigProfileAction
def contribute(self, data, context):
for k, v in data.items():
context[k] = v
return context
class DFACreateNetwork(upstream_networks_workflows.CreateNetwork):
default_steps = (upstream_networks_workflows.CreateNetworkInfo,
upstream_networks_workflows.CreateSubnetInfo,
upstream_networks_workflows.CreateSubnetDetail,
DFAConfigProfileInfo)
@staticmethod
def handle(self, request, data):
network = self._create_network(request, data)
if not network:
return False
if data['cfg_profile']:
associate_data = {'id': network['id'],
'cfgp': data['cfg_profile'],
'name': network['name'],
'tenant_id': request.user.project_id}
dfa_client.associate_profile_with_network(associate_data)
# If we do not need to create a subnet, return here.
if not data['with_subnet']:
return True
subnet = self._create_subnet(request, data, network, no_redirect=True)
if subnet:
return True
else:
self._delete_network(request, network)
return False

View File

@ -1,179 +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.
import logging
from horizon import exceptions
from horizon import forms
from horizon import messages
from openstack_dashboard import api
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
LOG = logging.getLogger(__name__)
def get_tenant_choices(request):
tenant_choices = [('', _("Select a project"))]
tenants = []
try:
tenants, has_more = api.keystone.tenant_list(request)
except Exception:
msg = _('Projects could not be retrieved.')
exceptions.handle(request, msg)
for tenant in tenants:
if tenant.enabled:
tenant_choices.append((tenant.id, tenant.name))
return tenant_choices
class CreateNetworkProfile(forms.SelfHandlingForm):
"""Create Network Profile form."""
name = forms.CharField(max_length=255,
label=_("Name"))
segment_type = forms.ChoiceField(label=_('Segment Type'),
choices=[('vlan', _('VLAN')),
('overlay', _('Overlay'))],
widget=forms.Select
(attrs={'class': 'switchable',
'data-slug': 'segtype'}))
# Sub type options available for Overlay segment type
sub_type = forms.ChoiceField(label=_('Sub Type'),
choices=[('native_vxlan', _('Native VXLAN')),
('enhanced', _('Enhanced VXLAN')),
('other', _('Other'))],
required=False,
widget=forms.Select
(attrs={'class': 'switchable switched',
'data-slug': 'subtype',
'data-switch-on': 'segtype',
'data-segtype-overlay':
_("Sub Type")}))
multicast_ip_range = forms.CharField(max_length=30,
label=_("Multicast IP Range"),
required=False,
widget=forms.TextInput
(attrs={'class': 'switched',
'data-switch-on':
'subtype',
'data-subtype-native_vxlan':
_("Multicast IP Range")}),
help_text=_("Multicast IPv4 range"
"(e.g. 224.0.1.0-"
"224.0.1.100)"))
other_subtype = forms.CharField(max_length=255,
label=_("Sub Type Value (Manual Input)"),
required=False,
widget=forms.TextInput
(attrs={'class': 'switched',
'data-switch-on':
'subtype',
'data-subtype-other':
_("Sub Type Value "
"(Manual Input)")}),
help_text=_("Enter parameter (e.g. GRE)"))
physical_network = forms.CharField(max_length=255,
label=_("Physical Network"),
required=False,
widget=forms.TextInput
(attrs={'class': 'switched',
'data-switch-on': 'segtype',
'data-segtype-vlan':
_("Physical Network")}))
project = forms.ChoiceField(label=_("Project"),
required=False)
def __init__(self, request, *args, **kwargs):
super(CreateNetworkProfile, self).__init__(request, *args, **kwargs)
self.fields['project'].choices = get_tenant_choices(request)
def clean(self):
cleaned_data = super(CreateNetworkProfile, self).clean()
segment_type = cleaned_data.get('segment_type')
if segment_type == 'overlay':
sub_type = cleaned_data.get('sub_type')
if sub_type == 'other':
other_subtype = cleaned_data.get('other_subtype')
cleaned_data['sub_type'] = other_subtype
LOG.debug('subtype is now %(params)s',
{'params': other_subtype})
return cleaned_data
def handle(self, request, data):
try:
LOG.debug('request = %(req)s, params = %(params)s',
{'req': request, 'params': data})
params = {'name': data['name'],
'segment_type': data['segment_type'],
'sub_type': data['sub_type'],
'physical_network': data['physical_network'],
'multicast_ip_range': data['multicast_ip_range'],
'tenant_id': data['project']}
profile = api.neutron.profile_create(request,
**params)
msg = _('Network Profile %s '
'was successfully created.') % data['name']
LOG.debug(msg)
messages.success(request, msg)
return profile
except Exception:
redirect = reverse('horizon:cisco:nexus1000v:index')
msg = _('Failed to create network profile %s') % data['name']
exceptions.handle(request, msg, redirect=redirect)
class UpdateNetworkProfile(CreateNetworkProfile):
"""Update Network Profile form."""
profile_id = forms.CharField(label=_("ID"),
widget=forms.HiddenInput())
project = forms.CharField(label=_("Project"), required=False)
def __init__(self, request, *args, **kwargs):
super(UpdateNetworkProfile, self).__init__(request, *args, **kwargs)
self.fields['segment_type'].widget.attrs['readonly'] = 'readonly'
self.fields['sub_type'].widget.attrs['readonly'] = 'readonly'
self.fields['other_subtype'].widget.attrs['readonly'] = 'readonly'
self.fields['physical_network'].widget.attrs['readonly'] = 'readonly'
self.fields['project'].widget.attrs['readonly'] = 'readonly'
def handle(self, request, data):
try:
LOG.debug('request = %(req)s, params = %(params)s',
{'req': request, 'params': data})
params = {'name': data['name'],
'multicast_ip_range': data['multicast_ip_range']}
profile = api.neutron.profile_update(
request,
data['profile_id'],
**params
)
msg = _('Network Profile %s '
'was successfully updated.') % data['name']
LOG.debug(msg)
messages.success(request, msg)
return profile
except Exception:
msg = _('Failed to update '
'network profile (%s).') % data['name']
redirect = reverse('horizon:cisco:nexus1000v:index')
exceptions.handle(request, msg, redirect=redirect)
return False

View File

@ -1,25 +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.
from django.utils.translation import ugettext_lazy as _
import horizon
from horizon_cisco_ui.cisco import dashboard
class Nexus1000v(horizon.Panel):
name = _("Nexus 1000v")
slug = 'nexus1000v'
permissions = ('openstack.services.network',)
dashboard.Cisco.register(Nexus1000v)

View File

@ -1,99 +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.
import logging
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import exceptions
from horizon import tables
from openstack_dashboard import api
LOG = logging.getLogger(__name__)
class CreateNetworkProfile(tables.LinkAction):
name = "create"
verbose_name = _("Create Network Profile")
url = "horizon:cisco:nexus1000v:create_network_profile"
classes = ("ajax-modal",)
icon = "plus"
class DeleteNetworkProfile(tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Network Profile",
u"Delete Network Profiles",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Deleted Network Profile",
u"Deleted Network Profiles",
count
)
def delete(self, request, obj_id):
try:
api.neutron.profile_delete(request, obj_id)
except Exception:
msg = _('Failed to delete network profile (%s).') % obj_id
LOG.info(msg)
redirect = reverse('horizon:cisco:nexus1000v:index')
exceptions.handle(request, msg, redirect=redirect)
class EditNetworkProfile(tables.LinkAction):
name = "update"
verbose_name = _("Edit Network Profile")
url = "horizon:cisco:nexus1000v:update_network_profile"
classes = ("ajax-modal",)
icon = "pencil"
class NetworkProfile(tables.DataTable):
id = tables.Column("id", hidden=True)
name = tables.Column("name", verbose_name=_("Network Profile"), )
project = tables.Column("project_name", verbose_name=_("Project"))
segment_type = tables.Column("segment_type",
verbose_name=_("Segment Type"))
sub_type = tables.Column("sub_type",
verbose_name=_("Sub Type"))
segment_range = tables.Column("segment_range",
verbose_name=_("Segment Range"))
multicast_ip_range = tables.Column("multicast_ip_range",
verbose_name=_("Multicast IP Range"))
physical_network = tables.Column("physical_network",
verbose_name=_("Physical Network Name"))
class Meta(object):
name = "network_profile"
verbose_name = _("Network Profile")
table_actions = (CreateNetworkProfile, DeleteNetworkProfile,)
row_actions = (EditNetworkProfile, DeleteNetworkProfile,)
class PolicyProfile(tables.DataTable):
id = tables.Column("id", hidden=True)
name = tables.Column("name", verbose_name=_("Policy Profile"), )
project = tables.Column("project_name", verbose_name=_("Project"))
class Meta(object):
name = "policy_profile"
verbose_name = _("Policy Profile")

View File

@ -1,36 +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.
from django.utils.translation import ugettext_lazy as _
from horizon import tabs
class NetworkProfileTab(tabs.Tab):
name = _("Network Profile")
slug = "network_profile"
template_name = 'cisco/nexus1000v/network_profile/index.html'
def get_context_data(self, request):
return None
class PolicyProfileTab(tabs.Tab):
name = _("Policy Profile")
slug = "policy_profile"
template_name = 'cisco/nexus1000v/policy_profile/index.html'
preload = False
class IndexTabs(tabs.TabGroup):
slug = "indextabs"
tabs = (NetworkProfileTab, PolicyProfileTab)

View File

@ -1,10 +0,0 @@
{% extends "horizon/common/_modal_form.html" %}
{% load i18n %}
{% block modal-body-right %}
<h3>{% trans "Description:" %}</h3>
<p><strong>{% trans "Name:" %}</strong> {% blocktrans %} Select a name for your network profile.{% endblocktrans %}</p>
<p><strong>{% trans "Segment Type:" %}</strong> {% blocktrans %} Segment types available are VLAN, Overlay and Trunk.{% endblocktrans %}</p>
<p><strong>{% trans "Segment Sub Type:" %}</strong> {% blocktrans %} Sub types available are for the Overlay and Trunk segments. Available sub-types for Overlay are: Native-VXLAN, Enhanced-VXLAN or 'Other' (eg. GRE) which can be manually inputed as a text parameter for subtype. Available sub-type for Trunk is: VLAN.{% endblocktrans %}</p>
<p><strong>{% trans "Segment Range:" %}</strong> {% blocktrans %} Segment Ranges are 1-4093 for VLAN and above 5000 for Enhanced-VXLAN Overlay.{% endblocktrans %}</p>
{% endblock %}

View File

@ -1,7 +0,0 @@
{% extends "horizon/common/_modal_form.html" %}
{% load i18n %}
{% block modal-body-right %}
<h3>{% trans "Description:" %}</h3>
<p>{% trans "Edit the network profile to update name, segment range or multicast IP range." %}</p>
{% endblock %}

View File

@ -1,7 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Create Network Profile" %}{% endblock %}
{% block main %}
{% include "cisco/nexus1000v/_create_network_profile.html" %}
{% endblock %}

View File

@ -1,19 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Cisco Nexus 1000V Networking" %}{% endblock %}
{% block main %}
<div id="network_profile">
{{ network_profile_table.render }}
</div>
<div id="policy_profile">
{{ policy_profile_table.render }}
</div>
{% comment %}
<div class="row">
<div class="col-sm-12">
{{ tab_group.render }}
</div>
</div>
{% endcomment %}
{% endblock %}

View File

@ -1,9 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Cisco Nexus 1000V Networking" %}{% endblock %}
{% block main %}
<div id="network_profile">
{{ table.render }}
</div>
{% endblock %}

View File

@ -1,9 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Cisco Nexus 1000V Networking" %}{% endblock %}
{% block main %}
<div id="policy_profile">
{{ table.render }}
</div>
{% endblock %}

View File

@ -1,7 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Update Network Profile" %}{% endblock %}
{% block main %}
{% include 'cisco/nexus1000v/_update_network_profile.html' %}
{% endblock %}

View File

@ -1,274 +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.
from django.core.urlresolvers import reverse
from django import http
from mox3.mox import IsA # noqa
from openstack_dashboard import api
from openstack_dashboard.test import helpers as test
def form_data_no_overlay():
return {'multicast_ip_range': '',
'sub_type': ''}
def form_data_overlay():
return {'physical_network': ''}
class Nexus1000vTest(test.BaseAdminViewTests):
@test.create_stubs({api.neutron: ('profile_list',
'profile_bindings_list'),
api.keystone: ('tenant_list',)})
def test_index(self):
tenants = self.tenants.list()
net_profiles = self.net_profiles.list()
policy_profiles = self.policy_profiles.list()
net_profile_binding = self.network_profile_binding.list()
policy_profile_binding = self.policy_profile_binding.list()
api.neutron.profile_list(IsA(http.HttpRequest),
'network').AndReturn(net_profiles)
api.neutron.profile_list(IsA(http.HttpRequest),
'policy').AndReturn(policy_profiles)
api.neutron.profile_bindings_list(
IsA(http.HttpRequest),
'network').AndReturn(net_profile_binding)
api.neutron.profile_bindings_list(
IsA(http.HttpRequest),
'policy').AndReturn(policy_profile_binding)
api.keystone.tenant_list(
IsA(http.HttpRequest)).AndReturn([tenants, False])
api.keystone.tenant_list(
IsA(http.HttpRequest)).AndReturn([tenants, False])
self.mox.ReplayAll()
res = self.client.get(reverse('horizon:cisco:nexus1000v:index'))
self.assertTemplateUsed(res, 'cisco/nexus1000v/index.html')
@test.create_stubs({api.neutron: ('profile_create',),
api.keystone: ('tenant_list',)})
def test_create_vlan_net_profile(self):
tenants = self.tenants.list()
net_profile = self.net_profiles.first()
params = {'name': net_profile.name,
'segment_type': net_profile.segment_type,
'physical_network': net_profile.physical_network,
'tenant_id': net_profile.project,
# vlan profiles have no sub_type or multicast_ip_range
'multicast_ip_range': '',
'sub_type': ''}
api.neutron.profile_create(IsA(http.HttpRequest),
**params).AndReturn(net_profile)
api.keystone.tenant_list(
IsA(http.HttpRequest)).AndReturn([tenants, False])
self.mox.ReplayAll()
form_data = {'name': net_profile.name,
'segment_type': net_profile.segment_type,
'physical_network': net_profile.physical_network,
'project': net_profile.project}
form_data.update(form_data_no_overlay())
url = reverse('horizon:cisco:nexus1000v:create_network_profile')
res = self.client.post(url, form_data)
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res,
reverse
('horizon:cisco:nexus1000v:index'))
@test.create_stubs({api.neutron: ('profile_create',),
api.keystone: ('tenant_list',)})
def test_create_overlay_net_profile(self):
tenants = self.tenants.list()
net_profile = self.net_profiles.list()[1]
params = {'name': net_profile.name,
'segment_type': net_profile.segment_type,
'multicast_ip_range': net_profile.multicast_ip_range,
'sub_type': net_profile.sub_type,
'tenant_id': net_profile.project,
# overlay profiles have no physical_network type
'physical_network': ''}
api.neutron.profile_create(IsA(http.HttpRequest),
**params).AndReturn(net_profile)
api.keystone.tenant_list(
IsA(http.HttpRequest)).AndReturn([tenants, False])
self.mox.ReplayAll()
form_data = {'name': net_profile.name,
'segment_type': net_profile.segment_type,
'multicast_ip_range': net_profile.multicast_ip_range,
'sub_type': net_profile.sub_type,
'project': net_profile.project}
form_data.update(form_data_overlay())
url = reverse('horizon:cisco:nexus1000v:create_network_profile')
res = self.client.post(url, form_data)
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res,
reverse
('horizon:cisco:nexus1000v:index'))
@test.create_stubs({api.neutron: ('profile_create',),
api.keystone: ('tenant_list',)})
def test_create_overlay_other_net_profile(self):
tenants = self.tenants.list()
net_profile = self.net_profiles.list()[2]
params = {'name': net_profile.name,
'segment_type': net_profile.segment_type,
'sub_type': net_profile.other_subtype,
'tenant_id': net_profile.project,
# overlay 'other' profiles have no multicast_ip_range
# or physical_network type
'multicast_ip_range': '',
'physical_network': ''}
api.neutron.profile_create(IsA(http.HttpRequest),
**params).AndReturn(net_profile)
api.keystone.tenant_list(
IsA(http.HttpRequest)).AndReturn([tenants, False])
self.mox.ReplayAll()
form_data = {'name': net_profile.name,
'segment_type': net_profile.segment_type,
'sub_type': net_profile.sub_type,
'other_subtype': net_profile.other_subtype,
'project': net_profile.project}
form_data.update(form_data_overlay())
url = reverse('horizon:cisco:nexus1000v:create_network_profile')
res = self.client.post(url, form_data)
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res,
reverse
('horizon:cisco:nexus1000v:index'))
@test.create_stubs({api.neutron: ('profile_get',
'profile_bindings_list'),
api.keystone: ('tenant_list',)})
def test_network_profile_update_get(self):
tenants = self.tenants.list()
net_profile = self.net_profiles.first()
net_profile_binding = self.network_profile_binding.list()
api.keystone.tenant_list(
IsA(http.HttpRequest)).AndReturn([tenants, False])
api.neutron.profile_bindings_list(
IsA(http.HttpRequest),
'network').AndReturn(net_profile_binding)
api.neutron.profile_get(
IsA(http.HttpRequest),
net_profile.id).AndReturn(net_profile)
api.keystone.tenant_list(
IsA(http.HttpRequest)).AndReturn([tenants, False])
self.mox.ReplayAll()
url = reverse('horizon:cisco:nexus1000v:update_network_profile',
args=[net_profile.id])
res = self.client.get(url)
self.assertTemplateUsed(
res,
'cisco/nexus1000v/_update_network_profile.html')
@test.create_stubs({api.neutron: ('profile_update',
'profile_get',
'profile_bindings_list'),
api.keystone: ('tenant_list',)})
def test_vlan_net_profile_update_post(self):
tenants = self.tenants.list()
net_profile = self.net_profiles.first()
net_profile_binding = self.network_profile_binding.list()
# vlan profiles can only update name and segment_range
params = {'name': net_profile.name,
# vlan profiles have no multicast_ip_range
'multicast_ip_range': ''}
api.neutron.profile_update(
IsA(http.HttpRequest),
net_profile.id,
**params).AndReturn(net_profile)
api.keystone.tenant_list(
IsA(http.HttpRequest)).AndReturn([tenants, False])
api.neutron.profile_bindings_list(
IsA(http.HttpRequest),
'network').AndReturn(net_profile_binding)
api.neutron.profile_get(
IsA(http.HttpRequest),
net_profile.id).AndReturn(net_profile)
api.keystone.tenant_list(
IsA(http.HttpRequest)).AndReturn([tenants, False])
self.mox.ReplayAll()
form_data = {'profile_id': net_profile.id,
'name': net_profile.name,
'segment_type': net_profile.segment_type,
'physical_network': net_profile.physical_network,
'project': net_profile.project}
form_data.update(form_data_no_overlay())
url = reverse('horizon:cisco:nexus1000v:update_network_profile',
args=[net_profile.id])
res = self.client.post(url, form_data)
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res,
reverse
('horizon:cisco:nexus1000v:index'))
@test.create_stubs({api.neutron: ('profile_update',
'profile_get',
'profile_bindings_list'),
api.keystone: ('tenant_list',)})
def test_overlay_net_profile_update_post(self):
tenants = self.tenants.list()
net_profile = self.net_profiles.get(name="net_profile_test2")
net_profile_binding = self.network_profile_binding.list()
# overlay profiles can only update
# name and multicast_ip_range
params = {'name': net_profile.name,
'multicast_ip_range': net_profile.multicast_ip_range}
api.neutron.profile_update(
IsA(http.HttpRequest),
net_profile.id,
**params).AndReturn(net_profile)
api.keystone.tenant_list(
IsA(http.HttpRequest)).AndReturn([tenants, False])
api.neutron.profile_bindings_list(
IsA(http.HttpRequest),
'network').AndReturn(net_profile_binding)
api.neutron.profile_get(
IsA(http.HttpRequest),
net_profile.id).AndReturn(net_profile)
api.keystone.tenant_list(
IsA(http.HttpRequest)).AndReturn([tenants, False])
self.mox.ReplayAll()
form_data = {'profile_id': net_profile.id,
'name': net_profile.name,
'segment_type': net_profile.segment_type,
'multicast_ip_range': net_profile.multicast_ip_range,
'sub_type': net_profile.sub_type,
'project': net_profile.project}
form_data.update(form_data_overlay())
url = reverse('horizon:cisco:nexus1000v:update_network_profile',
args=[net_profile.id])
res = self.client.post(url, form_data)
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res,
reverse
('horizon:cisco:nexus1000v:index'))

View File

@ -1,28 +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.
from django.conf.urls import patterns
from django.conf.urls import url
from horizon_cisco_ui.cisco.nexus1000v import views
urlpatterns = patterns(
'',
url(r'^$', views.IndexView.as_view(), name='index'),
# Network Profile
url(r'^network_profile/create$', views.CreateNetworkProfileView.as_view(),
name='create_network_profile'),
url(r'^network_profile/(?P<profile_id>[^/]+)/update$',
views.UpdateNetworkProfileView.as_view(),
name='update_network_profile'),
)

View File

@ -1,168 +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.
from collections import OrderedDict
import logging
from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import tables
from horizon import tabs
from horizon.utils import memoized
from openstack_dashboard import api
from horizon_cisco_ui.cisco.nexus1000v import forms as profileforms
from horizon_cisco_ui.cisco.nexus1000v import tables as profiletables
LOG = logging.getLogger(__name__)
def _get_tenant_list(request):
tenants = []
try:
tenants, has_more = api.keystone.tenant_list(request)
except Exception:
msg = _('Unable to retrieve project information.')
exceptions.handle(request, msg)
return OrderedDict([(t.id, t) for t in tenants])
def _get_profiles(request, type_p):
try:
profiles = api.neutron.profile_list(request, type_p)
except Exception:
profiles = []
msg = _('Network Profiles could not be retrieved.')
exceptions.handle(request, msg)
if profiles:
# Set project name
tenant_dict = _get_tenant_list(request)
bindings = api.neutron.profile_bindings_list(request, type_p)
bindings_dict = OrderedDict(
[(b.profile_id, b.tenant_id) for b in bindings])
for p in profiles:
project_id = bindings_dict.get(p.id)
project = tenant_dict.get(project_id)
p.project_name = getattr(project, 'name', None)
return profiles
class NetworkProfileIndexView(tables.DataTableView):
table_class = profiletables.NetworkProfile
template_name = 'cisco/nexus1000v/network_profile/index.html'
page_title = _("Nexus 1000V")
def get_data(self):
return _get_profiles(self.request, 'network')
class PolicyProfileIndexView(tables.DataTableView):
table_class = profiletables.PolicyProfile
template_name = 'cisco/nexus1000v/policy_profile/index.html'
page_title = _("Cisco Nexus 1000V")
def get_data(self):
return _get_profiles(self.request, 'policy')
class IndexTabGroup(tabs.TabGroup):
slug = "group"
tabs = (NetworkProfileIndexView, PolicyProfileIndexView,)
class IndexView(tables.MultiTableView):
table_classes = (profiletables.NetworkProfile,
profiletables.PolicyProfile,)
template_name = 'cisco/nexus1000v/index.html'
page_title = _("Cisco Nexus 1000V")
def get_network_profile_data(self):
return _get_profiles(self.request, 'network')
def get_policy_profile_data(self):
return _get_profiles(self.request, 'policy')
class CreateNetworkProfileView(forms.ModalFormView):
form_class = profileforms.CreateNetworkProfile
form_id = "create_network_profile_form"
modal_header = _("Create Network Profile")
template_name = 'cisco/nexus1000v/create_network_profile.html'
submit_label = _("Create Network Profile")
submit_url = reverse_lazy(
"horizon:cisco:nexus1000v:create_network_profile")
success_url = reverse_lazy('horizon:cisco:nexus1000v:index')
page_title = _("Create Network Profile")
class UpdateNetworkProfileView(forms.ModalFormView):
form_class = profileforms.UpdateNetworkProfile
form_id = "update_network_profile_form"
modal_header = _("Edit Network Profile")
template_name = 'cisco/nexus1000v/update_network_profile.html'
context_object_name = 'network_profile'
submit_label = _("Save Changes")
submit_url = "horizon:cisco:nexus1000v:update_network_profile"
success_url = reverse_lazy('horizon:cisco:nexus1000v:index')
page_title = _("Update Network Profile")
def get_context_data(self, **kwargs):
context = super(UpdateNetworkProfileView,
self).get_context_data(**kwargs)
context["profile_id"] = self.kwargs['profile_id']
args = (self.kwargs['profile_id'],)
context['submit_url'] = reverse(self.submit_url, args=args)
return context
@memoized.memoized_method
def _get_object(self, *args, **kwargs):
profile_id = self.kwargs['profile_id']
try:
profile = api.neutron.profile_get(self.request,
profile_id)
LOG.debug("Network Profile object=%s", profile)
return profile
except Exception:
redirect = self.success_url
msg = _('Unable to retrieve network profile details.')
exceptions.handle(self.request, msg, redirect=redirect)
def get_initial(self):
profile = self._get_object()
# Set project name
tenant_dict = _get_tenant_list(self.request)
try:
bindings = api.neutron.profile_bindings_list(
self.request, 'network')
except Exception:
msg = _('Failed to obtain network profile binding')
redirect = self.success_url
exceptions.handle(self.request, msg, redirect=redirect)
bindings_dict = OrderedDict(
[(b.profile_id, b.tenant_id) for b in bindings])
project_id = bindings_dict.get(profile.id)
project = tenant_dict.get(project_id)
project_name = getattr(project, 'name', project_id)
return {'profile_id': profile['id'],
'name': profile['name'],
'segment_type': profile['segment_type'],
'physical_network': profile['physical_network'],
'sub_type': profile['sub_type'],
'multicast_ip_range': profile['multicast_ip_range'],
'project': project_name}

View File

@ -1,28 +0,0 @@
# Copyright 2015 Cisco Systems, Inc.
#
# 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 slug of the dashboard to be added to HORIZON['dashboards']. Required.
DASHBOARD = 'cisco'
# A list of applications to be added to INSTALLED_APPS.
ADD_INSTALLED_APPS = [
'horizon_cisco_ui.cisco',
'horizon_cisco_ui.firewalls',
]
# Extra values to add to the Horizon settings
UPDATE_HORIZON_CONFIG = {
'customization_module': 'horizon_cisco_ui.overrides',
}

View File

@ -1,5 +0,0 @@
PANEL = 'nexus1000v'
PANEL_GROUP = 'default'
PANEL_DASHBOARD = 'cisco'
ADD_PANEL = 'horizon_cisco_ui.cisco.nexus1000v.panel.Nexus1000v'

View File

@ -1,5 +0,0 @@
PANEL = 'dfa'
PANEL_GROUP = 'default'
PANEL_DASHBOARD = 'cisco'
ADD_PANEL = 'horizon_cisco_ui.cisco.dfa.panel.DFA'

View File

@ -1,23 +0,0 @@
# Copyright 2015 Cisco Systems, Inc.
#
# 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 django.utils.translation import ugettext_lazy as _
from openstack_dashboard.dashboards.project.firewalls \
import views as firewall_views
class IndexView(firewall_views.IndexView):
# TODO(robcresswell): Remove name change, this is just an example
page_title = _("Cisco Firewalls")

View File

@ -1,150 +0,0 @@
# OpenStack Infra <zanata@openstack.org>, 2015. #zanata
# Rob Cresswell <robert.cresswell@outlook.com>, 2015. #zanata
# Andi Chandler <andi@gowling.com>, 2016. #zanata
# Andreas Jaeger <jaegerandi@gmail.com>, 2016. #zanata
msgid ""
msgstr ""
"Project-Id-Version: horizon-cisco-ui 0.0.1.dev23\n"
"Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n"
"POT-Creation-Date: 2016-05-13 09:34+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2016-05-20 11:05+0000\n"
"Last-Translator: Andi Chandler <andi@gowling.com>\n"
"Language-Team: English (United Kingdom)\n"
"Language: en-GB\n"
"X-Generator: Zanata 3.7.3\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
msgid "Cisco"
msgstr "Cisco"
msgid "Cisco Firewalls"
msgstr "Cisco Firewalls"
msgid "Cisco Nexus 1000V"
msgstr "Cisco Nexus 1000V"
msgid "Create Network Profile"
msgstr "Create Network Profile"
msgid "Delete Network Profile"
msgid_plural "Delete Network Profiles"
msgstr[0] "Delete Network Profile"
msgstr[1] "Delete Network Profiles"
msgid "Deleted Network Profile"
msgid_plural "Deleted Network Profiles"
msgstr[0] "Deleted Network Profile"
msgstr[1] "Deleted Network Profiles"
msgid "Edit Network Profile"
msgstr "Edit Network Profile"
msgid "Enhanced VXLAN"
msgstr "Enhanced VXLAN"
msgid "Enter parameter (e.g. GRE)"
msgstr "Enter parameter (e.g. GRE)"
#, python-format
msgid "Failed to create network profile %s"
msgstr "Failed to create network profile %s"
#, python-format
msgid "Failed to delete network profile (%s)."
msgstr "Failed to delete network profile (%s)."
msgid "Failed to obtain network profile binding"
msgstr "Failed to obtain network profile binding"
#, python-format
msgid "Failed to update network profile (%s)."
msgstr "Failed to update network profile (%s)."
msgid "ID"
msgstr "ID"
msgid "Multicast IP Range"
msgstr "Multicast IP Range"
msgid "Multicast IPv4 range(e.g. 224.0.1.0-224.0.1.100)"
msgstr "Multicast IPv4 range (e.g. 224.0.1.0-224.0.1.100)"
msgid "Name"
msgstr "Name"
msgid "Native VXLAN"
msgstr "Native VXLAN"
msgid "Network Profile"
msgstr "Network Profile"
#, python-format
msgid "Network Profile %s was successfully created."
msgstr "Network Profile %s was successfully created."
#, python-format
msgid "Network Profile %s was successfully updated."
msgstr "Network Profile %s was successfully updated."
msgid "Network Profiles could not be retrieved."
msgstr "Network Profiles could not be retrieved."
msgid "Nexus 1000V"
msgstr "Nexus 1000V"
msgid "Nexus 1000v"
msgstr "Nexus 1000v"
msgid "Other"
msgstr "Other"
msgid "Overlay"
msgstr "Overlay"
msgid "Physical Network"
msgstr "Physical Network"
msgid "Physical Network Name"
msgstr "Physical Network Name"
msgid "Policy Profile"
msgstr "Policy Profile"
msgid "Project"
msgstr "Project"
msgid "Projects could not be retrieved."
msgstr "Projects could not be retrieved."
msgid "Save Changes"
msgstr "Save Changes"
msgid "Segment Range"
msgstr "Segment Range"
msgid "Segment Type"
msgstr "Segment Type"
msgid "Select a project"
msgstr "Select a project"
msgid "Sub Type"
msgstr "Sub Type"
msgid "Sub Type Value (Manual Input)"
msgstr "Sub Type Value (Manual Input)"
msgid "Unable to retrieve network profile details."
msgstr "Unable to retrieve network profile details."
msgid "Unable to retrieve project information."
msgstr "Unable to retrieve project information."
msgid "Update Network Profile"
msgstr "Update Network Profile"
msgid "VLAN"
msgstr "VLAN"

View File

@ -1,144 +0,0 @@
# Yuko Katabami <yukokatabami@gmail.com>, 2015. #zanata
# Andreas Jaeger <jaegerandi@gmail.com>, 2016. #zanata
# Shu Muto <shu-mutou@rf.jp.nec.com>, 2016. #zanata
msgid ""
msgstr ""
"Project-Id-Version: horizon-cisco-ui 0.0.1.dev23\n"
"Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n"
"POT-Creation-Date: 2016-05-13 09:34+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2016-05-18 09:35+0000\n"
"Last-Translator: Shu Muto <shu-mutou@rf.jp.nec.com>\n"
"Language-Team: Japanese\n"
"Language: ja\n"
"X-Generator: Zanata 3.7.3\n"
"Plural-Forms: nplurals=1; plural=0\n"
msgid "Cisco"
msgstr "Cisco"
msgid "Cisco Firewalls"
msgstr "Cisco ファイアウォール"
msgid "Cisco Nexus 1000V"
msgstr "Cisco Nexus 1000V"
msgid "Create Network Profile"
msgstr "ネットワークプロファイルの作成"
msgid "Delete Network Profile"
msgid_plural "Delete Network Profiles"
msgstr[0] "ネットワークプロファイルの削除"
msgid "Deleted Network Profile"
msgid_plural "Deleted Network Profiles"
msgstr[0] "ネットワークプロファイルを削除しました"
msgid "Edit Network Profile"
msgstr "ネットワークプロファイルの編集"
msgid "Enhanced VXLAN"
msgstr "Enhanced VXLAN"
msgid "Enter parameter (e.g. GRE)"
msgstr "パラメータを入力してください(例 GRE"
#, python-format
msgid "Failed to create network profile %s"
msgstr "ネットワークプロファイル %s の作成に失敗しました"
#, python-format
msgid "Failed to delete network profile (%s)."
msgstr "ネットワークプロファイル %s の削除に失敗しました"
#, python-format
msgid "Failed to update network profile (%s)."
msgstr "ネットワークプロファイル %s の更新に失敗しました"
msgid "ID"
msgstr "ID"
msgid "Multicast IP Range"
msgstr "マルチキャスト IP 範囲"
msgid "Multicast IPv4 range(e.g. 224.0.1.0-224.0.1.100)"
msgstr "マルチキャスト IPv4 範囲(例 224.0.1.0-224.0.1.100)"
msgid "Name"
msgstr "名前"
msgid "Native VXLAN"
msgstr "ネィティブ VXLAN"
msgid "Network Profile"
msgstr "ネットワークプロファイル"
#, python-format
msgid "Network Profile %s was successfully created."
msgstr "ネットワークプロファイル %s が正常に作成されました。"
#, python-format
msgid "Network Profile %s was successfully updated."
msgstr "ネットワークプロファイル %s が正常に更新されました。"
msgid "Network Profiles could not be retrieved."
msgstr "ネットワークプロファイルを取得できません。"
msgid "Nexus 1000V"
msgstr "Nexus 1000V"
msgid "Nexus 1000v"
msgstr "Nexus 1000v"
msgid "Other"
msgstr "その他"
msgid "Overlay"
msgstr "オーバーレイ"
msgid "Physical Network"
msgstr "物理ネットワーク"
msgid "Physical Network Name"
msgstr "物理ネットワーク名"
msgid "Policy Profile"
msgstr "ポリシープロファイル"
msgid "Project"
msgstr "プロジェクト"
msgid "Projects could not be retrieved."
msgstr "プロジェクトを取得できませんでした。"
msgid "Save Changes"
msgstr "変更の保存"
msgid "Segment Range"
msgstr "セグメントの範囲"
msgid "Segment Type"
msgstr "セグメント種別"
msgid "Select a project"
msgstr "プロジェクトを選択してください"
msgid "Sub Type"
msgstr "サブタイプ"
msgid "Sub Type Value (Manual Input)"
msgstr "サブタイプ値(手入力)"
msgid "Unable to retrieve network profile details."
msgstr "ネットワークプロファイルの詳細を取得できません。"
msgid "Unable to retrieve project information."
msgstr "プロジェクト情報を取得できません。"
msgid "Update Network Profile"
msgstr "ネットワークプロファイルの更新"
msgid "VLAN"
msgstr "VLAN"

View File

@ -1,131 +0,0 @@
# OpenStack Infra <zanata@openstack.org>, 2015. #zanata
# Andreas Jaeger <jaegerandi@gmail.com>, 2016. #zanata
# Jimmy Li <ljzljm@163.com>, 2016. #zanata
msgid ""
msgstr ""
"Project-Id-Version: horizon-cisco-ui 0.0.1.dev27\n"
"Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n"
"POT-Creation-Date: 2016-07-21 16:53+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2016-08-04 01:48+0000\n"
"Last-Translator: Jimmy Li <ljzljm@163.com>\n"
"Language-Team: Chinese (China)\n"
"Language: zh-CN\n"
"X-Generator: Zanata 3.7.3\n"
"Plural-Forms: nplurals=1; plural=0\n"
msgid "Cisco"
msgstr "思科"
msgid "Cisco Firewalls"
msgstr "思科防火墙"
msgid "Cisco Nexus 1000V"
msgstr "Cisco Nexus 1000V"
msgid "Create Network Profile"
msgstr "创建网络配置文件"
msgid "Delete Network Profile"
msgid_plural "Delete Network Profiles"
msgstr[0] "删除网络配置文件"
msgid "Edit Network Profile"
msgstr "编辑网络配置文件"
msgid "Enter parameter (e.g. GRE)"
msgstr "输入参数比如GRE"
#, python-format
msgid "Failed to create network profile %s"
msgstr "创建网络配置 %s 文件失败"
#, python-format
msgid "Failed to delete network profile (%s)."
msgstr "删除网络配置文件 (%s)失败。"
#, python-format
msgid "Failed to update network profile (%s)."
msgstr "更新网络配置文件 (%s)失败。"
msgid "ID"
msgstr "ID"
msgid "Multicast IP Range"
msgstr "组播IP范围"
msgid "Multicast IPv4 range(e.g. 224.0.1.0-224.0.1.100)"
msgstr "组播IPv4范围比如224.0.1.0-224.0.1.100"
msgid "Name"
msgstr "名称"
msgid "Native VXLAN"
msgstr "Native VXLAN"
msgid "Network Profile"
msgstr "网络配置概要"
#, python-format
msgid "Network Profile %s was successfully created."
msgstr "网络配置文件 %s 被成功创建。"
#, python-format
msgid "Network Profile %s was successfully updated."
msgstr "网络配置文件 %s 被成功更新。"
msgid "Network Profiles could not be retrieved."
msgstr "无法获取网络配置文件"
msgid "Nexus 1000V"
msgstr "Nexus 1000V"
msgid "Nexus 1000v"
msgstr "Nexus 1000v"
msgid "Other"
msgstr "其它"
msgid "Physical Network"
msgstr "物理网络"
msgid "Physical Network Name"
msgstr "物理网络名称"
msgid "Policy Profile"
msgstr "策略配置文件"
msgid "Project"
msgstr "项目"
msgid "Projects could not be retrieved."
msgstr "不能获取项目。"
msgid "Save Changes"
msgstr "保存"
msgid "Segment Type"
msgstr "Segment Type"
msgid "Select a project"
msgstr "选择一个项目"
msgid "Sub Type"
msgstr "子类型"
msgid "Sub Type Value (Manual Input)"
msgstr "子类型值(手动输入)"
msgid "Unable to retrieve network profile details."
msgstr "无法获取网络配置文件详情。"
msgid "Unable to retrieve project information."
msgstr "无法获取项目信息。"
msgid "Update Network Profile"
msgstr "更新网络配置文件"
msgid "VLAN"
msgstr "VLAN"

View File

@ -1,35 +0,0 @@
# Copyright 2015 Cisco Systems, Inc.
#
# 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 horizon_cisco_ui.cisco.dfa \
import workflows as cisco_network_workflows
from horizon_cisco_ui.firewalls \
import views as cisco_firewall_views
from openstack_dashboard.dashboards.project.firewalls \
import views as firewall_views
from openstack_dashboard.dashboards.project.networks \
import workflows as horizon_network_workflows
horizon_network_workflows.CreateNetwork.default_steps = \
cisco_network_workflows.DFACreateNetwork.default_steps
horizon_network_workflows.CreateNetwork.handle = \
cisco_network_workflows.DFACreateNetwork.handle
horizon_network_workflows.CreateNetwork._create_network = \
cisco_network_workflows.DFACreateNetwork._create_network
# TODO(robcresswell): remove example
# Silly example that does nothing, but illustrates an override.
firewall_views.IndexView = cisco_firewall_views.IndexView

View File

@ -1,28 +0,0 @@
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# 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.
# Small hack to ensure that the tests don't fail, due to the developer
# dashboard hitting settings
from horizon.utils import secret_key
import os
LOCAL_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'local')
SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH,
'.secret_key_store'))
# Fall back to default o_d settings so we don't need to maintain our own
from openstack_dashboard.test.settings import * # noqa

View File

@ -1,3 +0,0 @@
import pbr.version
version_info = pbr.version.VersionInfo('horizon-cisco-ui')

View File

@ -1,23 +0,0 @@
#!/usr/bin/env python
# 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
from django.core.management import execute_from_command_line # noqa
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"horizon_cisco_ui.test.settings")
execute_from_command_line(sys.argv)

View File

@ -1,12 +0,0 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
# Order matters to the pip dependency resolver, so sorting this file
# changes how packages are installed. New dependencies should be
# added in alphabetical order, however, some dependencies may need to
# be installed in a specific order.
#
# PBR should always appear first
pbr>=2.0.0 # Apache-2.0
reno>=1.8.0 # Apache-2.0

View File

@ -1,37 +0,0 @@
[metadata]
name = horizon-cisco-ui
summary = Cisco Plugin for the OpenStack Dashboard
description-file =
README.rst
author = Cisco Systems, Inc.
author-email = openstack-dev@lists.openstack.org
home-page = https://github.com/openstack/horizon-cisco-ui
classifier =
Development Status :: 5 - Production/Stable
Environment :: OpenStack
Framework :: Django
Intended Audience :: Developers
Intended Audience :: Information Technology
Intended Audience :: System Administrators
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Topic :: Internet :: WWW/HTTP
[global]
setup-hooks = pbr.hooks.setup_hook
[files]
packages = horizon_cisco_ui
[build_sphinx]
all_files = 1
build-dir = doc/build
source-dir = doc/source
[nosetests]
verbosity=2
detailed-errors=1

View File

@ -1,29 +0,0 @@
# 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.
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup(
setup_requires=['pbr>=2.0.0'],
pbr=True)

View File

@ -1,28 +0,0 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
# Order matters to the pip dependency resolver, so sorting this file
# changes how packages are installed. New dependencies should be
# added in alphabetical order, however, some dependencies may need to
# be installed in a specific order.
#
http://tarballs.openstack.org/horizon/horizon-master.tar.gz#egg=horizon
# Hacking should appear first in case something else depends on pep8
hacking<0.11,>=0.10.0
#
coverage>=4.0 # Apache-2.0
django-nose>=1.4.4 # BSD
flake8<2.6.0,>=2.5.4 # MIT
mock>=2.0 # BSD
mox3!=0.19.0,>=0.7.0 # Apache-2.0
nose # LGPL
nose-exclude # LGPL
nosehtmloutput>=0.0.3 # Apache-2.0
nosexcover # BSD
openstack.nose-plugin>=0.7 # Apache-2.0
oslosphinx>=4.7.0 # Apache-2.0
selenium>=2.50.1 # Apache-2.0
sphinx>=1.5.1 # BSD
testtools>=1.4.0 # MIT
# This also needs xvfb library installed on your OS
xvfbwrapper>=0.1.3 #license: MIT

View File

@ -1,71 +0,0 @@
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2010 OpenStack Foundation
# Copyright 2013 IBM Corp.
#
# 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
import install_venv_common as install_venv # noqa
def print_help(venv, root):
help = """
OpenStack development environment setup is complete.
OpenStack development uses virtualenv to track and manage Python
dependencies while in development and testing.
To activate the OpenStack virtualenv for the extent of your current shell
session you can run:
$ source %s/bin/activate
Or, if you prefer, you can run commands in the virtualenv on a case by case
basis by running:
$ %s/tools/with_venv.sh <your command>
Also, make test will automatically use the virtualenv.
"""
print(help % (venv, root))
def main(argv):
root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
if os.environ.get('tools_path'):
root = os.environ['tools_path']
venv = os.path.join(root, '.venv')
if os.environ.get('venv'):
venv = os.environ['venv']
pip_requires = os.path.join(root, 'requirements.txt')
test_requires = os.path.join(root, 'test-requirements.txt')
py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
project = 'OpenStack'
install = install_venv.InstallVenv(root, venv, pip_requires, test_requires,
py_version, project)
options = install.parse_args(argv)
install.check_python_version()
install.check_dependencies()
install.create_virtualenv(no_site_packages=options.no_site_packages)
install.install_dependencies()
print_help(venv, root)
if __name__ == '__main__':
main(sys.argv)

View File

@ -1,172 +0,0 @@
# Copyright 2013 OpenStack Foundation
# Copyright 2013 IBM Corp.
#
# 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.
"""Provides methods needed by installation script for OpenStack development
virtual environments.
Since this script is used to bootstrap a virtualenv from the system's Python
environment, it should be kept strictly compatible with Python 2.6.
Synced in from openstack-common
"""
from __future__ import print_function
import optparse
import os
import subprocess
import sys
class InstallVenv(object):
def __init__(self, root, venv, requirements,
test_requirements, py_version,
project):
self.root = root
self.venv = venv
self.requirements = requirements
self.test_requirements = test_requirements
self.py_version = py_version
self.project = project
def die(self, message, *args):
print(message % args, file=sys.stderr)
sys.exit(1)
def check_python_version(self):
if sys.version_info < (2, 6):
self.die("Need Python Version >= 2.6")
def run_command_with_code(self, cmd, redirect_output=True,
check_exit_code=True):
"""Runs a command in an out-of-process shell.
Returns the output of that command. Working directory is self.root.
"""
if redirect_output:
stdout = subprocess.PIPE
else:
stdout = None
proc = subprocess.Popen(cmd, cwd=self.root, stdout=stdout)
output = proc.communicate()[0]
if check_exit_code and proc.returncode != 0:
self.die('Command "%s" failed.\n%s', ' '.join(cmd), output)
return (output, proc.returncode)
def run_command(self, cmd, redirect_output=True, check_exit_code=True):
return self.run_command_with_code(cmd, redirect_output,
check_exit_code)[0]
def get_distro(self):
if (os.path.exists('/etc/fedora-release') or
os.path.exists('/etc/redhat-release')):
return Fedora(
self.root, self.venv, self.requirements,
self.test_requirements, self.py_version, self.project)
else:
return Distro(
self.root, self.venv, self.requirements,
self.test_requirements, self.py_version, self.project)
def check_dependencies(self):
self.get_distro().install_virtualenv()
def create_virtualenv(self, no_site_packages=True):
"""Creates the virtual environment and installs PIP.
Creates the virtual environment and installs PIP only into the
virtual environment.
"""
if not os.path.isdir(self.venv):
print('Creating venv...', end=' ')
if no_site_packages:
self.run_command(['virtualenv', '-q', '--no-site-packages',
self.venv])
else:
self.run_command(['virtualenv', '-q', self.venv])
print('done.')
else:
print("venv already exists...")
pass
def pip_install(self, *args):
self.run_command(['tools/with_venv.sh',
'pip', 'install', '--upgrade'] + list(args),
redirect_output=False)
def install_dependencies(self):
print('Installing dependencies with pip (this can take a while)...')
# First things first, make sure our venv has the latest pip and
# setuptools and pbr
self.pip_install('pip>=1.4')
self.pip_install('setuptools')
self.pip_install('pbr')
self.pip_install('-r', self.requirements, '-r', self.test_requirements)
def parse_args(self, argv):
"""Parses command-line arguments."""
parser = optparse.OptionParser()
parser.add_option('-n', '--no-site-packages',
action='store_true',
help="Do not inherit packages from global Python "
"install.")
return parser.parse_args(argv[1:])[0]
class Distro(InstallVenv):
def check_cmd(self, cmd):
return bool(self.run_command(['which', cmd],
check_exit_code=False).strip())
def install_virtualenv(self):
if self.check_cmd('virtualenv'):
return
if self.check_cmd('easy_install'):
print('Installing virtualenv via easy_install...', end=' ')
if self.run_command(['easy_install', 'virtualenv']):
print('Succeeded')
return
else:
print('Failed')
self.die('ERROR: virtualenv not found.\n\n%s development'
' requires virtualenv, please install it using your'
' favorite package management tool' % self.project)
class Fedora(Distro):
"""This covers all Fedora-based distributions.
Includes: Fedora, RHEL, CentOS, Scientific Linux
"""
def check_pkg(self, pkg):
return self.run_command_with_code(['rpm', '-q', pkg],
check_exit_code=False)[1] == 0
def install_virtualenv(self):
if self.check_cmd('virtualenv'):
return
if not self.check_pkg('python-virtualenv'):
self.die("Please install 'python-virtualenv'.")
super(Fedora, self).install_virtualenv()

View File

@ -1,13 +0,0 @@
#!/bin/bash
TOOLS_PATH=${TOOLS_PATH:-$(dirname $0)}
VENV_PATH=${VENV_PATH:-${TOOLS_PATH}}
VENV_DIR=${VENV_NAME:-/../.venv}
TOOLS=${TOOLS_PATH}
VENV=${VENV:-${VENV_PATH}/${VENV_DIR}}
HORIZON_DIR=${TOOLS%/tools}
# This horrible mangling of the PYTHONPATH is required to get the
# babel-angular-gettext extractor to work. To fix this the extractor needs to
# be packaged on pypi and added to global requirements. That work is in progress.
export PYTHONPATH="$HORIZON_DIR"
source ${VENV}/bin/activate && "$@"

84
tox.ini
View File

@ -1,84 +0,0 @@
[tox]
envlist = py27,py27dj18,pep8
minversion = 1.6
skipsdist = True
[testenv]
usedevelop = True
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
NOSE_WITH_OPENSTACK=1
NOSE_OPENSTACK_COLOR=1
NOSE_OPENSTACK_RED=0.05
NOSE_OPENSTACK_YELLOW=0.025
NOSE_OPENSTACK_SHOW_ELAPSED=1
# Note the hash seed is set to 0 until horizon can be tested with a
# random hash seed successfully.
PYTHONHASHSEED=0
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = {toxinidir}/manage.py test horizon_cisco_ui --settings=horizon_cisco_ui.test.settings
[testenv:pep8]
commands = flake8
[testenv:venv]
commands = {posargs}
[testenv:py27dj18]
basepython = python2.7
commands = pip install django>=1.8,<1.9
{toxinidir}/manage.py test horizon_cisco_ui --settings=horizon_cisco_ui.test.settings
[testenv:py27dj19]
commands = pip install django>=1.9,<1.10
{toxinidir}/manage.py test horizon_cisco_ui --settings=horizon_cisco_ui.test.settings
[testenv:py34dj18]
basepython = python3.4
commands = pip install django>=1.8,<1.9
{toxinidir}/manage.py test horizon_cisco_ui --settings=horizon_cisco_ui.test.settings
[testenv:docs]
setenv = DJANGO_SETTINGS_MODULE=horizon_cisco_ui.test.settings
commands = python setup.py build_sphinx
[testenv:extractmessages]
commands =
pybabel extract -F babel-django.cfg \
-o horizon_cisco_ui/locale/django.pot -k gettext_noop -k gettext_lazy -k ngettext_lazy:1,2 \
-k ugettext_noop -k ugettext_lazy -k ungettext_lazy:1,2 -k npgettext:1c,2,3 \
-k pgettext_lazy:1c,2 -k npgettext_lazy:1c,2,3 --add-comments Translators: horizon_cisco_ui
pybabel extract -F babel-djangojs.cfg \
-o horizon_cisco_ui/locale/djangojs.pot -k gettext_noop -k gettext_lazy -k ngettext_lazy:1,2 \
-k ugettext_noop -k ugettext_lazy -k ungettext_lazy:1,2 -k npgettext:1c,2,3 \
-k pgettext_lazy:1c,2 -k npgettext_lazy:1c,2,3 --add-comments Translators: horizon_cisco_ui
[flake8]
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py,*/local/*,*/test/test_plugins/*,.ropeproject
# H405 multi line docstring summary not separated with an empty line
ignore = H405
max-complexity = 20
[hacking]
import_exceptions = collections.defaultdict,
django.conf.settings,
django.conf.urls.include,
django.conf.urls.patterns,
django.conf.urls.url,
django.core.urlresolvers.reverse,
django.core.urlresolvers.reverse_lazy,
django.template.loader.render_to_string,
django.test.utils.override_settings,
django.utils.datastructures.SortedDict,
django.utils.encoding.force_text,
django.utils.html.conditional_escape,
django.utils.html.escape,
django.utils.http.urlencode,
django.utils.safestring.mark_safe,
django.utils.translation.npgettext_lazy,
django.utils.translation.pgettext_lazy,
django.utils.translation.ugettext_lazy,
django.utils.translation.ungettext_lazy,
operator.attrgetter,
StringIO.StringIO