{ "info": { "author": "Dimitri Desmidt, Emanuele Mazza, Yves Fauser", "author_email": "yfauser@vmware.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Topic :: Utilities" ], "description": "PyNSXv\n======\n\nPyNSXv is a high level python based library that exposes ready to use\nwork-flows and a CLI tool that can be used to control VMware NSX for\nvSphere\n\nPyNSXv can be used in two different ways, as a library by importing the\nfiles in the /library subdirectory into your code, or as a CLI tool by\nexecuting ``pynsxv``\\ on the command line after installation. To install\nPyNSXv you can use PIP on your system\n\nTable of Contents\n~~~~~~~~~~~~~~~~~\n\n| **`Using PyNSXv as a CLI\n Tool <#Using%20PyNSXv%20as%20a%20CLI%20Tool>`__**\n| **`Using PyNSXv as a Python\n Library <#Using%20PyNSXv%20as%20a%20Python%20Library>`__**\n| **`Dependencies <#Dependencies>`__**\n| **`Installing PyNSXv <#Installing%20PyNSXv>`__**\n| **`Contributing <#Contributing>`__**\n| **`License <#License>`__**\n\nUsing PyNSXv as a CLI Tool\n==========================\n\nAfter you installed PyNSXv, the first thing you have to do is to create\nyour a ``ini`` file that contains the host names and credentials of your\nvCenter and NSX Manager.\n\nIf you have multiple NSX environments, you can create multiple ``ini``\nfiles and reference to them using the ``-i`` command line option. By\ndefault PyNSXv will look for a file called ``nsx.ini`` in the path your\nare running the pynsxv command in.\n\nThe ``ini`` file has the following format:\n\n.. code:: ini\n\n # [nsxraml]\n # nsxraml_file = <>\n # Uncomment the above section and add the path to the raml spec you want to use instead of the bundled version\n\n [nsxv]\n nsx_manager = \n nsx_username = admin\n nsx_password = \n\n [vcenter]\n vcenter = \n vcenter_user = administrator@domain.local\n vcenter_passwd = \n\n [defaults]\n transport_zone = \n datacenter_name = \n edge_datastore = \n edge_cluster = \n\nAfter placing the ``nsx.ini`` file in you path, you can run pynsxv from\nyour shell or cmd prompt. On Linux and Mac simply use ``pynsxv``\nfollowed by the subcommand. On Windows you will need to type\n``pynsxv.exe`` followed by the subcommand:\n\n::\n\n \u25b6 pynsxv -h\n usage: pynsxv [-h] [-i INI] [-v] [-d] {lswitch,dlr,esg,dhcp,dfw,usage} ...\n\n PyNSXv Command Line Client for NSX for vSphere\n\n positional arguments:\n {lswitch,dlr,esg,dhcp,dfw,usage}\n lswitch Functions for logical switches\n dlr Functions for distributed logical routers\n esg Functions for edge services gateways\n dhcp Functions for Edge DHCP\n dfw Functions for distributed firewall\n usage Functions to retrieve NSX-v usage statistics\n\n optional arguments:\n -h, --help show this help message and exit\n -i INI, --ini INI nsx configuration file\n -v, --verbose increase output verbosity\n -d, --debug print low level debug of http transactions\n\nHere is an example output using the lswitch subcommand:\n\n::\n\n \u25b6 pynsxv lswitch list\n +---------------------+----------------+\n | LS name | LS ID |\n |---------------------+----------------|\n | edge_ls | virtualwire-63 |\n | dlr_ls | virtualwire-64 |\n +---------------------+----------------+\n\n| Each subcommand has its own set of subcommands, as well as arguments.\n| You can see what is available by using ``-h`` after the first\n subcommand:\n\n::\n\n \u25b6 pynsxv lswitch -h\n usage: cli.py lswitch [-h] [-t TRANSPORT_ZONE] [-n NAME] command\n\n Functions for logical switches\n\n positional arguments:\n command\n create: create a new logical switch\n read: return the virtual wire id of a logical switch\n delete: delete a logical switch\"\n list: return a list of all logical switches\n\n\n optional arguments:\n -h, --help show this help message and exit\n -t TRANSPORT_ZONE, --transport_zone TRANSPORT_ZONE\n nsx transport zone\n -n NAME, --name NAME logical switch name, needed for create, read and delete\n\nYou can also use the ``-v`` switch of the main pynsxv command to switch\nto a json formated output for use with shell scripts\n\nUsing PyNSXv as a Python Library\n================================\n\nWhen using PyNSXv as a Python library you can either download the\nindividual modules in ``/library`` of this repo and import them in your\ncode, or you can install PyNSXv and import the modules from your python\npath for pip installed modules.\n\n| To use the modules you will also need to have at least the\n ``nsxramlclient`` installed (https://github.com/vmware/nsxramlclient).\n| You will also need a copy of the latest RAML API Spec of NSX for\n vSphere (https://github.com/vmware/nsxraml).\n\n| Import the module you want to use, as well as the NsxClient Class of\n the ``nsxramlclient``.\n| Then instantiate a session object of the NsxClient Class, and pass\n this session object to the function you want to use out of the module\n imported from PyNSXv. Here's an example:\n\n.. code:: ipython\n\n \u25b6 ipython\n Python 2.7.11 (default, Jun 17 2016, 20:01:51)\n Type \"copyright\", \"credits\" or \"license\" for more information.\n\n IPython 4.2.0 -- An enhanced Interactive Python.\n ? -> Introduction and overview of IPython's features.\n %quickref -> Quick reference.\n help -> Python's own help system.\n object? -> Details about 'object', use 'object??' for extra details.\n\n In [1]: from pynsxv.library.nsx_logical_switch import logical_switch_list,logical_switch_create\n\n In [2]: from nsxramlclient.client import NsxClient\n\n In [3]: nsxraml_file = '/raml/nsxraml/nsxvapi.raml'\n In [4]: nsxmanager = 'nsxmanager.invalid.org'\n In [5]: nsx_username = 'admin'\n In [6]: nsx_password = 'vmware'\n\n In [7]: client_session = NsxClient(nsxraml_file, nsxmanager, nsx_username, nsx_password)\n\n In [8]: lswitch_list = logical_switch_list(client_session)\n\n In [9]: lswitch_list\n Out[9]:\n ([('k8s-dlr-plr-transit', 'virtualwire-39'),\n ('k8s-minion-1', 'virtualwire-40'),\n ('k8s-minion-2', 'virtualwire-41'),\n ('vic-external', 'virtualwire-51'),\n ('vic-container-net1', 'virtualwire-52'),\n ('edge_ls', 'virtualwire-63'),\n ('dlr_ls', 'virtualwire-64')],\n [{'clientHandle': None,\n 'controlPlaneMode': 'HYBRID_MODE',\n 'ctrlLsUuid': 'e0c72e20-f39e-41ba-adb4-f0b191521c0c',\n 'description': None,\n 'extendedAttributes': None,\n 'guestVlanAllowed': 'false',\n 'isUniversal': 'false',\n\n .... Output truncated ....\n\n In [10]: new_lswitch = logical_switch_create(client_session, 'TZ1', 'new_lswitch_name')\n\n In [11]: new_lswitch\n Out[12]: ('virtualwire-65', '/api/2.0/vdn/virtualwires/virtualwire-65')\n\nAll module function have inline documentation available to guide you\nthrough the needed parameters:\n\n::\n\n In [1]: help(logical_switch_list)\n\n logical_switch_list(client_session)\n This function returns all logical switches found in NSX\n :param client_session: An instance of an NsxClient Session\n :return: returns a tuple, the first item is a list of tuples with item 0 containing the LS Name as string\n and item 1 containing the LS id as string. The second item contains a list of dictionaries containing\n all logical switch details\n\nDependencies\n============\n\nPyNSXv has the following dependencies: - pyvmomi\n(https://github.com/vmware/pyvmomi) - nsxramlclient\n(https://github.com/vmware/nsxramlclient) - tabulate\n(https://bitbucket.org/astanin/python-tabulate)\n\nPlease check the installation instructions of these projects if you run\ninto installation issues\n\nInstalling PyNSXv\n=================\n\nPyNSXv can be installed using pip:\n\n.. code:: shell\n\n pip install pynsxv\n\n| **`Installing PyNSXv on\n Ubuntu <###Installing%20PyNSXv%20on%20Ubuntu>`__**\n| **`Installing PyNSXv on a\n MAC <###Installing%20PyNSXv%20on%20a%20MAC>`__**\n| **`Installing PyNSXv on\n Windows <###Installing%20PyNSXv%20on%20Windows>`__**\n| **`Various caveats <###Various%20caveats>`__**\n\nInstalling PyNSXv on Ubuntu\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nFirst update/upgrade using apt and install the python-openssl, libxml\nand libxslt dependencies of the ``nsxramclient`` using apt. Please also\nconsult the Github page of the ``nsxramclient`` and ``pyvmomi`` in case\nyou run into issues during the installation of these dependencies.\n\n.. code:: shell\n\n apt-get update && apt-get upgrade -y\n apt-get install python-openssl libxml2-dev libxslt-dev python-dev zlib1g-dev python-pip -y\n\nAfter this you can simply install PyNSXv using pip:\n\n.. code:: shell\n\n sudo pip install pynsxv\n\nInstalling PyNSXv on a MAC\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nMake sure to install XCODE and its Command Line utilities:\nhttps://itunes.apple.com/app/xcode/id497799835?mt=12\n\n.. code:: shell\n\n xcode-select --install\n\nIf not yet present on your system, install python pip. The instructions\non how to do so can be found here:\nhttps://pip.pypa.io/en/latest/installing/#install-or-upgrade-pip\n\n.. code:: shell\n\n curl https://bootstrap.pypa.io/get-pip.py > get-pip.py\n sudo python get-pip.py\n\nIf you don't have it yet, install homebrew on your system:\nhttp://brew.sh\n\n.. code:: shell\n\n /usr/bin/ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\"\n\nNow install some of the xml formating dependencies needed by PyNSXv and\nthe underlying nsxramlclient\n\n.. code:: shell\n\n brew install libxml2\n brew install libxslt\n brew link libxml2 --force\n brew link libxslt --force\n\nFinaly we are ready to install PyNSXv using pip:\n\n.. code:: shell\n\n sudo pip install pynsxv\n\n**NOTE**: OSX 10.11 El Capitan introduces problems due to an outdated\ndependency ``six``. Due to OSX's new System Integrity Protection (SIP)\npip cannot remove the outdated version and install the needed one:\nhttp://apple.stackexchange.com/questions/209572/how-to-use-pip-after-the-os-x-el-capitan-upgrade/210021#210021\nhttp://stackoverflow.com/questions/31900008/oserror-errno-1-operation-not-permitted-when-installing-scrapy-in-osx-10-11\n\nIf you run into this error:\n\n``OSError: [Errno 1] Operation not permitted: '/tmp/pip-nIfswi-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'``\n\nYou should install a new non-bundled python version:\n\n.. code:: shell\n\n brew install python\n\n sudo pip uninstall pynsxv\n sudo pip uninstall six\n sudo pip uninstall PyYAML\n sudo pip uninstall pyraml-parser\n sudo pip uninstall nsxramlclient\n\n pip install pyopenssl\n pip install pynsxv\n\nInstalling PyNSXv on Windows\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n**To be Done**\n\nVarious caveats\n~~~~~~~~~~~~~~~\n\nShould you see this warning message:\n``UserWarning: /home/vagrant/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).``\n\nYou can solve this by changing the permissions of the .python-eggs\nfolder:\n\n.. code:: shell\n\n chmod g-wx,o-wx ~/.python-eggs\n\nContributing\n============\n\nEveryone is more than welcome to contribute to PyNSXv. If you come up\nwith any interesting additional subcommand, workflow, bugfix that you\nwould like to share, you can simply send us a pull request. Should you\nbe interested in helping us coding missing functionality, you can see\nwhat we are tracking as enhancements in the Github Issue tracker of this\nrepository. Before sending us your pull request, please make sure that\nyou pull the latest code from the ``devel`` branch, and base your\nadditions from this branch. Also note that you might be requested to\nsign a Contributor License Agreement before we can merge your code. This\nhappens automatically when you submit your first pull request.\n\nIf you don't want to code, we still very much welcome any help with\ntesting and requests for additional functionality. Please don't hesitate\nto contact us and open tickets in the Github Issue tracker if you need\nhelp using PyNSXv.\n\nLicense\n=======\n\nLicensed under the X11 (MIT)license (the \u201cLicense\u201d) set forth below; you\nmay not use this file except in compliance with the License.\u00a0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \u201cAS IS\u201d BASIS,\nwithout warranties or conditions of any kind, EITHER EXPRESS OR IMPLIED.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\nOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/vmware/pynsxv", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "PyNSXv", "package_url": "https://pypi.org/project/PyNSXv/", "platform": "", "project_url": "https://pypi.org/project/PyNSXv/", "project_urls": { "Homepage": "http://github.com/vmware/pynsxv" }, "release_url": "https://pypi.org/project/PyNSXv/0.4.1/", "requires_dist": null, "requires_python": "", "summary": "PyNSXv is a higher level python based library and CLI tool to control NSX for vSphere", "version": "0.4.1" }, "last_serial": 2271177, "releases": { "0.3": [ { "comment_text": "", "digests": { "md5": "f0a50917b018fdc844a7b793e567106a", "sha256": "fbf4618bb2e5401fcac2fffd215ad5811c803b23e5d970431d8ea84b0f1dadee" }, "downloads": -1, "filename": "PyNSXv-0.3.tar.gz", "has_sig": false, "md5_digest": "f0a50917b018fdc844a7b793e567106a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 40336, "upload_time": "2016-06-02T22:31:30", "url": "https://files.pythonhosted.org/packages/52/cb/f27d69255ffd2c5951fcc3358161e78e8498b09b6df3a5cc551466bb6020/PyNSXv-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "2e059ddf522c78bc1b0f740a28557126", "sha256": "0b49029bb6dd09da204bf7e3aba68f06ffb3abc60e717d7362985687ce848f46" }, "downloads": -1, "filename": "PyNSXv-0.4.tar.gz", "has_sig": false, "md5_digest": "2e059ddf522c78bc1b0f740a28557126", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 136265, "upload_time": "2016-07-28T05:55:31", "url": "https://files.pythonhosted.org/packages/1e/6c/9d1e99359bca5291b7e6b3ff4ffd147ee0d18d168302ee420bcb8a9a525b/PyNSXv-0.4.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "5a2afb44397c16c26009535b682f1acc", "sha256": "9e5ae0c0a03d3a075feccc12d980f705654541443635f2b1a3fc26d630f5410a" }, "downloads": -1, "filename": "PyNSXv-0.4.1.tar.gz", "has_sig": false, "md5_digest": "5a2afb44397c16c26009535b682f1acc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 137785, "upload_time": "2016-08-09T13:05:02", "url": "https://files.pythonhosted.org/packages/9e/a4/231aed804e77bbd7825f74a129879b600d2316926e1ecc31fa295b673ab4/PyNSXv-0.4.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5a2afb44397c16c26009535b682f1acc", "sha256": "9e5ae0c0a03d3a075feccc12d980f705654541443635f2b1a3fc26d630f5410a" }, "downloads": -1, "filename": "PyNSXv-0.4.1.tar.gz", "has_sig": false, "md5_digest": "5a2afb44397c16c26009535b682f1acc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 137785, "upload_time": "2016-08-09T13:05:02", "url": "https://files.pythonhosted.org/packages/9e/a4/231aed804e77bbd7825f74a129879b600d2316926e1ecc31fa295b673ab4/PyNSXv-0.4.1.tar.gz" } ] }