Skip to content

Releases: Juniper/py-junos-eznc

Release 2.1.1

28 Mar 17:33
Compare
Choose a tag to compare

Bugs Fixed:

  • Fix regressions caused by ignore_warning. #691

Release 2.1.0

23 Mar 02:37
Compare
Choose a tag to compare

Features Added:

  • Enhanced fact gathering. Facts are now gathered "on demand." Additional facts are added.
    The definition of facts and return values are properly documented. #638
  • Support for YANG get RPCs. #672
  • Add an ignore_warning argument to suppress RpcError exceptions for warnings. #672/#685
  • Enhanced the sw.install() method with basic ISSU and NSSU support using the issu and nssu
    boolean arguments. #606/#630/#632
    ** NSSU support has not yet been tested and should currently be considered experimental.
  • Provide a master property and a re_name property for Device. #682
  • Enhanced reboot() method to take an all_re boolean parameter which controls if only the connected
    Routing Engine, or all Routing Engines, are rebooted. #613
  • Enhanced the warning message produced by the cli() method to recommend the corresponding
    dev.rpc.<method>() call. #603
  • Add support for update parameter to configuration load() method. #681
  • Added directory_usage to utils #629/#631/#636
  • Adding support for NFX/JDM fact gathering. #652/#659
  • Connected property. #664

Bugs Fixed:

  • Updated the interface-name glob pattern to correctly match et-<x>/<y>/<z> interfaces
    in several tables and views. #609
  • Take care of special chars on screen during console connection. #610
  • Address issue with fact gathering stopping when it encounters a problem. #615
  • Minor typos fixed in RuntimeError exception message and in comments. #621
  • Added console_has_banner parameter. #622
  • Add CentOS Support to install instructions #623
  • Key value is needed in _IsisAdjacencyLogTable #627
  • Improved functionality and documentation of Docker build. #637/#673/#674/#677
  • added remote port ID to lldp.yml (OP) #645
  • Fix documentation for rollback() #647
  • Fix for fact gathering pprint. #660/#661
  • update ospf view, add bgp/inventory #665
  • Updated doc string for close function #686
  • Add Travis builds for Python 3.5 and 3.6 #687
  • StartShell.run to take this as None for non returning commands #680
  • Modify ignore_warning return value to mimic normal RPC return value. #688

Release 2.0.1

16 Sep 11:15
Compare
Choose a tag to compare
  • StartShell to take timeout (30 second by default) as paramter
from jnpr.junos.utils.start_shell import StartShell
with StartShell(dev, timeout=60) as ss:
    print ss.run("rtsockmon -t")[1]
  • Proper exception handling in case of Console connection #595
  • Fix: Config.lock() return exception when normalize is on
  • Added microbadge badge for the Docker image #593
  • Fix: print dev for Console conn was printing object not Device(....) #591
>>> from jnpr.junos import Device
>>> dev = Device('xxx', user='xxx', password='xxx', mode='telnet', port='23', gather_facts=True)
>>> dev.open()
Device(xxx)
  • Fix: To take care of special chars with StartShell->run function call #589
  • Fix: ssh private key file to be considered for scp util #586
dev = Device('xx.xx.xx.xx', user='xxxx', ssh_private_key_file='/Users/user/userkey')
dev.open()
print dev.facts

with SCP(dev) as obj:
    obj.put('/var/tmp/test.txt', '/var/home/user')
  • Added Dockerfile to enable automated image builds on project commits #585

Release 2.0.0

01 Sep 08:59
Compare
Choose a tag to compare

Console connection using PyEZ

Now PyEZ will support Console (Telnet/Serial) connection apart from SSH

  1. Telnet Connection
    • Over managment ip
    • Over Console Server ip/port
  2. Serial Connection
    Example:
from jnpr.junos import Device
from lxml import etree

with Device(host='console-srv-ip', user='xxx', password='xxxx', mode='telnet', port='7011', gather_facts=True) as dev:
    print dev.facts
    op = dev.rpc.get_interface_information(interface_name='fxp0')
    print etree.tostring(op)

