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 toFalse
- New exception – for devices that are unexpectedly closed or never opened. When this exception is thrown
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
tosw.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(),
-
Added additional options to commit
-
Example
cu.commit(comment='combo!', force_sync=True, detail=True, full=True)
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 ofnamesonly
andoptions
. -
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.
- All physical RE's are now accounted for in facts in the format
{'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
- Domain lookup now checks configuration first before attempting to parse
- 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