Hello community,
here is the log from the commit of package python-ncclient for openSUSE:Factory checked in at 2016-09-07 11:47:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-ncclient (Old)
and /work/SRC/openSUSE:Factory/.python-ncclient.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-ncclient"
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-ncclient/python-ncclient.changes 2016-02-08 09:47:58.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.python-ncclient.new/python-ncclient.changes 2016-09-07 11:47:32.000000000 +0200
@@ -1,0 +2,12 @@
+Sat Sep 3 20:52:24 UTC 2016 - mardnh@gmx.de
+
+- update to 0.5.2:
+ * Add support for Python 3
+ * Improve Junos ioproc performance
+ * Performance improvements
+ * Updated test cases
+ * Many bug and performance fixes
+- fix source-url
+- rebase patch: pr-109.patch
+
+-------------------------------------------------------------------
Old:
----
ncclient-0.4.7.tar.gz
New:
----
ncclient-0.5.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-ncclient.spec ++++++
--- /var/tmp/diff_new_pack.HEhhtT/_old 2016-09-07 11:47:34.000000000 +0200
+++ /var/tmp/diff_new_pack.HEhhtT/_new 2016-09-07 11:47:34.000000000 +0200
@@ -17,13 +17,13 @@
Name: python-ncclient
-Version: 0.4.7
+Version: 0.5.2
Release: 0
Url: https://github.com/ncclient/ncclient
Summary: Python NETCONF protocol library
License: Apache-2.0
Group: Development/Languages/Python
-Source: ncclient-%{version}.tar.gz
+Source: https://pypi.io/packages/source/n/ncclient/ncclient-%{version}.tar.gz
# PATCH-FIX-UPSTREAM pr-109.patch -- https://github.com/ncclient/ncclient/pull/109
Patch0: pr-109.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -65,7 +65,8 @@
%files
%defattr(-,root,root)
%doc LICENSE
-%{python_sitelib}/*
+%{python_sitelib}/ncclient
+%{python_sitelib}/ncclient-%{version}-py%{py_ver}.egg-info
%files doc
%defattr(-,root,root,-)
++++++ ncclient-0.4.7.tar.gz -> ncclient-0.5.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/PKG-INFO new/ncclient-0.5.2/PKG-INFO
--- old/ncclient-0.4.7/PKG-INFO 2016-01-30 08:08:06.000000000 +0100
+++ new/ncclient-0.5.2/PKG-INFO 2016-07-05 14:26:59.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: ncclient
-Version: 0.4.7
+Version: 0.5.2
Summary: Python library for NETCONF clients
Home-page: http://ncclient.org
Author: Shikhar Bhushan, Leonidas Poulopoulos, Ebben Aries
@@ -12,15 +12,18 @@
ncclient is a Python library that facilitates client-side scripting and
application development around the NETCONF protocol. ``ncclient`` was
developed by `Shikar Bhushan http://schmizz.net`_. It is now
- maintained by `Leonidas Poulopoulos (@leopoul) http://ncclient.org/ncclient`_
+ maintained by `Leonidas Poulopoulos (@leopoul) http://ncclient.org`_
Docs:
`http://ncclient.readthedocs.org http://ncclient.readthedocs.org`_
+ Github:
+ `https://github.com/ncclient/ncclient https://github.com/ncclient/ncclient`_
+
Requirements:
^^^^^^^^^^^^^
- - Python 2.6 <= version < 3.0
+ - Python >= 2.6 or Python 3
- setuptools 0.6+
- Paramiko 1.7+
- lxml 3.3.0+
@@ -102,6 +105,15 @@
Changes \| brief
~~~~~~~~~~~~~~~~
+ **v0.5.2**
+
+ - Add support for Python 3
+ - Improve Junos ioproc performance
+ - Performance improvements
+ - Updated test cases
+ - Many bug and performance fixes
+
+
**v0.4.7**
- Add support for netconf 1.1
@@ -161,19 +173,55 @@
Acknowledgements
~~~~~~~~~~~~~~~~
- - v0.4.7: Thanks to all contribs and bug hunters; `Einar Nilsen-Nygaard https://github.com/einarnn`_, `Vaibhav Bajpai https://github.com/vbajpai`_, Norio Nakamoto .
- - v0.4.6: Thanks to all contribs and bug hunters; `Nitin Kumar https://github.com/vnitinv`_, `Carl Moberg https://github.com/cmoberg`_, `Stavros Kroustouris https://github.com/kroustou`_ .
- - v0.4.5: Thanks to all contribs and bug hunters; `Sebastian Wiesinger https://github.com/sebastianw`_, `Vincent Bernat https://github.com/vincentbernat`_, `Matthew Stone https://github.com/bigmstone`_, `Nitin Kumar https://github.com/vnitinv`_.
- - v0.4.3: Thanks to all contributors and bug hunters; `Jeremy Schulman https://github.com/jeremyschulman`_, `Ray Solomon https://github.com/rsolomo`_, `Rick Sherman https://github.com/shermdog`_, `subhak186 https://github.com/subhak186`_.
- - v0.4.2: Thanks to all contributors; `katharh https://github.com/katharh`_, `Francis Luong (Franco) https://github.com/francisluong`_, `Vincent Bernat https://github.com/vincentbernat`_, `Juergen Brendel https://github.com/juergenbrendel`_, `Quentin Loos https://github.com/Kent1`_, `Ray Solomon https://github.com/rsolomo`_, `Sebastian Wiesinger https://github.com/sebastianw`_, `Ebben Aries https://github.com/earies`_ .
- - v0.4.1: Many thanks, primarily to `Jeremy Schulman https://github.com/jeremyschulman`_ (Juniper) for providing his precious feedback, to `Eben Aries https://github.com/earies`_ (Juniper) for his contribution, to Juergen Brendel (Cisco) for the Cisco fork and to all contributors from Cisco and Juniper.
-
-
+ - v0.5.2: `Nitin Kumar`_, `Kristian Larsson`_, `palashgupta`_,
+ `Jonathan Provost`_, `Jainpriyal`_, `sharang`_, `pseguel`_,
+ `nnakamot`_, `Алексей Пастухов`_, `Christian Giese`_, `Peipei Guo`_,
+ `Time Warner Cable Openstack Team`_
+ - v0.4.7: `Einar Nilsen-Nygaard`_, `Vaibhav Bajpai`_, Norio Nakamoto
+ - v0.4.6: `Nitin Kumar`_, `Carl Moberg`_, `Stavros Kroustouris`_
+ - v0.4.5: `Sebastian Wiesinger`_, `Vincent Bernat`_, `Matthew Stone`_,
+ `Nitin Kumar`_
+ - v0.4.3: `Jeremy Schulman`_, `Ray Solomon`_, `Rick Sherman`_,
+ `subhak186`_
+ - v0.4.2: `katharh`_, `Francis Luong (Franco)`_, `Vincent Bernat`_,
+ `Juergen Brendel`_, `Quentin Loos`_, `Ray Solomon`_, `Sebastian
+ Wiesinger`_, `Ebben Aries`_
+ - v0.4.1: `Jeremy Schulman`_, `Ebben Aries`_, Juergen Brendel
+
+ .. _Nitin Kumar: https://github.com/vnitinv
+ .. _Kristian Larsson: https://github.com/plajjan
+ .. _palashgupta: https://github.com/palashgupta
+ .. _Jonathan Provost: https://github.com/JoProvost
+ .. _Jainpriyal: https://github.com/Jainpriyal
+ .. _sharang: https://github.com/sharang
+ .. _pseguel: https://github.com/pseguel
+ .. _nnakamot: https://github.com/nnakamot
+ .. _Алексей Пастухов: https://github.com/p-alik
+ .. _Christian Giese: https://github.com/GIC-de
+ .. _Peipei Guo: https://github.com/peipeiguo
+ .. _Time Warner Cable Openstack Team: https://github.com/twc-openstack
+ .. _Einar Nilsen-Nygaard: https://github.com/einarnn
+ .. _Vaibhav Bajpai: https://github.com/vbajpai
+ .. _Carl Moberg: https://github.com/cmoberg
+ .. _Stavros Kroustouris: https://github.com/kroustou
+ .. _Sebastian Wiesinger: https://github.com/sebastianw
+ .. _Vincent Bernat: https://github.com/vincentbernat
+ .. _Matthew Stone: https://github.com/bigmstone
+ .. _Jeremy Schulman: https://github.com/jeremyschulman
+ .. _Ray Solomon: https://github.com/rsolomo
+ .. _Rick Sherman: https://github.com/shermdog
+ .. _subhak186: https://github.com/subhak186
+ .. _katharh: https://github.com/katharh
+ .. _Francis Luong (Franco): https://github.com/francisluong
+ .. _Juergen Brendel: https://github.com/juergenbrendel
+ .. _Quentin Loos: https://github.com/Kent1
+ .. _Ebben Aries: https://github.com/earies
Keywords: NETCONF,NETCONF Python client,Juniper Optimization,Cisco NXOS Optimization
Platform: Posix; OS X; Windows
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: System :: Networking
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/README new/ncclient-0.5.2/README
--- old/ncclient-0.4.7/README 2016-01-30 07:55:54.000000000 +0100
+++ new/ncclient-0.5.2/README 2016-07-05 14:20:51.000000000 +0200
@@ -13,7 +13,7 @@
**PyPI**: [https://pypi.python.org/pypi/ncclient](https://pypi.python.org/pypi/ncclient)
#### Requirements:
-* Python 2.6 <= version < 3.0
+* Python >= 2.6 or Python3
* setuptools 0.6+
* Paramiko 1.7+
* lxml 3.3.0+
@@ -75,15 +75,17 @@
### Changes | brief
-* Add support for netconf 1.1
-
-### Acknowledgements
-
-* v0.4.7: Thanks to all contribs and bug hunters; [Einar Nilsen-Nygaard] (https://github.com/einarnn), [Vaibhav Bajpai] (https://github.com/vbajpai), Norio Nakamoto
-* v0.4.6: Thanks to all contribs and bug hunters; [Nitin Kumar] (https://github.com/vnitinv), [Carl Moberg] (https://github.com/cmoberg), [Stavros Kroustouris] (https://github.com/kroustou)
-* v0.4.5: Thanks to all contribs and bug hunters; [Sebastian Wiesinger] (https://github.com/sebastianw), [Vincent Bernat] (https://github.com/vincentbernat), [Matthew Stone] (https://github.com/bigmstone), [Nitin Kumar] (https://github.com/vnitinv)
-* v0.4.3: Thanks to all contributors and bug hunters; [Jeremy Schulman](https://github.com/jeremyschulman), [Ray Solomon](https://github.com/rsolomo), [Rick Sherman](https://github.com/shermdog), [subhak186](https://github.com/subhak186)
-* v0.4.2: Thanks to all contributors; [katharh](https://github.com/katharh), [Francis Luong (Franco)](https://github.com/francisluong), [Vincent Bernat](https://github.com/vincentbernat), [Juergen Brendel](https://github.com/juergenbrendel), [Quentin Loos](https://github.com/Kent1), [Ray Solomon](https://github.com/rsolomo), [Sebastian Wiesinger](https://github.com/sebastianw), [Ebben Aries](https://github.com/earies)
-* v0.4.1: Many thanks, primarily to [Jeremy Schulman](https://github.com/jeremyschulman) (Juniper) for providing his precious feedback,
-to [Ebben Aries](https://github.com/earies) (Juniper) for his contribution, to Juergen Brendel (Cisco) for the Cisco fork and
-to all contributors from Cisco and Juniper.
+* Add support for Python 3
+* Improve Junos ioproc performance
+* Performance improvements
+* Updated test cases
+* Many bug and performance fixes
+
+### Contributors
+* v0.5.2: [Nitin Kumar](https://github.com/vnitinv), [Kristian Larsson](https://github.com/plajjan), [palashgupta](https://github.com/palashgupta), [Jonathan Provost](https://github.com/JoProvost), [Jainpriyal](https://github.com/Jainpriyal), [sharang](https://github.com/sharang), [pseguel](https://github.com/pseguel), [nnakamot](https://github.com/nnakamot), [Алексей Пастухов](https://github.com/p-alik), [Christian Giese](https://github.com/GIC-de), [Peipei Guo](https://github.com/peipeiguo), [Time Warner Cable Openstack Team](https://github.com/twc-openstack)
+* v0.4.7: [Einar Nilsen-Nygaard](https://github.com/einarnn), [Vaibhav Bajpai](https://github.com/vbajpai), Norio Nakamoto
+* v0.4.6: [Nitin Kumar](https://github.com/vnitinv), [Carl Moberg](https://github.com/cmoberg), [Stavros Kroustouris](https://github.com/kroustou)
+* v0.4.5: [Sebastian Wiesinger](https://github.com/sebastianw), [Vincent Bernat](https://github.com/vincentbernat), [Matthew Stone](https://github.com/bigmstone), [Nitin Kumar](https://github.com/vnitinv)
+* v0.4.3: [Jeremy Schulman](https://github.com/jeremyschulman), [Ray Solomon](https://github.com/rsolomo), [Rick Sherman](https://github.com/shermdog), [subhak186](https://github.com/subhak186)
+* v0.4.2: [katharh](https://github.com/katharh), [Francis Luong (Franco)](https://github.com/francisluong), [Vincent Bernat](https://github.com/vincentbernat), [Juergen Brendel](https://github.com/juergenbrendel), [Quentin Loos](https://github.com/Kent1), [Ray Solomon](https://github.com/rsolomo), [Sebastian Wiesinger](https://github.com/sebastianw), [Ebben Aries](https://github.com/earies)
+* v0.4.1: [Jeremy Schulman](https://github.com/jeremyschulman), [Ebben Aries](https://github.com/earies), Juergen Brendel
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/README.rst new/ncclient-0.5.2/README.rst
--- old/ncclient-0.4.7/README.rst 2016-01-30 07:55:29.000000000 +0100
+++ new/ncclient-0.5.2/README.rst 2016-07-05 14:22:23.000000000 +0200
@@ -4,15 +4,18 @@
ncclient is a Python library that facilitates client-side scripting and
application development around the NETCONF protocol. ``ncclient`` was
developed by `Shikar Bhushan http://schmizz.net`_. It is now
-maintained by `Leonidas Poulopoulos (@leopoul) http://ncclient.org/ncclient`_
+maintained by `Leonidas Poulopoulos (@leopoul) http://ncclient.org`_
Docs:
`http://ncclient.readthedocs.org http://ncclient.readthedocs.org`_
+Github:
+`https://github.com/ncclient/ncclient https://github.com/ncclient/ncclient`_
+
Requirements:
^^^^^^^^^^^^^
-- Python 2.6 <= version < 3.0
+- Python >= 2.6 or Python 3
- setuptools 0.6+
- Paramiko 1.7+
- lxml 3.3.0+
@@ -94,6 +97,15 @@
Changes \| brief
~~~~~~~~~~~~~~~~
+**v0.5.2**
+
+- Add support for Python 3
+- Improve Junos ioproc performance
+- Performance improvements
+- Updated test cases
+- Many bug and performance fixes
+
+
**v0.4.7**
- Add support for netconf 1.1
@@ -153,10 +165,46 @@
Acknowledgements
~~~~~~~~~~~~~~~~
-- v0.4.7: Thanks to all contribs and bug hunters; `Einar Nilsen-Nygaard https://github.com/einarnn`_, `Vaibhav Bajpai https://github.com/vbajpai`_, Norio Nakamoto .
-- v0.4.6: Thanks to all contribs and bug hunters; `Nitin Kumar https://github.com/vnitinv`_, `Carl Moberg https://github.com/cmoberg`_, `Stavros Kroustouris https://github.com/kroustou`_ .
-- v0.4.5: Thanks to all contribs and bug hunters; `Sebastian Wiesinger https://github.com/sebastianw`_, `Vincent Bernat https://github.com/vincentbernat`_, `Matthew Stone https://github.com/bigmstone`_, `Nitin Kumar https://github.com/vnitinv`_.
-- v0.4.3: Thanks to all contributors and bug hunters; `Jeremy Schulman https://github.com/jeremyschulman`_, `Ray Solomon https://github.com/rsolomo`_, `Rick Sherman https://github.com/shermdog`_, `subhak186 https://github.com/subhak186`_.
-- v0.4.2: Thanks to all contributors; `katharh https://github.com/katharh`_, `Francis Luong (Franco) https://github.com/francisluong`_, `Vincent Bernat https://github.com/vincentbernat`_, `Juergen Brendel https://github.com/juergenbrendel`_, `Quentin Loos https://github.com/Kent1`_, `Ray Solomon https://github.com/rsolomo`_, `Sebastian Wiesinger https://github.com/sebastianw`_, `Ebben Aries https://github.com/earies`_ .
-- v0.4.1: Many thanks, primarily to `Jeremy Schulman https://github.com/jeremyschulman`_ (Juniper) for providing his precious feedback, to `Eben Aries https://github.com/earies`_ (Juniper) for his contribution, to Juergen Brendel (Cisco) for the Cisco fork and to all contributors from Cisco and Juniper.
-
+- v0.5.2: `Nitin Kumar`_, `Kristian Larsson`_, `palashgupta`_,
+ `Jonathan Provost`_, `Jainpriyal`_, `sharang`_, `pseguel`_,
+ `nnakamot`_, `Алексей Пастухов`_, `Christian Giese`_, `Peipei Guo`_,
+ `Time Warner Cable Openstack Team`_
+- v0.4.7: `Einar Nilsen-Nygaard`_, `Vaibhav Bajpai`_, Norio Nakamoto
+- v0.4.6: `Nitin Kumar`_, `Carl Moberg`_, `Stavros Kroustouris`_
+- v0.4.5: `Sebastian Wiesinger`_, `Vincent Bernat`_, `Matthew Stone`_,
+ `Nitin Kumar`_
+- v0.4.3: `Jeremy Schulman`_, `Ray Solomon`_, `Rick Sherman`_,
+ `subhak186`_
+- v0.4.2: `katharh`_, `Francis Luong (Franco)`_, `Vincent Bernat`_,
+ `Juergen Brendel`_, `Quentin Loos`_, `Ray Solomon`_, `Sebastian
+ Wiesinger`_, `Ebben Aries`_
+- v0.4.1: `Jeremy Schulman`_, `Ebben Aries`_, Juergen Brendel
+
+.. _Nitin Kumar: https://github.com/vnitinv
+.. _Kristian Larsson: https://github.com/plajjan
+.. _palashgupta: https://github.com/palashgupta
+.. _Jonathan Provost: https://github.com/JoProvost
+.. _Jainpriyal: https://github.com/Jainpriyal
+.. _sharang: https://github.com/sharang
+.. _pseguel: https://github.com/pseguel
+.. _nnakamot: https://github.com/nnakamot
+.. _Алексей Пастухов: https://github.com/p-alik
+.. _Christian Giese: https://github.com/GIC-de
+.. _Peipei Guo: https://github.com/peipeiguo
+.. _Time Warner Cable Openstack Team: https://github.com/twc-openstack
+.. _Einar Nilsen-Nygaard: https://github.com/einarnn
+.. _Vaibhav Bajpai: https://github.com/vbajpai
+.. _Carl Moberg: https://github.com/cmoberg
+.. _Stavros Kroustouris: https://github.com/kroustou
+.. _Sebastian Wiesinger: https://github.com/sebastianw
+.. _Vincent Bernat: https://github.com/vincentbernat
+.. _Matthew Stone: https://github.com/bigmstone
+.. _Jeremy Schulman: https://github.com/jeremyschulman
+.. _Ray Solomon: https://github.com/rsolomo
+.. _Rick Sherman: https://github.com/shermdog
+.. _subhak186: https://github.com/subhak186
+.. _katharh: https://github.com/katharh
+.. _Francis Luong (Franco): https://github.com/francisluong
+.. _Juergen Brendel: https://github.com/juergenbrendel
+.. _Quentin Loos: https://github.com/Kent1
+.. _Ebben Aries: https://github.com/earies
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/examples/nc08.py new/ncclient-0.5.2/examples/nc08.py
--- old/ncclient-0.4.7/examples/nc08.py 1970-01-01 01:00:00.000000000 +0100
+++ new/ncclient-0.5.2/examples/nc08.py 2016-07-05 14:08:16.000000000 +0200
@@ -0,0 +1,34 @@
+#! /usr/bin/env python2.6
+#
+# Configure an Interface: its description and make it active.
+# XML payload created with lxml/etree instead of a template
+#
+# $ ./nc08.py Paulo Seguel
+
+import sys, os, warnings
+warnings.simplefilter("ignore", DeprecationWarning)
+import datetime
+from ncclient import manager
+from lxml import etree
+
+current_time = datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S')
+
+# build xml
+config_e = etree.Element("config")
+configuration = etree.SubElement(config_e, "interface-configurations", nsmap = {None: 'http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg'})
+interface_cfg = etree.SubElement(configuration, "interface-configuration")
+active = etree.SubElement(interface_cfg, "active").text = 'act'
+interface_name = etree.SubElement(interface_cfg, "interface-name").text = 'GigabitEthernet0/0/0/0'
+description = etree.SubElement(interface_cfg, "description").text = 'NETCONF configured - ' + current_time
+
+def demo(host, user, password):
+ with manager.connect(host=host, port=830, username=user, password=password,
+ hostkey_verify=False, device_params={'name':'default'},
+ look_for_keys=False, allow_agent=False) as m:
+ with m.locked(target="candidate"):
+ m.edit_config(config=config_e, default_operation="merge", target="candidate")
+ m.commit()
+
+if __name__ == '__main__':
+ demo(sys.argv[1], sys.argv[2], sys.argv[3])
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/__init__.py new/ncclient-0.5.2/ncclient/__init__.py
--- old/ncclient-0.4.7/ncclient/__init__.py 2016-01-30 07:53:44.000000000 +0100
+++ new/ncclient-0.5.2/ncclient/__init__.py 2016-07-05 14:19:55.000000000 +0200
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-__version__ = (0,4,7)
+__version__ = (0,5,2)
import sys
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/capabilities.py new/ncclient-0.5.2/ncclient/capabilities.py
--- old/ncclient-0.4.7/ncclient/capabilities.py 2015-09-10 07:36:02.000000000 +0200
+++ new/ncclient-0.5.2/ncclient/capabilities.py 2016-02-16 08:59:26.000000000 +0100
@@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import sys
+import six
+
def _abbreviate(uri):
if uri.startswith("urn:ietf:params") and ":netconf:" in uri:
splitted = uri.split(":")
@@ -44,7 +47,7 @@
def __contains__(self, key):
if key in self._dict:
return True
- for abbrs in self._dict.values():
+ for abbrs in six.itervalues(self._dict):
if key in abbrs:
return True
return False
@@ -52,11 +55,12 @@
def __len__(self):
return len(self._dict)
+ # python 2 and 3 compatible
def __iter__(self):
- return self._dict.iterkeys()
+ return six.iterkeys(self._dict)
def __repr__(self):
- return repr(self._dict.keys())
+ return repr(six.iterkeys(self._dict))
def add(self, uri):
"Add a capability."
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/devices/default.py new/ncclient-0.5.2/ncclient/devices/default.py
--- old/ncclient-0.4.7/ncclient/devices/default.py 2016-01-07 02:08:59.000000000 +0100
+++ new/ncclient-0.5.2/ncclient/devices/default.py 2016-02-16 08:59:26.000000000 +0100
@@ -22,6 +22,10 @@
generic information needed for interaction with a Netconf server.
"""
+import sys
+if sys.version >= '3':
+ xrange = range
+
class DefaultDeviceHandler(object):
"""
Default handler for device specific information.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/devices/huawei.py new/ncclient-0.5.2/ncclient/devices/huawei.py
--- old/ncclient-0.4.7/ncclient/devices/huawei.py 2015-11-08 09:14:25.000000000 +0100
+++ new/ncclient-0.5.2/ncclient/devices/huawei.py 2016-07-05 14:08:16.000000000 +0200
@@ -40,6 +40,9 @@
dict["action"] = Action
return dict
+ def handle_raw_dispatch(self, raw):
+ return raw.strip('\0')
+
def get_capabilities(self):
# Just need to replace a single value in the default capabilities
c = super(HuaweiDeviceHandler, self).get_capabilities()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/devices/junos.py new/ncclient-0.5.2/ncclient/devices/junos.py
--- old/ncclient-0.4.7/ncclient/devices/junos.py 2015-09-10 07:36:02.000000000 +0200
+++ new/ncclient-0.5.2/ncclient/devices/junos.py 2016-07-05 14:08:16.000000000 +0200
@@ -12,9 +12,13 @@
"""
+import re
+from lxml import etree
from .default import DefaultDeviceHandler
from ncclient.operations.third_party.juniper.rpc import GetConfiguration, LoadConfiguration, CompareConfiguration
from ncclient.operations.third_party.juniper.rpc import ExecuteRpc, Command, Reboot, Halt, Commit
+from ncclient.operations.rpc import RPCError
+from ncclient.xml_ import to_ele
class JunosDeviceHandler(DefaultDeviceHandler):
"""
@@ -41,8 +45,29 @@
def handle_raw_dispatch(self, raw):
if 'routing-engine' in raw:
- raw = re.sub(r'<ok/>', '</routing-engine>\n<ok/>', raw)
- return raw
+ raw = re.sub(r'<ok/>', '</routing-engine>\n<ok/>', raw)
+ return raw
+ # check if error is during cpapbilites exchange itself
+ elif re.search('\.*?\.*\?', raw, re.M|re.S):
+ errs = re.findall('\.*?\', raw, re.M|re.S)
+ err_list = []
+ if errs:
+ add_ns = """
+ http://www.w3.org/1999/XSL/Transform">
+
+
+
+
+
+
+ """
+ for err in errs:
+ doc = etree.ElementTree(etree.XML(err))
+ # Adding namespace using xslt
+ xslt = etree.XSLT(etree.XML(add_ns))
+ transformed_xml = etree.XML(etree.tostring(xslt(doc)))
+ err_list.append(RPCError(transformed_xml))
+ return RPCError(to_ele(''.join(errs)), err_list)
else:
return False
@@ -53,7 +78,7 @@
return True
def transform_reply(self):
- return '''http://www.w3.org/1999/XSL/Transform">
+ reply = '''http://www.w3.org/1999/XSL/Transform">
@@ -75,3 +100,8 @@
'''
+ import sys
+ if sys.version < '3':
+ return reply
+ else:
+ return reply.encode('UTF-8')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/manager.py new/ncclient-0.5.2/ncclient/manager.py
--- old/ncclient-0.4.7/ncclient/manager.py 2016-01-07 02:08:59.000000000 +0100
+++ new/ncclient-0.5.2/ncclient/manager.py 2016-07-05 14:08:16.000000000 +0200
@@ -18,10 +18,10 @@
It exposes all core functionality.
"""
-import capabilities
-import operations
-import transport
-
+from ncclient import capabilities
+from ncclient import operations
+from ncclient import transport
+import six
import logging
from ncclient.xml_ import *
@@ -145,10 +145,13 @@
def connect(*args, **kwds):
if "host" in kwds:
host = kwds["host"]
- if host != 'localhost':
- return connect_ssh(*args, **kwds)
- else:
+ device_params = kwds.get('device_params', {})
+ if host == 'localhost' and device_params.get('name') == 'junos' \
+ and device_params.get('local'):
return connect_ioproc(*args, **kwds)
+ else:
+ return connect_ssh(*args, **kwds)
+
class OpExecutor(type):
@@ -156,9 +159,9 @@
def make_wrapper(op_cls):
def wrapper(self, *args, **kwds):
return self.execute(op_cls, *args, **kwds)
- wrapper.func_doc = op_cls.request.func_doc
+ wrapper.__doc__ = op_cls.request.__doc__
return wrapper
- for op_name, op_cls in OPERATIONS.iteritems():
+ for op_name, op_cls in six.iteritems(OPERATIONS):
attrs[op_name] = make_wrapper(op_cls)
return super(OpExecutor, cls).__new__(cls, name, bases, attrs)
@@ -166,15 +169,15 @@
def make_wrapper(op_cls):
def wrapper(self, *args, **kwds):
return self.execute(op_cls, *args, **kwds)
- wrapper.func_doc = op_cls.request.func_doc
+ wrapper.__doc__ = op_cls.request.__doc__
return wrapper
if VENDOR_OPERATIONS:
- for op_name, op_cls in VENDOR_OPERATIONS.iteritems():
+ for op_name, op_cls in six.iteritems(VENDOR_OPERATIONS):
setattr(cls, op_name, make_wrapper(op_cls))
return super(OpExecutor, cls).__call__(*args, **kwargs)
-class Manager(object):
+class Manager(six.with_metaclass(OpExecutor, object)):
"""
For details on the expected behavior of the operations and their
@@ -194,7 +197,7 @@
m.close_session()
"""
- __metaclass__ = OpExecutor
+ # __metaclass__ = OpExecutor
def __init__(self, session, device_handler, timeout=30, *args, **kwargs):
self._session = session
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/operations/__init__.py new/ncclient-0.5.2/ncclient/operations/__init__.py
--- old/ncclient-0.4.7/ncclient/operations/__init__.py 2016-01-07 02:08:59.000000000 +0100
+++ new/ncclient-0.5.2/ncclient/operations/__init__.py 2016-02-16 08:59:26.000000000 +0100
@@ -12,16 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from errors import OperationError, TimeoutExpiredError, MissingCapabilityError
-from rpc import RPC, RPCReply, RPCError, RaiseMode
+from ncclient.operations.errors import OperationError, TimeoutExpiredError, MissingCapabilityError
+from ncclient.operations.rpc import RPC, RPCReply, RPCError, RaiseMode
# rfc4741 ops
-from retrieve import Get, GetConfig, GetSchema, GetReply, Dispatch
-from edit import EditConfig, CopyConfig, DeleteConfig, Validate, Commit, DiscardChanges
-from session import CloseSession, KillSession
-from lock import Lock, Unlock, LockContext
+
+from ncclient.operations.retrieve import Get, GetConfig, GetSchema, GetReply, Dispatch
+from ncclient.operations.edit import EditConfig, CopyConfig, DeleteConfig, Validate, Commit, DiscardChanges
+from ncclient.operations.session import CloseSession, KillSession
+from ncclient.operations.lock import Lock, Unlock, LockContext
+
# others...
-from flowmon import PoweroffMachine, RebootMachine
+from ncclient.operations.flowmon import PoweroffMachine, RebootMachine
__all__ = [
'RPC',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/operations/edit.py new/ncclient-0.5.2/ncclient/operations/edit.py
--- old/ncclient-0.4.7/ncclient/operations/edit.py 2015-11-17 23:38:48.000000000 +0100
+++ new/ncclient-0.5.2/ncclient/operations/edit.py 2016-07-05 14:08:16.000000000 +0200
@@ -14,9 +14,9 @@
from ncclient.xml_ import *
-from rpc import RPC
+from ncclient.operations.rpc import RPC
-import util
+from ncclient.operations import util
import logging
@@ -109,17 +109,15 @@
*source* is the name of the configuration datastore being validated or `config` element containing the configuration subtree to be validated
-
- ** modified to only accept valid string as source argument. Elements no longer accepted - earies - 04/22/2013
-
:seealso: :ref:`srctarget_params`"""
node = new_ele("validate")
- # rfc6241 sec 8.6.4 states valid source can be <candidate> or <config> elements
- tags = ("config", "candidate")
- if source not in tags:
- raise XMLError("Invalid source type: [%s], must be one of %s" % (source, tags))
- src_ele = sub_ele(node, "source")
- sub_ele(src_ele, source)
+ if type(source) is str:
+ src = util.datastore_or_url("source", source, self._assert)
+ else:
+ validated_element(source, ("config", qualify("config")))
+ src = new_ele("source")
+ src.append(source)
+ node.append(src)
return self._request(node)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/operations/flowmon.py new/ncclient-0.5.2/ncclient/operations/flowmon.py
--- old/ncclient-0.4.7/ncclient/operations/flowmon.py 2015-09-10 07:36:02.000000000 +0200
+++ new/ncclient-0.5.2/ncclient/operations/flowmon.py 2016-02-16 08:59:26.000000000 +0100
@@ -16,7 +16,7 @@
from ncclient.xml_ import *
-from rpc import RPC
+from ncclient.operations.rpc import RPC
PC_URN = "urn:liberouter:params:xml:ns:netconf:power-control:1.0"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/operations/lock.py new/ncclient-0.5.2/ncclient/operations/lock.py
--- old/ncclient-0.4.7/ncclient/operations/lock.py 2015-09-10 07:36:02.000000000 +0200
+++ new/ncclient-0.5.2/ncclient/operations/lock.py 2016-02-16 08:59:26.000000000 +0100
@@ -16,7 +16,7 @@
from ncclient.xml_ import *
-from rpc import RaiseMode, RPC
+from ncclient.operations.rpc import RaiseMode, RPC
# TODO: parse session-id from a lock-denied error, and raise a tailored exception?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/operations/retrieve.py new/ncclient-0.5.2/ncclient/operations/retrieve.py
--- old/ncclient-0.4.7/ncclient/operations/retrieve.py 2016-01-07 02:08:59.000000000 +0100
+++ new/ncclient-0.5.2/ncclient/operations/retrieve.py 2016-07-05 14:08:16.000000000 +0200
@@ -12,12 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from rpc import RPC, RPCReply
+from ncclient.operations.rpc import RPC, RPCReply
from ncclient.xml_ import *
from lxml import etree
-import util
+from ncclient.operations import util
class GetReply(RPCReply):
@@ -46,6 +46,15 @@
"Same as :attr:`data_ele`"
+class GetSchemaReply(GetReply):
+ """Reply for GetSchema called with specific parsing hook."""
+
+ def _parsing_hook(self, root):
+ self._data = None
+ if not self._errors:
+ self._data = root.find(qualify("data", NETCONF_MONITORING_NS)).text
+
+
class Get(RPC):
"The *get* RPC."
@@ -91,7 +100,7 @@
"""The *get-schema* RPC."""
- REPLY_CLS = GetReply
+ REPLY_CLS = GetSchemaReply
"""See :class:`GetReply`."""
def request(self, identifier, version=None, format=None):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/operations/rpc.py new/ncclient-0.5.2/ncclient/operations/rpc.py
--- old/ncclient-0.4.7/ncclient/operations/rpc.py 2016-01-07 02:08:59.000000000 +0100
+++ new/ncclient-0.5.2/ncclient/operations/rpc.py 2016-07-05 14:08:16.000000000 +0200
@@ -13,12 +13,13 @@
# limitations under the License.
from threading import Event, Lock
-from uuid import uuid1
+from uuid import uuid4
+import six
from ncclient.xml_ import *
from ncclient.transport import SessionListener
-from errors import OperationError, TimeoutExpiredError, MissingCapabilityError
+from ncclient.operations.errors import OperationError, TimeoutExpiredError, MissingCapabilityError
import logging
logger = logging.getLogger("ncclient.operations.rpc")
@@ -41,7 +42,7 @@
self._raw = raw
if errs is None:
# Single RPCError
- for attr in RPCError.tag_to_attr.values():
+ for attr in six.itervalues(RPCError.tag_to_attr):
setattr(self, attr, None)
for subele in raw:
attr = RPCError.tag_to_attr.get(subele.tag, None)
@@ -75,7 +76,7 @@
OperationError.__init__(self, self.message)
def to_dict(self):
- return dict([ (attr[1:], getattr(self, attr)) for attr in RPCError.tag_to_attr.values() ])
+ return dict([ (attr[1:], getattr(self, attr)) for attr in six.itervalues(RPCError.tag_to_attr) ])
@property
def xml(self):
@@ -227,7 +228,7 @@
def errback(self, err):
try:
- for rpc in self._id2rpc.values():
+ for rpc in six.itervalues(self._id2rpc):
rpc.deliver_error(err)
finally:
self._id2rpc.clear()
@@ -284,7 +285,7 @@
self._async = async
self._timeout = timeout
self._raise_mode = raise_mode
- self._id = uuid1().urn # Keeps things simple instead of having a class attr with running ID that has to be locked
+ self._id = uuid4().urn # Keeps things simple instead of having a class attr with running ID that has to be locked
self._listener = RPCReplyListener(session, device_handler)
self._listener.register(self._id, self)
self._reply = None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/operations/session.py new/ncclient-0.5.2/ncclient/operations/session.py
--- old/ncclient-0.4.7/ncclient/operations/session.py 2015-09-10 07:36:02.000000000 +0200
+++ new/ncclient-0.5.2/ncclient/operations/session.py 2016-02-16 08:59:26.000000000 +0100
@@ -16,7 +16,7 @@
from ncclient.xml_ import *
-from rpc import RPC
+from ncclient.operations.rpc import RPC
class CloseSession(RPC):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/operations/third_party/huawei/rpc.py new/ncclient-0.5.2/ncclient/operations/third_party/huawei/rpc.py
--- old/ncclient-0.4.7/ncclient/operations/third_party/huawei/rpc.py 2015-11-08 09:14:26.000000000 +0100
+++ new/ncclient-0.5.2/ncclient/operations/third_party/huawei/rpc.py 2016-07-05 14:08:16.000000000 +0200
@@ -14,13 +14,14 @@
Configuration system view exec
"""
# node = new_ele("execute-cli")
- node = new_ele('execute-cli', attrs={"xmlns":HW_PRIVATE_NS})
+ node = new_ele("execute-cli", attrs={"xmlns":HW_PRIVATE_NS})
node.append(validated_element(command))
return self._request(node)
class Action(RPC):
+ "`execute-action` RPC"
def request(self, action=None):
- node = new_ele("action")
+ node = new_ele("execute-action", attrs={"xmlns":HW_PRIVATE_NS})
node.append(validated_element(action))
return self._request(node)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/operations/util.py new/ncclient-0.5.2/ncclient/operations/util.py
--- old/ncclient-0.4.7/ncclient/operations/util.py 2015-09-10 07:36:02.000000000 +0200
+++ new/ncclient-0.5.2/ncclient/operations/util.py 2016-02-16 08:59:26.000000000 +0100
@@ -16,7 +16,7 @@
from ncclient.xml_ import *
-from errors import OperationError, MissingCapabilityError
+from ncclient.operations.errors import OperationError, MissingCapabilityError
def one_of(*args):
"Verifies that only one of the arguments is not None"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/transport/__init__.py new/ncclient-0.5.2/ncclient/transport/__init__.py
--- old/ncclient-0.4.7/ncclient/transport/__init__.py 2015-09-10 07:36:02.000000000 +0200
+++ new/ncclient-0.5.2/ncclient/transport/__init__.py 2016-02-16 08:59:26.000000000 +0100
@@ -14,9 +14,9 @@
"Transport layer"
-from session import Session, SessionListener
-from ssh import SSHSession
-from errors import *
+from ncclient.transport.session import Session, SessionListener
+from ncclient.transport.ssh import SSHSession
+from ncclient.transport.errors import *
__all__ = [
'Session',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/transport/errors.py new/ncclient-0.5.2/ncclient/transport/errors.py
--- old/ncclient-0.4.7/ncclient/transport/errors.py 2015-06-24 22:56:02.000000000 +0200
+++ new/ncclient-0.5.2/ncclient/transport/errors.py 2016-07-05 14:08:16.000000000 +0200
@@ -24,6 +24,9 @@
class AuthenticationError(TransportError):
pass
+class PermissionError(TransportError):
+ pass
+
class SessionCloseError(TransportError):
def __init__(self, in_buf, out_buf=None):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/transport/session.py new/ncclient-0.5.2/ncclient/transport/session.py
--- old/ncclient-0.4.7/ncclient/transport/session.py 2016-01-07 01:38:29.000000000 +0100
+++ new/ncclient-0.5.2/ncclient/transport/session.py 2016-07-05 14:08:16.000000000 +0200
@@ -15,16 +15,17 @@
import re
-
-from Queue import Queue
+import sys
+import logging
from threading import Thread, Lock, Event
-
+try:
+ from Queue import Queue
+except ImportError:
+ from queue import Queue
from ncclient.xml_ import *
from ncclient.capabilities import Capabilities
+from ncclient.transport.errors import TransportError, SessionError
-from errors import TransportError, SessionError
-
-import logging
logger = logging.getLogger('ncclient.transport.session')
@@ -51,9 +52,12 @@
try:
root = parse_root(raw)
except Exception as e:
- if self._device_handler.handle_raw_dispatch(raw):
- raw = self._device_handler.handle_raw_dispatch(raw)
- root = parse_root(raw)
+ device_handled_raw=self._device_handler.handle_raw_dispatch(raw)
+ if isinstance(device_handled_raw, str):
+ root = parse_root(device_handled_raw)
+ elif isinstance(device_handled_raw, Exception):
+ self._dispatch_error(device_handled_raw)
+ return
else:
logger.error('error parsing dispatch message: %s' % e)
return
@@ -231,7 +235,11 @@
hello = new_ele("hello", **xml_namespace_kwargs)
caps = sub_ele(hello, "capabilities")
def fun(uri): sub_ele(caps, "capability").text = uri
- map(fun, capabilities)
+ #python3 changes
+ if sys.version < '3':
+ map(fun, capabilities)
+ else:
+ list(map(fun, capabilities))
return to_xml(hello)
@staticmethod
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/transport/ssh.py new/ncclient-0.5.2/ncclient/transport/ssh.py
--- old/ncclient-0.4.7/ncclient/transport/ssh.py 2016-01-07 02:08:59.000000000 +0100
+++ new/ncclient-0.5.2/ncclient/transport/ssh.py 2016-07-05 14:19:33.000000000 +0200
@@ -18,15 +18,15 @@
import socket
import getpass
from binascii import hexlify
-from cStringIO import StringIO
+from lxml import etree
from select import select
from ncclient.capabilities import Capabilities
import paramiko
-from errors import AuthenticationError, SessionCloseError, SSHError, SSHUnknownHostError
-from session import Session
+from ncclient.transport.errors import AuthenticationError, SessionCloseError, SSHError, SSHUnknownHostError
+from ncclient.transport.session import Session
from ncclient.xml_ import *
import logging
@@ -35,6 +35,7 @@
BUF_SIZE = 4096
# v1.0: RFC 4742
MSG_DELIM = "]]>]]>"
+MSG_DELIM_LEN = len(MSG_DELIM)
# v1.1: RFC 6242
END_DELIM = '\n##\n'
@@ -54,11 +55,26 @@
return False
def _colonify(fp):
+ fp = fp.decode('UTF-8')
finga = fp[:2]
for idx in range(2, len(fp), 2):
finga += ":" + fp[idx:idx+2]
return finga
+if sys.version < '3':
+ def textify(buf):
+ return buf
+else:
+ def textify(buf):
+ return buf.decode('UTF-8')
+
+if sys.version < '3':
+ from six import StringIO
+else:
+ from io import BytesIO as StringIO
+
+
+
class SSHSession(Session):
"Implements a :rfc:`4742` NETCONF session over SSH."
@@ -72,7 +88,7 @@
self._channel = None
self._channel_id = None
self._channel_name = None
- self._buffer = StringIO() # for incoming data
+ self._buffer = StringIO()
# parsing-related, see _parse()
self._device_handler = device_handler
self._parsing_state10 = 0
@@ -93,48 +109,29 @@
"""Messages are delimited by MSG_DELIM. The buffer could have grown by
a maximum of BUF_SIZE bytes everytime this method is called. Retains
- state across method calls and if a byte has been read it will not be
+ state across method calls and if a chunk has been read it will not be
considered again."""
logger.debug("parsing netconf v1.0")
- delim = MSG_DELIM
- n = len(delim) - 1
- expect = self._parsing_state10
buf = self._buffer
buf.seek(self._parsing_pos10)
- while True:
- x = buf.read(1)
- if not x: # done reading
- break
- elif x == delim[expect]: # what we expected
- expect += 1 # expect the next delim char
+ if MSG_DELIM in buf.read().decode('UTF-8'):
+ buf.seek(0)
+ msg, _, remaining = buf.read().decode('UTF-8').partition(MSG_DELIM)
+ msg = msg.strip()
+ if sys.version < '3':
+ self._dispatch_message(msg.encode())
else:
- expect = 0
- continue
- # loop till last delim char expected, break if other char encountered
- for i in range(expect, n):
- x = buf.read(1)
- if not x: # done reading
- break
- if x == delim[expect]: # what we expected
- expect += 1 # expect the next delim char
- else:
- expect = 0 # reset
- break
- else: # if we didn't break out of the loop, full delim was parsed
- msg_till = buf.tell() - n
- buf.seek(0)
- logger.debug('parsed new message')
- self._dispatch_message(buf.read(msg_till).strip())
- buf.seek(n+1, os.SEEK_CUR)
- rest = buf.read()
- buf = StringIO()
- buf.write(rest)
- buf.seek(0)
- expect = 0
- self._buffer = buf
- self._parsing_state10 = expect
- self._parsing_pos10 = self._buffer.tell()
+ self._dispatch_message(msg)
+ # create new buffer which contains remaining of old buffer
+ self._buffer = StringIO()
+ self._buffer.write(remaining.encode())
+ self._parsing_pos10 = 0
+ else:
+ # handle case that MSG_DELIM is split over two chunks
+ self._parsing_pos10 = buf.tell() - MSG_DELIM_LEN
+ if self._parsing_pos10 < 0:
+ self._parsing_pos10 = 0
def _parse11(self):
logger.debug("parsing netconf v1.1")
@@ -144,7 +141,7 @@
state = self._parsing_state11
inendpos = self._inendpos
num_list = self._size_num_list
- MAX_STARTCHUNK_SIZE = 10 # 4294967295
+ MAX_STARTCHUNK_SIZE = 12 # \#+4294967295+\n
pre = 'invalid base:1:1 frame'
buf = self._buffer
buf.seek(self._parsing_pos11)
@@ -156,12 +153,12 @@
if not x:
logger.debug('No more data to read')
# Store the current chunk to the message list
- chunk = ''.join(chunk_list)
- message_list.append(chunk)
+ chunk = b''.join(chunk_list)
+ message_list.append(textify(chunk))
break # done reading
logger.debug('x: %s', x)
if state == idle:
- if x == '\n':
+ if x == b'\n':
state = instart
inendpos = 1
else:
@@ -169,7 +166,7 @@
raise Exception
elif state == instart:
if inendpos == 1:
- if x == '#':
+ if x == b'#':
inendpos += 1
else:
logger.debug('%s (%s: expect "#")'%(pre, state))
@@ -185,10 +182,10 @@
if inendpos == MAX_STARTCHUNK_SIZE:
logger.debug('%s (%s: no. too long)'%(pre, state))
raise Exception
- elif x == '\n':
- num = ''.join(num_list)
+ elif x == b'\n':
+ num = b''.join(num_list)
num_list = [] # Reset num_list
- try: num = long(num)
+ try: num = int(num)
except:
logger.debug('%s (%s: invalid no.)'%(pre, state))
raise Exception
@@ -202,7 +199,7 @@
inendpos += 1 # > 3 now #
num_list.append(x)
else:
- log.debug('%s (%s: expect digit)'%(pre, state))
+ logger.debug('%s (%s: expect digit)'%(pre, state))
raise Exception
elif state == inmsg:
chunk_list.append(x)
@@ -211,24 +208,24 @@
if chunkleft == 0:
inendpos = 0
state = inbetween
- chunk = ''.join(chunk_list)
- message_list.append(chunk)
- chunk_list = [] # Reset chunk_list
+ chunk = b''.join(chunk_list)
+ message_list.append(textify(chunk))
+ chunk_list = [] # Reset chunk_list
logger.debug('parsed new chunk: %s'%(chunk))
elif state == inbetween:
if inendpos == 0:
- if x == '\n': inendpos += 1
+ if x == b'\n': inendpos += 1
else:
logger.debug('%s (%s: expect newline)'%(pre, state))
raise Exception
elif inendpos == 1:
- if x == '#': inendpos += 1
+ if x == b'#': inendpos += 1
else:
logger.debug('%s (%s: expect "#")'%(pre, state))
raise Exception
else:
inendpos += 1 # == 3 now #
- if x == '#':
+ if x == b'#':
state = inend
elif x.isdigit():
# More trunks
@@ -240,14 +237,14 @@
raise Exception
elif state == inend:
if inendpos == 3:
- if x == '\n':
+ if x == b'\n':
inendpos = 0
state = idle
logger.debug('dispatching message')
self._dispatch_message(''.join(message_list))
# reset
rest = buf.read()
- buf = StringIO()
+ buf = BytesIO()
buf.write(rest)
buf.seek(0)
message_list = []
@@ -301,7 +298,7 @@
self._transport.close()
self._channel = None
self._connected = False
-
+
# REMEMBER to update transport.rst if sig. changes, since it is hardcoded there
def connect(self, host, port=830, timeout=None, unknown_host_cb=default_unknown_host_cb,
@@ -373,6 +370,8 @@
t = self._transport = paramiko.Transport(sock)
t.set_log_channel(logger.name)
+ if config.get("compression") == 'yes':
+ t.use_compression()
try:
t.start_client()
@@ -391,7 +390,7 @@
if key_filename is None:
key_filenames = []
- elif isinstance(key_filename, basestring):
+ elif isinstance(key_filename, (str, bytes)):
key_filenames = [ key_filename ]
else:
key_filenames = key_filename
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/transport/third_party/junos/ioproc.py new/ncclient-0.5.2/ncclient/transport/third_party/junos/ioproc.py
--- old/ncclient-0.4.7/ncclient/transport/third_party/junos/ioproc.py 2015-09-10 07:36:02.000000000 +0200
+++ new/ncclient-0.5.2/ncclient/transport/third_party/junos/ioproc.py 2016-07-05 14:13:37.000000000 +0200
@@ -1,13 +1,21 @@
import os
-from cStringIO import StringIO
+import sys
+import re
+
+if sys.version < '3':
+ from cStringIO import StringIO
+else:
+ from io import StringIO
from select import select
-from subprocess import Popen, PIPE, STDOUT
+if sys.version>='2.7':
+ from subprocess import Popen, check_output, PIPE, STDOUT
+else:
+ from subprocess import Popen, PIPE, STDOUT
-from ncclient.transport.errors import SessionCloseError, TransportError
+from ncclient.transport.errors import SessionCloseError, TransportError, PermissionError
from ncclient.transport.ssh import SSHSession
MSG_DELIM = "]]>]]>"
-TICK = 0.1
NETCONF_SHELL = 'xml-mode netconf need-trailer'
@@ -28,11 +36,21 @@
self._device_handler = device_handler
def close(self):
- self._channel.kill()
+ self._channel.wait()
+ self._channel = None
self._connected = False
def connect(self):
-
+ stdoutdata = check_output(NETCONF_SHELL, shell=True, stdin=PIPE,
+ stderr=STDOUT)
+ if 'error: Restricted user session' in stdoutdata:
+ obj = re.search(r'<error-message>\n?(.*)\n?</error-message>', stdoutdata, re.M)
+ if obj:
+ raise PermissionError(obj.group(1))
+ else:
+ raise PermissionError('Restricted user session')
+ elif 'xml-mode: command not found' in stdoutdata:
+ raise PermissionError('xml-mode: command not found')
self._channel = Popen(NETCONF_SHELL, shell=True,
stdin=PIPE, stdout=PIPE, stderr=STDOUT)
self._connected = True
@@ -46,27 +64,22 @@
q = self._q
try:
while True:
- r, w, e = select([chan.stdout], [], [], TICK)
- data = ''
- if r:
- while True:
- data += chan.stdout.readline()
- if MSG_DELIM in data:
- break
- if data:
- self._buffer.write(data)
- self._parse()
- else:
- raise SessionCloseError(self._buffer.getvalue())
- if not q.empty():
- data = q.get() + MSG_DELIM
- while data:
- chan.stdin.write(data)
- chan.stdin.flush()
- data = False
+ # write
+ data = q.get() + MSG_DELIM
+ chan.stdin.write(data)
+ chan.stdin.flush()
+ # read
+ data = []
+ while True:
+ line = chan.stdout.readline()
+ data.append(line)
+ if MSG_DELIM in line:
+ break
+ self._buffer.write(b''.join(data))
+ self._parse()
except Exception as e:
- self.close()
self._dispatch_error(e)
+ self.close()
@property
def transport(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient/xml_.py new/ncclient-0.5.2/ncclient/xml_.py
--- old/ncclient-0.4.7/ncclient/xml_.py 2016-01-07 02:08:59.000000000 +0100
+++ new/ncclient-0.5.2/ncclient/xml_.py 2016-07-05 14:08:16.000000000 +0200
@@ -17,8 +17,10 @@
import io
-
-from StringIO import StringIO
+import sys
+import six
+from six import StringIO
+from io import BytesIO
from lxml import etree
# In case issues come up with XML generation/parsing
@@ -71,7 +73,7 @@
# cElementTree uses ElementTree's _namespace_map, so that's ok
ElementTree._namespace_map[uri] = prefix
-for (ns, pre) in {
+for (ns, pre) in six.iteritems({
BASE_NS_1_0: 'nc',
NETCONF_MONITORING_NS: 'ncm',
NXOS_1_0: 'nxos',
@@ -81,7 +83,7 @@
CISCO_CPI_1_0: 'cpi',
FLOWMON_1_0: 'fm',
JUNIPER_1_1: 'junos',
-}.items():
+}):
register_namespace(pre, ns)
qualify = lambda tag, ns=BASE_NS_1_0: tag if ns is None else "{%s}%s" % (ns, tag)
@@ -91,15 +93,25 @@
def to_xml(ele, encoding="UTF-8", pretty_print=False):
"Convert and return the XML for an *ele* (:class:`~xml.etree.ElementTree.Element`) with specified *encoding*."
xml = etree.tostring(ele, encoding=encoding, pretty_print=pretty_print)
- return xml if xml.startswith('<?xml') else '<?xml version="1.0" encoding="%s"?>%s' % (encoding, xml)
+ if sys.version < '3':
+ return xml if xml.startswith('<?xml') else '<?xml version="1.0" encoding="%s"?>%s' % (encoding, xml)
+ else:
+ return xml.decode('UTF-8') if xml.startswith(b'<?xml') \
+ else '<?xml version="1.0" encoding="%s"?>%s' % (encoding, xml.decode('UTF-8'))
def to_ele(x):
"Convert and return the :class:`~xml.etree.ElementTree.Element` for the XML document *x*. If *x* is already an :class:`~xml.etree.ElementTree.Element` simply returns that."
- return x if etree.iselement(x) else etree.fromstring(x, parser=parser)
+ if sys.version < '3':
+ return x if etree.iselement(x) else etree.fromstring(x, parser=parser)
+ else:
+ return x if etree.iselement(x) else etree.fromstring(x.encode('UTF-8'), parser=parser)
def parse_root(raw):
"Efficiently parses the root element of a *raw* XML document, returning a tuple of its qualified name and attribute dictionary."
- fp = StringIO(raw)
+ if sys.version < '3':
+ fp = StringIO(raw)
+ else:
+ fp = BytesIO(raw.encode('UTF-8'))
for event, element in etree.iterparse(fp, events=('start',)):
return (element.tag, element.attrib)
@@ -114,13 +126,13 @@
"""
ele = to_ele(x)
if tags:
- if isinstance(tags, basestring):
+ if isinstance(tags, (str, bytes)):
tags = [tags]
if ele.tag not in tags:
raise XMLError("Element [%s] does not meet requirement" % ele.tag)
if attrs:
for req in attrs:
- if isinstance(req, basestring): req = [req]
+ if isinstance(req, (str, bytes)): req = [req]
for alt in req:
if alt in ele.attrib:
break
@@ -161,7 +173,10 @@
def __str__(self):
"""syntactic sugar for str() - alias to tostring"""
- return self.tostring
+ if sys.version<'3':
+ return self.tostring
+ else:
+ return self.tostring.decode('UTF-8')
@property
def tostring(self):
@@ -181,7 +196,7 @@
self.__parser = etree.XMLParser(remove_blank_text=True)
self.__xslt_doc = etree.parse(io.BytesIO(self.__xslt), self.__parser)
self.__transform = etree.XSLT(self.__xslt_doc)
- self.__root = etree.fromstring(str(self.__transform(etree.parse(StringIO(rpc_reply)))))
+ self.__root = etree.fromstring(str(self.__transform(etree.parse(StringIO(str(rpc_reply))))))
return self.__root
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient.egg-info/PKG-INFO new/ncclient-0.5.2/ncclient.egg-info/PKG-INFO
--- old/ncclient-0.4.7/ncclient.egg-info/PKG-INFO 2016-01-30 08:08:05.000000000 +0100
+++ new/ncclient-0.5.2/ncclient.egg-info/PKG-INFO 2016-07-05 14:26:59.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: ncclient
-Version: 0.4.7
+Version: 0.5.2
Summary: Python library for NETCONF clients
Home-page: http://ncclient.org
Author: Shikhar Bhushan, Leonidas Poulopoulos, Ebben Aries
@@ -12,15 +12,18 @@
ncclient is a Python library that facilitates client-side scripting and
application development around the NETCONF protocol. ``ncclient`` was
developed by `Shikar Bhushan http://schmizz.net`_. It is now
- maintained by `Leonidas Poulopoulos (@leopoul) http://ncclient.org/ncclient`_
+ maintained by `Leonidas Poulopoulos (@leopoul) http://ncclient.org`_
Docs:
`http://ncclient.readthedocs.org http://ncclient.readthedocs.org`_
+ Github:
+ `https://github.com/ncclient/ncclient https://github.com/ncclient/ncclient`_
+
Requirements:
^^^^^^^^^^^^^
- - Python 2.6 <= version < 3.0
+ - Python >= 2.6 or Python 3
- setuptools 0.6+
- Paramiko 1.7+
- lxml 3.3.0+
@@ -102,6 +105,15 @@
Changes \| brief
~~~~~~~~~~~~~~~~
+ **v0.5.2**
+
+ - Add support for Python 3
+ - Improve Junos ioproc performance
+ - Performance improvements
+ - Updated test cases
+ - Many bug and performance fixes
+
+
**v0.4.7**
- Add support for netconf 1.1
@@ -161,19 +173,55 @@
Acknowledgements
~~~~~~~~~~~~~~~~
- - v0.4.7: Thanks to all contribs and bug hunters; `Einar Nilsen-Nygaard https://github.com/einarnn`_, `Vaibhav Bajpai https://github.com/vbajpai`_, Norio Nakamoto .
- - v0.4.6: Thanks to all contribs and bug hunters; `Nitin Kumar https://github.com/vnitinv`_, `Carl Moberg https://github.com/cmoberg`_, `Stavros Kroustouris https://github.com/kroustou`_ .
- - v0.4.5: Thanks to all contribs and bug hunters; `Sebastian Wiesinger https://github.com/sebastianw`_, `Vincent Bernat https://github.com/vincentbernat`_, `Matthew Stone https://github.com/bigmstone`_, `Nitin Kumar https://github.com/vnitinv`_.
- - v0.4.3: Thanks to all contributors and bug hunters; `Jeremy Schulman https://github.com/jeremyschulman`_, `Ray Solomon https://github.com/rsolomo`_, `Rick Sherman https://github.com/shermdog`_, `subhak186 https://github.com/subhak186`_.
- - v0.4.2: Thanks to all contributors; `katharh https://github.com/katharh`_, `Francis Luong (Franco) https://github.com/francisluong`_, `Vincent Bernat https://github.com/vincentbernat`_, `Juergen Brendel https://github.com/juergenbrendel`_, `Quentin Loos https://github.com/Kent1`_, `Ray Solomon https://github.com/rsolomo`_, `Sebastian Wiesinger https://github.com/sebastianw`_, `Ebben Aries https://github.com/earies`_ .
- - v0.4.1: Many thanks, primarily to `Jeremy Schulman https://github.com/jeremyschulman`_ (Juniper) for providing his precious feedback, to `Eben Aries https://github.com/earies`_ (Juniper) for his contribution, to Juergen Brendel (Cisco) for the Cisco fork and to all contributors from Cisco and Juniper.
-
-
+ - v0.5.2: `Nitin Kumar`_, `Kristian Larsson`_, `palashgupta`_,
+ `Jonathan Provost`_, `Jainpriyal`_, `sharang`_, `pseguel`_,
+ `nnakamot`_, `Алексей Пастухов`_, `Christian Giese`_, `Peipei Guo`_,
+ `Time Warner Cable Openstack Team`_
+ - v0.4.7: `Einar Nilsen-Nygaard`_, `Vaibhav Bajpai`_, Norio Nakamoto
+ - v0.4.6: `Nitin Kumar`_, `Carl Moberg`_, `Stavros Kroustouris`_
+ - v0.4.5: `Sebastian Wiesinger`_, `Vincent Bernat`_, `Matthew Stone`_,
+ `Nitin Kumar`_
+ - v0.4.3: `Jeremy Schulman`_, `Ray Solomon`_, `Rick Sherman`_,
+ `subhak186`_
+ - v0.4.2: `katharh`_, `Francis Luong (Franco)`_, `Vincent Bernat`_,
+ `Juergen Brendel`_, `Quentin Loos`_, `Ray Solomon`_, `Sebastian
+ Wiesinger`_, `Ebben Aries`_
+ - v0.4.1: `Jeremy Schulman`_, `Ebben Aries`_, Juergen Brendel
+
+ .. _Nitin Kumar: https://github.com/vnitinv
+ .. _Kristian Larsson: https://github.com/plajjan
+ .. _palashgupta: https://github.com/palashgupta
+ .. _Jonathan Provost: https://github.com/JoProvost
+ .. _Jainpriyal: https://github.com/Jainpriyal
+ .. _sharang: https://github.com/sharang
+ .. _pseguel: https://github.com/pseguel
+ .. _nnakamot: https://github.com/nnakamot
+ .. _Алексей Пастухов: https://github.com/p-alik
+ .. _Christian Giese: https://github.com/GIC-de
+ .. _Peipei Guo: https://github.com/peipeiguo
+ .. _Time Warner Cable Openstack Team: https://github.com/twc-openstack
+ .. _Einar Nilsen-Nygaard: https://github.com/einarnn
+ .. _Vaibhav Bajpai: https://github.com/vbajpai
+ .. _Carl Moberg: https://github.com/cmoberg
+ .. _Stavros Kroustouris: https://github.com/kroustou
+ .. _Sebastian Wiesinger: https://github.com/sebastianw
+ .. _Vincent Bernat: https://github.com/vincentbernat
+ .. _Matthew Stone: https://github.com/bigmstone
+ .. _Jeremy Schulman: https://github.com/jeremyschulman
+ .. _Ray Solomon: https://github.com/rsolomo
+ .. _Rick Sherman: https://github.com/shermdog
+ .. _subhak186: https://github.com/subhak186
+ .. _katharh: https://github.com/katharh
+ .. _Francis Luong (Franco): https://github.com/francisluong
+ .. _Juergen Brendel: https://github.com/juergenbrendel
+ .. _Quentin Loos: https://github.com/Kent1
+ .. _Ebben Aries: https://github.com/earies
Keywords: NETCONF,NETCONF Python client,Juniper Optimization,Cisco NXOS Optimization
Platform: Posix; OS X; Windows
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: System :: Networking
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient.egg-info/SOURCES.txt new/ncclient-0.5.2/ncclient.egg-info/SOURCES.txt
--- old/ncclient-0.4.7/ncclient.egg-info/SOURCES.txt 2016-01-30 08:08:06.000000000 +0100
+++ new/ncclient-0.5.2/ncclient.egg-info/SOURCES.txt 2016-07-05 14:26:59.000000000 +0200
@@ -24,6 +24,7 @@
examples/nc05.py
examples/nc06.py
examples/nc07.py
+examples/nc08.py
examples/nxosapi.py
examples/juniper/command-jnpr.py
examples/juniper/compare-config-jnpr.py
@@ -55,6 +56,7 @@
ncclient.egg-info/PKG-INFO
ncclient.egg-info/SOURCES.txt
ncclient.egg-info/dependency_links.txt
+ncclient.egg-info/pbr.json
ncclient.egg-info/requires.txt
ncclient.egg-info/top_level.txt
ncclient/devices/__init__.py
@@ -97,5 +99,4 @@
ncclient/transport/ssh.py
ncclient/transport/third_party/__init__.py
ncclient/transport/third_party/junos/__init__.py
-ncclient/transport/third_party/junos/ioproc.py
-test/test_xml_.py
\ No newline at end of file
+ncclient/transport/third_party/junos/ioproc.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient.egg-info/pbr.json new/ncclient-0.5.2/ncclient.egg-info/pbr.json
--- old/ncclient-0.4.7/ncclient.egg-info/pbr.json 1970-01-01 01:00:00.000000000 +0100
+++ new/ncclient-0.5.2/ncclient.egg-info/pbr.json 2016-03-18 14:11:03.000000000 +0100
@@ -0,0 +1 @@
+{"is_release": false, "git_version": "6cec9b9"}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/ncclient.egg-info/requires.txt new/ncclient-0.5.2/ncclient.egg-info/requires.txt
--- old/ncclient-0.4.7/ncclient.egg-info/requires.txt 2016-01-30 08:08:05.000000000 +0100
+++ new/ncclient-0.5.2/ncclient.egg-info/requires.txt 2016-07-05 14:26:59.000000000 +0200
@@ -1,3 +1,4 @@
setuptools>0.6
paramiko>=1.7.7.1
lxml>=3.3.0
+six
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/requirements.txt new/ncclient-0.5.2/requirements.txt
--- old/ncclient-0.4.7/requirements.txt 2016-01-30 07:39:24.000000000 +0100
+++ new/ncclient-0.5.2/requirements.txt 2016-02-16 08:59:26.000000000 +0100
@@ -1,3 +1,4 @@
setuptools>0.6
paramiko>=1.7.7.1
lxml>=3.3.0
+six
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/setup.py new/ncclient-0.5.2/setup.py
--- old/ncclient-0.4.7/setup.py 2016-01-30 07:37:17.000000000 +0100
+++ new/ncclient-0.5.2/setup.py 2016-07-05 14:25:03.000000000 +0200
@@ -1,5 +1,5 @@
# Copyright 2009 Shikhar Bhushan
-# Copyright 201[2-4] Leonidas Poulopoulos (@leopoul)
+# Copyright 201[2-5] Leonidas Poulopoulos (@leopoul)
# Copyright 2013 Ebben Aries
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,12 +20,8 @@
import sys
import platform
-if not sys.version_info[0] == 2:
- print "Sorry, Python 3 is not supported (yet)"
- exit()
-
if sys.version_info[0] == 2 and sys.version_info[1] < 6:
- print "Sorry, Python < 2.6 is not supported"
+ print ("Sorry, Python < 2.6 is not supported")
exit()
#parse requirements
@@ -37,7 +33,7 @@
setup(name='ncclient',
- version='0.4.7',
+ version='0.5.2',
description="Python library for NETCONF clients",
long_description = long_description,
author="Shikhar Bhushan, Leonidas Poulopoulos, Ebben Aries",
@@ -52,6 +48,7 @@
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3.4',
'Topic :: System :: Networking',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.4.7/test/test_xml_.py new/ncclient-0.5.2/test/test_xml_.py
--- old/ncclient-0.4.7/test/test_xml_.py 2015-09-10 07:36:02.000000000 +0200
+++ new/ncclient-0.5.2/test/test_xml_.py 1970-01-01 01:00:00.000000000 +0100
@@ -1,52 +0,0 @@
-# python
-
-from ncclient import manager
-from ncclient.xml_ import *
-
-from nose.tools import assert_equal
-from nose.tools import assert_not_equal
-from nose.tools import assert_raises
-from nose.tools import raises
-
-
-class Test_NCElement(object):
-
- def test_ncelement_reply_001(self):
- """test parse rpc_reply and string/data_xml"""
- #read in reply1 contents
- with open('test/reply1', 'r') as f:
- reply = f.read()
- device_params = {'name':'junos'}
- device_handler = manager.make_device_handler(device_params)
- transform_reply = device_handler.transform_reply()
- result = NCElement(reply, transform_reply)
- assert_equal(str(result), result.tostring)
- #data_xml != tostring
- assert_not_equal(result.tostring, result.data_xml)
-
- def test_ncelement_reply_002(self):
- """test parse rpc_reply and xpath"""
- #read in reply1 contents
- with open('test/reply1', 'r') as f:
- reply = f.read()
- device_params = {'name':'junos'}
- device_handler = manager.make_device_handler(device_params)
- transform_reply = device_handler.transform_reply()
- result = NCElement(reply, transform_reply)
- #XPATH checks work
- assert_equal(result.xpath("//host-name")[0].text,"R1")
- assert_equal(result.xpath("/rpc-reply/software-information/host-name")[0].text,"R1")
- assert_equal(result.xpath("software-information/host-name")[0].text,"R1")
-
- def test_ncelement_reply_003(self):
- """test parse rpc_reply and find"""
- #read in reply1 contents
- with open('test/reply1', 'r') as f:
- reply = f.read()
- device_params = {'name':'junos'}
- device_handler = manager.make_device_handler(device_params)
- transform_reply = device_handler.transform_reply()
- result = NCElement(reply, transform_reply)
- #find
- assert_equal(result.findtext(".//host-name"),"R1")
- assert_equal(result.find(".//host-name").tag,"host-name")
++++++ pr-109.patch ++++++
--- /var/tmp/diff_new_pack.HEhhtT/_old 2016-09-07 11:47:34.000000000 +0200
+++ /var/tmp/diff_new_pack.HEhhtT/_new 2016-09-07 11:47:34.000000000 +0200
@@ -1,22 +1,10 @@
-From 955cb0dd3e4246575e79867236930c1348bdb5bf Mon Sep 17 00:00:00 2001
-From: Thomas Bechtold
-Date: Fri, 5 Feb 2016 10:32:50 +0100
-Subject: [PATCH] Lower required lxml version
-
-ncclient doesn't use any features of the newest lxml module.
-So lower the requirement.
-This is useful for distributions (in my case SLES) which don't
-have the latest and greatest version.
----
- requirements.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-Index: ncclient-0.4.7/requirements.txt
-===================================================================
---- ncclient-0.4.7.orig/requirements.txt
-+++ ncclient-0.4.7/requirements.txt
-@@ -1,3 +1,3 @@
+diff --git a/requirements.txt b/requirements.txt
+index 6c1ff6c..b833698 100644
+--- a/requirements.txt
++++ b/requirements.txt
+@@ -1,4 +1,4 @@
setuptools>0.6
paramiko>=1.7.7.1
-lxml>=3.3.0
+lxml>=3.1
+ six