Python >=3.4 support

$ python
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from jnpr.junos import Device
>>> dev = Device('xxxx', user='xxxx', password='xxxx')
>>> dev.open()
>>> print (dev.facts)

Configuration Tables to Define and Configure Structured Resources

Example:

from jnpr.junos import Device
from jnpr.junos.resources.interface import InterfaceTable

dev = Device(host='xx.xx.xx.xx', user='xxx', gather_facts=False)
dev.open()

intf = InterfaceTable(dev)

intf.name = "ge-1/1/5"
intf.unit_name = 0
intf.disable = True
intf.mode = "trunk"
intf.vlan_list = [510, 520, 530]
intf.native_vlan = 510
intf.desc = "l2-interface created"
intf.append()
intf.set()

JSON Config load

For devices >=16.1, user can also load JSON config apart from xml/set/text

Example:

from jnpr.junos import Device

dev = Device(host='xx.xxx.xxx.xx', user='xxxx', password='xxxx', gather_facts=False)
dev.open()

cnf = """{
    "configuration" : {
        "system" : {
            "services" : {
                "telnet" : [null]
            }
        }
    }
}"""

cu = Config(dev)
op = cu.load(cnf, format='json')
print etree.tostring(op)
dev.close()

FTP Utility

Option to use FTP utility to transfer files in addition to existing SCP.

from jnpr.junos import Device
from jnpr.junos.utils.ftp import FTP

dev = Device(host='xx.xxx.xxx.xx', user='xxxx', password='xxxx', gather_facts=False)
dev.open()

with FTP(dev) as ftp:
    ftp.put('/var/tmp/test.txt', '/var/tmp/test.txt')

dev.close()

Multi RPC error

If the config being loaded got more then 1 error/warning, PyEZ will give all error details to the user

from jnpr.junos import Device
from jnpr.junos.utils.config import Config

dev = Device(host='xx.xxx.xxx.xx', user='xxxx', password='xxxx', gather_facts=False)
dev.open()

cnf = \
"""set interfaces xe-0/0/10 ether-options 802.3ad ae10
et interfaces xe-0/0/11 ether-options 802.3ad ae11
set interfaces xe-0/0/12 ether-options 802.3ad lcap force-up
set interfaces xe-0/0/14 ether-options 802.3ad ae14"""
cu = Config(dev)
try:
    cu.load(cnf, format='set')
    cu.commit()
except Exception as ex:
    print ex.errs
    print ex```

Output

[{'source': None, 'message': 'syntax error', 'bad_element': 'ether-options', 'severity': 'error'},
{'source': None, 'message': 'unknown command', 'bad_element': 'et', 'severity': 'error'},
{'source': None, 'message': 'syntax error', 'bad_element': 'ether-options', 'severity': 'error'},
{'source': None, 'message': 'syntax error', 'bad_element': 'ether-options', 'severity': 'error'}]

ConfigLoadError(severity: error, bad_element: ether-options, message: error: syntax error
error: unknown command
error: syntax error
error: syntax error)```

Bug fixes

  • dev.cli "invalid command" returned even in case of proper command. #498 #492
  • StartShell utility to work on Occam and root users.
  • StartShell run function to return Tuple of last_ok & command output
  • Many other bug fixes.

Release 1.3.1

22 Dec 10:17
Compare
Choose a tag to compare

Bugs Fixed:

  • Not to suppress exception under Config util context manager.

Release 1.3.0

18 Dec 10:16
Compare
Choose a tag to compare

Feature addition:

  • support "private" and "dynamic" database access #301 #458

We should be able to use Config as context manager where we can specify mode from
private/exclusive/dynamic/batch/ephemeral.

# mode can be private/dynamic/exclusive/batch
with Config(dev, mode='private') as cu:  
    cu.load('set system services netconf traceoptions file test.log', format='set')
    cu.pdiff()
    cu.commit()

