mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 21:30:22 -07:00
Add platform facts in network facts modules (#51434)
* Add platform facts in network facts modules Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Add nxos Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Add vyos Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Add iosxr Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Add junos Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * fix pep8 Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * update unit test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * fix vyos_facts unittest Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * fix ios_facts unittest Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * fix iosxr unittests Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * fix CI failure Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * fix junos test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
5cd7bf39dd
commit
a41028244d
16 changed files with 303 additions and 180 deletions
|
@ -145,7 +145,7 @@ def get_connection(module):
|
|||
if hasattr(module, 'connection'):
|
||||
return module.connection
|
||||
|
||||
capabilities = get_device_capabilities(module)
|
||||
capabilities = get_capabilities(module)
|
||||
network_api = capabilities.get('network_api')
|
||||
if network_api == 'cliconf':
|
||||
module.connection = Connection(module._socket_path)
|
||||
|
@ -157,7 +157,7 @@ def get_connection(module):
|
|||
return module.connection
|
||||
|
||||
|
||||
def get_device_capabilities(module):
|
||||
def get_capabilities(module):
|
||||
if hasattr(module, 'capabilities'):
|
||||
return module.capabilities
|
||||
try:
|
||||
|
@ -317,12 +317,12 @@ def etree_findall(root, node):
|
|||
|
||||
|
||||
def is_cliconf(module):
|
||||
capabilities = get_device_capabilities(module)
|
||||
capabilities = get_capabilities(module)
|
||||
return (capabilities.get('network_api') == 'cliconf')
|
||||
|
||||
|
||||
def is_netconf(module):
|
||||
capabilities = get_device_capabilities(module)
|
||||
capabilities = get_capabilities(module)
|
||||
network_api = capabilities.get('network_api')
|
||||
if network_api == 'netconf':
|
||||
if not HAS_NCCLIENT:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue