Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

[iosxr_l2_interfaces] resource module #17

Open
wants to merge 44 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
3b64369
iosxr l2 interface
justjais May 26, 2019
cd6de5b
iosxr l2 interface
justjais May 26, 2019
b48b556
iosxr l2 interface
justjais May 26, 2019
8f61674
iosxr l2 interface
justjais May 26, 2019
20d480b
iosxr l2 interface
justjais May 26, 2019
41f969e
iosxr l2 interface
justjais May 26, 2019
6fb2152
iosxr l2 interface
justjais May 26, 2019
2e27d3a
iosxr l2 interface
justjais May 26, 2019
e8d1f0b
iosxr l2 interface
justjais May 26, 2019
9ad68f4
iosxr l2 interface
justjais May 26, 2019
517c730
iosxr l2 interface
justjais May 26, 2019
277c1ef
iosxr l2 interface
justjais May 26, 2019
9e07746
iosxr l2 interface
justjais May 26, 2019
ceb7a37
iosxr l2 interface
justjais May 26, 2019
ac15454
iosxr l2 interface
justjais May 26, 2019
a938203
iosxr l2 interface
justjais May 26, 2019
8570fdf
iosxr l2 interface
justjais May 26, 2019
14f5232
iosxr l2 interface
justjais May 26, 2019
3626913
iosxr l2 interface
justjais May 26, 2019
dd6b49c
iosxr l2 interface
justjais May 26, 2019
c57b239
iosxr l2 interface
justjais May 26, 2019
82849b9
iosxr l2 interface
justjais May 26, 2019
a4fb5eb
iosxr l2 interface
justjais May 26, 2019
bc9f14f
iosxr l2 interface
justjais May 26, 2019
027aa4a
iosxr l2 interface
justjais May 26, 2019
3c44908
iosxr l2 interface
justjais May 26, 2019
1de53e7
iosxr l2 interface
justjais May 26, 2019
136bc0b
fix review comment
justjais May 27, 2019
b1b1c83
fix review comment
justjais May 27, 2019
1e19d44
fix review comment
justjais May 27, 2019
b0c7924
fix review comment
justjais May 27, 2019
fb9ea64
fix review comment
justjais May 27, 2019
709b071
fix review comment
justjais May 27, 2019
f5dd9d0
fix idempotency
justjais May 27, 2019
92c4f37
bug n doc fix
justjais May 29, 2019
2135b4d
bug n doc fix
justjais May 29, 2019
57e7117
bug n doc fix
justjais May 29, 2019
a611633
bug n doc fix
justjais May 29, 2019
752aaa7
bug n doc fix
justjais May 29, 2019
c4af8f8
bug n doc fix
justjais May 29, 2019
a6054f7
bug n doc fix
justjais May 29, 2019
9079a8b
bug n doc fix
justjais May 29, 2019
34e9b60
bug n doc fix
justjais May 29, 2019
6d22d39
fix issues
justjais Aug 8, 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
6 changes: 6 additions & 0 deletions .idea/libraries/R_User_Library.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/network.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

508 changes: 508 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Empty file added library/__init__.py
Empty file.
116 changes: 116 additions & 0 deletions library/iosxr_facts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/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 IOSXR devices.
description:
- Collects facts from network devices running the iosxr 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, min, hardware, config, legacy, and interfaces. 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"
gather_network_resources:
description:
- When supplied, this argument will restrict the facts collected
to a given subset. Possible values for this argument include
all and the resources like interfaces, vlans etc.
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
version_added: "2.9"
"""

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)
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