Hello community, here is the log from the commit of package python-ncclient for openSUSE:Factory checked in at 2017-08-28 15:31:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-ncclient (Old) and /work/SRC/openSUSE:Factory/.python-ncclient.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-ncclient" Mon Aug 28 15:31:14 2017 rev:6 rq:514958 version:0.5.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-ncclient/python-ncclient.changes 2016-09-07 11:47:32.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-ncclient.new/python-ncclient.changes 2017-08-28 15:31:16.385753187 +0200 @@ -0,0 +1,11 @@ + +------------------------------------------------------------------- +Mon Aug 7 08:36:21 UTC 2017 - [email protected] + +- Update to 0.5.3 + * Add notifications support + * Add support for ecdsa keys + * Various bug fixes +- Convert to singlespec +- Rebase patch: pr-109.patch + Old: ---- ncclient-0.5.2.tar.gz New: ---- ncclient-0.5.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-ncclient.spec ++++++ --- /var/tmp/diff_new_pack.YoKvGg/_old 2017-08-28 15:31:17.401610373 +0200 +++ /var/tmp/diff_new_pack.YoKvGg/_new 2017-08-28 15:31:17.405609811 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-ncclient # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,60 +16,64 @@ # +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%bcond_without test Name: python-ncclient -Version: 0.5.2 +Version: 0.5.3 Release: 0 -Url: https://github.com/ncclient/ncclient -Summary: Python NETCONF protocol library +Summary: Python library for NETCONF clients License: Apache-2.0 Group: Development/Languages/Python -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 +Url: http://ncclient.org +Source: https://files.pythonhosted.org/packages/source/n/ncclient/ncclient-%{version}.tar.gz Patch0: pr-109.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: python-base -BuildRequires: python-setuptools -Requires: python-lxml >= 3.1 -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 +BuildRequires: %{python_module devel} +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: %{python_module lxml >= 3.3.0} +Requires: %{python_module paramiko >= 1.15.0} +Requires: %{python_module setuptools > 0.6} +Requires: %{python_module six} BuildArch: noarch +%if %{with test} +BuildRequires: %{python_module lxml >= 3.3.0} +BuildRequires: %{python_module paramiko >= 1.15.0} +BuildRequires: %{python_module setuptools > 0.6} +BuildRequires: %{python_module six} %endif +%python_subpackages %description ncclient is a Python library that facilitates client-side scripting and application development around the NETCONF protocol. -%package doc +%package -n python-ncclient-doc Summary: Python NETCONF protocol library - Documentation Group: Documentation/HTML -BuildRequires: python-Sphinx -Requires: %{name} = %{version} +BuildRequires: %{python_module Sphinx} +Provides: %{python_module python-ncclient-doc = %{version}} -%description doc +%description -n python-ncclient-doc This package contains documentation files for %{name}. - %prep %setup -q -n ncclient-%{version} %patch0 -p1 %build -python setup.py build -cd docs && make html && rm build/html/.buildinfo +%python_build +cd docs && make %{?_smp_mflags} html && rm build/html/.buildinfo %install -python2 setup.py install --prefix=%{_prefix} --root=%{buildroot} +%python_install +%fdupes %{buildroot} -%files -%defattr(-,root,root) +%files %{python_files} %doc LICENSE -%{python_sitelib}/ncclient -%{python_sitelib}/ncclient-%{version}-py%{py_ver}.egg-info +%{python_sitelib}/* -%files doc -%defattr(-,root,root,-) -%doc LICENSE README examples docs/build/html +%files -n python-ncclient-doc +%doc LICENSE README README.rst examples docs/build/html %changelog ++++++ ncclient-0.5.2.tar.gz -> ncclient-0.5.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/PKG-INFO new/ncclient-0.5.3/PKG-INFO --- old/ncclient-0.5.2/PKG-INFO 2016-07-05 14:26:59.000000000 +0200 +++ new/ncclient-0.5.3/PKG-INFO 2016-12-28 08:50:45.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: ncclient -Version: 0.5.2 +Version: 0.5.3 Summary: Python library for NETCONF clients Home-page: http://ncclient.org Author: Shikhar Bhushan, Leonidas Poulopoulos, Ebben Aries @@ -105,6 +105,12 @@ Changes \| brief ~~~~~~~~~~~~~~~~ + **v0.5.3** + + - Add notifications support + - Add support for ecdsa keys + - Various bug fixes + **v0.5.2** - Add support for Python 3 @@ -173,6 +179,8 @@ Acknowledgements ~~~~~~~~~~~~~~~~ + - v0.5.3: `Justin Wilcox`_, `Stacy W. Smith`_, `Mircea Ulinic`_, + `Ebben Aries`_, `Einar Nilsen-Nygaard`_, `QijunPan`_ - v0.5.2: `Nitin Kumar`_, `Kristian Larsson`_, `palashgupta`_, `Jonathan Provost`_, `Jainpriyal`_, `sharang`_, `pseguel`_, `nnakamot`_, `Алексей Пастухов`_, `Christian Giese`_, `Peipei Guo`_, @@ -216,6 +224,11 @@ .. _Juergen Brendel: https://github.com/juergenbrendel .. _Quentin Loos: https://github.com/Kent1 .. _Ebben Aries: https://github.com/earies + .. _Justin Wilcox: https://github.com/jwwilcox + .. _Stacy W. Smith: https://github.com/stacywsmith + .. _Mircea Ulinic: https://github.com/mirceaulinic + .. _QijunPan: https://github.com/QijunPan + Keywords: NETCONF,NETCONF Python client,Juniper Optimization,Cisco NXOS Optimization Platform: Posix; OS X; Windows Classifier: Development Status :: 5 - Production/Stable diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/README new/ncclient-0.5.3/README --- old/ncclient-0.5.2/README 2016-07-05 14:20:51.000000000 +0200 +++ new/ncclient-0.5.3/README 2016-12-28 08:28:26.000000000 +0100 @@ -73,15 +73,14 @@ * HP Comware: device_params={'name':'hpcomware'} -### Changes | brief +### Changes | brief - v0.5.3 -* Add support for Python 3 -* Improve Junos ioproc performance -* Performance improvements -* Updated test cases -* Many bug and performance fixes +* Add notifications support +* Add support for ecdsa keys +* Various bug fixes ### Contributors +* v0.5.3: [Justin Wilcox](https://github.com/jwwilcox), [Stacy W. Smith](https://github.com/stacywsmith), [Mircea Ulinic](https://github.com/mirceaulinic), [Ebben Aries](https://github.com/earies), [Einar Nilsen-Nygaard](https://github.com/einarnn), [QijunPan](https://github.com/QijunPan) * 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) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/README.rst new/ncclient-0.5.3/README.rst --- old/ncclient-0.5.2/README.rst 2016-07-05 14:22:23.000000000 +0200 +++ new/ncclient-0.5.3/README.rst 2016-12-28 08:44:45.000000000 +0100 @@ -97,6 +97,12 @@ Changes \| brief ~~~~~~~~~~~~~~~~ +**v0.5.3** + +- Add notifications support +- Add support for ecdsa keys +- Various bug fixes + **v0.5.2** - Add support for Python 3 @@ -165,6 +171,8 @@ Acknowledgements ~~~~~~~~~~~~~~~~ +- v0.5.3: `Justin Wilcox`_, `Stacy W. Smith`_, `Mircea Ulinic`_, + `Ebben Aries`_, `Einar Nilsen-Nygaard`_, `QijunPan`_ - v0.5.2: `Nitin Kumar`_, `Kristian Larsson`_, `palashgupta`_, `Jonathan Provost`_, `Jainpriyal`_, `sharang`_, `pseguel`_, `nnakamot`_, `Алексей Пастухов`_, `Christian Giese`_, `Peipei Guo`_, @@ -207,4 +215,8 @@ .. _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 +.. _Ebben Aries: https://github.com/earies +.. _Justin Wilcox: https://github.com/jwwilcox +.. _Stacy W. Smith: https://github.com/stacywsmith +.. _Mircea Ulinic: https://github.com/mirceaulinic +.. _QijunPan: https://github.com/QijunPan diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/examples/juniper/edit-config-jnpr-json.py new/ncclient-0.5.3/examples/juniper/edit-config-jnpr-json.py --- old/ncclient-0.5.2/examples/juniper/edit-config-jnpr-json.py 1970-01-01 01:00:00.000000000 +0100 +++ new/ncclient-0.5.3/examples/juniper/edit-config-jnpr-json.py 2016-11-11 03:36:47.000000000 +0100 @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +import json + +from ncclient import manager + +def connect(host, user, password): + conn = manager.connect(host=host, + username=user, + password=password, + timeout=10, + device_params = {'name':'junos'}, + hostkey_verify=False) + + conn.lock() + + # configuration as a json encoded string + location = """ + { + "configuration": { + "system": { + "location": { + "building": "Main Campus, E", + "floor": "15" + } + } + } + } + """ + + config_json = json.loads(location) + config_json['configuration']['system']['location']['rack'] = "1117" + config = json.dumps(config_json) + + send_config = conn.load_configuration(format='json', config=config) + print send_config.tostring + + check_config = conn.validate() + print check_config.tostring + + compare_config = conn.compare_configuration() + print compare_config.tostring + + conn.commit() + conn.unlock() + conn.close_session() + +if __name__ == '__main__': + connect('router', 'netconf', 'juniper!') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/examples/juniper/get-configuration-jnpr.py new/ncclient-0.5.3/examples/juniper/get-configuration-jnpr.py --- old/ncclient-0.5.2/examples/juniper/get-configuration-jnpr.py 2016-02-16 08:59:26.000000000 +0100 +++ new/ncclient-0.5.3/examples/juniper/get-configuration-jnpr.py 2016-11-11 03:36:47.000000000 +0100 @@ -1,5 +1,7 @@ #!/usr/bin/env python +import json + from ncclient import manager from ncclient.xml_ import * @@ -15,6 +17,10 @@ result_xml = conn.get_configuration(format='xml') print result_xml.tostring + result_json = conn.get_configuration(format='json') + payload = json.loads(result_json.xpath('.')[0].text) + print(payload['configuration']['system']['services']) + result_text = conn.get_configuration(format='text') print result_text.xpath('configuration-text')[0].text diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/examples/nxosapi.py new/ncclient-0.5.3/examples/nxosapi.py --- old/ncclient-0.5.2/examples/nxosapi.py 2016-02-16 08:59:26.000000000 +0100 +++ new/ncclient-0.5.3/examples/nxosapi.py 2016-11-11 03:36:47.000000000 +0100 @@ -48,14 +48,15 @@ <ethernet> <interface>%s</interface> <__XML__MODE_if-ethernet-switch> - <switchport></switchport> <switchport> <trunk> <allowed> <vlan> - <__XML__BLK_Cmd_switchport_trunk_allowed_allow-vlans> - <allow-vlans>%s</allow-vlans> - </__XML__BLK_Cmd_switchport_trunk_allowed_allow-vlans> + <add> + <__XML__BLK_Cmd_switchport_trunk_allowed_allow-vlans> + <add-vlans>%s</add-vlans> + </__XML__BLK_Cmd_switchport_trunk_allowed_allow-vlans> + </add> </vlan> </allowed> </trunk> @@ -73,18 +74,19 @@ <ethernet> <interface>%s</interface> <__XML__MODE_if-ethernet-switch> - <switchport></switchport> <switchport> <trunk> - <notallowed> + <allowed> <vlan> - <__XML__BLK_Cmd_switchport_trunk_allowed_allow-vlans> - <allow-vlans>%s</allow-vlans> - </__XML__BLK_Cmd_switchport_trunk_allowed_allow-vlans> + <remove> + <__XML__BLK_Cmd_switchport_trunk_allowed_allow-vlans> + <remove-vlans>%s</remove-vlans> + </__XML__BLK_Cmd_switchport_trunk_allowed_allow-vlans> + </remove> </vlan> - </notallowed> + </allowed> </trunk> - <switchport> + </switchport> </__XML__MODE_if-ethernet-switch> </ethernet> </interface> @@ -102,7 +104,7 @@ def nxos_connect(host, port, user, password): return manager.connect(host=host, port=port, username=user, - password=password) + password=password, device_params={'name': 'nexus'}) def enable_vlan(mgr, vlanid, vlanname): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/ncclient/__init__.py new/ncclient-0.5.3/ncclient/__init__.py --- old/ncclient-0.5.2/ncclient/__init__.py 2016-07-05 14:19:55.000000000 +0200 +++ new/ncclient-0.5.3/ncclient/__init__.py 2016-12-28 08:15:23.000000000 +0100 @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = (0,5,2) +__version__ = (0,5,3) import sys diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/ncclient/devices/default.py new/ncclient-0.5.3/ncclient/devices/default.py --- old/ncclient-0.5.2/ncclient/devices/default.py 2016-02-16 08:59:26.000000000 +0100 +++ new/ncclient-0.5.3/ncclient/devices/default.py 2016-12-28 08:29:40.000000000 +0100 @@ -91,6 +91,7 @@ "urn:ietf:params:netconf:capability:url:1.0?scheme=http,ftp,file,https,sftp", "urn:ietf:params:netconf:capability:validate:1.0", "urn:ietf:params:netconf:capability:xpath:1.0", + "urn:ietf:params:netconf:capability:notification:1.0", "urn:liberouter:params:netconf:capability:power-control:1.0", "urn:ietf:params:netconf:capability:interleave:1.0" ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/ncclient/devices/huawei.py new/ncclient-0.5.3/ncclient/devices/huawei.py --- old/ncclient-0.5.2/ncclient/devices/huawei.py 2016-07-05 14:08:16.000000000 +0200 +++ new/ncclient-0.5.3/ncclient/devices/huawei.py 2016-12-28 08:29:40.000000000 +0100 @@ -50,7 +50,8 @@ c.append('http://www.huawei.com/netconf/capability/action/1.0') c.append('http://www.huawei.com/netconf/capability/active/1.0') c.append('http://www.huawei.com/netconf/capability/discard-commit/1.0') - c.append('urn:ietf:params:netconf:capability:notification:1.0') + c.append('http://www.huawei.com/netconf/capability/exchange/1.0') + return c def get_xml_base_namespace_dict(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/ncclient/devices/iosxe.py new/ncclient-0.5.3/ncclient/devices/iosxe.py --- old/ncclient-0.5.2/ncclient/devices/iosxe.py 2016-02-16 08:59:26.000000000 +0100 +++ new/ncclient-0.5.3/ncclient/devices/iosxe.py 2016-11-11 03:36:47.000000000 +0100 @@ -15,6 +15,8 @@ from .default import DefaultDeviceHandler +from ncclient.operations.third_party.iosxe.rpc import SaveConfig + def iosxe_unknown_host_cb(host, fingerprint): #This will ignore the unknown host check when connecting to CSR devices return True @@ -35,7 +37,7 @@ def add_additional_ssh_connect_params(self, kwargs): kwargs['allow_agent'] = False kwargs['look_for_keys'] = False - kwargs['unknown_host_cb'] = csr_unknown_host_cb + kwargs['unknown_host_cb'] = iosxe_unknown_host_cb def perform_qualify_check(self): return False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/ncclient/manager.py new/ncclient-0.5.3/ncclient/manager.py --- old/ncclient-0.5.2/ncclient/manager.py 2016-07-05 14:08:16.000000000 +0200 +++ new/ncclient-0.5.3/ncclient/manager.py 2016-12-28 08:29:40.000000000 +0100 @@ -41,6 +41,7 @@ "delete_config": operations.DeleteConfig, "lock": operations.Lock, "unlock": operations.Unlock, + "create_subscription": operations.CreateSubscription, "close_session": operations.CloseSession, "kill_session": operations.KillSession, "poweroff_machine": operations.PoweroffMachine, @@ -265,6 +266,24 @@ return r return _missing + def take_notification(self, block=True, timeout=None): + """Attempt to retrieve one notification from the queue of received + notifications. + + If block is True, the call will wait until a notification is + received. + + If timeout is a number greater than 0, the call will wait that + many seconds to receive a notification before timing out. + + If there is no notification available when block is False or + when the timeout has elapse, None will be returned. + + Otherwise a :class:`~ncclient.operations.notify.Notification` + object will be returned. + """ + return self._session.take_notification(block, timeout) + @property def client_capabilities(self): """:class:`~ncclient.capabilities.Capabilities` object representing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/ncclient/operations/__init__.py new/ncclient-0.5.3/ncclient/operations/__init__.py --- old/ncclient-0.5.2/ncclient/operations/__init__.py 2016-02-16 08:59:26.000000000 +0100 +++ new/ncclient-0.5.3/ncclient/operations/__init__.py 2016-12-28 08:29:40.000000000 +0100 @@ -21,6 +21,7 @@ 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 +from ncclient.operations.subscribe import CreateSubscription # others... from ncclient.operations.flowmon import PoweroffMachine, RebootMachine @@ -43,6 +44,7 @@ 'DeleteConfig', 'Lock', 'Unlock', + 'CreateSubscription', 'PoweroffMachine', 'RebootMachine', ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/ncclient/operations/notify.py new/ncclient-0.5.3/ncclient/operations/notify.py --- old/ncclient-0.5.2/ncclient/operations/notify.py 1970-01-01 01:00:00.000000000 +0100 +++ new/ncclient-0.5.3/ncclient/operations/notify.py 2016-12-28 08:29:40.000000000 +0100 @@ -0,0 +1,28 @@ +# Copyright 2009 Shikhar Bhushan +# +# 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 ncclient.xml_ import to_ele + +class Notification(object): + def __init__(self, raw): + self._raw = raw + self._root_ele = to_ele(raw) + + @property + def notification_ele(self): + return self._root_ele + + @property + def notification_xml(self): + return self._raw diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/ncclient/operations/rpc.py new/ncclient-0.5.3/ncclient/operations/rpc.py --- old/ncclient-0.5.2/ncclient/operations/rpc.py 2016-07-05 14:08:16.000000000 +0200 +++ new/ncclient-0.5.3/ncclient/operations/rpc.py 2016-11-11 03:36:47.000000000 +0100 @@ -217,7 +217,7 @@ logger.debug("Delivering to %r" % rpc) rpc.deliver_reply(raw) except KeyError: - raise OperationError("Unknown 'message-id': %s", id) + raise OperationError("Unknown 'message-id': %s" % id) # no catching other exceptions, fail loudly if must else: # if no error delivering, can del the reference to the RPC diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/ncclient/operations/subscribe.py new/ncclient-0.5.3/ncclient/operations/subscribe.py --- old/ncclient-0.5.2/ncclient/operations/subscribe.py 2016-02-16 08:59:26.000000000 +0100 +++ new/ncclient-0.5.3/ncclient/operations/subscribe.py 2016-12-28 08:29:41.000000000 +0100 @@ -12,15 +12,53 @@ # See the License for the specific language governing permissions and # limitations under the License. -# TODO -class Notification(object): - pass +from ncclient.operations.rpc import RPC +from ncclient.xml_ import * -class CreateSubscription(object): - pass +from ncclient.operations import util +class CreateSubscription(RPC): + "`create-subscription` RPC. Depends on the `:notification` capability." -class NotificationListener(object): - pass + DEPENDS = [':notification'] + + def request(self, filter=None, stream_name=None, start_time=None, stop_time=None): + """Creates a subscription for notifications from the server. + + *filter* specifies the subset of notifications to receive (by + default all notificaitons are received) + + :seealso: :ref:`filter_params` + + *stream_name* specifies the notification stream name. The + default is None meaning all streams. + + *start_time* triggers the notification replay feature to + replay notifications from the given time. The default is None, + meaning that this is not a replay subscription. The format is + an RFC 3339/ISO 8601 date and time. + + *stop_time* indicates the end of the notifications of + interest. This parameter must be used with *start_time*. The + default is None, meaning that (if *start_time* is present) the + notifications will continue until the subscription is + terminated. The format is an RFC 3339/ISO 8601 date and time. + + """ + node = new_ele_ns("create-subscription", NETCONF_NOTIFICATION_NS) + if filter is not None: + node.append(util.build_filter(filter)) + if stream_name is not None: + sub_ele(node, "stream").text = stream_name + + if start_time is not None: + sub_ele(node, "startTime").text = start_time + + if stop_time is not None: + if start_time is None: + raise ValueError("You must provide start_time if you provide stop_time") + sub_ele(node, "stopTime").text = stop_time + + return self._request(node) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/ncclient/operations/third_party/juniper/rpc.py new/ncclient-0.5.3/ncclient/operations/third_party/juniper/rpc.py --- old/ncclient-0.5.2/ncclient/operations/third_party/juniper/rpc.py 2016-02-16 08:59:26.000000000 +0100 +++ new/ncclient-0.5.3/ncclient/operations/third_party/juniper/rpc.py 2016-11-11 03:36:47.000000000 +0100 @@ -24,6 +24,8 @@ if format == 'xml': config_node = sub_ele(node, 'configuration') config_node.append(config) + if format == 'json': + config_node = sub_ele(node, 'configuration-json').text = config if format == 'text' and not action == 'set': config_node = sub_ele(node, 'configuration-text').text = config if action == 'set' and format == 'text': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/ncclient/transport/session.py new/ncclient-0.5.3/ncclient/transport/session.py --- old/ncclient-0.5.2/ncclient/transport/session.py 2016-07-05 14:08:16.000000000 +0200 +++ new/ncclient-0.5.3/ncclient/transport/session.py 2016-12-28 08:29:41.000000000 +0100 @@ -19,12 +19,13 @@ import logging from threading import Thread, Lock, Event try: - from Queue import Queue + from Queue import Queue, Empty except ImportError: - from queue import Queue + from queue import Queue, Empty from ncclient.xml_ import * from ncclient.capabilities import Capabilities from ncclient.transport.errors import TransportError, SessionError +from ncclient.operations.notify import Notification logger = logging.getLogger('ncclient.transport.session') @@ -40,6 +41,7 @@ self._lock = Lock() self.setName('session') self._q = Queue() + self._notification_q = Queue() self._client_capabilities = capabilities self._server_capabilities = None # yet self._id = None # session-id @@ -89,6 +91,7 @@ def err_cb(err): error[0] = err init_event.set() + self.add_listener(NotificationHandler(self._notification_q)) listener = HelloHandler(ok_cb, err_cb) self.add_listener(listener) self.send(HelloHandler.build(self._client_capabilities, self._device_handler)) @@ -157,6 +160,12 @@ raise NotImplementedError ### Properties + def take_notification(self, block, timeout): + try: + return self._notification_q.get(block, timeout) + except Empty: + return None + @property def connected(self): "Connection status of the session." @@ -255,3 +264,16 @@ if cap.tag == qualify("capability") or cap.tag == "capability": capabilities.append(cap.text) return sid, Capabilities(capabilities) + + +class NotificationHandler(SessionListener): + def __init__(self, notification_q): + self._notification_q = notification_q + + def callback(self, root, raw): + tag, _ = root + if tag == qualify('notification', NETCONF_NOTIFICATION_NS): + self._notification_q.put(Notification(raw)) + + def errback(self, _): + pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/ncclient/transport/ssh.py new/ncclient-0.5.3/ncclient/transport/ssh.py --- old/ncclient-0.5.2/ncclient/transport/ssh.py 2016-07-05 14:19:33.000000000 +0200 +++ new/ncclient-0.5.3/ncclient/transport/ssh.py 2016-12-28 08:29:41.000000000 +0100 @@ -127,6 +127,11 @@ self._buffer = StringIO() self._buffer.write(remaining.encode()) self._parsing_pos10 = 0 + if len(remaining) > 0: + # There could be another entire message in the + # buffer, so we should try to parse again. + logger.debug('Trying another round of parsing since there is still data') + self._parse10() else: # handle case that MSG_DELIM is split over two chunks self._parsing_pos10 = buf.tell() - MSG_DELIM_LEN @@ -148,6 +153,8 @@ message_list = self._message_list # a message is a list of chunks chunk_list = [] # a chunk is a list of characters + should_recurse = False + while True: x = buf.read(1) if not x: @@ -253,6 +260,9 @@ expchunksize = chunksize = 0 parsing_state11 = idle inendpos = parsing_pos11 = 0 + # There could be another entire message in the + # buffer, so we should try to parse again. + should_recurse = True break else: logger.debug('%s (%s: expect newline)'%(pre, state)) @@ -270,6 +280,10 @@ self._parsing_pos11 = self._buffer.tell() logger.debug('parse11 ending ...') + if should_recurse: + logger.debug('Trying another round of parsing since there is still data') + self._parse11() + def load_known_hosts(self, filename=None): @@ -426,7 +440,7 @@ saved_exception = None for key_filename in key_filenames: - for cls in (paramiko.RSAKey, paramiko.DSSKey): + for cls in (paramiko.RSAKey, paramiko.DSSKey, paramiko.ECDSAKey): try: key = cls.from_private_key_file(key_filename, password) logger.debug("Trying key %s from %s" % @@ -452,17 +466,23 @@ if look_for_keys: rsa_key = os.path.expanduser("~/.ssh/id_rsa") dsa_key = os.path.expanduser("~/.ssh/id_dsa") + ecdsa_key = os.path.expanduser("~/.ssh/id_ecdsa") if os.path.isfile(rsa_key): keyfiles.append((paramiko.RSAKey, rsa_key)) if os.path.isfile(dsa_key): keyfiles.append((paramiko.DSSKey, dsa_key)) + if os.path.isfile(ecdsa_key): + keyfiles.append((paramiko.ECDSAKey, ecdsa_key)) # look in ~/ssh/ for windows users: rsa_key = os.path.expanduser("~/ssh/id_rsa") dsa_key = os.path.expanduser("~/ssh/id_dsa") + ecdsa_key = os.path.expanduser("~/ssh/id_ecdsa") if os.path.isfile(rsa_key): keyfiles.append((paramiko.RSAKey, rsa_key)) if os.path.isfile(dsa_key): keyfiles.append((paramiko.DSSKey, dsa_key)) + if os.path.isfile(ecdsa_key): + keyfiles.append((paramiko.ECDSAKey, ecdsa_key)) for cls, filename in keyfiles: try: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/ncclient/xml_.py new/ncclient-0.5.3/ncclient/xml_.py --- old/ncclient-0.5.2/ncclient/xml_.py 2016-07-05 14:08:16.000000000 +0200 +++ new/ncclient-0.5.3/ncclient/xml_.py 2016-12-28 08:29:41.000000000 +0100 @@ -64,6 +64,8 @@ H3C_ACTION_1_0 = "http://www.h3c.com/netconf/action:1.0" #: Namespace for netconf monitoring NETCONF_MONITORING_NS = "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring" +#: Namespace for netconf notifications +NETCONF_NOTIFICATION_NS = "urn:ietf:params:xml:ns:netconf:notification:1.0" # try: register_namespace = etree.register_namespace @@ -202,4 +204,6 @@ new_ele = lambda tag, attrs={}, **extra: etree.Element(qualify(tag), attrs, **extra) +new_ele_ns = lambda tag, ns, attrs={}, **extra: etree.Element(qualify(tag,ns), attrs, **extra) + sub_ele = lambda parent, tag, attrs={}, **extra: etree.SubElement(parent, qualify(tag), attrs, **extra) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/ncclient.egg-info/PKG-INFO new/ncclient-0.5.3/ncclient.egg-info/PKG-INFO --- old/ncclient-0.5.2/ncclient.egg-info/PKG-INFO 2016-07-05 14:26:59.000000000 +0200 +++ new/ncclient-0.5.3/ncclient.egg-info/PKG-INFO 2016-12-28 08:50:40.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: ncclient -Version: 0.5.2 +Version: 0.5.3 Summary: Python library for NETCONF clients Home-page: http://ncclient.org Author: Shikhar Bhushan, Leonidas Poulopoulos, Ebben Aries @@ -105,6 +105,12 @@ Changes \| brief ~~~~~~~~~~~~~~~~ + **v0.5.3** + + - Add notifications support + - Add support for ecdsa keys + - Various bug fixes + **v0.5.2** - Add support for Python 3 @@ -173,6 +179,8 @@ Acknowledgements ~~~~~~~~~~~~~~~~ + - v0.5.3: `Justin Wilcox`_, `Stacy W. Smith`_, `Mircea Ulinic`_, + `Ebben Aries`_, `Einar Nilsen-Nygaard`_, `QijunPan`_ - v0.5.2: `Nitin Kumar`_, `Kristian Larsson`_, `palashgupta`_, `Jonathan Provost`_, `Jainpriyal`_, `sharang`_, `pseguel`_, `nnakamot`_, `Алексей Пастухов`_, `Christian Giese`_, `Peipei Guo`_, @@ -216,6 +224,11 @@ .. _Juergen Brendel: https://github.com/juergenbrendel .. _Quentin Loos: https://github.com/Kent1 .. _Ebben Aries: https://github.com/earies + .. _Justin Wilcox: https://github.com/jwwilcox + .. _Stacy W. Smith: https://github.com/stacywsmith + .. _Mircea Ulinic: https://github.com/mirceaulinic + .. _QijunPan: https://github.com/QijunPan + Keywords: NETCONF,NETCONF Python client,Juniper Optimization,Cisco NXOS Optimization Platform: Posix; OS X; Windows Classifier: Development Status :: 5 - Production/Stable diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/ncclient.egg-info/SOURCES.txt new/ncclient-0.5.3/ncclient.egg-info/SOURCES.txt --- old/ncclient-0.5.2/ncclient.egg-info/SOURCES.txt 2016-07-05 14:26:59.000000000 +0200 +++ new/ncclient-0.5.3/ncclient.egg-info/SOURCES.txt 2016-12-28 08:50:40.000000000 +0100 @@ -30,6 +30,7 @@ examples/juniper/compare-config-jnpr.py examples/juniper/delete-config-jnpr.py examples/juniper/edit-config-bgp-peer.py +examples/juniper/edit-config-jnpr-json.py examples/juniper/edit-config-jnpr-set.py examples/juniper/edit-config-jnpr-text.py examples/juniper/edit-config-jnpr.py @@ -75,6 +76,7 @@ ncclient/operations/errors.py ncclient/operations/flowmon.py ncclient/operations/lock.py +ncclient/operations/notify.py ncclient/operations/retrieve.py ncclient/operations/rpc.py ncclient/operations/session.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/ncclient.egg-info/requires.txt new/ncclient-0.5.3/ncclient.egg-info/requires.txt --- old/ncclient-0.5.2/ncclient.egg-info/requires.txt 2016-07-05 14:26:59.000000000 +0200 +++ new/ncclient-0.5.3/ncclient.egg-info/requires.txt 2016-12-28 08:50:40.000000000 +0100 @@ -1,4 +1,4 @@ setuptools>0.6 -paramiko>=1.7.7.1 +paramiko>=1.15.0 lxml>=3.3.0 six diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/requirements.txt new/ncclient-0.5.3/requirements.txt --- old/ncclient-0.5.2/requirements.txt 2016-02-16 08:59:26.000000000 +0100 +++ new/ncclient-0.5.3/requirements.txt 2016-12-28 08:29:41.000000000 +0100 @@ -1,4 +1,4 @@ setuptools>0.6 -paramiko>=1.7.7.1 +paramiko>=1.15.0 lxml>=3.3.0 six diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncclient-0.5.2/setup.py new/ncclient-0.5.3/setup.py --- old/ncclient-0.5.2/setup.py 2016-07-05 14:25:03.000000000 +0200 +++ new/ncclient-0.5.3/setup.py 2016-12-28 08:49:54.000000000 +0100 @@ -19,6 +19,7 @@ import sys import platform +import codecs if sys.version_info[0] == 2 and sys.version_info[1] < 6: print ("Sorry, Python < 2.6 is not supported") @@ -28,12 +29,12 @@ req_lines = [line.strip() for line in open("requirements.txt").readlines()] install_reqs = list(filter(None, req_lines)) -with open('README.rst') as file: +with codecs.open('README.rst', 'r', encoding='utf8') as file: long_description = file.read() setup(name='ncclient', - version='0.5.2', + version='0.5.3', description="Python library for NETCONF clients", long_description = long_description, author="Shikhar Bhushan, Leonidas Poulopoulos, Ebben Aries", ++++++ pr-109.patch ++++++ --- /var/tmp/diff_new_pack.YoKvGg/_old 2017-08-28 15:31:17.925536718 +0200 +++ /var/tmp/diff_new_pack.YoKvGg/_new 2017-08-28 15:31:17.925536718 +0200 @@ -1,10 +1,10 @@ diff --git a/requirements.txt b/requirements.txt -index 6c1ff6c..b833698 100644 +index a586d5c..4109867 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ setuptools>0.6 - paramiko>=1.7.7.1 + paramiko>=1.15.0 -lxml>=3.3.0 +lxml>=3.1 six
