Commit graph

49 commits

Author SHA1 Message Date
Ganesh Nalawade
d8bf4206e4
netconf - handle import error when running in FIPS mode (#73992)
* Handle netconf plugin ncclient import error when running in FIPS mode

*  While running in FIPS mode importing ncclient result in
   InternalError raised by cryptography
*  Refer https://github.com/ansible/ansible/pull/65477
2021-04-19 12:41:55 -04:00
Ganesh Nalawade
7635d23cee
Fix netconf validate capability check (#71195)
*  Use ``:validate`` string to check if the netconf
   server supports validate capability as per netconf RFC
2020-08-12 09:17:54 +05:30
Ansible Core Team
35063de590 Migrated to junipernetworks.junos 2020-03-23 11:14:21 -05:00
Ansible Core Team
5aa37733c3 Migrated to cisco.iosxr 2020-03-23 11:14:21 -05:00
Ansible Core Team
9a7a574ffc Migrated to ansible.netcommon 2020-03-23 11:14:21 -05:00
Ansible Core Team
4e488d8435 Migrated to community.general 2020-03-23 11:14:21 -05:00
Ganesh Nalawade
1cfab26fab
Fix netconf plugin related to collections (#65718)
* Fix netconf plugin related to collections

Fixes #65655 (partly)

*  Make netconf plugins configurable so that the
   information of ncclient device handler
   for give platform resides in the platform
   specific netconf plugin.
*  If the device handler value in ncclient is
   different from the ansible_network_os value
   the right value of `ncclient_device_handler`
   should be set in the plugin documentation.

* Fix review comments

* Fix CI issue

* Fix review comment
2019-12-20 12:25:59 +05:30
Paul Belanger
093d1500b9
Clean up flake8 for ansible.netcommon collection (#65842)
We noticed the following flake8 errors when we ran the migration script
for ansible.netcommon.

Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2019-12-16 08:24:38 -05:00
Ganesh Nalawade
3919a891c2
Fix iosxr netconf plugin get device info (#65489)
* Fix iosxr netconf plugin get device info

Fixes https://github.com/ansible/ansible/issues/64634

*  Catch execption if the xml payload to get
   device info is not valid for iosxr version
   running on remote host.

* Fix CI issue
2019-12-06 08:58:03 +05:30
Xu Yuandong
da8ec327cc Update plugins/netconf/ce.py to fix a bug(failed to get veriosn information via neocnf). (#65065)
* fix version fail.

* add a changelog fragment.

* Update ce.py

* Rename plugins-netconf-ce-fix.yaml to 65065-plugins-netconf-ce-fix.yaml

* Update ce.py
2019-11-20 22:18:24 +01:00
Nathaniel Case
f5e0995cae
Fix netconf post "delay persistent connections" (#63463)
* ensure_connect on manager use

* Remove ensure_connected from individual netconf plugins
2019-10-17 11:22:48 -04:00
Xu Yuandong
d6ef7c8530 module_utils-network-cloudengine: fix get_nc_next. (#62587)
* fix get_nc_next.

* add a changelog fragment.

* upadte for  changelgo fragment.

* merge two prs, one depens another.

* merge two prs, one depens another.

* update changelog.
2019-09-23 15:13:42 +02:00
Xu Yuandong
037401b6e0 fix plugins/netconf/ce.py for netconf/capability/exchange (#60569) 2019-09-17 08:00:55 +02:00
Ganesh Nalawade
fcc32bcf0e
Fix junos netconf plugin get_configuration filter (#58271)
* junos `get_configuration` netconf api expects the
  filter as instance of ElementTree object
2019-06-25 16:00:56 +05:30
markafarrell
43872d6b88 Fix netconf guess_network_os to use ssh_config if supplied. (#55199)
* feature: use network_os=auto to trigger network os guessing

* doc: add debug messages

* fix linting

* fix test_netconf_init default network_os is auto

* add documentation

* fix rst errors

* use init lexer

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update lib/ansible/plugins/connection/netconf.py

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update lib/ansible/plugins/connection/netconf.py

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update lib/ansible/plugins/connection/netconf.py

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>
2019-06-21 09:04:13 +05:30
Ganesh Nalawade
cc00f21a35 Fix issue in netconf plugin dispatch for junos and iosxr (#57981)
*  If case xml reply is transformed or namespace is removed in ncclient
   device specific handler return modified xml response as string

*  If data xml node is present in xml response return the xml string
   with data node as root node

*  If none above is true return raw xml string received from host
   with rpc-reply as the root node
2019-06-18 10:36:03 -04:00
Paul Belanger
fa738613dc
Revert "Fix iosxr discard_changes netconf rpc issue (#57931)" (#57954)
This actually broken junos netconf_rpc, and was merged without properly
testing.

This reverts commit 795cb90367.
2019-06-17 11:45:30 -04:00
Ganesh Nalawade
795cb90367
Fix iosxr discard_changes netconf rpc issue (#57931)
* If dispatch() rpc response has data element
return the xml string from <data> element
else return the complete xml string from
<rpc-reply>.

Depends-On: #57909
Depends-On: #57919
2019-06-17 16:22:23 +05:30
Ganesh Nalawade
a867ced4de Fix junos integration zuul CI failures (#57309) 2019-06-10 16:10:57 +02:00
Nathaniel Case
b442706b54
Move missing library abort to use rather than import for netconf (#55384) 2019-04-23 09:19:47 -04:00
Ganesh Nalawade
ac07c6b5e6
Fix netconf plugin dispatch response (#54326)
Fixes #53236

*  If dispatch() rpc response has data element
   return the xml string from `<data>` element
   else return the complete xml string from
   `<rpc-reply>`.
2019-03-26 10:23:26 +05:30
Ganesh Nalawade
f547c88ade
Fix connect_timeout config varaible in netconf connection (#51055)
*  Fetch connect_timeout value from get_options()
   instead of play_context
2019-01-21 12:21:09 +05:30
Nathaniel Case
1829a72885
Allow persistent connection plugins to queue messages back to ansible-connection (#49977)
* Connections can queue messages to be returned from ansible-connection

* Provide fallback for invalid display level

* Strip display from plugins

* Route messages through helper method to try to avoid improper appends
2018-12-19 10:54:42 -05:00
Ganesh Nalawade
829fc0feda
Fix iosxr netconf plugin response namespace (#49238)
* Fix iosxr netconf plugin response namespace

*  iosxr netconf plugin removes namespace by default
   for all the responses as parsing of xml is easier
   without namepsace in iosxr module. However to validate
   the response received from device against yang model requires
   namespace to be present in resposne.
*  Add a parameter in iosxr netconf plugin to control if namespace
   should be removed from response or not.

* Fix CI issues

* Fix review comment
2018-11-29 13:21:41 +05:30
Matt Martz
9773a1f289
Add a Singleton metaclass, use it with Display (#48935)
* Add a Singleton class, use it with Display

* update six import

* Move remaining failes to display singleton

* Fix rebase issues

* Singleton improvements

* Add code-smell for 'from __main__ import display'. ci_complete

* s/self/cls/g

* Add docs for no-main-display

* Address linting issues

* Add changelog fragment. ci_complete

* Implement reentrant lock for class instantiation in Singleton

* Add Display singleton porting guide
2018-11-20 17:06:51 -06:00
Martin Krizek
a80c25cbd9
Do not use str() on exceptions (#46950) 2018-11-09 07:59:30 +01:00
Nathaniel Case
406b59aeba
Move persistent connections to only use registered variables (#45616)
* Try to intuit proper plugins to send to ansible-connection

* Move sub-plugins to init so that vars will be populated in executor

* Fix connection unit tests
2018-09-20 09:56:43 -04:00
Ganesh Nalawade
455dfbe732
Fix netconf module and plugin issues (#45140)
* Fix netconf netconf issues

*  Identifier is optional for get_schema api
*  Fix dispatch api mandatory argument check
*  Add save option handling to copy config from target datastore
   to startup datastore if supported
*  Validate config in check-mode or if validate option set to true

* Copy config if check-mode is not enabled
2018-09-04 13:23:18 +05:30
Ganesh Nalawade
b0d6867fbb
Fix netconf_config module default_operation issue (#44958)
* Pass parameters as dict to edit_config api
  as either dict or args can be passed over
  jsonrpc 2.0 and not combination of args and
  kwargs
2018-08-31 16:33:34 +05:30
Ganesh Nalawade
ce541454e9
Update netconf_config module (#44379)
Fixes #40650
Fixes #40245
Fixes #41541

*  Refactor netconf_config module as per proposal #104
*  Update netconf_config module metadata to core network supported
*  Refactor local connection to use persistent connection framework
   for backward compatibility
*  Update netconf connection plugin configuration varaibles (Fixes #40245)
*  Add support for optional lock feature to Fixes #41541
*  Add integration test for netconf_config module
*  Documentation update
* Move deprecated options in netconf_config module
2018-08-21 20:41:18 +05:30
Ganesh Nalawade
d9ee693652
Update netconf plugins for junos and iosxr (#44157)
* Update netconf plugins for junos and iosxr

Fixes #39160

*  Update api signature for netcon api's
   from variable arguments to named arguments

* Udpate get default rpc supported

* Fix CI issue
2018-08-15 16:34:45 +05:30
Ganesh Nalawade
b0bd1651fa
Fix netconf plugin set_option (#43589)
* To enable set config option with `Netconf` plugin
  inherit `NetconfBase` class from `AnsiblePlugin` parent class
2018-08-02 11:31:17 +05:30
Ganesh Nalawade
88b966e23b
Fix junos_config confirm commit issue (#41527)
* Fix junos_config confirm commit issue

Fixes #40626

* Due to issue in ncclient commit() method for Juniper
  device (ncclient/ncclient#238)
  add a workaround in junos netconf plugin to generate proper
  commit-configuration xml and execute it using ncclient
  generic `rpc()` method.

* Update junos_config doc
2018-06-29 15:09:55 +05:30
Nathaniel Case
9aa8c652ba
Netconf bytes fixes (#41607)
* Solve some bytes issues on iosxr

* Solve some bytes issues in junos

* Do the correct thing with tostring based on lxml or not
2018-06-22 11:50:44 -04:00
Biao Liu
d90d8e7f99 Add cli and netconf ability from ansible itself for cloudengine ce modules (#41357)
* for shippable

for shippable

* add cliconf

* add network_cli

* add cliconf and network cli and netconf

* modify bugs of netconf

* add shippable modify

* update shippable

update shippable
2018-06-14 09:38:27 +05:30
wiso
160bf82544 Add NETCONF support for SROS devices (#40330)
* added NETCONF support for SROS devices

* corrected alu mapping

* fix pep8 in sros.py

* BOT META file updated
2018-05-24 15:44:39 +05:30
wiso
387a23c3d1 New ansible module netconf_rpc (#40358)
* New ansible module netconf_rpc

* add integration test for module netconf_rpc

* pep8/meta-data corrections

* usage of jxmlease for all XML processing
separation of attributes "rpc" and "content"

* removed unused imports
improved error handling

* fixed pep8

* usage of ast.literal_eval instead of eval
added description to SROS integration test for cases commented out
2018-05-24 15:25:02 +05:30
Ganesh Nalawade
30f992f260
Add netconf_get module (#39869)
* Add netconf_get module

Implements part-1 of proposal #104
https://github.com/ansible/proposals/issues/104

*  Add netconf_get module
*  Refactor `get`, `get_config`, `lock`, `unlock`
   and `discard_changes` netconf plugin api's
*  Add netconf module_utils file which netconf module
   related common functions
*  Refactor junos and iosxr netconf plugins

* Fix source option handling

* Fix review comments

* Update botmeta file

* Update review comments and add support for lock

* Lock update fix

* Fix CI issue

* Add integration test and minor fixes

* Fix review comments

* Fix CI failure

* Fix CI issues

* Fix CI issues

* Fix review comments and update integration test

* Fix review comments

* Fix review comments

* Fix review comments

Fix reveiw comments
2018-05-17 17:38:12 +05:30
Nathaniel Case
85cc5ea129
Raise error when trying to use older iosxr modules with netconf (#37423) 2018-03-15 12:49:35 -04:00
Ganesh Nalawade
41d75783b5
Fix junos_command py3 related issues (#36782)
Fixes #36204

*  tostring() input string shoulb be in byte string format
*  to_ele() input is required in unicode format
2018-03-01 12:09:11 +05:30
Ganesh Nalawade
9ea5e8b37c
Check if data_xml object in present in NCElement object (#35604)
If ncclient return NCElement object call data_xml() on response
else call xml()
2018-02-01 21:38:49 +05:30
Peter Sprygada
58d54799b8
exposes rpc method to plugin (#35507)
The rpc method should be exposed to the modules over the connection rpc
mechanism.  This fix will expose the rpc method to call generalized rpc
endpoints on remote devices
2018-01-30 12:27:48 -05:00
Peter Sprygada
b4fa68555d adds support for using connection=netconf (#33400)
* adds support for using connection=netconf

This change updates the module to provide support for using
connection=netconf instead of connection=local.  If connection=netconf
is used, then the various connection arguments will be silently ignored.

* adds netconf plugin default

This adds a default implementation for netconf plugins if the network_os
is not specified.  The default plugin will implement only the standard
netconf rpcs

* fix up pep8 issues
2018-01-24 21:48:41 +05:30
Kedar Kekan
93acd7c651 refactor iosxr_system for cliconf and netconf (#34749)
* * refactor iosxr_system for cliconf and netconf

* * Fix unit tests and sanity issues
2018-01-17 07:29:28 -07:00
Peter Sprygada
1699a39ad0 fixes guess_os for netconf connections (#33671)
* fixes guess_os for netconf connections

This change fixes invalid calls to play_context when the network_os is
not set and the connection attempts to guess the network_os.  The method
will now check the correct values for ssh key file and allow agent
instead of returning errors.

* fix up pep8 issues
2017-12-07 20:17:41 +05:30
Kedar Kekan
2bc4c4f156
IOS-XR NetConf and Cliconf plugin work (#33332)
*  - Netconf plugin addition for iosxr
 - Utilities refactoring to support netconf and cliconf
 - iosx_banner refactoring for netconf and cliconf
 - Integration testcases changes to accomodate above changes

* Fix sanity failures, shippable errors and review comments

* fix pep8 issue

* changes run_command method to send specific command args

* - Review comment fixes
- iosxr_command changes to remove ComplexDict based command_spec

* - Move namespaces removal method from utils to netconf plugin

* Minor refactoring in utils and change in deprecation message

* rewrite build_xml logic and import changes for new utils dir structure

* - Review comment changes and minor changes to documentation

* * refactor common code and docs updates
2017-12-06 22:37:31 +05:30
Ganesh Nalawade
3d63ecb6f3
Refactor junos modules to Use netconf and cliconf plugins (#32621)
* Fix junos integration test fixes as per connection refactor (#33050)

Refactor netconf connection plugin to work with netconf plugin

* Fix junos integration test fixes as per connection refactor (#33050)

Refactor netconf connection plugin to work with netconf plugin
Fix CI failure
Fix unit test failure
Fix review comments
2017-11-24 12:04:47 +05:30
Ganesh Nalawade
3bd8dbb53d Add support for netconf network discovery (#25435)
* Add support for netconf network discovery

* Fix unit test failure
2017-06-28 11:07:38 +05:30
Ganesh Nalawade
6215922889 Add support for cliconf and netconf plugin (#25093)
* ansible-connection refactor and action plugin changes
* Add cliconf plugin for eos, ios, iosxr, junos, nxos, vyos
* Add netconf plugin for junos
* Add jsonrpc support
* Modify network_cli and netconf connection plugin
* Fix py3 unit test failure
* Fix review comment
* Minor fixes
* Fix ansible-connection review comments
* Fix CI issue
* platform_agnostic related changes
2017-06-06 13:56:25 +05:30