Feature enhancements:

  • Support for Feature Velocity releases #442
  • Multiple RPC support #338 #453
  • Merged Table/View pull requests from user. #441
  • Facts gathering to raise only warning in case of exception #459

Bugs Fixed:

  • Raise RpcTimeoutError in commit_check #437
  • Config load not throwing RpcTimeoutError #443 #444
  • Prevented AttributeError upon XML comment #448 #447
  • Facts gathering fix for QFX and other specific software releases #450 #463

Release 1.2.3

06 Oct 17:46
Compare
Choose a tag to compare

Bugs Fixed:

  • Software upgrade for multi RE and multi VC #429
    • single chassis (EX8208 1EA-2RE) software installation was broken.
  • Facts gathering on VMx & Qfabric #313
  • SCP & SW progress to print proper log messages #422, #421
  • TXP facts broken #417
  • Prefer explicitly defined ssh_private_key_file to sshconfig #418

Feature enhancements:

  • Implement context manager for Device #433
  • JSON as format option to RPC calls for Junos >= 14.2
  • Merged Table/View pull requests from users.

Release 1.2.2

31 Jul 15:45
Compare
Choose a tag to compare

Bugs Fixed:

  • Suppress paramiko logger warnings #363
    • A few places warnings similar to No handlers could be found for logger "paramiko.transport" would be displayed.
  • Device password setter did not work #400
    • dev.password = 'newpass'
  • Facts gather for EX8200 standalone failing #402
  • JSON dump of RPC XML failing when contents include XML comment #406
  • SCP logger not enabled by default #362

Release 1.2.1

30 Jun 20:18
Compare
Choose a tag to compare

Bugs Fixed:

  • Unable to use get() multiple times with Tables
  • Add increased timeout value for remote_checksum
  • Ability to set options in CfgTable definition
  • Domain Fact
    • Put RPC inside try block
    • Search inherited version of config
  • Update support of swver fact for Junos 15.1

Release 1.2.0

09 Jun 21:32
Compare
Choose a tag to compare

New Features

Enhanced Exception Handling

  • ConnectError
    • Added more information including underlying message
  • CommitError
    • Added field descriptors
  • RpcError
    • Added field descriptors
  • ConnectClosedError
    • New exception – for devices that are unexpectedly closed or never opened. When this exception is thrown device.connected is set to False

XML Normalization Support

  • New feature adds the ability to normalize-space entire XML-RPC reply data. Some JUNOS RPC's return data wrapped in newlines which can interfere with text based searches.

  • Normalization is off by default (except for OpTables) and can be enabled by default per-device or on a per-RPC basis.

    No normalization
    rsp = dev.rpc.get_interface_information(interface_name='ge-0/0/0.0', terse=True)
    rsp.xpath(".//address-family[address-family-name='\ninet\n']/interface-address/ifa-local")[0].text
    '\n192.168.74.31/24\n
    Normalized
    rsp = dev.rpc.get_interface_information(interface_name='ge-0/0/0.0', terse=True, normalize=True)
    rsp.xpath(".//address-family[address-family-name='inet']/interface-address/ifa-local")[0].text
    '192.168.74.31/24'
    Enabling Normalization
    # Per Device
    dev = Device(host='1.1.1.1', normalize=True)
    dev.open(normalize=True)
    # Per RPC
    dev.rpc.any_rpc(normalize=True)

OpTables normalization

  • OpTables previously used normalize-space for table keys. Utilizing the new normalization function keys and values are now normalized.
  • This can be disabled in the table definition or via the get function
SessionTable:
  rpc:  get-flow-session-information
  item:  .//flow-session
  key:  session-identifier
  args:
    normalize: False
  view:  SessionView
session_table.get(normalize=False)

Mixed Mode Virtual Chassis Upgrade Support

  • Added pkg_set to sw.install

    Example
    sw.install(pkg_set=['jinstall-qfx-5-13.2X51-D35.3-domestic-signed.tgz', 'jinstall-ex-4300-13.2X51-D35.3-domestic-signed.tgz'], progress=sw.progress)

