11
0

Accepting request 201089 from Cloud:OpenStack:Factory

New Package needed for Nexus / OpenStack Neutron integration (also needed for 13.1)

OBS-URL: https://build.opensuse.org/request/show/201089
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-ncclient?expand=0&rev=1
This commit is contained in:
Stephan Kulow
2013-10-01 06:32:57 +00:00
committed by Git OBS Bridge
commit 062e66f088
6 changed files with 217 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

3
ncclient-0.3.2.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7749b9ce7f5ad5a702bf312b378ba182d08304324656cb5150c40b45a7ee3fe7
size 35856

110
nexus-support.patch Normal file
View File

@@ -0,0 +1,110 @@
From cc429a1b83b65b4ab39d917774d34603473afcba Mon Sep 17 00:00:00 2001
From: envydd <ddutta@gmail.com>
Date: Mon, 8 Aug 2011 22:15:13 -0700
Subject: [PATCH 1/2] This commit has the changes required for ncclient to work
with the Nexus family of devices from Cisco
Conflicts:
ncclient/operations/rpc.py
ncclient/xml_.py
---
ncclient/operations/rpc.py | 9 ++++++++-
ncclient/xml_.py | 10 +++++++++-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/ncclient/operations/rpc.py b/ncclient/operations/rpc.py
index a476e18..d30907b 100644
--- a/ncclient/operations/rpc.py
+++ b/ncclient/operations/rpc.py
@@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# Debojyoti Dutta added some code for interoperability with Cisco's
+# Nexus family of switches. Tested with Nexus 7000 series.
+
from threading import Event, Lock
from uuid import uuid1
@@ -256,7 +259,11 @@ class RPC(object):
def _wrap(self, subele):
# internal use
- ele = new_ele("rpc", {"message-id": self._id})
+ ele = new_ele("rpc", {"message-id": self._id},
+ **{"xmlns":BASE_NS_1_0,
+ "xmlns:nxos":"http://www.cisco.com/nxos:1.0",
+ "xmlns:if":"http://www.cisco.com/nxos:1.0:if_manager"
+ })
ele.append(subele)
return to_xml(ele)
diff --git a/ncclient/xml_.py b/ncclient/xml_.py
index 9e94ef0..c22b0f1 100644
--- a/ncclient/xml_.py
+++ b/ncclient/xml_.py
@@ -13,6 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# Debojyoti Dutta added some code for interoperability with Cisco's
+# Nexus family of switches. Tested with Nexus 7000 series.
+
"Methods for creating, parsing, and dealing with XML and ElementTree objects."
from cStringIO import StringIO
@@ -29,6 +32,10 @@ class XMLError(NCClientError): pass
#: Base NETCONF namespace
BASE_NS_1_0 = "urn:ietf:params:xml:ns:netconf:base:1.0"
+# NXOS_1_0
+NXOS_1_0 = "http://www.cisco.com/nxos:1.0"
+# NXOS_IF
+NXOS_IF = "http://www.cisco.com/nxos:1.0:if_manager"
#: Namespace for Tail-f core data model
TAILF_AAA_1_1 = "http://tail-f.com/ns/aaa/1.1"
#: Namespace for Tail-f execd data model
@@ -51,6 +58,8 @@ register_namespace.func_doc = "ElementTree's namespace map determines the prefix
for (ns, pre) in {
BASE_NS_1_0: 'nc',
+ NXOS_1_0: 'nxos',
+ NXOS_IF: 'if',
TAILF_AAA_1_1: 'aaa',
TAILF_EXECD_1_1: 'execd',
CISCO_CPI_1_0: 'cpi',
@@ -105,4 +114,3 @@ def validated_element(x, tags=None, attrs=None):
new_ele = lambda tag, attrs={}, **extra: ET.Element(qualify(tag), attrs, **extra)
sub_ele = lambda parent, tag, attrs={}, **extra: ET.SubElement(parent, qualify(tag), attrs, **extra)
-
--
1.8.1.4
From 71aa03550d34ec45983ec2ceab821a73f7b8278e Mon Sep 17 00:00:00 2001
From: Edgar Magana <emagana@gmail.com>
Date: Thu, 24 May 2012 14:56:53 -0700
Subject: [PATCH 2/2] Changing the subsystem from netconf to xmlagent
---
ncclient/transport/ssh.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ncclient/transport/ssh.py b/ncclient/transport/ssh.py
index 14082da..886ac91 100644
--- a/ncclient/transport/ssh.py
+++ b/ncclient/transport/ssh.py
@@ -204,8 +204,8 @@ class SSHSession(Session):
self._connected = True # there was no error authenticating
c = self._channel = self._transport.open_session()
- c.set_name("netconf")
- c.invoke_subsystem("netconf")
+ c.set_name("xmlagent")
+ c.invoke_subsystem("xmlagent")
self._post_connect()
--
1.8.1.4

19
python-ncclient.changes Normal file
View File

@@ -0,0 +1,19 @@
-------------------------------------------------------------------
Mon Aug 26 14:59:37 UTC 2013 - rhafer@suse.com
- added nexus-support.patch: this is required to make make ncclient
capable of accessing cisco nexus switches (for quantum's nexus
plugin)
-------------------------------------------------------------------
Thu Aug 8 14:50:07 UTC 2013 - dmueller@suse.com
- (rpm-wise) downgrade to a released version 0.3.2:
* http://ncclient.grnet.gr/0.3.2/
-------------------------------------------------------------------
Mon Jul 29 08:08:56 UTC 2013 - speilicke@suse.com
- Require python-paramiko (for ssh transport)
- Build HTML documentation

61
python-ncclient.spec Normal file
View File

@@ -0,0 +1,61 @@
#
# spec file for package python-ncclient
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: python-ncclient
Version: 0.3.2
Release: 0
Url: https://github.com/CiscoSystems/ncclient
Summary: Python NETCONF protocol library
License: Apache-2.0
Group: Development/Languages/Python
Source: ncclient-%{version}.tar.gz
# Forward ported from https://github.com/CiscoSystems/ncclient required for the
# quantum nexus plugin to work with nexus switches
Patch0: nexus-support.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-base
# Documentation requirements:
BuildRequires: python-Sphinx
Requires: python-paramiko >= 1.7.7.1
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch: noarch
%endif
%description
ncclient is a Python library that facilitates client-side scripting
and application development around the NETCONF protocol.
%prep
%setup -q -n leopoul-ncclient-3304dc4
%patch0 -p1
%build
python setup.py build
cd docs && make html && rm build/html/.buildinfo
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
%files
%defattr(-,root,root)
%doc LICENSE README examples docs/build/html
%{python_sitelib}/*
%changelog