Skip to content

Commit

Permalink
Initial commit to show the usage of neutronclient extension mechanism.
Browse files Browse the repository at this point in the history
  • Loading branch information
sayajirp authored and sayajirp committed Apr 13, 2015
0 parents commit 5c06535
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 0 deletions.
19 changes: 19 additions & 0 deletions nuage/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

import pbr.version


__version__ = pbr.version.VersionInfo(
'nuage_neutron').version_string()
48 changes: 48 additions & 0 deletions nuage/netpartition.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2014 Alcatel-Lucent USA 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 neutronclient.common import extension

class NetPartition(extension.NeutronClientExtension):
resource = 'net_partition'
resource_plural = '%ss' % resource
object_path = '/%s' % 'net-partitions'
resource_path = '/%s/%%s' % 'net-partitions'
versions = ['2.0']

class NetPartitionList(extension.ClientExtensionList, NetPartition):
shell_command = 'nuage-netpartition-list'
list_columns = ['id', 'name']
pagination_support = True
sorting_support = True

class NetPartitionCreate(extension.ClientExtensionCreate, NetPartition):
shell_command = 'nuage-netpartition-create'

def add_known_arguments(self, parser):
parser.add_argument(
'name', metavar='name',
help='Name of netpartition to create.')

def args2body(self, parsed_args):
body = {'net_partition': {'name': parsed_args.name}, }
return body

class NetPartitionDelete(extension.ClientExtensionDelete, NetPartition):
shell_command = 'nuage-netpartition-delete'


class NetPartitionShow(extension.ClientExtensionShow, NetPartition):
shell_command = 'nuage-netpartition-show'
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# 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.

pbr>=0.6,!=0.7,<1.0
Babel>=1.3
51 changes: 51 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[metadata]
name = nuage-openstack-neutronclient
summary = "Openstack Neutron Client for Nuage Networks"
description-file =
README.rst
author = Alcatel-Lucent USA Inc
author-email = [email protected]
home-page = http://www.nuagenetworks.net
classifier =
Environment :: OpenStack
Intended Audience :: Information Technology
Intended Audience :: System Administrators
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 2.6
Programming Language :: Python :: 3
Programming Language :: Python :: 3.3
Programming Language :: Python :: 3.4

[files]
packages =
nuage_openstack_neutronclient

[build_sphinx]
source-dir = doc/source
build-dir = doc/build
all_files = 1

[upload_sphinx]
upload-dir = doc/build/html

[compile_catalog]
directory = nuage_openstack_neutronclient/locale
domain = nuage-openstack-neutronclient

[update_catalog]
domain = nuage-openstack-neutronclient
output_dir = nuage_openstack_neutronclient/locale
input_file = nuage_openstack_neutronclient/locale/nuage-openstack-neutronclient.pot

[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = nuage_openstack_neutronclient/locale/nuage-openstack-neutronclient.pot

[entry_points]
neutronclient.extension =
netpartition = nuage.netpartition
30 changes: 30 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python
# 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'],
pbr=True)

0 comments on commit 5c06535

Please sign in to comment.