Add sync, force_sync, full, detail to Config.commit(),

Configuration Table Support

  • Ability to load configuration tables from device or XML file / object.

  • By default {'inherit': 'inherit', 'groups': 'groups'} and full child values are retrieved. (This is opposite of before).

  • get now has kwargs of namesonly and options.

  • group operator has also been added to simplify the gathering of apply-group inheritance.

    Example
    ---
    UserTable:
    get: system/login/user
    required_keys:
      user: name
    view: userView
    
    userView:
    groups:
      auth: authentication
    fields:
      uid: uid
      class: class
      uidgroup: { uid: group }
      fullgroup: { full-name: group }
    fields_auth:
      pass: encrypted-password
    
    PolicyRuleTable:
    get: security/policies/policy/policy
    required_keys:
      policy:
        - from-zone-name
        - to-zone-name
    view: policyRuleView
    
    policyRuleView:
    groups:
      match: match
      then: then
    fields_match:
      match_src: source-address
      match_dst: destination-address
      match_app: application
    fields_then:
      log_init : { log/session-init: flag }
      action : deny | permit

Support for SSH ProxyCommand in SCP

  • Utils.scp updated to utilize ProxyCommand

Set minimum paramiko version

  • Required version is now 1.15.2
  • Note If paramiko or ecdsa was installed via system packages pip -U encounter issues.

Bugs Fixed

Facts

  • MX Virtual Chassis
    • All physical RE's are now accounted for in facts in the format Device-RE => 'RE1-RE0'
    • Master fact is same format as other VC systems.
{'2RE': True,
 'HOME': '/var/home/regress',
 'RE0-RE0': {'last_reboot_reason': 'Router rebooted after a normal shutdown.',
             'mastership_state': 'master',
             'model': 'RE-S-1800x4',
             'status': 'OK',
             'up_time': '13 days, 22 hours, 27 minutes, 23 seconds'},
 'RE0-RE1': {'last_reboot_reason': 'Router rebooted after a normal shutdown.',
             'mastership_state': 'backup',
             'model': 'RE-S-1800x4',
             'status': 'OK',
             'up_time': '13 days, 22 hours, 27 minutes, 22 seconds'},
 'RE1-RE0': {'last_reboot_reason': 'Router rebooted after a normal shutdown.',
             'mastership_state': 'master',
             'model': 'RE-S-1800x4',
             'status': 'OK',
             'up_time': '13 days, 22 hours, 28 minutes, 19 seconds'},
 'RE1-RE1': {'last_reboot_reason': 'Router rebooted after a normal shutdown.',
             'mastership_state': 'backup',
             'model': 'RE-S-1800x4',
             'status': 'OK',
             'up_time': '13 days, 22 hours, 28 minutes, 5 seconds'},
 'RE_hw_mi': True,
 'domain': 'juniper.net',
 'fqdn': 'host.juniper.net',
 'hostname': 'host',
 'ifd_style': 'CLASSIC',
 'master': 'RE0',
 'model': 'MX2010',
 'personality': 'MX',
 'serialnumber': 'JN11CAXXXXXX',
 'switch_style': 'BRIDGE_DOMAIN',
 'vc_capable': True,
 'version': '14.2I20150327_2246',
 'version_RE0': '14.2I20150327_2246',
 'version_RE1': '14.2I20150327_2246',
 'version_info': junos.version_info(major=(14, 2), type=I, minor=20150327_2246, build=None)}
  • Domain
    • Domain lookup now checks configuration first before attempting to parse /etc/resolv.conf or /var/etc/resolv.conf
  • 2RE
    • Fixed false positive of 2RE on vc_capable systems

StartShell root user

  • Utils.start_shell now supports the user root

utils.fs multiple RE support

  • Fixed bug affecting multiple RE systems

OpTables loading from XML files and objects

  • OpTables were not properly loading when passing in a XML file path or lxml object