From f0e3c26170f0a2e5722854e461fb95dfaa05b97f Mon Sep 17 00:00:00 2001 From: Peter Hamilton Date: Wed, 13 Aug 2014 19:23:05 -0400 Subject: [PATCH] PyKMIP - Release v0.0.1 This changes adds the final modifications needed for release v0.0.1 of the PyKMIP library. Packaging and licensing files are updated with current information and some minor file restructuring is done to ensure test suite integrity. --- AUTHORS => AUTHORS.txt | 1 + CHANGES.txt | 1 + LICENSE => LICENSE.txt | 0 MANIFEST.in | 4 ++ README | 1 - README.txt | 46 +++++++++++++++ bin/run_server.sh | 2 +- kmip/__init__.py | 2 +- kmip/core/__init__.py | 3 +- bin/run_server.py => kmip/demos/server.py | 0 kmip/tests/services/test_kmip_client.py | 3 +- kmip/tests/utils/__init__.py | 0 kmip/tests/utils/server.py | 70 +++++++++++++++++++++++ setup.py | 3 +- 14 files changed, 128 insertions(+), 8 deletions(-) rename AUTHORS => AUTHORS.txt (68%) create mode 100644 CHANGES.txt rename LICENSE => LICENSE.txt (100%) create mode 100644 MANIFEST.in delete mode 100644 README create mode 100644 README.txt rename bin/run_server.py => kmip/demos/server.py (100%) create mode 100644 kmip/tests/utils/__init__.py create mode 100644 kmip/tests/utils/server.py diff --git a/AUTHORS b/AUTHORS.txt similarity index 68% rename from AUTHORS rename to AUTHORS.txt index 87ea0dd..615e983 100644 --- a/AUTHORS +++ b/AUTHORS.txt @@ -1,2 +1,3 @@ Nathan Reller Peter Hamilton +Kaitlin Farr \ No newline at end of file diff --git a/CHANGES.txt b/CHANGES.txt new file mode 100644 index 0000000..626bf8d --- /dev/null +++ b/CHANGES.txt @@ -0,0 +1 @@ +v0.0.1, August 12 2014 -- Initial release. \ No newline at end of file diff --git a/LICENSE b/LICENSE.txt similarity index 100% rename from LICENSE rename to LICENSE.txt diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..4ee49d0 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +include AUTHORS.txt CHANGES.txt LICENSE.txt README.txt +global-include logconfig.ini +recursive-include bin run_server.sh +recursive-include kmip *.py \ No newline at end of file diff --git a/README b/README deleted file mode 100644 index 2b0b71e..0000000 --- a/README +++ /dev/null @@ -1 +0,0 @@ -TODO fill this in diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..ea47b9d --- /dev/null +++ b/README.txt @@ -0,0 +1,46 @@ +====== +PyKMIP +====== + +PyKMIP is a Python implementation of the Key Management Interoperability +Protocol (KMIP) specification, supporting version 1.1 of the KMIP standard. +The library currently provides a KMIP client, which supports the following +operations for KMIP SymmetricKey managed objects: + +* create +* register +* get +* destroy + +PyKMIP also provides a software-based KMIP server, which is intended for use +in testing and demonstration environments. The server is NOT intended to be +a substitute for secured hardware-based KMIP appliances. + +Version +======= +This distribution of PyKMIP is version 0.0.1. Future work includes adding +support for basic KMIP profiles, including the basic supporting operations. + +For more information on KMIP profiles, see the `OASIS documentation for +KMIP profiles +`_. + +Platform +======== +PyKMIP has been tested and runs on Ubuntu 12.04 LTS. + +References +========== + +For more information on the KMIP specification, see the `OASIS documentation +for KMIP +`_. + +Contributors +============ + +Many thanks to the developers who created PyKMIP: + +Nathan Reller +Peter Hamilton +Kaitlin Farr diff --git a/bin/run_server.sh b/bin/run_server.sh index ed85da3..e272bb0 100755 --- a/bin/run_server.sh +++ b/bin/run_server.sh @@ -2,5 +2,5 @@ set -eu -python run_server.py +python ../kmip/demos/server.py diff --git a/kmip/__init__.py b/kmip/__init__.py index c91f990..239e7e3 100644 --- a/kmip/__init__.py +++ b/kmip/__init__.py @@ -54,4 +54,4 @@ else: else: logging.basicConfig() -__all__ = ['test', 'transport'] +__all__ = ['core', 'demos', 'services'] diff --git a/kmip/core/__init__.py b/kmip/core/__init__.py index fc73ed1..0b02c29 100644 --- a/kmip/core/__init__.py +++ b/kmip/core/__init__.py @@ -13,5 +13,4 @@ # License for the specific language governing permissions and limitations # under the License. -__all__ = ['attributes', 'enums', 'errors', 'messages', 'objects', - 'primitives', 'protocol', 'utils'] +__all__ = ['factories', 'messages', 'repo'] diff --git a/bin/run_server.py b/kmip/demos/server.py similarity index 100% rename from bin/run_server.py rename to kmip/demos/server.py diff --git a/kmip/tests/services/test_kmip_client.py b/kmip/tests/services/test_kmip_client.py index 53b1a2d..4f511a3 100644 --- a/kmip/tests/services/test_kmip_client.py +++ b/kmip/tests/services/test_kmip_client.py @@ -61,8 +61,7 @@ class TestKMIPClient(TestCase): # Set up the KMIP server process path = os.path.join(os.path.dirname(__file__), os.path.pardir, - os.path.pardir, os.path.pardir, 'bin', - 'run_server.py') + 'utils', 'server.py') self.server = Popen(['python', '{0}'.format(path), '-p', '{0}'.format(self.KMIP_PORT)], stderr=sys.stdout) diff --git a/kmip/tests/utils/__init__.py b/kmip/tests/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/kmip/tests/utils/server.py b/kmip/tests/utils/server.py new file mode 100644 index 0000000..f2848cd --- /dev/null +++ b/kmip/tests/utils/server.py @@ -0,0 +1,70 @@ +# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory +# 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 logging +import optparse +import sys + +from thrift.server import TServer +from thrift.transport import TSocket +from thrift.transport import TTransport + +from kmip.core.server import KMIPImpl + +from kmip.services.kmip_protocol import KMIPProtocolFactory +from kmip.services.kmip_server import Processor + + +def run_server(host='127.0.0.1', port=5696): + logger = logging.getLogger(__name__) + + handler = KMIPImpl() + processor = Processor(handler) + transport = TSocket.TServerSocket(host, port) + tfactory = TTransport.TBufferedTransportFactory() + pfactory = KMIPProtocolFactory() + server = TServer.TSimpleServer(processor, transport, tfactory, pfactory) + + logger.info('Starting the KMIP server') + + try: + server.serve() + except KeyboardInterrupt: + logger.info('KeyboardInterrupt received while serving') + except Exception, e: + logger.info('Exception received while serving: {0}'.format(e)) + finally: + transport.close() + + logger.info('Shutting down KMIP server') + + +def build_cli_parser(): + parser = optparse.OptionParser(usage="%prog [options]", + description="Run KMIP Server") + parser.add_option("-n", "--hostname", action="store", default='127.0.0.1', + dest="hostname", + help="Hostname/IP address of platform running the KMIP " + "server (e.g., localhost, 127.0.0.1)") + parser.add_option("-p", "--port", action="store", default=5696, + dest="port", help="Port number for KMIP services") + return parser + +if __name__ == '__main__': + parser = build_cli_parser() + + opts, args = parser.parse_args(sys.argv[1:]) + + run_server(opts.hostname, opts.port) diff --git a/setup.py b/setup.py index a6ae9d3..4dc457f 100644 --- a/setup.py +++ b/setup.py @@ -22,9 +22,10 @@ setuptools.setup( keywords='KMIP', author='Peter Hamilton', author_email='peter.hamilton@jhuapl.edu', - url='http://www.jhuapl.edu', + url='https://github.com/OpenKMIP/PyKMIP', license='Apache License, Version 2.0', packages=setuptools.find_packages(exclude=["kmip.tests", "kmip.tests.*"]), + package_data={'kmip': ['logconfig.ini']}, classifiers=[ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License",