Hello community,
here is the log from the commit of package python-junos-eznc for
openSUSE:Factory checked in at 2020-08-24 15:08:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-junos-eznc (Old)
and /work/SRC/openSUSE:Factory/.python-junos-eznc.new.3399 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-junos-eznc"
Mon Aug 24 15:08:43 2020 rev:6 rq:828721 version:2.5.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-junos-eznc/python-junos-eznc.changes
2020-08-04 20:22:30.849002370 +0200
+++
/work/SRC/openSUSE:Factory/.python-junos-eznc.new.3399/python-junos-eznc.changes
2020-08-24 15:09:26.930579607 +0200
@@ -1,0 +2,9 @@
+Sat Aug 22 14:14:26 UTC 2020 - Martin Hauke <[email protected]>
+
+- Update to version 2.5.2
+ * juniper_junos_system fails when (vmhost) rebooting MX204 router
+ * Testcase failing in PyEZ after ncclient upgrade
+ * Wheel support for version integrated with versioneer.
+ * rpc-reply during reboot parsing gives error
+
+-------------------------------------------------------------------
Old:
----
python-junos-eznc-2.5.1.tar.gz
New:
----
python-junos-eznc-2.5.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-junos-eznc.spec ++++++
--- /var/tmp/diff_new_pack.SonQvm/_old 2020-08-24 15:09:28.994580612 +0200
+++ /var/tmp/diff_new_pack.SonQvm/_new 2020-08-24 15:09:28.994580612 +0200
@@ -20,7 +20,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-junos-eznc
-Version: 2.5.1
+Version: 2.5.2
Release: 0
Summary: Junos 'EZ' automation for non-programmers
License: Apache-2.0
++++++ python-junos-eznc-2.5.1.tar.gz -> python-junos-eznc-2.5.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-junos-eznc-2.5.1/.coveragerc
new/py-junos-eznc-2.5.2/.coveragerc
--- old/py-junos-eznc-2.5.1/.coveragerc 2020-07-29 09:01:44.000000000 +0200
+++ new/py-junos-eznc-2.5.2/.coveragerc 2020-08-21 09:07:17.000000000 +0200
@@ -1,6 +1,7 @@
[run]
omit =
lib/jnpr/junos/cfg/*
+ lib/jnpr/junos/_version.py
[report]
show_missing = True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-junos-eznc-2.5.1/lib/jnpr/junos/_version.py
new/py-junos-eznc-2.5.2/lib/jnpr/junos/_version.py
--- old/py-junos-eznc-2.5.1/lib/jnpr/junos/_version.py 2020-07-29
09:01:44.000000000 +0200
+++ new/py-junos-eznc-2.5.2/lib/jnpr/junos/_version.py 2020-08-21
09:07:17.000000000 +0200
@@ -22,9 +22,9 @@
# setup.py/versioneer.py will grep for the variable names, so they must
# each be defined on a line of their own. _version.py will just call
# get_keywords().
- git_refnames = " (HEAD -> master, tag: 2.5.1)"
- git_full = "bfb6e25cab81bf74217b685ebe0fd5716dbeea60"
- git_date = "2020-07-29 12:31:44 +0530"
+ git_refnames = " (HEAD -> master, tag: 2.5.2)"
+ git_full = "6705a002e9909ece9d68048baf71ea31dbf8939e"
+ git_date = "2020-08-21 12:37:17 +0530"
keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
return keywords
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/py-junos-eznc-2.5.1/lib/jnpr/junos/factory/cmdtable.py
new/py-junos-eznc-2.5.2/lib/jnpr/junos/factory/cmdtable.py
--- old/py-junos-eznc-2.5.1/lib/jnpr/junos/factory/cmdtable.py 2020-07-29
09:01:44.000000000 +0200
+++ new/py-junos-eznc-2.5.2/lib/jnpr/junos/factory/cmdtable.py 2020-08-21
09:07:17.000000000 +0200
@@ -384,7 +384,15 @@
for row in cli_table:
temp_dict = self._parse_row(row, cli_table, reverse_fields)
logger.debug("data at index {} is {}".format(row.row, temp_dict))
- if self.KEY in temp_dict:
+ if isinstance(self.KEY, list):
+ key_list = []
+ for key in self.KEY:
+ if key not in fields:
+ key_list.append(temp_dict.pop(key))
+ else:
+ key_list.append(temp_dict[key])
+ output[tuple(key_list)] = temp_dict
+ elif self.KEY in temp_dict:
if self.KEY not in fields:
output[temp_dict.pop(self.KEY)] = temp_dict
else:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-junos-eznc-2.5.1/lib/jnpr/junos/jxml.py
new/py-junos-eznc-2.5.2/lib/jnpr/junos/jxml.py
--- old/py-junos-eznc-2.5.1/lib/jnpr/junos/jxml.py 2020-07-29
09:01:44.000000000 +0200
+++ new/py-junos-eznc-2.5.2/lib/jnpr/junos/jxml.py 2020-08-21
09:07:17.000000000 +0200
@@ -92,7 +92,9 @@
<xsl:output method="xml" indent="no"/>
<xsl:template
match="/*[local-name()='rpc-reply']/*[local-name()='output']">
- <xsl:copy-of select="."/>
+ <output>
+ <xsl:value-of select="."/>
+ </output>
</xsl:template>
<xsl:template match="/|comment()|processing-instruction()">
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-junos-eznc-2.5.1/lib/jnpr/junos/utils/sw.py
new/py-junos-eznc-2.5.2/lib/jnpr/junos/utils/sw.py
--- old/py-junos-eznc-2.5.1/lib/jnpr/junos/utils/sw.py 2020-07-29
09:01:44.000000000 +0200
+++ new/py-junos-eznc-2.5.2/lib/jnpr/junos/utils/sw.py 2020-08-21
09:07:17.000000000 +0200
@@ -1077,7 +1077,11 @@
# REs produces <output> messages and
# <request-reboot-status> messages.
output_msg = "\n".join(
- [i.text for i in rsp.xpath("//output") if i.text is
not None]
+ [
+ i.text
+ for i in rsp.getparent().xpath("//output")
+ if i.text is not None
+ ]
)
if output_msg is not "":
got = output_msg
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-junos-eznc-2.5.1/setup.cfg
new/py-junos-eznc-2.5.2/setup.cfg
--- old/py-junos-eznc-2.5.1/setup.cfg 2020-07-29 09:01:44.000000000 +0200
+++ new/py-junos-eznc-2.5.2/setup.cfg 2020-08-21 09:07:17.000000000 +0200
@@ -7,7 +7,7 @@
VCS = git
style = pep440
versionfile_source = lib/jnpr/junos/_version.py
-#versionfile_build =
+versionfile_build = jnpr/junos/_version.py
tag_prefix =
#parentdir_prefix =
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/py-junos-eznc-2.5.1/tests/unit/factory/rpc-reply/show_arp_no-resolve.xml
new/py-junos-eznc-2.5.2/tests/unit/factory/rpc-reply/show_arp_no-resolve.xml
---
old/py-junos-eznc-2.5.1/tests/unit/factory/rpc-reply/show_arp_no-resolve.xml
1970-01-01 01:00:00.000000000 +0100
+++
new/py-junos-eznc-2.5.2/tests/unit/factory/rpc-reply/show_arp_no-resolve.xml
2020-08-21 09:07:17.000000000 +0200
@@ -0,0 +1,37 @@
+<output>
+MAC Address Address Interface Flags
+f0:76:1c:9d:23:19 10.221.128.201 fxp0.0 none
+fc:45:96:f3:be:1c 10.221.128.202 fxp0.0 none
+56:68:ad:d8:12:f0 10.221.129.54 fxp0.0 none
+56:68:ad:d8:13:af 10.221.129.93 fxp0.0 none
+56:68:ad:d8:10:f4 10.221.129.121 fxp0.0 none
+56:68:ad:d8:10:c6 10.221.129.191 fxp0.0 none
+56:68:ad:d8:10:ec 10.221.129.221 fxp0.0 none
+56:68:ad:d8:11:a1 10.221.129.231 fxp0.0 none
+56:68:ad:d8:15:f3 10.221.129.239 fxp0.0 none
+56:68:ad:d8:1d:3a 10.221.130.6 fxp0.0 none
+56:68:ad:d8:13:32 10.221.130.28 fxp0.0 none
+56:68:ad:d8:17:f8 10.221.130.54 fxp0.0 none
+56:68:ad:d8:15:eb 10.221.130.56 fxp0.0 none
+56:68:ad:d8:17:82 10.221.130.130 fxp0.0 none
+56:68:ad:d8:10:eb 10.221.130.170 fxp0.0 none
+56:68:ad:d8:12:f8 10.221.130.186 fxp0.0 none
+56:68:ad:d8:1f:f8 10.221.130.219 fxp0.0 none
+56:68:ad:d8:13:14 10.221.130.235 fxp0.0 none
+56:68:ad:d8:17:10 10.221.130.250 fxp0.0 none
+56:68:ad:d8:15:3e 10.221.131.11 fxp0.0 none
+56:68:ad:d8:17:83 10.221.131.16 fxp0.0 none
+56:68:ad:d8:18:ae 10.221.131.36 fxp0.0 none
+56:68:ad:d8:1c:7f 10.221.131.78 fxp0.0 none
+56:68:ad:d8:1a:c1 10.221.131.82 fxp0.0 none
+56:68:ad:d8:17:9a 10.221.131.119 fxp0.0 none
+56:68:ad:d8:18:b2 10.221.131.128 fxp0.0 none
+56:68:ad:d8:19:0c 10.221.131.132 fxp0.0 none
+56:68:ad:d8:19:4f 10.221.131.158 fxp0.0 none
+56:68:ad:d8:18:86 10.221.131.207 fxp0.0 none
+56:68:ad:d8:16:76 10.221.131.208 fxp0.0 none
+56:68:ad:d8:1a:74 10.221.131.212 fxp0.0 none
+56:68:ad:d8:1d:68 10.221.132.32 fxp0.0 none
+56:68:ad:d8:20:44 10.221.132.62 fxp0.0 none
+56:68:ad:d8:1d:3b 10.221.132.199 fxp0.0 none
+</output>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/py-junos-eznc-2.5.1/tests/unit/factory/test_cmdtable.py
new/py-junos-eznc-2.5.2/tests/unit/factory/test_cmdtable.py
--- old/py-junos-eznc-2.5.1/tests/unit/factory/test_cmdtable.py 2020-07-29
09:01:44.000000000 +0200
+++ new/py-junos-eznc-2.5.2/tests/unit/factory/test_cmdtable.py 2020-08-21
09:07:17.000000000 +0200
@@ -14,6 +14,7 @@
import yamlordereddictloader
from jnpr.junos.factory.factory_loader import FactoryLoader
import yaml
+import json
@attr("unit")
@@ -2334,6 +2335,67 @@
stats = stats.get(target="fpc0")
self.assertEqual(stats["cchip-lookup-out-errors"], 500)
+ @patch("jnpr.junos.Device.execute")
+ def test_textfsm_table(self, mock_execute):
+ mock_execute.side_effect = self._mock_manager
+ yaml_data = """
+---
+ARPtable:
+ command: show arp no-resolve
+ platform: juniper_junos
+ key: ip
+ use_textfsm: True
+ view: ARPview
+
+ARPview:
+ fields:
+ mac: MAC
+ ip: IP_ADDRESS
+ interface: INTERFACE
+ flag: FLAGS
+"""
+ globals().update(
+ FactoryLoader().load(
+ yaml.load(yaml_data, Loader=yamlordereddictloader.Loader)
+ )
+ )
+ stats = ARPtable(self.dev)
+ stats = stats.get()
+ self.assertEqual(len(stats), 34)
+ self.assertIn("10.221.128.201", stats)
+
+ @patch("jnpr.junos.Device.execute")
+ def test_textfsm_table_mutli_key(self, mock_execute):
+ mock_execute.side_effect = self._mock_manager
+ yaml_data = """
+---
+ARPtable:
+ command: show arp no-resolve
+ platform: juniper_junos
+ key:
+ - ip
+ - mac
+ use_textfsm: True
+ view: ARPview
+
+ARPview:
+ fields:
+ mac: MAC
+ ip: IP_ADDRESS
+ interface: INTERFACE
+ flag: FLAGS
+"""
+ globals().update(
+ FactoryLoader().load(
+ yaml.load(yaml_data, Loader=yamlordereddictloader.Loader)
+ )
+ )
+ stats = ARPtable(self.dev)
+ stats = stats.get()
+ self.assertIn(
+ "('10.221.129.121', '56:68:ad:d8:10:f4')",
json.loads(stats.to_json())
+ )
+
def _read_file(self, fname):
from ncclient.xml_ import NCElement
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-junos-eznc-2.5.1/tests/unit/test_factcache.py
new/py-junos-eznc-2.5.2/tests/unit/test_factcache.py
--- old/py-junos-eznc-2.5.1/tests/unit/test_factcache.py 2020-07-29
09:01:44.000000000 +0200
+++ new/py-junos-eznc-2.5.2/tests/unit/test_factcache.py 2020-08-21
09:07:17.000000000 +0200
@@ -212,9 +212,29 @@
@patch("jnpr.junos.device.warnings")
def test_factcache_refresh_exception_on_failure(self, mock_warn):
+ # Override the callbacks
+ self.dev.facts._callbacks = {
+ "foo": get_foo_raise_error,
+ }
+ # Populate the cache
+ self.dev.facts._cache["foo"] = "before"
+ # Confirm the cached values
+ self.assertEqual(self.dev.facts["foo"], "before")
with self.assertRaises(ValueError):
- # Refresh all facts with exception on failure
- self.dev.facts._refresh(exception_on_failure=True)
+ self.dev.facts._refresh(exception_on_failure=True, keys="foo")
+
+ @patch("jnpr.junos.device.warnings")
+ def test_factcache_refresh_no_exception_on_failure(self, mock_warn):
+ # Override the callbacks
+ self.dev.facts._callbacks = {
+ "foo": get_foo_raise_error,
+ }
+ # Populate the cache
+ self.dev.facts._cache["foo"] = "before"
+ # Confirm the cached values
+ self.assertEqual(self.dev.facts["foo"], "before")
+ self.dev.facts._refresh(exception_on_failure=False, keys="foo")
+ self.assertEqual(self.dev.facts["foo"], None)
@patch("jnpr.junos.device.warnings")
@patch("jnpr.junos.factcache.warnings")
@@ -265,3 +285,7 @@
return {
"_hidden": True,
}
+
+
+def get_foo_raise_error(device):
+ raise ValueError("Error")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-junos-eznc-2.5.1/tests/unit/test_jxml.py
new/py-junos-eznc-2.5.2/tests/unit/test_jxml.py
--- old/py-junos-eznc-2.5.1/tests/unit/test_jxml.py 2020-07-29
09:01:44.000000000 +0200
+++ new/py-junos-eznc-2.5.2/tests/unit/test_jxml.py 2020-08-21
09:07:17.000000000 +0200
@@ -3,8 +3,15 @@
from io import StringIO
from nose.plugins.attrib import attr
from mock import patch
-from jnpr.junos.jxml import NAME, INSERT, remove_namespaces, cscript_conf
+from jnpr.junos.jxml import (
+ NAME,
+ INSERT,
+ remove_namespaces,
+ cscript_conf,
+ normalize_xslt,
+)
from lxml import etree
+from ncclient.xml_ import NCElement
__author__ = "Nitin Kumar, Rick Sherman"
__credits__ = "Jeremy Schulman"
@@ -49,6 +56,43 @@
op = cscript_conf(self._read_file("get-configuration.xml"))
self.assertTrue(op is None)
+ def test_cscript_conf_output_tag_child_element(self):
+ xmldata = u"""<rpc-reply
message-id="urn:uuid:932d11dc-9ae5-4d25-81fa-8b50ea2d3a03"
xmlns:junos="http://xml.juniper.net/junos/19.3R0/junos">
+ <output>
+ shutdown: [pid 8683]
+ Shutdown NOW!
+ </output>
+</rpc-reply>
+"""
+ xmldata_without_ns = u"""<rpc-reply
message-id="urn:uuid:932d11dc-9ae5-4d25-81fa-8b50ea2d3a03">
+ <output>
+ shutdown: [pid 8683]
+ Shutdown NOW!
+ </output>
+</rpc-reply>
+"""
+ rpc_reply = NCElement(xmldata, normalize_xslt.encode("UTF-8"))
+ self.assertEqual(str(rpc_reply), xmldata_without_ns)
+
+ def test_cscript_conf_output_tag_not_first_child_element(self):
+ xmldata = u"""<rpc-reply
message-id="urn:uuid:932d11dc-9ae5-4d25-81fa-8b50ea2d3a03"
xmlns:junos="http://xml.juniper.net/junos/19.3R0/junos">
+ <xyz>
+ <output>
+ shutdown: [pid 8683]
+ Shutdown NOW!
+ </output>
+ </xyz>
+</rpc-reply>
+"""
+ xmldata_without_ns = u"""<rpc-reply
message-id="urn:uuid:932d11dc-9ae5-4d25-81fa-8b50ea2d3a03">
+ <xyz>
+ <output>shutdown: [pid 8683] Shutdown NOW!</output>
+ </xyz>
+</rpc-reply>
+"""
+ rpc_reply = NCElement(xmldata, normalize_xslt.encode("UTF-8"))
+ self.assertEqual(str(rpc_reply), xmldata_without_ns)
+
def _read_file(self, fname):
fpath = os.path.join(os.path.dirname(__file__), "rpc-reply", fname)
with open(fpath) as fp:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/py-junos-eznc-2.5.1/tests/unit/utils/rpc-reply/request-reboot-output.xml
new/py-junos-eznc-2.5.2/tests/unit/utils/rpc-reply/request-reboot-output.xml
---
old/py-junos-eznc-2.5.1/tests/unit/utils/rpc-reply/request-reboot-output.xml
1970-01-01 01:00:00.000000000 +0100
+++
new/py-junos-eznc-2.5.2/tests/unit/utils/rpc-reply/request-reboot-output.xml
2020-08-21 09:07:17.000000000 +0200
@@ -0,0 +1,21 @@
+<rpc-reply>
+<output>
+Initiating vmhost reboot...
+</output>
+<rpc-error>
+<error-severity>warning</error-severity>
+<error-message>
+Rebooting re0 in 1 min
+</error-message>
+</rpc-error>
+<rpc-error>
+<error-severity>warning</error-severity>
+<error-message>
+Initiating Junos shutdown...
+</error-message>
+</rpc-error>
+<output>
+shutdown: [pid 13192]
+Shutdown at Thu Aug 6 09:27:13 2020.
+</output>
+</rpc-reply>
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-junos-eznc-2.5.1/tests/unit/utils/test_sw.py
new/py-junos-eznc-2.5.2/tests/unit/utils/test_sw.py
--- old/py-junos-eznc-2.5.1/tests/unit/utils/test_sw.py 2020-07-29
09:01:44.000000000 +0200
+++ new/py-junos-eznc-2.5.2/tests/unit/utils/test_sw.py 2020-08-21
09:07:17.000000000 +0200
@@ -849,6 +849,12 @@
self.assertTrue("Shutdown NOW" in self.sw.reboot())
@patch("jnpr.junos.Device.execute")
+ def test_sw_reboot_output_in_reply(self, mock_execute):
+ mock_execute.side_effect = self._mock_manager
+ self.sw._multi_MX = True
+ self.assertTrue("shutdown: [pid 13192]" in self.sw.reboot())
+
+ @patch("jnpr.junos.Device.execute")
def test_sw_reboot_at(self, mock_execute):
mock_execute.side_effect = self._mock_manager
self.assertTrue("Shutdown at" in self.sw.reboot(at="201407091815"))
@@ -1001,7 +1007,9 @@
session = SSHSession(device_handler)
return Manager(session, device_handler)
elif args:
- if args[0].find("at") is not None:
+ if self._testMethodName == "test_sw_reboot_output_in_reply":
+ return self._read_file("request-reboot-output.xml")
+ elif args[0].find("at") is not None:
return self._read_file("request-reboot-at.xml")
elif self._testMethodName == "test_sw_check_pending_install":
if args[0].text == "request-package-check-pending-install":