Skip to content
This repository was archived by the owner on Apr 20, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
72eff5e
draft iosxr l3 interface
justjais May 30, 2019
01a55a0
draft iosxr l3 interface
justjais May 30, 2019
7a8c77f
draft iosxr l3 interface
justjais May 30, 2019
39c4dd3
draft iosxr l3 interface
justjais May 30, 2019
8763198
draft iosxr l3 interface
justjais May 30, 2019
4b961da
draft iosxr l3 interface
justjais May 30, 2019
c9b8889
draft iosxr l3 interface
justjais May 30, 2019
8a4e3e2
draft iosxr l3 interface
justjais May 30, 2019
cef820e
draft iosxr l3 interface
justjais May 30, 2019
3d487e1
draft iosxr l3 interface
justjais May 30, 2019
16853eb
draft iosxr l3 interface
justjais May 30, 2019
dd0ab22
draft iosxr l3 interface
justjais May 30, 2019
c7fd8e1
draft iosxr l3 interface
justjais May 30, 2019
a46fb55
draft iosxr l3 interface
justjais May 30, 2019
81fefaf
draft iosxr l3 interface
justjais May 30, 2019
088da00
draft iosxr l3 interface
justjais May 30, 2019
e3bed47
draft iosxr l3 interface
justjais May 30, 2019
f2e138d
draft iosxr l3 interface
justjais May 30, 2019
b7289b8
draft iosxr l3 interface
justjais May 30, 2019
1a72d3b
draft iosxr l3 interface
justjais May 30, 2019
8d3ad8c
draft iosxr l3 interface
justjais May 30, 2019
3a54477
draft iosxr l3 interface
justjais May 30, 2019
fbb8d96
draft iosxr l3 interface
justjais May 30, 2019
d48e153
draft iosxr l3 interface
justjais May 30, 2019
6c09779
draft iosxr l3 interface
justjais May 30, 2019
88c667c
draft iosxr l3 interface
justjais May 30, 2019
e2b28b2
Merge branch 'devel' of https://github.com/ansible/network into iosxr…
justjais Jun 5, 2019
27fb4aa
iosxr l3 interface update
justjais Jun 6, 2019
91a3962
iosxr l3 interface update
justjais Jun 6, 2019
dfca09f
iosxr l3 interface update
justjais Jun 6, 2019
9239b61
iosxr l3 interface update
justjais Jun 6, 2019
9a4b0a6
review comment
justjais Jun 14, 2019
a600af2
review comment
justjais Jun 14, 2019
52a466c
iosxr l3 interface update
justjais Jun 16, 2019
4202b4e
bug fix
justjais Jun 18, 2019
6d44d08
iosxr l3 minor update
justjais Jun 18, 2019
b7cd387
secondary default set
justjais Jun 28, 2019
68fca47
secondary default set
justjais Jun 28, 2019
dddb9c9
fix iosxr l3
justjais Aug 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions library/iosxr_facts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The module file for iosxr_facts
"""

from __future__ import absolute_import, division, print_function

ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}

NETWORK_OS = "iosxr"
RESOURCE = "facts"
COPYRIGHT = "Copyright 2019 Red Hat"

DOCUMENTATION = """
---
module: iosxr_facts
version_added: 2.9
short_description: Get facts about Cisco IOS-XR devices.
description:
- Collects facts from network devices running the Cisco IOS-XR operating
system. This module places the facts gathered in the fact tree keyed by the
respective resource name. The facts module will always collect a
base set of facts from the device and can enable or disable
collection of additional facts.
author: [u'Sumit Jaiswal (@justjais)']
notes:
- Tested against IOSXRv Version 6.1.3 on VIRL
options:
gather_subset:
description:
- When supplied, this argument will restrict the facts collected
to a given subset. Possible values for this argument include
all, and net_configuration_<resource_name>. Can specify a
list of values to include a larger subset. Values can also be used
with an initial C(M(!)) to specify that a specific subset should
not be collected.
required: false
default: 'all'
version_added: "2.2"
"""

EXAMPLES = """
# Gather all facts
- iosxr_facts:
gather_subset: all
gather_network_resources: all
# Collect only the iosxr facts
- iosxr_facts:
gather_subset:
- !all
- !min
gather_network_resources:
- iosxr
# Do not collect iosxr facts
- iosxr_facts:
gather_network_resources:
- "!iosxr"
# Collect iosxr and minimal default facts
- iosxr_facts:
gather_subset: min
gather_network_resources: iosxr
"""

RETURN = """
See the respective resource module parameters for the tree.
"""

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.connection import Connection
from ansible.module_utils.iosxr.facts.facts import Facts


def main():
"""
Main entry point for module execution

:returns: ansible_facts
"""
module = AnsibleModule(argument_spec=Facts.argument_spec,
supports_check_mode=True)
warnings = ['default value for `gather_subset` will be changed to `min` from `!config` v2.11 onwards']

connection = Connection(module._socket_path) #pylint: disable=W0212
gather_subset = module.params['gather_subset']
gather_network_resources = module.params['gather_network_resources']
result = Facts().get_facts(module, connection, gather_subset, gather_network_resources)

try:
ansible_facts, warning = result
warnings.extend(warning)
except (TypeError, KeyError):
ansible_facts = result

module.exit_json(ansible_facts=ansible_facts, warnings=warnings)

if __name__ == '__main__':
main()
Loading