From a453ac31f3428614cceb99027f8efbdb9258a40b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 14 May 2024 22:03:01 +0200 Subject: Adding upstream version 2.10.7+merged+base+2.10.8+dfsg. Signed-off-by: Daniel Baumann --- .../ansible_collections/cisco/iosxr/.gitignore | 91 + .../ansible_collections/cisco/iosxr/.yamllint | 15 + .../ansible_collections/cisco/iosxr/.zuul.yaml | 8 + .../ansible_collections/cisco/iosxr/FILES.json | 6060 +++++++++++ .../ansible_collections/cisco/iosxr/LICENSE | 674 ++ .../ansible_collections/cisco/iosxr/MANIFEST.json | 35 + .../ansible_collections/cisco/iosxr/README.md | 154 + .../ansible_collections/cisco/iosxr/bindep.txt | 6 + .../cisco/iosxr/changelogs/CHANGELOG.rst | 133 + .../cisco/iosxr/changelogs/changelog.yaml | 167 + .../cisco/iosxr/changelogs/config.yaml | 30 + .../cisco.iosxr.iosxr_acl_interfaces_module.rst | 774 ++ .../iosxr/docs/cisco.iosxr.iosxr_acls_module.rst | 4731 +++++++++ .../iosxr/docs/cisco.iosxr.iosxr_banner_module.rst | 331 + .../iosxr/docs/cisco.iosxr.iosxr_bgp_module.rst | 718 ++ .../cisco/iosxr/docs/cisco.iosxr.iosxr_cliconf.rst | 43 + .../docs/cisco.iosxr.iosxr_command_module.rst | 382 + .../iosxr/docs/cisco.iosxr.iosxr_config_module.rst | 649 ++ .../iosxr/docs/cisco.iosxr.iosxr_facts_module.rst | 533 + .../docs/cisco.iosxr.iosxr_interface_module.rst | 748 ++ .../docs/cisco.iosxr.iosxr_interfaces_module.rst | 697 ++ .../cisco.iosxr.iosxr_l2_interfaces_module.rst | 879 ++ .../cisco.iosxr.iosxr_l3_interfaces_module.rst | 803 ++ .../cisco.iosxr.iosxr_lacp_interfaces_module.rst | 802 ++ .../iosxr/docs/cisco.iosxr.iosxr_lacp_module.rst | 500 + .../cisco.iosxr.iosxr_lag_interfaces_module.rst | 1033 ++ .../docs/cisco.iosxr.iosxr_lldp_global_module.rst | 692 ++ .../cisco.iosxr.iosxr_lldp_interfaces_module.rst | 849 ++ .../docs/cisco.iosxr.iosxr_logging_module.rst | 633 ++ .../cisco/iosxr/docs/cisco.iosxr.iosxr_netconf.rst | 76 + .../docs/cisco.iosxr.iosxr_netconf_module.rst | 296 + .../cisco.iosxr.iosxr_ospf_interfaces_module.rst | 3089 ++++++ .../iosxr/docs/cisco.iosxr.iosxr_ospfv2_module.rst | 7069 +++++++++++++ .../iosxr/docs/cisco.iosxr.iosxr_ospfv3_module.rst | 10348 +++++++++++++++++++ .../cisco.iosxr.iosxr_static_routes_module.rst | 1141 ++ .../iosxr/docs/cisco.iosxr.iosxr_system_module.rst | 427 + .../iosxr/docs/cisco.iosxr.iosxr_user_module.rst | 651 ++ .../cisco/iosxr/meta/runtime.yml | 156 + .../cisco/iosxr/plugins/action/__init__.py | 0 .../cisco/iosxr/plugins/action/iosxr.py | 162 + .../cisco/iosxr/plugins/cliconf/__init__.py | 0 .../cisco/iosxr/plugins/cliconf/iosxr.py | 366 + .../cisco/iosxr/plugins/doc_fragments/__init__.py | 0 .../cisco/iosxr/plugins/doc_fragments/iosxr.py | 73 + .../cisco/iosxr/plugins/filter/__init__.py | 0 .../cisco/iosxr/plugins/module_utils/__init__.py | 0 .../iosxr/plugins/module_utils/network/__init__.py | 0 .../plugins/module_utils/network/iosxr/__init__.py | 0 .../module_utils/network/iosxr/argspec/__init__.py | 0 .../iosxr/argspec/acl_interfaces/__init__.py | 0 .../iosxr/argspec/acl_interfaces/acl_interfaces.py | 85 + .../network/iosxr/argspec/acls/__init__.py | 0 .../network/iosxr/argspec/acls/acls.py | 538 + .../network/iosxr/argspec/facts/__init__.py | 0 .../network/iosxr/argspec/facts/facts.py | 27 + .../network/iosxr/argspec/interfaces/__init__.py | 0 .../network/iosxr/argspec/interfaces/interfaces.py | 64 + .../iosxr/argspec/l2_interfaces/__init__.py | 0 .../iosxr/argspec/l2_interfaces/l2_interfaces.py | 85 + .../iosxr/argspec/l3_interfaces/__init__.py | 0 .../iosxr/argspec/l3_interfaces/l3_interfaces.py | 72 + .../network/iosxr/argspec/lacp/__init__.py | 0 .../network/iosxr/argspec/lacp/lacp.py | 69 + .../iosxr/argspec/lacp_interfaces/__init__.py | 0 .../argspec/lacp_interfaces/lacp_interfaces.py | 77 + .../iosxr/argspec/lag_interfaces/__init__.py | 0 .../iosxr/argspec/lag_interfaces/lag_interfaces.py | 88 + .../network/iosxr/argspec/lldp_global/__init__.py | 0 .../iosxr/argspec/lldp_global/lldp_global.py | 73 + .../iosxr/argspec/lldp_interfaces/__init__.py | 0 .../argspec/lldp_interfaces/lldp_interfaces.py | 77 + .../iosxr/argspec/ospf_interfaces/__init__.py | 0 .../argspec/ospf_interfaces/ospf_interfaces.py | 379 + .../network/iosxr/argspec/ospfv2/__init__.py | 0 .../network/iosxr/argspec/ospfv2/ospfv2.py | 795 ++ .../network/iosxr/argspec/ospfv3/__init__.py | 0 .../network/iosxr/argspec/ospfv3/ospfv3.py | 1376 +++ .../iosxr/argspec/static_routes/__init__.py | 0 .../iosxr/argspec/static_routes/static_routes.py | 103 + .../module_utils/network/iosxr/config/__init__.py | 0 .../iosxr/config/acl_interfaces/__init__.py | 0 .../iosxr/config/acl_interfaces/acl_interfaces.py | 126 + .../network/iosxr/config/acls/__init__.py | 0 .../module_utils/network/iosxr/config/acls/acls.py | 518 + .../network/iosxr/config/interfaces/__init__.py | 0 .../network/iosxr/config/interfaces/interfaces.py | 327 + .../network/iosxr/config/l2_interfaces/__init__.py | 0 .../iosxr/config/l2_interfaces/l2_interfaces.py | 373 + .../network/iosxr/config/l3_interfaces/__init__.py | 0 .../iosxr/config/l3_interfaces/l3_interfaces.py | 397 + .../network/iosxr/config/lacp/__init__.py | 0 .../module_utils/network/iosxr/config/lacp/lacp.py | 213 + .../iosxr/config/lacp_interfaces/__init__.py | 0 .../config/lacp_interfaces/lacp_interfaces.py | 312 + .../iosxr/config/lag_interfaces/__init__.py | 0 .../iosxr/config/lag_interfaces/lag_interfaces.py | 439 + .../network/iosxr/config/lldp_global/__init__.py | 0 .../iosxr/config/lldp_global/lldp_global.py | 221 + .../iosxr/config/lldp_interfaces/__init__.py | 0 .../config/lldp_interfaces/lldp_interfaces.py | 278 + .../iosxr/config/ospf_interfaces/__init__.py | 0 .../config/ospf_interfaces/ospf_interfaces.py | 240 + .../network/iosxr/config/ospfv2/__init__.py | 0 .../network/iosxr/config/ospfv2/ospfv2.py | 262 + .../network/iosxr/config/ospfv3/__init__.py | 0 .../network/iosxr/config/ospfv3/ospfv3.py | 255 + .../network/iosxr/config/static_routes/__init__.py | 0 .../iosxr/config/static_routes/static_routes.py | 549 + .../module_utils/network/iosxr/facts/__init__.py | 0 .../network/iosxr/facts/acl_interfaces/__init__.py | 0 .../iosxr/facts/acl_interfaces/acl_interfaces.py | 78 + .../network/iosxr/facts/acls/__init__.py | 0 .../module_utils/network/iosxr/facts/acls/acls.py | 457 + .../module_utils/network/iosxr/facts/facts.py | 122 + .../network/iosxr/facts/interfaces/__init__.py | 0 .../network/iosxr/facts/interfaces/interfaces.py | 110 + .../network/iosxr/facts/l2_interfaces/__init__.py | 0 .../iosxr/facts/l2_interfaces/l2_interfaces.py | 134 + .../network/iosxr/facts/l3_interfaces/__init__.py | 0 .../iosxr/facts/l3_interfaces/l3_interfaces.py | 126 + .../network/iosxr/facts/lacp/__init__.py | 0 .../module_utils/network/iosxr/facts/lacp/lacp.py | 89 + .../iosxr/facts/lacp_interfaces/__init__.py | 0 .../iosxr/facts/lacp_interfaces/lacp_interfaces.py | 115 + .../network/iosxr/facts/lag_interfaces/__init__.py | 0 .../iosxr/facts/lag_interfaces/lag_interfaces.py | 141 + .../network/iosxr/facts/legacy/__init__.py | 0 .../network/iosxr/facts/legacy/base.py | 261 + .../network/iosxr/facts/lldp_global/__init__.py | 0 .../network/iosxr/facts/lldp_global/lldp_global.py | 107 + .../iosxr/facts/lldp_interfaces/__init__.py | 0 .../iosxr/facts/lldp_interfaces/lldp_interfaces.py | 109 + .../iosxr/facts/ospf_interfaces/__init__.py | 0 .../iosxr/facts/ospf_interfaces/ospf_interfaces.py | 137 + .../network/iosxr/facts/ospfv2/__init__.py | 0 .../network/iosxr/facts/ospfv2/ospfv2.py | 157 + .../network/iosxr/facts/ospfv3/__init__.py | 0 .../network/iosxr/facts/ospfv3/ospfv3.py | 155 + .../network/iosxr/facts/static_routes/__init__.py | 0 .../iosxr/facts/static_routes/static_routes.py | 191 + .../plugins/module_utils/network/iosxr/iosxr.py | 671 ++ .../network/iosxr/providers/__init__.py | 0 .../network/iosxr/providers/cli/__init__.py | 0 .../network/iosxr/providers/cli/config/__init__.py | 0 .../iosxr/providers/cli/config/bgp/__init__.py | 0 .../providers/cli/config/bgp/address_family.py | 129 + .../iosxr/providers/cli/config/bgp/neighbors.py | 135 + .../iosxr/providers/cli/config/bgp/process.py | 126 + .../module_utils/network/iosxr/providers/module.py | 72 + .../network/iosxr/providers/providers.py | 128 + .../network/iosxr/rm_templates/__init__.py | 0 .../network/iosxr/rm_templates/acl_interfaces.py | 61 + .../network/iosxr/rm_templates/ospf_interfaces.py | 1370 +++ .../network/iosxr/rm_templates/ospfv2.py | 2876 ++++++ .../network/iosxr/rm_templates/ospfv3.py | 2801 +++++ .../module_utils/network/iosxr/utils/__init__.py | 0 .../module_utils/network/iosxr/utils/utils.py | 391 + .../cisco/iosxr/plugins/modules/__init__.py | 0 .../iosxr/plugins/modules/iosxr_acl_interfaces.py | 651 ++ .../cisco/iosxr/plugins/modules/iosxr_acls.py | 1451 +++ .../cisco/iosxr/plugins/modules/iosxr_banner.py | 316 + .../cisco/iosxr/plugins/modules/iosxr_bgp.py | 355 + .../cisco/iosxr/plugins/modules/iosxr_command.py | 213 + .../cisco/iosxr/plugins/modules/iosxr_config.py | 480 + .../cisco/iosxr/plugins/modules/iosxr_facts.py | 218 + .../cisco/iosxr/plugins/modules/iosxr_interface.py | 1057 ++ .../iosxr/plugins/modules/iosxr_interfaces.py | 558 + .../iosxr/plugins/modules/iosxr_l2_interfaces.py | 687 ++ .../iosxr/plugins/modules/iosxr_l3_interfaces.py | 671 ++ .../cisco/iosxr/plugins/modules/iosxr_lacp.py | 392 + .../iosxr/plugins/modules/iosxr_lacp_interfaces.py | 652 ++ .../iosxr/plugins/modules/iosxr_lag_interfaces.py | 853 ++ .../iosxr/plugins/modules/iosxr_lldp_global.py | 489 + .../iosxr/plugins/modules/iosxr_lldp_interfaces.py | 724 ++ .../cisco/iosxr/plugins/modules/iosxr_logging.py | 1220 +++ .../cisco/iosxr/plugins/modules/iosxr_netconf.py | 221 + .../iosxr/plugins/modules/iosxr_ospf_interfaces.py | 1210 +++ .../cisco/iosxr/plugins/modules/iosxr_ospfv2.py | 2544 +++++ .../cisco/iosxr/plugins/modules/iosxr_ospfv3.py | 2783 +++++ .../iosxr/plugins/modules/iosxr_static_routes.py | 854 ++ .../cisco/iosxr/plugins/modules/iosxr_system.py | 943 ++ .../cisco/iosxr/plugins/modules/iosxr_user.py | 973 ++ .../cisco/iosxr/plugins/netconf/__init__.py | 0 .../cisco/iosxr/plugins/netconf/iosxr.py | 297 + .../cisco/iosxr/plugins/terminal/__init__.py | 0 .../cisco/iosxr/plugins/terminal/iosxr.py | 57 + .../cisco/iosxr/requirements.txt | 3 + .../cisco/iosxr/test-requirements.txt | 7 + .../cisco/iosxr/tests/.gitignore | 1 + .../tests/integration/network-integration.cfg | 4 + .../tests/integration/target-prefixes.network | 1 + .../iosxr_acl_interfaces/defaults/main.yaml | 3 + .../targets/iosxr_acl_interfaces/tasks/cli.yaml | 20 + .../targets/iosxr_acl_interfaces/tasks/main.yaml | 4 + .../iosxr_acl_interfaces/tests/cli/_populate.yaml | 18 + .../tests/cli/_remove_config.yaml | 27 + .../iosxr_acl_interfaces/tests/cli/deleted.yaml | 33 + .../tests/cli/deleted_all.yaml | 52 + .../tests/cli/empty_config.yaml | 60 + .../tests/cli/fixtures/parsed.cfg | 14 + .../iosxr_acl_interfaces/tests/cli/gathered.yaml | 63 + .../iosxr_acl_interfaces/tests/cli/merged.yaml | 132 + .../iosxr_acl_interfaces/tests/cli/overridden.yaml | 78 + .../iosxr_acl_interfaces/tests/cli/parsed.yaml | 16 + .../iosxr_acl_interfaces/tests/cli/rendered.yaml | 46 + .../iosxr_acl_interfaces/tests/cli/replaced.yaml | 63 + .../iosxr_acl_interfaces/tests/cli/rtt.yaml | 114 + .../targets/iosxr_acl_interfaces/vars/main.yaml | 172 + .../targets/iosxr_acls/defaults/main.yaml | 3 + .../integration/targets/iosxr_acls/tasks/cli.yaml | 20 + .../integration/targets/iosxr_acls/tasks/main.yaml | 4 + .../iosxr_acls/tests/cli/_populate_config.yaml | 9 + .../iosxr_acls/tests/cli/_remove_config.yaml | 9 + .../targets/iosxr_acls/tests/cli/deleted.yaml | 100 + .../targets/iosxr_acls/tests/cli/empty_config.yaml | 60 + .../iosxr_acls/tests/cli/fixtures/parsed.cfg | 8 + .../targets/iosxr_acls/tests/cli/gathered.yaml | 23 + .../targets/iosxr_acls/tests/cli/merged.yaml | 186 + .../targets/iosxr_acls/tests/cli/overridden.yaml | 79 + .../targets/iosxr_acls/tests/cli/parsed.yaml | 15 + .../targets/iosxr_acls/tests/cli/rendered.yaml | 101 + .../targets/iosxr_acls/tests/cli/replaced.yaml | 78 + .../targets/iosxr_acls/tests/cli/rtt.yaml | 96 + .../integration/targets/iosxr_acls/vars/main.yaml | 317 + .../targets/iosxr_banner/defaults/main.yaml | 3 + .../targets/iosxr_banner/meta/main.yaml | 3 + .../targets/iosxr_banner/tasks/cli.yaml | 18 + .../targets/iosxr_banner/tasks/main.yaml | 3 + .../targets/iosxr_banner/tasks/netconf.yaml | 26 + .../iosxr_banner/tests/cli/basic-login.yaml | 36 + .../targets/iosxr_banner/tests/cli/basic-motd.yaml | 36 + .../iosxr_banner/tests/cli/basic-no-login.yaml | 34 + .../iosxr_banner/tests/netconf/basic-login.yaml | 36 + .../iosxr_banner/tests/netconf/basic-motd.yaml | 36 + .../iosxr_banner/tests/netconf/basic-no-login.yaml | 34 + .../targets/iosxr_bgp/defaults/main.yaml | 3 + .../integration/targets/iosxr_bgp/meta/main.yaml | 3 + .../integration/targets/iosxr_bgp/tasks/cli.yaml | 16 + .../integration/targets/iosxr_bgp/tasks/main.yaml | 4 + .../targets/iosxr_bgp/tests/cli/basic.yaml | 256 + .../targets/iosxr_command/defaults/main.yaml | 3 + .../targets/iosxr_command/meta/main.yml | 3 + .../targets/iosxr_command/tasks/cli.yaml | 16 + .../targets/iosxr_command/tasks/main.yaml | 4 + .../iosxr_command/tests/cli/bad_operator.yaml | 20 + .../iosxr_command/tests/cli/cli_command.yaml | 45 + .../targets/iosxr_command/tests/cli/contains.yaml | 19 + .../targets/iosxr_command/tests/cli/invalid.yaml | 32 + .../targets/iosxr_command/tests/cli/output.yaml | 28 + .../targets/iosxr_command/tests/cli/prompt.yaml | 28 + .../targets/iosxr_command/tests/cli/timeout.yaml | 18 + .../targets/iosxr_config/defaults/main.yaml | 3 + .../iosxr_config/fixtures/config_add_interface.txt | 35 + .../iosxr_config/fixtures/config_del_interface.txt | 29 + .../integration/targets/iosxr_config/meta/main.yml | 3 + .../targets/iosxr_config/tasks/cli.yaml | 18 + .../targets/iosxr_config/tasks/cli_config.yaml | 18 + .../targets/iosxr_config/tasks/main.yaml | 6 + .../targets/iosxr_config/tasks/redirection.yaml | 16 + .../templates/basic/change_prefix_set.j2 | 7 + .../targets/iosxr_config/templates/basic/config.j2 | 4 + .../iosxr_config/templates/basic/configuration.j2 | 3 + .../templates/basic/init_prefix_set.j2 | 3 + .../iosxr_config/templates/basic/route_policy.j2 | 121 + .../templates/basic/route_policy_change.j2 | 65 + .../templates/basic/route_policy_clean.j2 | 32 + .../iosxr_config/templates/defaults/config.j2 | 4 + .../targets/iosxr_config/tests/cli/backup.yaml | 124 + .../iosxr_config/tests/cli/comment-too-long.yaml | 28 + .../targets/iosxr_config/tests/cli/comment.yaml | 36 + .../iosxr_config/tests/cli/commit_label.yaml | 70 + .../iosxr_config/tests/cli/misplaced_sublevel.yaml | 29 + .../iosxr_config/tests/cli/prefix_set_remark.yaml | 29 + .../iosxr_config/tests/cli/replace_config.yaml | 44 + .../iosxr_config/tests/cli/route_policy.yaml | 53 + .../targets/iosxr_config/tests/cli/src_basic.yaml | 33 + .../iosxr_config/tests/cli/src_invalid.yaml | 16 + .../iosxr_config/tests/cli/src_match_none.yaml | 35 + .../targets/iosxr_config/tests/cli/sublevel.yaml | 43 + .../iosxr_config/tests/cli/sublevel_block.yaml | 60 + .../iosxr_config/tests/cli/sublevel_exact.yaml | 64 + .../iosxr_config/tests/cli/sublevel_strict.yaml | 66 + .../tests/cli/sublevel_strict_mul_parents.yaml | 75 + .../targets/iosxr_config/tests/cli/toplevel.yaml | 37 + .../iosxr_config/tests/cli/toplevel_after.yaml | 45 + .../iosxr_config/tests/cli/toplevel_before.yaml | 45 + .../tests/cli/toplevel_nonidempotent.yaml | 44 + .../iosxr_config/tests/cli_config/cli_backup.yaml | 114 + .../iosxr_config/tests/cli_config/cli_basic.yaml | 32 + .../iosxr_config/tests/redirection/shortname.yaml | 37 + .../targets/iosxr_facts/defaults/main.yaml | 3 + .../integration/targets/iosxr_facts/meta/main.yml | 3 + .../integration/targets/iosxr_facts/tasks/cli.yaml | 16 + .../targets/iosxr_facts/tasks/main.yaml | 4 + .../targets/iosxr_facts/tests/cli/all_facts.yaml | 21 + .../iosxr_facts/tests/cli/default_facts.yaml | 21 + .../iosxr_facts/tests/cli/invalid_subset.yaml | 36 + .../iosxr_facts/tests/cli/not_hardware.yaml | 23 + .../targets/iosxr_interface/defaults/main.yaml | 3 + .../targets/iosxr_interface/meta/main.yaml | 3 + .../targets/iosxr_interface/tasks/cli.yaml | 18 + .../targets/iosxr_interface/tasks/main.yaml | 3 + .../targets/iosxr_interface/tasks/netconf.yaml | 26 + .../targets/iosxr_interface/tests/cli/basic.yaml | 296 + .../targets/iosxr_interface/tests/cli/intent.yaml | 80 + .../iosxr_interface/tests/cli/net_interface.yaml | 53 + .../iosxr_interface/tests/netconf/basic.yaml | 308 + .../iosxr_interface/tests/netconf/intent.yaml | 79 + .../tests/netconf/net_interface.yaml | 45 + .../targets/iosxr_interfaces/defaults/main.yaml | 3 + .../targets/iosxr_interfaces/meta/main.yaml | 2 + .../targets/iosxr_interfaces/tasks/cli.yaml | 20 + .../targets/iosxr_interfaces/tasks/main.yaml | 4 + .../tests/cli/_populate_config.yaml | 8 + .../iosxr_interfaces/tests/cli/_remove_config.yaml | 18 + .../iosxr_interfaces/tests/cli/deleted.yaml | 45 + .../iosxr_interfaces/tests/cli/empty_config.yaml | 60 + .../iosxr_interfaces/tests/cli/fixtures/parsed.cfg | 19 + .../iosxr_interfaces/tests/cli/gathered.yaml | 42 + .../targets/iosxr_interfaces/tests/cli/merged.yaml | 59 + .../iosxr_interfaces/tests/cli/overridden.yaml | 54 + .../targets/iosxr_interfaces/tests/cli/parsed.yaml | 16 + .../iosxr_interfaces/tests/cli/rendered.yaml | 29 + .../iosxr_interfaces/tests/cli/replaced.yaml | 55 + .../targets/iosxr_interfaces/vars/main.yaml | 196 + .../targets/iosxr_l2_interfaces/defaults/main.yaml | 3 + .../targets/iosxr_l2_interfaces/meta/main.yaml | 2 + .../targets/iosxr_l2_interfaces/tasks/cli.yaml | 20 + .../targets/iosxr_l2_interfaces/tasks/main.yaml | 4 + .../tests/cli/_populate_config.yaml | 9 + .../tests/cli/_remove_config.yaml | 8 + .../iosxr_l2_interfaces/tests/cli/deleted.yaml | 45 + .../tests/cli/empty_config.yaml | 60 + .../tests/cli/fixtures/parsed.cfg | 31 + .../iosxr_l2_interfaces/tests/cli/gathered.yaml | 45 + .../iosxr_l2_interfaces/tests/cli/merged.yaml | 62 + .../iosxr_l2_interfaces/tests/cli/overridden.yaml | 59 + .../iosxr_l2_interfaces/tests/cli/parsed.yaml | 16 + .../iosxr_l2_interfaces/tests/cli/rendered.yaml | 34 + .../iosxr_l2_interfaces/tests/cli/replaced.yaml | 55 + .../targets/iosxr_l2_interfaces/vars/main.yaml | 147 + .../targets/iosxr_l3_interfaces/defaults/main.yaml | 3 + .../targets/iosxr_l3_interfaces/meta/main.yaml | 2 + .../targets/iosxr_l3_interfaces/tasks/cli.yaml | 20 + .../targets/iosxr_l3_interfaces/tasks/main.yaml | 4 + .../tests/cli/_populate_config.yaml | 8 + .../tests/cli/_remove_config.yaml | 7 + .../iosxr_l3_interfaces/tests/cli/deleted.yaml | 50 + .../tests/cli/empty_config.yaml | 60 + .../tests/cli/fixtures/parsed.cfg | 31 + .../iosxr_l3_interfaces/tests/cli/gathered.yaml | 43 + .../iosxr_l3_interfaces/tests/cli/merged.yaml | 60 + .../iosxr_l3_interfaces/tests/cli/overridden.yaml | 55 + .../iosxr_l3_interfaces/tests/cli/parsed.yaml | 16 + .../iosxr_l3_interfaces/tests/cli/rendered.yaml | 32 + .../iosxr_l3_interfaces/tests/cli/replaced.yaml | 55 + .../targets/iosxr_l3_interfaces/tests/cli/rtt.yaml | 47 + .../targets/iosxr_l3_interfaces/vars/main.yaml | 133 + .../targets/iosxr_lacp/defaults/main.yaml | 3 + .../integration/targets/iosxr_lacp/tasks/cli.yaml | 20 + .../integration/targets/iosxr_lacp/tasks/main.yaml | 4 + .../targets/iosxr_lacp/tests/cli/_populate.yaml | 6 + .../iosxr_lacp/tests/cli/_remove_config.yaml | 6 + .../targets/iosxr_lacp/tests/cli/deleted.yaml | 48 + .../targets/iosxr_lacp/tests/cli/empty_config.yaml | 49 + .../iosxr_lacp/tests/cli/fixtures/parsed.cfg | 2 + .../targets/iosxr_lacp/tests/cli/gathered.yaml | 30 + .../targets/iosxr_lacp/tests/cli/merged.yaml | 51 + .../targets/iosxr_lacp/tests/cli/parsed.yaml | 15 + .../targets/iosxr_lacp/tests/cli/rendered.yaml | 20 + .../targets/iosxr_lacp/tests/cli/replaced.yaml | 52 + .../targets/iosxr_lacp/tests/cli/rtt.yaml | 53 + .../integration/targets/iosxr_lacp/vars/main.yaml | 44 + .../iosxr_lacp_interfaces/defaults/main.yaml | 3 + .../targets/iosxr_lacp_interfaces/tasks/cli.yaml | 20 + .../targets/iosxr_lacp_interfaces/tasks/main.yaml | 4 + .../iosxr_lacp_interfaces/tests/cli/_populate.yaml | 26 + .../tests/cli/_remove_config.yaml | 28 + .../iosxr_lacp_interfaces/tests/cli/deleted.yaml | 51 + .../tests/cli/empty_config.yaml | 60 + .../tests/cli/fixtures/parsed.cfg | 14 + .../iosxr_lacp_interfaces/tests/cli/gathered.yaml | 39 + .../iosxr_lacp_interfaces/tests/cli/merged.yaml | 63 + .../tests/cli/overridden.yaml | 61 + .../iosxr_lacp_interfaces/tests/cli/parsed.yaml | 15 + .../iosxr_lacp_interfaces/tests/cli/rendered.yaml | 27 + .../iosxr_lacp_interfaces/tests/cli/replaced.yaml | 59 + .../iosxr_lacp_interfaces/tests/cli/rtt.yaml | 66 + .../targets/iosxr_lacp_interfaces/vars/main.yaml | 130 + .../iosxr_lag_interfaces/defaults/main.yaml | 3 + .../targets/iosxr_lag_interfaces/tasks/cli.yaml | 20 + .../targets/iosxr_lag_interfaces/tasks/main.yaml | 4 + .../tests/cli/_populate_config.yaml | 29 + .../tests/cli/_remove_config.yaml | 32 + .../iosxr_lag_interfaces/tests/cli/deleted.yaml | 52 + .../tests/cli/empty_config.yaml | 60 + .../tests/cli/fixtures/parsed.cfg | 33 + .../iosxr_lag_interfaces/tests/cli/gathered.yaml | 49 + .../iosxr_lag_interfaces/tests/cli/merged.yaml | 75 + .../iosxr_lag_interfaces/tests/cli/overridden.yaml | 68 + .../iosxr_lag_interfaces/tests/cli/parsed.yaml | 15 + .../iosxr_lag_interfaces/tests/cli/rendered.yaml | 34 + .../iosxr_lag_interfaces/tests/cli/replaced.yaml | 65 + .../iosxr_lag_interfaces/tests/cli/rtt.yaml | 71 + .../targets/iosxr_lag_interfaces/vars/main.yaml | 181 + .../targets/iosxr_lldp_global/defaults/main.yaml | 3 + .../targets/iosxr_lldp_global/tasks/cli.yaml | 20 + .../targets/iosxr_lldp_global/tasks/main.yaml | 4 + .../iosxr_lldp_global/tests/cli/_populate.yaml | 8 + .../tests/cli/_remove_config.yaml | 6 + .../iosxr_lldp_global/tests/cli/deleted.yaml | 48 + .../iosxr_lldp_global/tests/cli/empty_config.yaml | 49 + .../tests/cli/fixtures/parsed.cfg | 11 + .../iosxr_lldp_global/tests/cli/gathered.yaml | 34 + .../iosxr_lldp_global/tests/cli/merged.yaml | 54 + .../iosxr_lldp_global/tests/cli/parsed.yaml | 15 + .../iosxr_lldp_global/tests/cli/rendered.yaml | 23 + .../iosxr_lldp_global/tests/cli/replaced.yaml | 55 + .../targets/iosxr_lldp_global/tests/cli/rtt.yaml | 51 + .../targets/iosxr_lldp_global/vars/main.yaml | 63 + .../iosxr_lldp_interfaces/defaults/main.yaml | 3 + .../targets/iosxr_lldp_interfaces/tasks/cli.yaml | 20 + .../targets/iosxr_lldp_interfaces/tasks/main.yaml | 4 + .../iosxr_lldp_interfaces/tests/cli/_populate.yaml | 12 + .../tests/cli/_remove_config.yaml | 22 + .../iosxr_lldp_interfaces/tests/cli/deleted.yaml | 51 + .../tests/cli/empty_config.yaml | 60 + .../tests/cli/fixtures/parsed.cfg | 16 + .../iosxr_lldp_interfaces/tests/cli/gathered.yaml | 33 + .../iosxr_lldp_interfaces/tests/cli/merged.yaml | 57 + .../tests/cli/overridden.yaml | 56 + .../iosxr_lldp_interfaces/tests/cli/parsed.yaml | 16 + .../iosxr_lldp_interfaces/tests/cli/rendered.yaml | 27 + .../iosxr_lldp_interfaces/tests/cli/replaced.yaml | 56 + .../iosxr_lldp_interfaces/tests/cli/rtt.yaml | 56 + .../targets/iosxr_lldp_interfaces/vars/main.yaml | 73 + .../targets/iosxr_logging/defaults/main.yaml | 3 + .../targets/iosxr_logging/meta/main.yaml | 3 + .../targets/iosxr_logging/tasks/cli.yaml | 21 + .../targets/iosxr_logging/tasks/main.yaml | 3 + .../targets/iosxr_logging/tasks/netconf.yaml | 29 + .../targets/iosxr_logging/tests/cli/basic.yaml | 161 + .../iosxr_logging/tests/cli/net_logging.yaml | 33 + .../targets/iosxr_logging/tests/netconf/basic.yaml | 227 + .../targets/iosxr_netconf/defaults/main.yaml | 3 + .../targets/iosxr_netconf/meta/main.yaml | 3 + .../targets/iosxr_netconf/tasks/cli.yaml | 16 + .../targets/iosxr_netconf/tasks/main.yaml | 4 + .../targets/iosxr_netconf/tests/cli/basic.yaml | 72 + .../iosxr_ospf_interfaces/defaults/main.yaml | 3 + .../iosxr_ospf_interfaces/fixtures/parsed.cfg | 51 + .../targets/iosxr_ospf_interfaces/tasks/cli.yaml | 20 + .../targets/iosxr_ospf_interfaces/tasks/main.yaml | 4 + .../tests/cli/_populate_config.yaml | 23 + .../tests/cli/_remove_config.yaml | 12 + .../iosxr_ospf_interfaces/tests/cli/deleted.yaml | 86 + .../tests/cli/empty_config.yaml | 60 + .../iosxr_ospf_interfaces/tests/cli/gathered.yaml | 25 + .../iosxr_ospf_interfaces/tests/cli/merged.yaml | 121 + .../tests/cli/overridden.yaml | 65 + .../iosxr_ospf_interfaces/tests/cli/parsed.yaml | 19 + .../iosxr_ospf_interfaces/tests/cli/rendered.yaml | 51 + .../iosxr_ospf_interfaces/tests/cli/replaced.yaml | 72 + .../iosxr_ospf_interfaces/tests/cli/rtt.yaml | 79 + .../targets/iosxr_ospf_interfaces/vars/main.yaml | 138 + .../targets/iosxr_ospfv2/defaults/main.yaml | 3 + .../targets/iosxr_ospfv2/fixtures/parsed.cfg | 42 + .../targets/iosxr_ospfv2/tasks/cli.yaml | 20 + .../targets/iosxr_ospfv2/tasks/main.yaml | 4 + .../iosxr_ospfv2/tests/cli/_populate_config.yaml | 47 + .../iosxr_ospfv2/tests/cli/_remove_config.yaml | 11 + .../targets/iosxr_ospfv2/tests/cli/deleted.yaml | 84 + .../iosxr_ospfv2/tests/cli/empty_config.yaml | 60 + .../targets/iosxr_ospfv2/tests/cli/gathered.yaml | 22 + .../targets/iosxr_ospfv2/tests/cli/merged.yaml | 132 + .../targets/iosxr_ospfv2/tests/cli/overridden.yaml | 65 + .../targets/iosxr_ospfv2/tests/cli/parsed.yaml | 16 + .../targets/iosxr_ospfv2/tests/cli/rendered.yaml | 72 + .../targets/iosxr_ospfv2/tests/cli/replaced.yaml | 66 + .../targets/iosxr_ospfv2/tests/cli/rtt.yaml | 101 + .../targets/iosxr_ospfv2/vars/main.yaml | 316 + .../targets/iosxr_ospfv3/defaults/main.yaml | 3 + .../targets/iosxr_ospfv3/fixtures/parsed.cfg | 36 + .../targets/iosxr_ospfv3/tasks/cli.yaml | 20 + .../targets/iosxr_ospfv3/tasks/main.yaml | 4 + .../iosxr_ospfv3/tests/cli/_populate_config.yaml | 39 + .../iosxr_ospfv3/tests/cli/_remove_config.yaml | 11 + .../targets/iosxr_ospfv3/tests/cli/deleted.yaml | 84 + .../iosxr_ospfv3/tests/cli/empty_config.yaml | 60 + .../targets/iosxr_ospfv3/tests/cli/gathered.yaml | 24 + .../targets/iosxr_ospfv3/tests/cli/merged.yaml | 120 + .../targets/iosxr_ospfv3/tests/cli/overridden.yaml | 61 + .../targets/iosxr_ospfv3/tests/cli/parsed.yaml | 18 + .../targets/iosxr_ospfv3/tests/cli/rendered.yaml | 68 + .../targets/iosxr_ospfv3/tests/cli/replaced.yaml | 62 + .../targets/iosxr_ospfv3/tests/cli/rtt.yaml | 91 + .../targets/iosxr_ospfv3/vars/main.yaml | 260 + .../targets/iosxr_smoke/defaults/main.yaml | 3 + .../integration/targets/iosxr_smoke/meta/main.yaml | 3 + .../integration/targets/iosxr_smoke/tasks/cli.yaml | 26 + .../targets/iosxr_smoke/tasks/main.yaml | 3 + .../targets/iosxr_smoke/tasks/netconf.yaml | 26 + .../iosxr_smoke/tests/cli/common_config.yaml | 100 + .../iosxr_smoke/tests/cli/common_utils.yaml | 37 + .../iosxr_smoke/tests/netconf/common_netconf.yaml | 53 + .../iosxr_smoke/tests/netconf/misc_tests.yaml | 40 + .../targets/iosxr_static_routes/defaults/main.yaml | 3 + .../iosxr_static_routes/fixtures/parsed.cfg | 18 + .../targets/iosxr_static_routes/tasks/cli.yaml | 20 + .../targets/iosxr_static_routes/tasks/main.yaml | 4 + .../tests/cli/_populate_config.yaml | 69 + .../tests/cli/_remove_config.yaml | 7 + .../iosxr_static_routes/tests/cli/deleted.yaml | 79 + .../tests/cli/empty_config.yaml | 49 + .../iosxr_static_routes/tests/cli/gathered.yaml | 23 + .../iosxr_static_routes/tests/cli/merged.yaml | 167 + .../iosxr_static_routes/tests/cli/overridden.yaml | 79 + .../iosxr_static_routes/tests/cli/parsed.yaml | 17 + .../iosxr_static_routes/tests/cli/rendered.yaml | 91 + .../iosxr_static_routes/tests/cli/replaced.yaml | 69 + .../targets/iosxr_static_routes/tests/cli/rtt.yaml | 89 + .../targets/iosxr_static_routes/vars/main.yaml | 264 + .../targets/iosxr_system/defaults/main.yaml | 2 + .../integration/targets/iosxr_system/meta/main.yml | 3 + .../targets/iosxr_system/tasks/cli.yaml | 29 + .../targets/iosxr_system/tasks/main.yaml | 3 + .../targets/iosxr_system/tasks/netconf.yaml | 29 + .../targets/iosxr_system/tests/cli/net_system.yaml | 36 + .../iosxr_system/tests/cli/set_domain_list.yaml | 123 + .../iosxr_system/tests/cli/set_domain_name.yaml | 37 + .../iosxr_system/tests/cli/set_hostname.yaml | 36 + .../iosxr_system/tests/cli/set_lookup_source.yaml | 40 + .../iosxr_system/tests/cli/set_name_servers.yaml | 66 + .../tests/netconf/set_domain_list.yaml | 179 + .../tests/netconf/set_domain_name.yaml | 78 + .../iosxr_system/tests/netconf/set_hostname.yaml | 45 + .../tests/netconf/set_lookup_source.yaml | 162 + .../tests/netconf/set_name_servers.yaml | 138 + .../targets/iosxr_user/defaults/main.yaml | 3 + .../integration/targets/iosxr_user/files/private | 30 + .../targets/iosxr_user/files/public.pub | 1 + .../targets/iosxr_user/files/public2.pub | 1 + .../integration/targets/iosxr_user/meta/main.yaml | 3 + .../integration/targets/iosxr_user/tasks/cli.yaml | 29 + .../integration/targets/iosxr_user/tasks/main.yaml | 3 + .../targets/iosxr_user/tasks/netconf.yaml | 37 + .../targets/iosxr_user/tests/cli/basic.yaml | 182 + .../targets/iosxr_user/tests/common/auth.yaml | 121 + .../targets/iosxr_user/tests/netconf/basic.yaml | 193 + .../targets/prepare_iosxr_tests/tasks/main.yml | 16 + .../prepare_iosxr_tests/templates/config.j2 | 4 + .../cisco/iosxr/tests/sanity/ignore-2.10.txt | 1 + .../cisco/iosxr/tests/sanity/ignore-2.9.txt | 3 + .../cisco/iosxr/tests/sanity/requirements.txt | 4 + .../cisco/iosxr/tests/unit/__init__.py | 0 .../cisco/iosxr/tests/unit/compat/__init__.py | 0 .../cisco/iosxr/tests/unit/compat/builtins.py | 34 + .../cisco/iosxr/tests/unit/compat/mock.py | 126 + .../cisco/iosxr/tests/unit/compat/unittest.py | 39 + .../cisco/iosxr/tests/unit/mock/__init__.py | 0 .../cisco/iosxr/tests/unit/mock/loader.py | 116 + .../cisco/iosxr/tests/unit/mock/path.py | 10 + .../cisco/iosxr/tests/unit/mock/procenv.py | 94 + .../cisco/iosxr/tests/unit/mock/vault_helper.py | 42 + .../cisco/iosxr/tests/unit/mock/yaml_helper.py | 167 + .../cisco/iosxr/tests/unit/modules/__init__.py | 0 .../cisco/iosxr/tests/unit/modules/conftest.py | 40 + .../iosxr/tests/unit/modules/network/__init__.py | 0 .../tests/unit/modules/network/iosxr/__init__.py | 0 .../modules/network/iosxr/fixtures/__init__.py | 0 .../unit/modules/network/iosxr/fixtures/dir_7all | 6 + .../network/iosxr/fixtures/iosxr_acls_config.cfg | 5 + .../network/iosxr/fixtures/iosxr_config_config.cfg | 12 + .../network/iosxr/fixtures/iosxr_config_src.cfg | 11 + .../iosxr/fixtures/iosxr_ospf_interfaces.cfg | 9 + .../network/iosxr/fixtures/iosxr_ospfv2.cfg | 8 + .../network/iosxr/fixtures/iosxr_ospfv3.cfg | 8 + .../iosxr/fixtures/iosxr_static_routes_config.cfg | 18 + .../network/iosxr/fixtures/iosxr_system_config.cfg | 8 + .../network/iosxr/fixtures/iosxr_user_config.cfg | 8 + .../modules/network/iosxr/fixtures/show_interfaces | 41 + .../network/iosxr/fixtures/show_ipv6_interface | 5 + .../unit/modules/network/iosxr/fixtures/show_lldp | 1 + .../iosxr/fixtures/show_lldp_neighbors_detail | 1 + .../network/iosxr/fixtures/show_memory_summary | 5 + .../network/iosxr/fixtures/show_running-config | 43 + .../modules/network/iosxr/fixtures/show_version | 84 + .../fixtures/show_version___utility_head_-n_20 | 18 + .../network/iosxr/fixtures/show_version_brief | 18 + .../unit/modules/network/iosxr/iosxr_module.py | 105 + .../unit/modules/network/iosxr/test_iosxr_acls.py | 361 + .../modules/network/iosxr/test_iosxr_command.py | 128 + .../modules/network/iosxr/test_iosxr_config.py | 308 + .../unit/modules/network/iosxr/test_iosxr_facts.py | 117 + .../modules/network/iosxr/test_iosxr_netconf.py | 114 + .../network/iosxr/test_iosxr_ospf_interfaces.py | 358 + .../modules/network/iosxr/test_iosxr_ospfv2.py | 275 + .../modules/network/iosxr/test_iosxr_ospfv3.py | 275 + .../network/iosxr/test_iosxr_static_routes.py | 338 + .../modules/network/iosxr/test_iosxr_system.py | 123 + .../unit/modules/network/iosxr/test_iosxr_user.py | 129 + .../cisco/iosxr/tests/unit/modules/utils.py | 51 + .../cisco/iosxr/tests/unit/requirements.txt | 42 + .../ansible_collections/cisco/iosxr/tox.ini | 32 + 604 files changed, 107789 insertions(+) create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/.gitignore create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/.yamllint create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/.zuul.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/FILES.json create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/LICENSE create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/MANIFEST.json create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/README.md create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/bindep.txt create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/changelogs/CHANGELOG.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/changelogs/changelog.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/changelogs/config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_acl_interfaces_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_acls_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_banner_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_bgp_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_cliconf.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_command_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_config_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_facts_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_interface_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_interfaces_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_l2_interfaces_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_l3_interfaces_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lacp_interfaces_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lacp_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lag_interfaces_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lldp_global_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lldp_interfaces_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_logging_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_netconf.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_netconf_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_ospf_interfaces_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_ospfv2_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_ospfv3_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_static_routes_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_system_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_user_module.rst create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/meta/runtime.yml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/action/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/action/iosxr.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/cliconf/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/cliconf/iosxr.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/doc_fragments/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/doc_fragments/iosxr.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/filter/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/acl_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/acl_interfaces/acl_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/acls/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/acls/acls.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/facts/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/facts/facts.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/interfaces/interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/l2_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/l2_interfaces/l2_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/l3_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/l3_interfaces/l3_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lacp/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lacp/lacp.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lacp_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lacp_interfaces/lacp_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lag_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lag_interfaces/lag_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lldp_global/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lldp_global/lldp_global.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lldp_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lldp_interfaces/lldp_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospf_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospf_interfaces/ospf_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospfv2/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospfv2/ospfv2.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospfv3/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospfv3/ospfv3.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/static_routes/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/static_routes/static_routes.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/acl_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/acls/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/acls/acls.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/interfaces/interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/l2_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/l2_interfaces/l2_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/l3_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/l3_interfaces/l3_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lacp/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lacp/lacp.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lacp_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lacp_interfaces/lacp_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lag_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lag_interfaces/lag_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lldp_global/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lldp_global/lldp_global.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lldp_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lldp_interfaces/lldp_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospf_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospfv2/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospfv3/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/static_routes/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/static_routes/static_routes.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/acl_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/acl_interfaces/acl_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/acls/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/acls/acls.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/facts.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/interfaces/interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/l2_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/l2_interfaces/l2_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/l3_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/l3_interfaces/l3_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lacp/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lacp/lacp.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lacp_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lacp_interfaces/lacp_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lag_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lag_interfaces/lag_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/legacy/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/legacy/base.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lldp_global/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lldp_global/lldp_global.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lldp_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lldp_interfaces/lldp_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospf_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospf_interfaces/ospf_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospfv2/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospfv2/ospfv2.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospfv3/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospfv3/ospfv3.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/static_routes/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/static_routes/static_routes.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/iosxr.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/bgp/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/bgp/address_family.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/bgp/neighbors.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/bgp/process.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/module.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/providers.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/acl_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/ospf_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/ospfv2.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/ospfv3.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/utils/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/utils/utils.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_acl_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_acls.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_banner.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_bgp.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_command.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_config.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_facts.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_interface.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_l2_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_l3_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lacp.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lacp_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lag_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lldp_global.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lldp_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_logging.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_netconf.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_ospf_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_ospfv2.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_ospfv3.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_static_routes.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_system.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_user.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/netconf/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/netconf/iosxr.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/terminal/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/plugins/terminal/iosxr.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/requirements.txt create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/test-requirements.txt create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/.gitignore create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/network-integration.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/target-prefixes.network create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/_populate.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/deleted_all.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/vars/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/_populate_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/vars/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/cli/basic-login.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/cli/basic-motd.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/cli/basic-no-login.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/netconf/basic-login.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/netconf/basic-motd.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/netconf/basic-no-login.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/tests/cli/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/bad_operator.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/cli_command.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/contains.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/invalid.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/output.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/prompt.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/timeout.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/fixtures/config_add_interface.txt create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/fixtures/config_del_interface.txt create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tasks/cli_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tasks/redirection.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/change_prefix_set.j2 create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/config.j2 create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/configuration.j2 create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/init_prefix_set.j2 create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/route_policy.j2 create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/route_policy_change.j2 create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/route_policy_clean.j2 create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/defaults/config.j2 create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/backup.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/comment.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/commit_label.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/misplaced_sublevel.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/prefix_set_remark.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/replace_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/route_policy.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_basic.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_invalid.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_match_none.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel_block.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel_exact.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel_strict.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel_strict_mul_parents.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/toplevel.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/toplevel_after.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/toplevel_before.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/toplevel_nonidempotent.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli_config/cli_backup.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli_config/cli_basic.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/redirection/shortname.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tests/cli/all_facts.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tests/cli/default_facts.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tests/cli/invalid_subset.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tests/cli/not_hardware.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/cli/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/cli/intent.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/cli/net_interface.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/netconf/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/netconf/intent.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/netconf/net_interface.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/_populate_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/vars/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/_populate_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/vars/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/_populate_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/vars/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/_populate.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/vars/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/_populate.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/vars/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/_populate_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/vars/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/_populate.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/vars/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/_populate.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/vars/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/cli/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/cli/net_logging.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/netconf/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/tests/cli/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/_populate_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/vars/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/_populate_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/vars/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/_populate_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/vars/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/cli/common_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/cli/common_utils.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/netconf/common_netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/netconf/misc_tests.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/_populate_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/vars/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/net_system.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_domain_list.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_domain_name.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_hostname.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_lookup_source.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_name_servers.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_domain_list.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_domain_name.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_hostname.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_lookup_source.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_name_servers.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/files/private create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/files/public.pub create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/files/public2.pub create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tests/cli/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tests/common/auth.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tests/netconf/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/prepare_iosxr_tests/tasks/main.yml create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/prepare_iosxr_tests/templates/config.j2 create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.10.txt create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.9.txt create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/sanity/requirements.txt create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/compat/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/compat/builtins.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/compat/mock.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/compat/unittest.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/loader.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/path.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/procenv.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/vault_helper.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/yaml_helper.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/conftest.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/__init__.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/dir_7all create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_acls_config.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_config_config.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_config_src.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_ospf_interfaces.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_ospfv2.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_ospfv3.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_static_routes_config.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_system_config.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_user_config.cfg create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_interfaces create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_ipv6_interface create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_lldp create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_lldp_neighbors_detail create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_memory_summary create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_running-config create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_version create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_version___utility_head_-n_20 create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_version_brief create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/iosxr_module.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_acls.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_command.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_config.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_facts.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_netconf.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospf_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospfv2.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospfv3.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_static_routes.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_system.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_user.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/utils.py create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/requirements.txt create mode 100644 collections-debian-merged/ansible_collections/cisco/iosxr/tox.ini (limited to 'collections-debian-merged/ansible_collections/cisco/iosxr') diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/.gitignore b/collections-debian-merged/ansible_collections/cisco/iosxr/.gitignore new file mode 100644 index 00000000..d9fe27b7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/.gitignore @@ -0,0 +1,91 @@ +# build products... +*.py[co] +build +AUTHORS.TXT +# Emacs backup and autosave files... +*~ +.\#* +\#* +# RPM stuff... +MANIFEST +dist +rpm-build +# Eclipse/PyDev stuff... +.project +.pydevproject +# PyCharm stuff... +.idea +#IntelliJ IDEA stuff.. +*.iml +#VSCode stuff.. +.vscode/ +# Mac OS X stuff... +.DS_Store +# manpage build stuff... +docs/man/man1/ansible*.1 +docs/man/man1/ansible*.1.asciidoc.in +docs/man/man3/* +# Sublime stuff +*.sublime-project +*.sublime-workspace +# docsite stuff... +docs/docsite/_build +docs/docsite/*.html +docs/docsite/htmlout +docs/docsite/rst/cli/ansible-*.rst +docs/docsite/rst/cli/ansible.rst +docs/docsite/rst/dev_guide/collections_galaxy_meta.rst +docs/docsite/rst/dev_guide/testing/sanity/index.rst.new +docs/docsite/rst/modules/*.rst +docs/docsite/rst/playbooks_directives.rst +docs/docsite/rst/plugins_by_category.rst +docs/docsite/rst/plugins/*/*.rst +docs/docsite/rst/reference_appendices/config.rst +docs/docsite/rst/reference_appendices/playbooks_keywords.rst +docs/docsite/rst_warnings +docs/docsite/searchindex.js +docs/docsite/_static/*.gif +docs/docsite/_static/*.png +docs/docsite/_static/websupport.js +# deb building stuff... +/debian/ +deb-build +# Vim swap files +*.swp +*.swo +credentials.yml +# test output +*.retry +*.out +.pytest_cache/ +.tox +.cache +.pytest_cache +results.xml +coverage.xml +/tests/units/cover-html +/tests/integration/inventory +/tests/integration/targets/*/backup/ +/tests/cache/* +# Development +/tests/develop +venv +Vagrantfile +.vagrant +.python-version +# Release directory +packaging/release/ansible_release +/.cache/ +# python 'rope' stuff +.ropeproject +# local 'ack' config files +.ackrc +# default 'coverage html' results +htmlcov/ +# default 'coverage' tool data +.coverage +# ansible-test coverage results +tests/units/.coverage.* +/SYMLINK_CACHE.json +changelogs/.plugin-cache.yaml +.ansible-test-timeout.json diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/.yamllint b/collections-debian-merged/ansible_collections/cisco/iosxr/.yamllint new file mode 100644 index 00000000..3adaf90c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/.yamllint @@ -0,0 +1,15 @@ +--- +extends: default + +ignore: | + .tox + changelogs/* + +rules: + braces: + max-spaces-inside: 1 + level: error + brackets: + max-spaces-inside: 1 + level: error + line-length: disable diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/.zuul.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/.zuul.yaml new file mode 100644 index 00000000..a892ec72 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/.zuul.yaml @@ -0,0 +1,8 @@ +--- +- project: + check: + jobs: + - ansible-tox-linters + gate: + jobs: + - ansible-tox-linters diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/FILES.json b/collections-debian-merged/ansible_collections/cisco/iosxr/FILES.json new file mode 100644 index 00000000..cccd0ab1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/FILES.json @@ -0,0 +1,6060 @@ +{ + "files": [ + { + "name": ".", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": ".gitignore", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "445eae124a1f5bb47770dec970cb756d2b736e0e009182ea2175dd3f0d7b7317", + "format": 1 + }, + { + "name": "test-requirements.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f3c3034db738d9dd385446a8bb5275e8cdfa3661206dd97ac783c2f730534b24", + "format": 1 + }, + { + "name": "changelogs", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "changelogs/changelog.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0c0fcafb6761cdb68fde8cffd1077e7735797b3ffae193901b388ec26a97fa35", + "format": 1 + }, + { + "name": "changelogs/CHANGELOG.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d5815eb64788888adbc903167ceb07a15a9eab2df908d49d6a871c85ec793182", + "format": 1 + }, + { + "name": "changelogs/config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "abdc4b233c55892747806c9d6132ac05820da64e8e57aa84d1b8428181b6046a", + "format": 1 + }, + { + "name": "LICENSE", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986", + "format": 1 + }, + { + "name": "plugins", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/filter", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/filter/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/terminal", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/terminal/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/terminal/iosxr.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "467e04ae9e63de658e49375a7b24f643d41d9794581beb86d5576192c6e326b1", + "format": 1 + }, + { + "name": "plugins/modules", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/modules/iosxr_static_routes.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4667dc1c462fd95ffdbffb893f8f68c0326c323ed84672e82cf15b8aa058be96", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_acl_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "997f251e74143e434a9192bdcdb6a8532f26b2eb81fd12039e07ae8ce395580e", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_banner.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "33abeb945197b4921b21e2b7de3c5537be3e4fab3b8cb566c8b65c122541775b", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_user.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7f5751ea7f9d2c396d0402539789f60be67cae7b3fc0e7f08b3c7b161fa48fe8", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_netconf.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e78655a59b45d2856033a04e0b8337b1bfeaab7e7b01b0f0d4630708e24a858a", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_l2_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "282f7120689bcaa659b463b67f23360621801676248837d0263760267c0b9993", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_lldp_global.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2a3a27e710f607784c7cb571b35bb0fba36988a75b28ade647bf672f7fb32849", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_lacp.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7bfde7a158f682fe99b072050957fd0ee3cad57e7b03430729f209e4daf13132", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_lldp_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9ec15f89ee0d33a633cde851a0ed534700df934f3415c5226d07f5cd5ff6f7e2", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_ospfv2.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "993677624fd3d72670537c2fc75ea82766d297efe8ab02184b6829cd3f9d53f7", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_acls.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ef4262ad0f1389dccf0e800ea0e805a6d2c5bd0bd9d97b7696fce72f66d8f427", + "format": 1 + }, + { + "name": "plugins/modules/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_lag_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f79d252d7460b0c2afd73850d39d964a8bb15e53a5f5d27039b0cc898711e9e6", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_ospfv3.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f05e6c2d7d364cabf7314bdde96f210bda457ac434f2cf17af7f536bba65347e", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_config.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8482a5c263f39e9cfa7a3db19e3dd3df1bcc2a2459ead4ab646e54425224360e", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_command.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4c8caf35b203867134eaf31419472a8d3c973f6c8e46d413e1fede7d3200c8cb", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_interface.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5adba9b0ff2cbe2a468d96ea253a190483d2b4c87b8f234342f8997eaca7869b", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "46f3e6becdf80acd88f881d960d6be164a4f025eedb266f1d9061d1ce49868f5", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0285187fcc13312681406940765cde4828d0bb5c0257bc2194d57657f0399728", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_lacp_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c179dfdfa9c25c1cb204e6858114d475ac38474e8c40e1452ddbc9ff8a68cbe4", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_system.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ee20eadc48b9f164603845ff71a19c72ec5eb60e42a6a4e8e5dd345a302bc458", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_l3_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4fa035848c073c56e2385b8171dc5e7544084146ffa7b729ec411d59c6ede95f", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_logging.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3b3317fbd94f3ceec1c32a9237f5bdc48ee98e132e10e34b9680dc8067a2bf80", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_bgp.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e335832dde0f7b4555b21fbe5abf07adc72e32af32a89d8c9015140fa561155d", + "format": 1 + }, + { + "name": "plugins/modules/iosxr_ospf_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "eb5b43beb548aa7ccd0f296d49ba1d61de1c6c119ac96aca34338089a8962aab", + "format": 1 + }, + { + "name": "plugins/doc_fragments", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/doc_fragments/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/doc_fragments/iosxr.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d4036427d7ad91be3f9f39bd6f84418e19b504e2910af31ea922e17152d8ab34", + "format": 1 + }, + { + "name": "plugins/module_utils", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/acl_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/acl_interfaces/acl_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a3f3eef1a8283e8ea5b787102dbc51fd99d9827db6818cafe5c95ee5fff12ac0", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/acl_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "802b358a2230ae0f01b7f4fd491f6d58a3aeb9caa6aac42ed9f27e98895dfcfa", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/lldp_global", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/lldp_global/lldp_global.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fb38bfebbbfd4eb54f0c5eefff90eb4d4e08eb53a8c283aca3ffbfdc3c3ce296", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/lldp_global/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/lldp_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/lldp_interfaces/lldp_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6285fc62d4b69dc85689af932c7a2727ec96f888d4a092d25344cfc624ec1d45", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/lldp_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/ospf_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/ospf_interfaces/ospf_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "014e7b9fc324e9ca0b6e1c81e146349a7890969be72c1c839024d3681c6e6a04", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/ospf_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/ospfv3", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/ospfv3/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/ospfv3/ospfv3.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e82c00186645a179edaffa9a8bf821c1b1f2b5ed8c758709d9c0beb0e5165f6b", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/ospfv2", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/ospfv2/ospfv2.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e595db1fb5560f6200e76b4ac21b4806527cd2d7c14e9f40e0e0192f736a05f9", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/ospfv2/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/legacy", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/legacy/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/legacy/base.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a3ae541948810a0f8c0bfbeb3e521b3eb434cc4d923c3a8b7c9dee71d57d6942", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/l2_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/l2_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/l2_interfaces/l2_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5b15df321c0d14af58f5e979eaa5bcc02a5e67f744aa9b687b3c1e7136388da4", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/interfaces/interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "07837ce8a8c7fe7b667d9c57c485410d45deae38873d9e46989a6277685e0b98", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/lacp", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/lacp/lacp.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ad37d89c606c0cee6f71737a4c79a7ab508c4a3c7f4c1a9b5bc1e4bee731aa49", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/lacp/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/acls", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/acls/acls.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9f9f7a90d0bc72ee5df009f77c9bd86b76f220906577179556967b3346852987", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/acls/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/lacp_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/lacp_interfaces/lacp_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "eb25f1d7c7a22849a2100b615832df34925c971b9e33ce33d05fe81b34365991", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/lacp_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/l3_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/l3_interfaces/l3_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ef8d3b20e6146008634cba321d0b7e524ce94333154073a686a86161d30b6cd2", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/l3_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/lag_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/lag_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/lag_interfaces/lag_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4b338732e667c8b10e0aef06af6e17dbff0ec3c73e1974e5be381d7663317c75", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/static_routes", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/static_routes/static_routes.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "922c0016c8a51057b9367a0fcb1bdfce778beac14810cf107c69baf8185620fe", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/facts/static_routes/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/rm_templates", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/rm_templates/ospfv2.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3e0f9980f9cb5bb2c7613c39fa4b637b10bb5270a937e1ce6be8050667be5573", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/rm_templates/acl_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "369d020fcad32c8eb940b0f7dce87ada19ea059120e1da4048cfa03519c78174", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/rm_templates/ospf_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "da06d1aa13d79cdc2c44ef637caef3af806489d500f2d277bdfe5f4d242f2a05", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/rm_templates/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/rm_templates/ospfv3.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0912a19da0e67ea59c89734df9579ba064928802d572639a4fb9e035d8f1ff81", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/utils", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/utils/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/utils/utils.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "06ecd83eee8676e27212eff14efedb25b0c87c958e3cf468bf3c4dd991d22ad3", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/providers", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/providers/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/providers/cli/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/providers/cli/config", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/providers/cli/config/bgp", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/providers/cli/config/bgp/neighbors.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1f0fe02a5b90312811821234526a3d9347ec172979c08887f9328d754a3af3c7", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/providers/cli/config/bgp/process.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f1f7688872e43e58a70fcfe2794e20713abf894620e0ef58ab5bedfd52bfa604", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/providers/cli/config/bgp/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/providers/cli/config/bgp/address_family.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bbd9d47ef4e765f7234392bbdae8ad3097550cfd4cd548e8291f70e834c6d43c", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/providers/cli/config/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/providers/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/providers/providers.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1e40324ccc5b05d7a51c2a6d604362a4e80d92919581f319dc1b4efaff17008e", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/providers/module.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8447fe8d9b72ba930a6f122dbbfba2e3e69d95e715f258cf0db00d2238efe080", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/iosxr.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c28b104c4a8b1700fcd2b27192584a2cb8784e18835ab3da03f075115cff533c", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/acl_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "94329a82cc6e01af58e9d83b6c62deeb0ec12d8b5997aa5ce092305346481d57", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/acl_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/lldp_global", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/lldp_global/lldp_global.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1db99aa643eb0ceb0c854294ad1a76ba3ff9df2eac39d0942c7ebcea4541f5e7", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/lldp_global/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/lldp_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/lldp_interfaces/lldp_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d6565fbfebdb82082df6515d03da939fe2973567e956d268e2c036eea7501477", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/lldp_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/ospf_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5c4595541af2551d3c8288b6eb5ae8cddc106bfd4cd81eb7363eda9cb4069e56", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/ospf_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/ospfv3", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/ospfv3/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f00583e6194c4501cc7151b52c06af8ee02734586f1d1ef020c4d0a045ed5500", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/ospfv2", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "85aa7eff9f7a15838859354f22001bae07131763898e3c2e89b17163c07637ed", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/ospfv2/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/l2_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/l2_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/l2_interfaces/l2_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7d9015280aebe553c0ab314bfd738ddbc2d4c82e059292033c7348f02b02a412", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/interfaces/interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "633a87dd870bb8ad9705b4c85aad149015d89f15b25fa8d6a33b51c842aa267d", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/lacp", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/lacp/lacp.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4c0e9217f94de5490fde99ec8cfbb4355d792c320dfabb3621541ef278d4a58a", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/lacp/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/acls", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/acls/acls.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8d80f17d8b1d3e4b905b74efd01e57322f41155824ae76a2c91f2464e6970f66", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/acls/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/lacp_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/lacp_interfaces/lacp_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c453e997bc6b9551d988a334e8fd057621eae22a6963836a4d3221f90c3bee45", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/lacp_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/l3_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/l3_interfaces/l3_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ad96804e7df1d14ffd2eae35527bc3bee07e4c03caf8f91b2954984c3c15bed2", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/l3_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/lag_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/lag_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/lag_interfaces/lag_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2dbcdfee62503e98d182e0607275e24858bbed8db31625a89efac8929e798c60", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/static_routes", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/static_routes/static_routes.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0caac77796cd33abeca3624b6d4ba29ca8ef40e7090d04f04db118068791e96f", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/config/static_routes/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/acl_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/acl_interfaces/acl_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cce504b4e4ec93a8feaad5280cb0cf51935f1caad15efed7d0d3a0d2455c632d", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/acl_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/lldp_global", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/lldp_global/lldp_global.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7dde1b9caccdbeae41bcaea288ab37a40eb1f66e1fa58326af8f13f7a36fa1e0", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/lldp_global/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/facts", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/facts/facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1e016a9c622b391dfc45d799e53567ffa111892a102b872a320cd09c2dfe866d", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/facts/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/lldp_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/lldp_interfaces/lldp_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "afb71a2a28a1b07ec1a81d4d3876986cfcb136f0736dd816248ceed4fb89af17", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/lldp_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/ospf_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/ospf_interfaces/ospf_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "510dfc623241f91c7bc9395178d84baecab54d377985c0a6f5ed790f2fd1891e", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/ospf_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/ospfv3", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/ospfv3/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/ospfv3/ospfv3.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a70cd977f22b1812e9cd23e041e52390cae1f221f9409c4bc962032dbc37b951", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/ospfv2", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/ospfv2/ospfv2.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ab84f0e6dd560a0d98982f056d58dc81fc2084a1a98faadd104c0b5eebe4762c", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/ospfv2/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/l2_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/l2_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/l2_interfaces/l2_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d54c83221db6effdf8329ecb56f8d6a7d648775ef66073630b4c52c20e74fca5", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/interfaces/interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d161df41b6c6ec712e6dfcbaf02193e17f053b2e33a7988920e076b46d4a8a8b", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/lacp", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/lacp/lacp.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "15addbe1a782a4af2d36f2dcbf3bb784abb5b20c2d5a3a3e2408db7c9f68dd74", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/lacp/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/acls", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/acls/acls.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5bf535800a3964edf745b15e28d6f7c5b4558796d0a1027fc7ec181f7287ccc2", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/acls/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/lacp_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/lacp_interfaces/lacp_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cdee15d3154a7b8142735bae3e8c33fe0d3e7c6ba2c58c9a0d4f1bfd6c613f6f", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/lacp_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/l3_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/l3_interfaces/l3_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "10653524d7f4d186beaca1a1fcc2a4d82ff29eabf0b7ebe658ae9725fc65cb10", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/l3_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/lag_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/lag_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/lag_interfaces/lag_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "db5f3a940eef2dc2c232e6aa0316dcbeaf097b4539fe0b5d636506cf15fed9ac", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/static_routes", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/static_routes/static_routes.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "77e910a1f0f28d68757bd8203a4c91466a51e04b3e55348207cd229232f7059e", + "format": 1 + }, + { + "name": "plugins/module_utils/network/iosxr/argspec/static_routes/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/netconf/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/netconf/iosxr.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "332075c1a79c8cf74988a708123d3ac685c54a20b2ecbdfa6ee1cfb33ca4a873", + "format": 1 + }, + { + "name": "plugins/cliconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/cliconf/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/cliconf/iosxr.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bcf4036628bd6a2e974bfba1ef470af75300b7b2998f303da3886abbc10819c9", + "format": 1 + }, + { + "name": "plugins/action", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/action/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/action/iosxr.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "757b8897cf2d3e41b840326c12ba7bac26964f7d9b7db2fb3df54d85ec1d1aa4", + "format": 1 + }, + { + "name": "tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/sanity", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/sanity/ignore-2.9.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d66d9c2176146a0cf541569e6d8ae8b1314b5fded8708e116ac43447527873b1", + "format": 1 + }, + { + "name": "tests/sanity/ignore-2.10.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d00606e57fbb8dc1fd70d3b23ff2398c5c31ce53cbfd68688fdd810d6df019f7", + "format": 1 + }, + { + "name": "tests/sanity/requirements.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8a4ac4bfdef88e75d6e748e35a42fb4915947dfa2b7dd788626fd829600e014", + "format": 1 + }, + { + "name": "tests/.gitignore", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b5726d3ec9335a09c124469eca039523847a6b0f08a083efaefd002b83326600", + "format": 1 + }, + { + "name": "tests/unit", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/modules", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/modules/network", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/test_iosxr_ospfv3.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3793dc659fc0934c8d83e9b0b2fc20bad1ac32e41aa45199e801f9e5ff1d6ba0", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/test_iosxr_system.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5e30a55a0b49ed300b160e441b6e2d3007cee03c7b07163f5060e23fdeea473f", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/iosxr_module.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "def63fd47add5418789d93e11d3949ade38de3f09a66ecd8b20fd01f4d511e8a", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/test_iosxr_user.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a561eac2d4ccd67f9f5a5438031cd335d3b47693944edb678f62babf3555f851", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/test_iosxr_netconf.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c3726605a47672fbe738d5bb95d492193c8b071c297b0a92576fdad91ce87cb", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/test_iosxr_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2375fe79d8f39c4e5dbef6d2eb6f726a2f584928728f0d4ac25841840d4af91d", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/test_iosxr_static_routes.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c36b2e27259a09467d9902d1a2c734441be908603e304f4de056712ca6963c2e", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/iosxr_config_config.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6fe81e446733fef4e3643a80042ab4111b9b0c927599c4b5972ecea4c18b4ffd", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/show_interfaces", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f7710c99d663a4da8192b24b35157411e23a037a2a4a989af21eaa44dc4c850d", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/show_version", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "089ab6658c475d1146f913b1cdee2671b46051958e2b7f562da626d327456726", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/iosxr_static_routes_config.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "32ee56a46ecc87911222ff89e44693c8ae2cc8464170f8b24f225d082ee417fe", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/dir_7all", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c5e2c218c5731bee3f874af0bc5d5694a426ceba650efc03795a5739235f0120", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/iosxr_user_config.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e387d5d8b668b1f290872aab2a3e8f8de3d4bdcb99906b8bbf618b950f0c60e9", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/show_memory_summary", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c0fedc43463c95b152254b43d741b62c704ffc82b2707b758d1294283384c4e0", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/iosxr_ospf_interfaces.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "17444c54f6bc1f9e356cbec7c9c2ffdb4a4b42879aeceff12a7a809e8a6735ca", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/show_lldp", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4135607fe98acfedbef4f2d3305b4ade7e5e833130f049f310b68f32ce451c66", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/iosxr_ospfv3.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8a6d31304503f7cd58289c7ab493bab726a003a69dbcfff3177f82e051180ff4", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/iosxr_config_src.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "57d42d2e8e8b7a4b6cae566115ee42fecea077b525cace10cefc3b7dbd85f033", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/show_version_brief", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e4eb1b26a35a3c5bcf1e45eab472c8d59ff0559cfbfe701cd60c17ee6d9d6957", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/iosxr_acls_config.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "59430ac3ee2b54911b34f033b88f76f5099ddcd4fa2c84c363ec0748f202ccb6", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/show_lldp_neighbors_detail", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4135607fe98acfedbef4f2d3305b4ade7e5e833130f049f310b68f32ce451c66", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/iosxr_ospfv2.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "27b9a4a53478778c5781170c052ba66bcc09dcb40aab0709d28018f6cd332126", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/show_ipv6_interface", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "151235002e58119649b79a98cbacb5ce155225e31aa0188dd8085ee0961feacf", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/iosxr_system_config.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "18ae20e11b3f557435b212a739a50c59c95e4162dc13989695e6c14ae35e58f7", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/show_running-config", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9442b8aa3e29caa5725d8968da29fa173e998d7c664c92b3ddd66a7aea76a71e", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/fixtures/show_version___utility_head_-n_20", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e4eb1b26a35a3c5bcf1e45eab472c8d59ff0559cfbfe701cd60c17ee6d9d6957", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/test_iosxr_config.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "99b72b70e776abc53d5943c430f1ad8179195a37c4294552ed0560d6f47d090f", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/test_iosxr_ospfv2.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2881e6402d44975a5fd818023b2810f6186c8050748d31bca9d6a4228ca5e620", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/test_iosxr_ospf_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "df39e72c8603aaa7199a29b189b9594a178986897d4792c428a3db7280f72a85", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/test_iosxr_command.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3becd7ceba917cdb6152fb0deb070ee19cc7bd11154e30b0102187f5db9b5031", + "format": 1 + }, + { + "name": "tests/unit/modules/network/iosxr/test_iosxr_acls.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4dfc0f525f331013e0b716da3b1eb402d108251079bb7cb350b7f6d1b706e7f5", + "format": 1 + }, + { + "name": "tests/unit/modules/network/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/unit/modules/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/unit/modules/conftest.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2af4846e50d461a131ad3edfb609fbb39a9eb1796048c62e4ead8234bcf5c6a1", + "format": 1 + }, + { + "name": "tests/unit/modules/utils.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a1413ca906b0ea8de94f1c3cfa100b421a5b01f1dc40a2ef63f049e8411ef83f", + "format": 1 + }, + { + "name": "tests/unit/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/unit/compat", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/compat/unittest.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3ed698b1faec43d87a2c1ebcb15a2aae48b09ff355bb9a598e5f5a1c928dbb30", + "format": 1 + }, + { + "name": "tests/unit/compat/mock.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "92c05c107e3254b8c0e3ec6fcef2be9d36255008b1d22488e48e554ca5ebb70d", + "format": 1 + }, + { + "name": "tests/unit/compat/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/unit/compat/builtins.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ba13a350ade8ef804336f888d5883b8e54f8bddfb9d0fadc10277a8ca6540f4e", + "format": 1 + }, + { + "name": "tests/unit/requirements.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "49ba996dc4735c3463e9af561344346dfae14bcc1a68096ce78364b377f0df1f", + "format": 1 + }, + { + "name": "tests/unit/mock", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/mock/yaml_helper.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "94e2f3c867d2582c9f7a0e99e544718e355025c4a51c9925e70158fa89b3609e", + "format": 1 + }, + { + "name": "tests/unit/mock/loader.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0cfbf4c710a5d5725f84d5f34ab76ec1a0e853397cd945c90fd97769f89dddc5", + "format": 1 + }, + { + "name": "tests/unit/mock/vault_helper.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "feae23166b6eb502f7d9b77c314970516c9a99aaad7de01295b4dfdad53c5c09", + "format": 1 + }, + { + "name": "tests/unit/mock/path.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "53bb779a7669696754c1bea32052fb5b6f93e0fdf843e1d3cca36862aeb0e539", + "format": 1 + }, + { + "name": "tests/unit/mock/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/unit/mock/procenv.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "dbc77e7aa7a3e236a676c228affc887adca4c82ce764f1dc4938463992808787", + "format": 1 + }, + { + "name": "tests/integration", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/network-integration.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d67b11263a8f50b30bf43c7c2b4bdd8dc4f173f0b5dd22761311360dfbd56a1d", + "format": 1 + }, + { + "name": "tests/integration/target-prefixes.network", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "60c1f89345b308be75e572c064735f2fc749d9bb89ef936f14f33d212582fefa", + "format": 1 + }, + { + "name": "tests/integration/targets", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tests/cli/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "43e211ff2be29a1695024c0c5477e4107c0aa6866eafc18c1d89fcf4bcb9732e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b535abaa4359adb10027bbd428cb9ea859ba2c8e440ddca1bc487a5d0f8bee48", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tests/cli/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "48c54e7dd68a06ad182239166357d72c31e708f468c479c89552b926cceae9c6", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b8218f3c1610ae394c49f23d30bbc4805ed119afd4bfc76e3b9fc50ef839bcd9", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tests/cli/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tests/cli/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "07241fb0e9cbf3884bc1c29a8410446c84223339b54df1277fd0bd651164956e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tests/cli/_populate_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2b5e724b1e3d4af1180b806854fe9f97eb3bc6576382c70d38c63c8f6228f007", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tests/cli/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "12fe077aa8d1066b49e853c3cc287b5584aebefffb9fa81964d6a5e8a029f641", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "add273b22d632699d86230ae4268c1445f1c10759eaa2a13dd7c15413ab737b7", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4096307ac120e94447b5d22b035955375aba4f10fa2ab83d18f8af2d50ac8e5b", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tests/cli/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "be9488078cfc215d6b02fc46e063cbd9c5dffff4ea8eefa8eea0eef53de7b1db", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0141ad7c14a94c53d284b7bc917d8ed146f87bbacfd37b70fdc216ae3ee61885", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5f69f92e46aa5661bd8bdd0ac6ecaf7497db0732b5fe1a8e2da13eb1a1318ad0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a15baf460706b8582ac802d4392e3037101cc9a9bc6a73cc8a9edbae8226e1ab", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ec4fa30fc4a7b9e002d1c7b3932286ace72ba36e4f532e2cc79f49d07e0794c3", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l3_interfaces/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "90528688ff4d0b98df05918adb9b9740dfcc14e9c9a544c2f7507613d21e98a0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/tests/cli/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8bb0f6a9c16f4f45bf0a6d8138526e3b2292689ed10c6805c3125b79f60bfaf8", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "27cfe3d5911b55b4595d7b075c3988d0bd442b0e5e2884453b9179f7b4647751", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/tests/cli/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8be7ac792f388d8c3a87b62f6200b51b5bb1f256e4df34aa9adf259b6c99b5ef", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5c2cebf9171a9e0be32861c815bc196e701de1f8563f630f2da6aba28f765853", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/tests/cli/_populate_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0923adff921d0e4de4105214951d027ce19bc185740a58076b79e892ba3c085e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/tests/cli/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "22efaad73407e942e8dbc0c169249fe95c0708d94128a14bb179512cf1017394", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "84e37db31c9e53db90e934237cfe3c0ecdff5a550b413d01277dff0666438e3f", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "76ebdef5a5ee76343c0b67c1e43d6e060f7b7b49ad5d635a3084d84e6eabd3af", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/tests/cli/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "93cd8ccbe893e42887580c016bc62f606dd7f9c5476f9e1968f82e6240ee05d9", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cb65d3bdc0b39c5c5b00eba55af8ea91ff85b7ab162cc46a8e58c425bc838b6c", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8f326a4f98d10e69c3a58b40e713141fb58aae383c114a8dd61561c54954373a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6e148c74b09c0b22e87e8e55b815a0250281aa8daabde38b951b425cfbec2442", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d2335eeeaa4ace8094a5daa3fa60d634693f9b07c483babba9e3c6c265d77508", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_static_routes/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "90528688ff4d0b98df05918adb9b9740dfcc14e9c9a544c2f7507613d21e98a0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tests/cli/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a54c117eb0f0891dd3967377157c9751f07734b67a9ca1fa359535a644e5fe13", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e5e8635685d1cf9f914f590c4d836ac5ec30a69e596ca80ab0588f7c72dffdf5", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tests/cli/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "616b36bd1930bf54e1492f749f8319afb947e7d845791eccd078f091a422b3fd", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tests/cli/_populate.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "264a8c0b8cada72e14090c9791e6798f0c28202baea158f42424b8d87e397ba9", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "48ce40d16eee57cce3beea805938696e99d93fc4e30318f6e1ddf5fee8de4a0a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tests/cli/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tests/cli/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "09906ee86cc2c5b1a515dafa190e3576def507f53ed9563c471db011ab76eb54", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tests/cli/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a83663cb7e49f95429a2053b940681641db3af45be2515c4524d97294a6d9be6", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b2510cb59cc827cd9597ea07d906ba48a38252016418bc6f4fa4442eeca91c57", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "13333546167098eafc10253dce20230f3f3b7687a07a918aeb1c4752c8610f66", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tests/cli/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f1a020d8a69aeda43a49f410ce2fc0c8b388e74dbdb3bc3ad77c021462a6b2c8", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2b66427a9463b4fba069c1f986a69e96f41b353153b8c722dec871eb435a2a31", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b465248b3ed4cc3dba91bd97095052880845c905452c54760651e1b622de343e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0dca88a635c4df7935a64b62dcc4e29afc8ea29e79c5a69790d9fa39248aa593", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_interfaces/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "90528688ff4d0b98df05918adb9b9740dfcc14e9c9a544c2f7507613d21e98a0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/tests/cli/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f6303a1c157aa43d3ed0dfada52fa54d6e23ac300e8bd0192b46760e24bc7f81", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3745bcbda25a847e68a067ae213b4c5f28e09749d7930b535aa6d5582608412f", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/tests/cli/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5b599806dc1e9a93b2066e99a74e3a38f525e6cfd6b2d29f0439bbf160624f96", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e785c692c44e1fdcd006aac67e0dd469483dcffb212f129a7c54f5c41e3784c5", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/tests/cli/_populate_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e9f4b4e2adf8ee4debe61d78d7f4b32953f7a756935246950b5648de39b433fe", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/tests/cli/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "02b46d715d998a51eecc65973e02e8b67cc96486953d6df2a567c47d4969945c", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8a027624c6fa1c9f737b05c3d38065c7fda1d6f94cd34f52c7c5c37992410f7a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f7b9ce25078f6ab45f83789648b30900aa86f2afc1400491090816f8bbec9df1", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/tests/cli/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ae753ba768b9b68abbf018652a8230d66e04d343053e221ab97d9073f7f80899", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "af60093fa5b2b70c9a49d9309cbc5472c0d52db3954552e63890ed3e66a0ad36", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "20e48336887c67da6536c6c7ab606f61de00dc9a02e0251a30ee1e566330fe32", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d11bd78a2d74e8dc46a2880b54b3500e2f88cc4e3e6fd42a249138556e94964a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "934f6f7a277e34f616d5459e1989f9e0faeaf4e0a61444289abfaf37ee120659", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospf_interfaces/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "90528688ff4d0b98df05918adb9b9740dfcc14e9c9a544c2f7507613d21e98a0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "afdc5ba7f0888dd67f958a04419f06713f71671f16b66f754cb9322c3b0d47e6", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tests/cli/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "027d22fde5f7c211b58e9ec9558b559bae58e826ebdba35a6ef447b38a2ba6f4", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tests/cli/_populate.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "77726b8cda1f319642e5120c9046ba1bc83d6d740b65651926698d0e81ffee80", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0a53a4cfeb9780a5a3f92b2e9de9f212331e9b7b089f654ffc881f6207c1f88d", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tests/cli/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tests/cli/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b053b09f9388c7f6208c51e8b9e53867bd6352bf37c9688f28b02ab348ed3767", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tests/cli/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fbe39661405e904c9b5c5d44d8930d77a970ac6dd0678928cd694c217068f386", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "be9449d3c5b834037691283129216a5412ea04f0ca29e0cf0f61fba2e48b717e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b81de3612853980a891e9dd857b58eecd173cc9a66332980193964fae74be491", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tests/cli/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2c556f462a4bbb6ae614bbfff91b44c08e1afcd0806508dad6b0443c3e15d0f7", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cc6eb54188aada720c9f28d8330869007b39e153b43979aee7ca468cfc24ad5f", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "600a13d3c273d281ef9459b57e0f410b3ebc257fecc08f768feb7d17bf763a68", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "28efea0049957f8eb23160dce61b09a38b89b1fa61bc53f4f53b7f809b4eebd1", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "90528688ff4d0b98df05918adb9b9740dfcc14e9c9a544c2f7507613d21e98a0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/tests/cli/basic-motd.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7a44af81bfa24e44efc39d5e21900a9a7deae759f75940d737dc63a7f94b7dd2", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/tests/cli/basic-no-login.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0d7660a39a5eec8bd189f135d4ec50e5c1b24c1382c8509e2c16f0c881d78b67", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/tests/cli/basic-login.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6e641b60f523c27a9cbd306bf7aab90518be633c22067e2b5240eebf7628abca", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/tests/netconf/basic-motd.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "397891b7d69315e72a073956f9762f0588b2d4eca4bf69449ad608094b17ff6d", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/tests/netconf/basic-no-login.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fa495a963720cfb63f16e37eaa139d646a8cde6e754b1bea6911b04fb6511ba1", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/tests/netconf/basic-login.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2fc8cd01d0b141794a008521670e5d7454df687a247bfbd953874fb330a92cbe", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55144d29457d670189e343c566fbc6b465b90dbd9f2028efbb12d7fcc9f07b06", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "549cfb05d51408c3c60065091160390246d2d63458bf3a0c697731efe3ff3b59", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "190abeacd88f15b161e12beb10157c146d8d51df6d7eb0e7c11abfbe70dac0e7", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_banner/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "31cfb1ca71bf9a422c1b29c516d44cb879dbd4e6f5735e8be27fd4e8099d0490", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tests/cli/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "eb66720686dcdeeb2c23a88b66b11666b7f66fccd425f36aa15e10f11d4b2055", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f86a36a7d796eb8e87a197360380c81bae9e72403da205852288508e03bff892", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tests/cli/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7837c657f7e9a274b42d4a24cbfb1d5642e615225abedda7a69f2105b12f428d", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bb12466312e5733309eaabab1e0c777c50175e77d4412ff66f770dca3a8cbdd1", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tests/cli/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tests/cli/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a69fc90e1abe390279edff54a7df34d0fe64cbf54c9f58ba588b62df6bfc8a2a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tests/cli/_populate_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d2329fbd002ae7078d3804fb64f9f4a5b16329824aa532c05d77c490e66a2228", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tests/cli/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ab00c0cd1495cf4b208b57b938e217433aeff919e76da9a9519d5671f764b2ae", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2dc35edb15902e5bdf892b4ecba5bc6dd3ae073340d6ce2e4aacfed713248a7d", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7a76f4b2951d08a3177b800e9d91d9c732a672281fbb2ecf2a1544e5332e4f9e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tests/cli/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e0d97189c0b7eb7675266020b4758a2859d44ad8c3118c6c533ad63e575f7b7a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a212d2a103dc8062630508d8f9c5ccceea4ee5efd68b9750b8abb505f2ae47da", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3b34c0c85643741818360d5c423c01170201efa2f106024ee29d77c43baf3461", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d709bbb76c9b147fa2300279037cddd5865131a790152a66a788ff999d4cb6e1", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acls/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "90528688ff4d0b98df05918adb9b9740dfcc14e9c9a544c2f7507613d21e98a0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_bgp", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_bgp/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_bgp/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_bgp/tests/cli/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e42b6d0a58fa927942ed7af4b0d99a57dfb96fc33c946ed9c714a9de75986ffc", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_bgp/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_bgp/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55144d29457d670189e343c566fbc6b465b90dbd9f2028efbb12d7fcc9f07b06", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_bgp/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_bgp/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_bgp/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_bgp/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_bgp/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "03c73c1ce648bd2159b91cef3220d52324a7a5e3877f403199543c637c13d6f3", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tests/cli/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8bfa536743433e0079566eac32dfa10849255f4da2e765c64ed0e2a951ba308e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "14812527603f825ca610f79736c3b2458b2bcd275e3326fa26a7daf5d6a391db", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tests/cli/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f72c0f3cbaacba74908e31af49ea52c74269e97ec3dc651c0d2c0475672e2edb", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "47a8c375bd4d77f371f4b7db372756bfd619aaca44e5ad99e8b045fa9c3c5d06", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tests/cli/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tests/cli/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1d7b3fa83a6dcf767633f7258ec977dd805bca495bfb100a9e3ed837324a81d8", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tests/cli/_populate_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "89576040392a674c9fe8a8fd5a2415af6b28acf093d46047712515b4913474c5", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tests/cli/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "10085a2c4317c52c8d4da5d3e14cf4242c6ad591ba5c96a32819cc7e45206079", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d09a6dee989d0adbbcd2c9c1ea8b87d68dcddffead2202a3111058f0a6c3b1ad", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "363b709312362746ba12cee67204daff50e8c0062784a6d371db38d53661c912", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tests/cli/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b5a28be618d4ca93d0a40679321ed7458e73d92aeb6be03867eebee8bde8c3db", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "79537223380b09c48326da6e22e02f21dcdd19a3c0d777a57031b743f9fef4b0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3547bdfd2ad689e926e5ce4f36e680b06552c752ac73fd3ad092c9dfe402fc9c", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c4de7c47f2b8925c29801c2f697f1cd3a888331f1c57fdd66883eafe4e7b5584", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lag_interfaces/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "90528688ff4d0b98df05918adb9b9740dfcc14e9c9a544c2f7507613d21e98a0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/templates", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/templates/basic", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/templates/basic/configuration.j2", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1fd4692dc95cf561f544f8f680c9046add01c85c6fb83c17db2690cb854d3bb8", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/templates/basic/change_prefix_set.j2", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e9ef2a7080051a1b23e1fbc6cf3bb437bc99d89a735d1a3c23f85672a5e31014", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/templates/basic/route_policy.j2", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "83c3226c2070afbe01cde658ec7852261ac925abed96766989888c70a2f8bc92", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/templates/basic/init_prefix_set.j2", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "92dec92ecf095d1c33c493f4769541caa745787d80e498d6ae81decc93351e0a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/templates/basic/config.j2", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8a1d61def7b5db197597c56f0c6c31f6aaf16ab38c990e99e386305f46ffa6a8", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/templates/basic/route_policy_change.j2", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e876ec5c5b2ae5f93154312c627b80b164860f49bc6283d5184ef592c7cdb1a2", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/templates/basic/route_policy_clean.j2", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "213238a72856965973d969bbc5afe4fb6f21655ea1f9a2e8ffd58fc80b6a0489", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/templates/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/templates/defaults/config.j2", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "63cabaa434b59d994f3d56383ce682f57335258c9275f2f3db142dca3ece356e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/comment.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5ae96a07d00ae791d8814019a9bd6912d1d1861d8d97ec7367a951732538ee5b", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/route_policy.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "223c0a0e5cc8ef2175c8f59814291bcf8ead8d8d34fb82f660655d6fad2a9b53", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/sublevel_strict.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c33f4502f82499a59e2acdba8c4bdafefd7b8ba878c3600f24c2cdb75c77f751", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/toplevel_before.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9221bd5feab29374f57f6a49a2bfd1850561c9ff5de825e4b5893a02b8aa7c3e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/misplaced_sublevel.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a4565f5d3caf86349a6b20861984681534ca099fc2eef871f69ea996879e080e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/src_match_none.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "568329f352ff9a731a8169bd936cb7bd88b948eb42be09e57f441f817a596bf1", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/commit_label.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "506f066de485bb4366c348b7e8f1a965b8dc261cf486c0c820d4651382cb1366", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/replace_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e365cdbe0305fb8ebd82ad1a08e4421629532f7c851fd9f23716904be6ac8043", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/sublevel_exact.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "056077aada0da146880cce571cb4c3fe13ee75a314ad74c0265e2134c7cd0a84", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/src_invalid.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bbe8bfd0a1efa1acd89ded22d3ef6eb3c9523678d7820a8bb5bbe88a094e0f72", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/toplevel.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "480c9a149f7d17ff2f86aa51ace917b16ff5f23d03ab9f103fe9f535c8e84390", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/toplevel_after.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ccd2e49a74a7fa5ef2aaee1d7ef39e1ded0fd6aa27966001032bf3c2d99931f2", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/sublevel.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c3dec8392ed195964672f1a0ae74fe7e214f4ee3542d83d0adde38b84b75766b", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/toplevel_nonidempotent.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "21c43fd562d62435db0af5b03c6104c03666c6be646a212561878f343b767819", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/src_basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2c52f6a8c62a96dcfff611118f83d5e4c562e03cd72737f66f4cd2e95bd739de", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/sublevel_strict_mul_parents.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b6c391f806beaf3474d65555eab2923c747a218c0a966c08e6975b01b5b820f8", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/sublevel_block.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "14b7b67fbe3d5e141f8a14eed092ecefc8e7476a774aa2fc21c85915583796bb", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/backup.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7f2339914583108ac68fd6a448a0ce75d00aa0da235ff2ac49d66be0a162fa19", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/prefix_set_remark.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "418f2968defac06af79b0920a6c7af07a2a6f66d0dbc97c9c7b14aafbe412918", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b631b5e63ff83ba8892d97a7c556203bbc2b3616e71912c136342ca5dc814a39", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli_config", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli_config/cli_backup.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8e3dc4e968e2149e65f78bf511fd56927fb8a0deb33233b24f6205f38bd5d3d8", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/cli_config/cli_basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "db93483ff0390cd576694545907a377fe21b3357bc8b83ec8dc3f9a265b551d1", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/redirection", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tests/redirection/shortname.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "586a928e6c3f6c7e1103a55e7515a5d977a60904dd77d354e16d9367d46c3393", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/fixtures/config_del_interface.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bd232ca03ce45663aa31c2d1d3035d34a9404325a787d130315cb25c6768da7f", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/fixtures/config_add_interface.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "10c5704da15d8c2c23f8a3e4005ee50843e5244d7dfdd5b397537bbaea299c5b", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55144d29457d670189e343c566fbc6b465b90dbd9f2028efbb12d7fcc9f07b06", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cb0eb9495a97d94113e86ce70c78b774f2788ea642aa2ccd18efc740f056f626", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "31cfb1ca71bf9a422c1b29c516d44cb879dbd4e6f5735e8be27fd4e8099d0490", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tasks/redirection.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "24c235a52dd3f178bf104b6909e8852323ae8c7e31019efd6a86452c621c22a5", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_config/tasks/cli_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3b49a8fe96428a8ff73c067c2efb3fffc30d0986cd48994b88bfc3ba148b51fa", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tests/cli/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9487a70ea6b6c46733030646171880120914099dbbb5ee23d02d74dee8629779", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ea248765e98099b7b2019a8dee05687abf9538d3897ed53aabc850eb64ea69f7", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tests/cli/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "37e97d40f5ece6e31da74f566d7661b561d2cb9de149c08470312dddd4632d3f", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tests/cli/_populate.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e8ecd186c842220523445b7623d23e7a3cec31dca381e25716cdb8cd894067ba", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c85ce351a9c10632bad83c51259e023f68b8beda416fd253e5035b1c01762464", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tests/cli/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tests/cli/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d2d60ebae8ece4e0b0b755137203b5ea618f87c277f2f8b605891d29db7dff83", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tests/cli/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3c7d168e78d262be3e22279d77eac23faadba9b75543aed00fc3b8ea88037dba", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "eed1547180bdc0630f77250a118244716299170831e5b4761b9e62757b6702ca", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a2417b9f418c00b16921d12449a6340bb92cebc21a55fad7582a19e1aeb34357", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tests/cli/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "405bd74b0af982f23a0478cd6fa23465cb96fb6ef550a69b3969ed5bc61bb358", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "598e0b62bf647e769d16ba01625b74ea23087439779c23d7445410182fd0baed", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2c7a3e5edeac0c518c37446c999c361e1eca7a8a4d40a4b7dab96e99fdc89e2e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "29a8acf3766df1e54abe6a3dadfc393571647722393b132444952162b30a60ae", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lacp_interfaces/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "90528688ff4d0b98df05918adb9b9740dfcc14e9c9a544c2f7507613d21e98a0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_facts", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_facts/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_facts/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_facts/tests/cli/not_hardware.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6bb48d2fc105bf70d6a6588d6159f5a7154f8cd5e53ad3b828c3657fdd8a42f0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_facts/tests/cli/invalid_subset.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c6c4691c1b051e05d76778de367c44f6f737f857fbf7b555c6703ee345a8a6e6", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_facts/tests/cli/all_facts.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "def6cdb1bb85ad5f2dd94243094e7a27a9d8b85d59b0afd535a209a66878cc5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_facts/tests/cli/default_facts.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "77059041cb45f20b8ca2dd9a915eb3cb864ce18325c162dbe8312638c2931af8", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_facts/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_facts/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55144d29457d670189e343c566fbc6b465b90dbd9f2028efbb12d7fcc9f07b06", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_facts/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_facts/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_facts/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_facts/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_facts/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "03c73c1ce648bd2159b91cef3220d52324a7a5e3877f403199543c637c13d6f3", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tests/cli/set_domain_list.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6fe20d020c2d55d0449771fb39a92387ff06e474ac8f5b75569f6ca6238e630b", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tests/cli/set_hostname.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "65cb14ba37d93c75860508494678f4f332b99b1e3ef80cfae596efe8ace975d6", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tests/cli/set_lookup_source.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "53cda39cfd8bbb13bce2958062fad4776c582b5a3b7409057baaf109c48fcde0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tests/cli/set_domain_name.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "429379d40cdcf6f5a5ec5083a6668c35232ae58cbfc2d35f806fdc534f9d57f6", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tests/cli/net_system.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d066b65327fddc5ebb988daa19afa503b6af3ccde750f5934370ff42c4060f91", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tests/cli/set_name_servers.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "447f9cb29635a711722d47d98f2fc24d607c0675b0551fc2db2d6d608779421c", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tests/netconf/set_domain_list.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0d7c18d4b50fc97835c921d36699769f81d56b48e08618cc7b501ad25ddd6a55", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tests/netconf/set_hostname.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "06731e212efa0967b942123e39dc3b5545f52d3f80300fe53209ad29c4b89db7", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tests/netconf/set_lookup_source.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "feb2d072b3575c422948c68fa0e52ab35a79eed4b0c4aed8929570bcf6156233", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tests/netconf/set_domain_name.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ee04d41b5c01613d6395b66c430274ff3c95a5d0b1c292f774d565cfdbb70571", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tests/netconf/set_name_servers.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a90b23a80fdd0634ee3c80d4175b10c79afc85364ad493c23f7a7576c493db76", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55144d29457d670189e343c566fbc6b465b90dbd9f2028efbb12d7fcc9f07b06", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8e82c716422654d049fd043bbf84d624ed532f96741e032f52f14c19e970d3e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "549cfb05d51408c3c60065091160390246d2d63458bf3a0c697731efe3ff3b59", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0434014351f94d6611d1f4e7b2cdfdf23ec1ccb86b1b33986f410820537e38f1", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_system/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8b9faf104c52c534386b8e738f64269d6a8f2ce95a9b82d43e89f5d2c931b0c9", + "format": 1 + }, + { + "name": "tests/integration/targets/prepare_iosxr_tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/prepare_iosxr_tests/templates", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/prepare_iosxr_tests/templates/config.j2", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7ca941952f4366404a261ceda3a81c9c28257e7c189280fe107be2b643565546", + "format": 1 + }, + { + "name": "tests/integration/targets/prepare_iosxr_tests/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/prepare_iosxr_tests/tasks/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "be72e331af68859c94e6106693906f8eedc7e0f1e0f1871cec6063d6573469fc", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_netconf/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_netconf/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_netconf/tests/cli/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "77f22d17431b4aaf868d0ecb66af6baf4087e83cffcd2b94b27198e52782e34f", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_netconf/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_netconf/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55144d29457d670189e343c566fbc6b465b90dbd9f2028efbb12d7fcc9f07b06", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_netconf/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_netconf/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_netconf/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_netconf/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_netconf/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "03c73c1ce648bd2159b91cef3220d52324a7a5e3877f403199543c637c13d6f3", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_logging", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_logging/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_logging/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_logging/tests/cli/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5bf1ebb8c51ab33116071b2db75ec0f4653f040f797c8d6cff4e953568960559", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_logging/tests/cli/net_logging.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "443aa0b0afe4c3d230a88f771c9a32a5340ffa1afec23875184e182a857a1872", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_logging/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_logging/tests/netconf/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "eed5fd4e7e1bcae6ed1b1f0c3758ba9398bd3c1918b834ea0e2de52ebb638e73", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_logging/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_logging/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55144d29457d670189e343c566fbc6b465b90dbd9f2028efbb12d7fcc9f07b06", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_logging/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_logging/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_logging/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_logging/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "549cfb05d51408c3c60065091160390246d2d63458bf3a0c697731efe3ff3b59", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_logging/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "383275b8234d718abeb21a0c40146f428189419f122d03b074331e71d462ee8e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_logging/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3de2f427f12d15af36a09be6fe89647b1f82ed8a0d99985194c460ae3b9378ce", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_smoke", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_smoke/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_smoke/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_smoke/tests/cli/common_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "524d04ed70b825db5543df8469f0d184d65ea7e10f28952b437cb7487f5e06d8", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_smoke/tests/cli/common_utils.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bc1d83f2bba36eca3b1536ccdc8f4e682beb41953839fc27dedfa79a917aa623", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_smoke/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_smoke/tests/netconf/misc_tests.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "795c408df67a745b03b0b60c86f989d51262551fd365d0b844f334178dca7d47", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_smoke/tests/netconf/common_netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "15427acf2a757cf29574dd39f45c7cc5c6f4ac3ff9c440d82ecdf97b9df6c3d5", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_smoke/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_smoke/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55144d29457d670189e343c566fbc6b465b90dbd9f2028efbb12d7fcc9f07b06", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_smoke/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_smoke/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "665288590cd4226da42511817f09ccdfc92df36c9621583cd2c82919af295c5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_smoke/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_smoke/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "549cfb05d51408c3c60065091160390246d2d63458bf3a0c697731efe3ff3b59", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_smoke/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1545c3e0b0193ea1d9ae89278742f5aa770debfc75959bce20df891575592501", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_smoke/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a7ec5b439ea0123aceb116bc54c862a613b37bbdc5e0bcbe10837361c4bfbd4b", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tests/cli/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b777429051ce464eeaf8011eccdf779310b9cfbb2cf119059f94119c357e4dd6", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a974ea180eebe0b0691a70be2357a9cd31e6a282ee3b222065eaa7aceba255d1", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tests/cli/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f2d495e0656c2c47fee2ae0063ede06afaeb6ed388338557d97ead0dc2682568", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "dffad5b9e4bc949658aa3f82a369cf969374307b65925e026307c6a546434b4c", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tests/cli/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tests/cli/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3bb6727e8ca619c3b6539b19e7fd1ef13d7adc173c4adf12c2e277d3d350ffc", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tests/cli/_populate_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7c0761a956b29ef1863f96e4ac35d295e2e97ec31ebac5270bbe97509cd9e8ae", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tests/cli/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "19faaea60c2be7a1165f50bd710f280b9af1316af7cea473d7dd0de817418f60", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "202fa7f5c412da1e52ba675f2864e7ca8666b9dfc7bc7bfd33c25d0bda45fafd", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tests/cli/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "67e44a89e03d3874599648c693123c1a1d755121c89f1837d939e269b99e02c5", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5ff94e58a4a24c7f79840ac6b4379f77902b839d3281229f4f3e32bacaec2c42", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8b118298711bf10c69fecd8422d16e9c10d1109fc725c44d9ada29f6178fa14", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a9778fba31c09aa6795fe422c8056f851535642282dee55864dc3185cce4149e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ec4fa30fc4a7b9e002d1c7b3932286ace72ba36e4f532e2cc79f49d07e0794c3", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interfaces/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "90528688ff4d0b98df05918adb9b9740dfcc14e9c9a544c2f7507613d21e98a0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/tests/cli/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bd2c4200a2c8d15171d205041e6622cf990ef703a459684cb15301cade089220", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "befd90d5e15da96e7d05ae3922240830496d4c64bef7e508a2ece8707f8e49d1", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/tests/cli/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "eab98e509d6f665a08283924c8b24d00140a5041fcca90b849d9f26d223010cf", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2abb52f64ab00ea05c63fdf8d79d673b1e6ccca4a16268eba95271661a94431e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/tests/cli/_populate_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2eedf6932473c98d452747eba0f44114b5e7f4864671f35c79e1d4cf68e6fdc7", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/tests/cli/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f4385b7f23bc9f1ffe3dd330faa4e7ff572cc9940f6fe7e43bc12e21e296ea9d", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "982cf6a4099b5d9847d56c437f767459e0ee8c15c6d56bd609584a3df2355f0c", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cee4a074041a65c2ae60a003e4b070385064a0139a532a36df00adf555d0d8b0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/tests/cli/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7d201f3b376a0d58b3b268b00547a5c61796d068dc9257afd3c051947864e290", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e8a50e755506284f320d3d2ba1c29e994c77025021c3e414a58c2f1e9444434c", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ae3e2714ba35525b9c2083876c00108675c9c187df415425a6f29ada3909b2e1", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "717d5351bebea57a2f0ccd874a2517595c2dda6c4ca8cb3c6de7c0902aa14b75", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fb19a75341b8cd045204b896abc234440510f9b2a9ee079bc5afe45123ebe9e7", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv3/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "90528688ff4d0b98df05918adb9b9740dfcc14e9c9a544c2f7507613d21e98a0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/tests/cli/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "72128fcfcb919567ff7cc8ef25ad986251080a425f3491e84fc739631d38307f", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "57d8f1277b1b645ecae495982bf267757151bdd955d453962e6265c9d0b096e5", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/tests/cli/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "242644c5a8a72b726ee65e042f0f359ac2aca81e95cb29dae26a4ae5af2990ea", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0b01e26f2525609e71032cc93c832f4e0ce2e61793269051eab98f84845671c0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/tests/cli/_populate_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6d7f4ec7fdec43a457981bd0e09f904dc6bce7bda05c9444dd16eb92fc4a698e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/tests/cli/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5278abfbc0cf97dd55bd0c4158cd280f306354a14556097d27c241bc348a3f57", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "40c946b531d7d2cfef88939f5c6cf55d8017b5ed31616a9e7a071cbfca316ac4", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ca26b4158eb614153ed0062f85ff25cf17d34c1395c4bf997f377cd324ba54d3", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/tests/cli/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ce659aa5549eb95e1258dba081a7030de685cd6455e0717360cbd151b8ce2c5f", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6bf6e25cf3147b919e1c87115f391989a0fd37388321efbaca953ff626dfeab5", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d4ccabca2b0f3e9fe176f72d103b0f96b4b7098f7c15e2daa7647bd551ec7cf3", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7200105e66871ab7b8ae409eacde75f173708b19fbc46b5dfd512816beb5c0fd", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "99346169bd730ad926053bdb6a9c076745625b9ed479019a62507e0dc7447d86", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_ospfv2/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "90528688ff4d0b98df05918adb9b9740dfcc14e9c9a544c2f7507613d21e98a0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command/tests/cli/cli_command.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0de4ac687dc2ba6552f75440fce5eecc4dc039e45e78317761e6ae44e74a1267", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command/tests/cli/output.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "458348f49d9fffa9ac331feba477ddbafb5cedd9b23355c8098251be691be8e8", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command/tests/cli/invalid.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bc2dd00bb154f69de8b5bf29081254c9ab5e763380c95914fd98f2f8c42422cc", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command/tests/cli/prompt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "820f0f375cb6fb3a1aa82e85e8d353b08c30677edf09bedb6da958cd5e9f066d", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command/tests/cli/timeout.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c0a1a4211377dbfb265842a08d887a5d79bdbd514e0ae023a55e28a500af2173", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command/tests/cli/bad_operator.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fc1cacddb46378cdc038a18598919d1514c0df49e4fab3055df211fba2eea250", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command/tests/cli/contains.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5b3941e022e40944b25661111af17864508b347e2a955d02b91e823117df06b1", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55144d29457d670189e343c566fbc6b465b90dbd9f2028efbb12d7fcc9f07b06", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_command/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "03c73c1ce648bd2159b91cef3220d52324a7a5e3877f403199543c637c13d6f3", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tests/cli/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "66b2ac21bcd8f4a2da15c6b7ea7fce725841457ce0b791f2e68048180865977c", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2226b94d04e1fb716bf69c941b9b72c7e67c8d4e493851244245969845b72dc9", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tests/cli/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a547b59a58a7709cbdef0d993d9d5c64ae5996b7d1a535a22ff1dfb4ff6873d2", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tests/cli/_populate.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4f7f2f0d23a4b5701aeea3af1219f259761cb1e264d71be7adbf73dca2c1dcf7", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7bb63a77791f1e56fa596f54fc7bf895290f8360eb271e98f6ea42981808b5b2", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tests/cli/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tests/cli/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a4b7d79bb62c8044f72ce338537100c0d4fd1526b73d1ecda61cabfb8d3a98fa", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tests/cli/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7d7e721da202c7d0bad2ef019bb339e540ad67be10be6899e510d2c5425602b7", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "af465c559750ca939573c88c271a286d7c533513f473d8a19d91a71600b17221", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ec711b83177c995449aa4735455ec1e5714d5935a3a952a2c22c0a57649c2e55", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tests/cli/deleted_all.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "75bab8b5d272963514a704c10ad108c948672baab33b9aaa2c5d730891191b93", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tests/cli/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c73c549a4b78f54b9fc1361e0f49687fbb4f69646a8f7ee19810ec105da3e17e", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "485af2cedc892533b257cd66f392f354f6f125fe2b1007f4608fc90188c56808", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "199bf47e96500d8905225fa79e76ecf9b1df5f17807aea2d48c826ff902e8ebe", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e159ecb19984c90d7b670f4d9a1be5e893c822d25ce204cc2176e2602cd8eecd", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_acl_interfaces/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "90528688ff4d0b98df05918adb9b9740dfcc14e9c9a544c2f7507613d21e98a0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "67ffd6e9552f55c250f9d7bb1e0ab7838c266d37deee383105b11963ca95611f", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tests/cli/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "42188300de28845817de67208bcdbeed34cc73ffbe4b574266acaf246951d521", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tests/cli/_populate.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0f345534b60858c2a0cc00b83d32101b267b4d6dc370b69aac7cda311d4146f3", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4abc08aceef2579b4a247e81beba6e306c4fafad7421e2bbc2af2ce174096dc7", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tests/cli/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tests/cli/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "576970062a5818579acbb6be83fb2973b2080d833d88f04b369baf6508b9ee67", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tests/cli/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d51ace0aaffc2b14581e942c73649990785065e7b89a8e12d6f37a7150cd1845", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "911b64cb53c7eae6673f82eb9cb42e0913b7dfbf7dd73c58e3a334ac5794caeb", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "439480acae03caa0a5f19f25e7cb8db271fcf6e5bf52e2e9ca36b14f1f807631", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tests/cli/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e9f804628cb14a6fe8e3d0426db91ec646310f76d5aa94b4b1d4ea1b1edde449", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b5d80f62ce5fef5d650cb373ff21ab0391ad05f30d036487caf22b6e314221d7", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7b26f69931de2b34eb9bdc7544520b6e52494b5c408caa2d3914d0022723ca2a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3a4ed71b399bcf1bbc0fd2978888ebf6d151bee360e2ab4d1c87fbe35198c936", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_lldp_global/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "90528688ff4d0b98df05918adb9b9740dfcc14e9c9a544c2f7507613d21e98a0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tests/cli/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5e3a4ec41803fd082099a1f89ec45f530fc450062083b1cc1133e38a46bce57d", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bd4a70bc35f26fc2d998a06770cd29741c0ed39eecec19c4986420936fb5b623", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tests/cli/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3454f33f1e288fe83f937b6a4e68c9687a5e1d8b27f97f7e4d63713d3f9a912b", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7eea9853e9b7841c5a8856151339bb59d52fe48e06f3528a571bbf504ab96035", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tests/cli/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tests/cli/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "dc96339b5bc4eee747eca626faf3bce62cc514ccf017556e0ead6fe29b2bb8a9", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tests/cli/_populate_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ecba8436f1295b7644b1be0d59204e38083c6bec8d2387c7c3f195c98f2865d3", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tests/cli/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bebeda97e6b06c820e9c3e647a789512a903ab709eecfd7845ff47c313979ed7", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "410e96224f36a63e4e111b87441c75b8ba3b3cf25fea000faa6bd4abf791bb9d", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tests/cli/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a0b7ffadbd391f7df091ed5deab94128859a9b00296d3025a8d21ed4f2faa6eb", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "862dd8b949b52de5dcc7c126861f66471a772a0b8cc9bcd3703adb89cc89f7e8", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b6d9291bd9021d78f34ff051dd8534d26ece40dceec06d33f95146e6368c190b", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5a69feefeab189f95f21fc8cea8ffbac698a9ac1a0221c44f0c744a05decd21f", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ec4fa30fc4a7b9e002d1c7b3932286ace72ba36e4f532e2cc79f49d07e0794c3", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a2ed6e2e9ba3726d6661ba7938c2a5bb607cce4e616fc0edb05e1e43d365e5a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_l2_interfaces/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "90528688ff4d0b98df05918adb9b9740dfcc14e9c9a544c2f7507613d21e98a0", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/files", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/files/private", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "defce0b7196d17e47b5dd1ba865e6287590deb3638a980bcbc3cc2d2b9975060", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/files/public2.pub", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "84fba91f96acc846b7c33b308b9005d335053679b828127d67f26d500a5a4036", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/files/public.pub", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cd8730417146b7691724621b213a5c6aa5e5120829714a2f62334ee23f8c4c6f", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/tests/cli/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "85a10631a55c69ea44597b2516d9698198b36eeb7afcca51ce32a951ce5a0de4", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/tests/common", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/tests/common/auth.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "df95fcb8003807c2262391d722c858b96d84bb17bb2d7995504c7433199b435a", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/tests/netconf/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "23a4dc778c05fa2c50f9c43dd896bb5f557c3f354e2cb5a3eac774ad50be65a2", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55144d29457d670189e343c566fbc6b465b90dbd9f2028efbb12d7fcc9f07b06", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "549cfb05d51408c3c60065091160390246d2d63458bf3a0c697731efe3ff3b59", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c825cc804755db74748aaad4505ffdcc9594e85c65b37235905c8128fff66de1", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_user/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6502b43e3efc55fef84c81e70115c95f24580b588fd6f92be1772894e7be27e7", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/tests/cli/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b2efa8378b880bf3b2f29ff8726838f9961c351b41aff7ff5b2396afea52fa51", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/tests/cli/net_interface.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5cda7a61a2172c720dfb3ad2ba6e57fab99d310642dfbf0c0160f065107641f4", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/tests/cli/intent.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fe19e36f2173fe00bf842634e812024b74d9f67bfcfcd8b3187f92f6e7730b76", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/tests/netconf/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e2222f146c454e4eff2ece7fe8bdba4cffe7b4d0b550769985c21c9a0996b499", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/tests/netconf/net_interface.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "63ee675e67664632f570f147843ca0bf82582663aa2e4e68e77da8c09c635ae9", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/tests/netconf/intent.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fb06be783fcbfe143eefd6a0b2e76d8627cf87f5337988eca5ac48220391e7fa", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55144d29457d670189e343c566fbc6b465b90dbd9f2028efbb12d7fcc9f07b06", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "549cfb05d51408c3c60065091160390246d2d63458bf3a0c697731efe3ff3b59", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "936b653bc700e0fc678c95bf7d0f499f0888446cc5577d0f2f1c86baf7ab88d2", + "format": 1 + }, + { + "name": "tests/integration/targets/iosxr_interface/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "31cfb1ca71bf9a422c1b29c516d44cb879dbd4e6f5735e8be27fd4e8099d0490", + "format": 1 + }, + { + "name": "tox.ini", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c6e94fc72827b917d55ef15386cbe48fc9eca81755aed8f532d8da97a0be3483", + "format": 1 + }, + { + "name": "bindep.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "80645079eb025b3a905b4775ac545d080a3d7d35d537c31e04f7197c94315ab5", + "format": 1 + }, + { + "name": ".yamllint", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "827ef9e031ecdcaf137be239d33ef93fcbbc3611cbb6b30b0e507d0e03373d0e", + "format": 1 + }, + { + "name": "meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "meta/runtime.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e46736dd2d3de276da22e919ffefa469879c17d18a265d568d9dae41f2d48794", + "format": 1 + }, + { + "name": "README.md", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "39fecdddbdc4cf001784d967e83be781e74060a31dbab7dce1c3e5dd8159355a", + "format": 1 + }, + { + "name": "requirements.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3b7aa3bebb06a3546133073f5d120b176829f651e0124f8bf2d8288d5b0fa368", + "format": 1 + }, + { + "name": ".zuul.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "98905acf2eec9aa791cbf5a9effe6e7402bfaa3d2d204c30013120e00668da6e", + "format": 1 + }, + { + "name": "docs", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_command_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2f25570ea9b9ed670793f13aafe994d60eee881528a1ec3c6e5edeabe7f4b349", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_logging_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "045da4183021715026faae3ac4af07b26e8bbb403a387da64ffcdecfb406555c", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_interface_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fc7c248be198a09d144a65cdede8b5ff5f88a9b1c227c51f8807e27e5a8eddcf", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_acls_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "38340cb085b7cbb935eef7c613c7d4e90e37104928941e07601dad3d91f41c76", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_system_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d4bd4d382be85042d0aab91e60f2cd481786bb343cb676518df0fc8ed42fe5e0", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_netconf.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0b0305fa0ec4e467f8e3b14597ff86cd1c70c4aaf007c46386a980d5138016bd", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_ospfv3_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bdf4e54a429edbe73da54f8d833ddc12f2ee29e7cd4b4353deadfbc8fce6c256", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_static_routes_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "96060c509808d2948c880644829c8e7d3aa38d9563aa11e0e654cad6e13b7a8c", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_ospfv2_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "68c4f74076032ef1d697e74dc8f12654173ad24a60cec3ad9b769c55640d1363", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_acl_interfaces_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f1fea6b133aa9f957d6f32371e4956c5ed20b78483e2f0df7c4a07494a196a62", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_lag_interfaces_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5afc74470d233d99fb8ebfcef625f0f01ed9d906ce71f8f3d894005d99c7ef67", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_cliconf.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d943266ec3c20d3afadd5275c5d330a0c63b3cef3a18522d9f2bd92fc0d7e425", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_ospf_interfaces_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ec1faf0712bc7f9671ff9273d0ca0e2bd6f0d0e6ed53cf8cfafdf867451e7c38", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_l2_interfaces_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c86c80fe84adeb1faa34c750feca8a9aaa0cb39c59e8fa3573f55c19cf4637cc", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_facts_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b774e4df9507613adcbceecd530488a78c92b41e1fc30f51ac6e453a4223db31", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_netconf_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e0ab5040ed80f4e528ade4dcc493b10227b7a2fa360b9763cebb34ca167d2f46", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_lacp_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ed7657079e260c2c00a1581aac025b49079b10eff2233d218c17340cc82b1c91", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_lacp_interfaces_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c3c2f4cd8cb5a595ce36425b970c2555e4eb70986a94615b346cf08b0ef3c2d3", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_config_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a6c917df4f62708c9c62ec0d89998bc7e1bbb0389fcd07b7871bca65d4be060e", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_lldp_interfaces_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "57f3ca36b100170d1696a95f910246b70c17677661ccca9d92ddb67f9a744101", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_interfaces_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "dc17f5e09fd605fa747b39a0df671d685bc888cfd28163f726de0b21ec655e87", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_user_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "61180d85901d74d9b6ec2bc5ff382f7303b0d805f49dbb2389991e452610ed6b", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_l3_interfaces_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2658b11270dd401e435f72a822fa0d0e3d3cc3069c0d0d49e34ce1bd7e09bdd8", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_lldp_global_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "68356dd1ae98e0bec8fefd2b1af27341f085104d59a63b675435f05512ef3e96", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_banner_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c99e9d23652b892532c1e2721f453a65503c413f6ab1d303e0f538b28d8546ab", + "format": 1 + }, + { + "name": "docs/cisco.iosxr.iosxr_bgp_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3de347a4f436bb7fa5c15fbd76abc3667337f994dddc8e96ef44be5f228a1a63", + "format": 1 + } + ], + "format": 1 +} \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/LICENSE b/collections-debian-merged/ansible_collections/cisco/iosxr/LICENSE new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/MANIFEST.json b/collections-debian-merged/ansible_collections/cisco/iosxr/MANIFEST.json new file mode 100644 index 00000000..17aa0726 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/MANIFEST.json @@ -0,0 +1,35 @@ +{ + "collection_info": { + "namespace": "cisco", + "name": "iosxr", + "version": "1.2.1", + "authors": [ + "Ansible Network Community (ansible-network)" + ], + "readme": "README.md", + "tags": [ + "cisco", + "iosxr", + "networking", + "netconf" + ], + "description": "Ansible Network Collection for Cisco IOSXR devices.", + "license": [], + "license_file": "LICENSE", + "dependencies": { + "ansible.netcommon": "*" + }, + "repository": "https://github.com/ansible-collections/cisco.iosxr", + "documentation": null, + "homepage": null, + "issues": null + }, + "file_manifest_file": { + "name": "FILES.json", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c0db56178177fc6841d3fefa01bdaf998da31ba0cb26ce204644969818b31460", + "format": 1 + }, + "format": 1 +} \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/README.md b/collections-debian-merged/ansible_collections/cisco/iosxr/README.md new file mode 100644 index 00000000..257ec82f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/README.md @@ -0,0 +1,154 @@ +# Cisco IOSXR Collection +[![CI](https://zuul-ci.org/gated.svg)](https://dashboard.zuul.ansible.com/t/ansible/project/github.com/ansible-collections/cisco.iosxr) + +The Ansible Cisco IOSXR collection includes a variety of Ansible content to help automate the management of Cisco IOSXR network appliances. + +This collection has been tested against Cisco IOSXR version 6.1.3. + + +## Ansible version compatibility + +This collection has been tested against following Ansible versions: **>=2.9.10,<2.11**. + +Plugins and modules within a collection may be tested with only specific Ansible versions. +A collection may contain metadata that identifies these versions. +PEP440 is the schema used to describe the versions of Ansible. + + +### Supported connections +The Cisco IOSXR collection supports ``network_cli`` and ``netconf`` connections. + +## Included content + +### Cliconf plugins +Name | Description +--- | --- +[cisco.iosxr.iosxr](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_cliconf.rst)|Use iosxr cliconf to run command on Cisco IOS XR platform + +### Filter plugins +Name | Description +--- | --- + +### Netconf plugins +Name | Description +--- | --- +[cisco.iosxr.iosxr](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_netconf.rst)|Use iosxr netconf plugin to run netconf commands on Cisco IOSXR platform + +### Modules +Name | Description +--- | --- +[cisco.iosxr.iosxr_acl_interfaces](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_acl_interfaces_module.rst)|ACL interfaces resource module +[cisco.iosxr.iosxr_acls](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_acls_module.rst)|ACLs resource module +[cisco.iosxr.iosxr_banner](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_banner_module.rst)|Manage multiline banners on Cisco IOS XR devices +[cisco.iosxr.iosxr_bgp](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_bgp_module.rst)|Configure global BGP protocol settings on Cisco IOS-XR +[cisco.iosxr.iosxr_command](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_command_module.rst)|Run commands on remote devices running Cisco IOS XR +[cisco.iosxr.iosxr_config](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_config_module.rst)|Manage Cisco IOS XR configuration sections +[cisco.iosxr.iosxr_facts](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_facts_module.rst)|Get facts about iosxr devices. +[cisco.iosxr.iosxr_interface](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_interface_module.rst)|(deprecated, removed after 2022-06-01) Manage Interface on Cisco IOS XR network devices +[cisco.iosxr.iosxr_interfaces](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_interfaces_module.rst)|Interfaces resource module +[cisco.iosxr.iosxr_l2_interfaces](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_l2_interfaces_module.rst)|L2 interfaces resource module +[cisco.iosxr.iosxr_l3_interfaces](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_l3_interfaces_module.rst)|L3 interfaces resource module +[cisco.iosxr.iosxr_lacp](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_lacp_module.rst)|LACP resource module +[cisco.iosxr.iosxr_lacp_interfaces](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_lacp_interfaces_module.rst)|LACP interfaces resource module +[cisco.iosxr.iosxr_lag_interfaces](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_lag_interfaces_module.rst)|LAG interfaces resource module +[cisco.iosxr.iosxr_lldp_global](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_lldp_global_module.rst)|LLDP resource module +[cisco.iosxr.iosxr_lldp_interfaces](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_lldp_interfaces_module.rst)|LLDP interfaces resource module +[cisco.iosxr.iosxr_logging](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_logging_module.rst)|Configuration management of system logging services on network devices +[cisco.iosxr.iosxr_netconf](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_netconf_module.rst)|Configures NetConf sub-system service on Cisco IOS-XR devices +[cisco.iosxr.iosxr_ospf_interfaces](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_ospf_interfaces_module.rst)|OSPF Interfaces Resource Module. +[cisco.iosxr.iosxr_ospfv2](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_ospfv2_module.rst)|OSPFv2 resource module +[cisco.iosxr.iosxr_ospfv3](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_ospfv3_module.rst)|ospfv3 resource module +[cisco.iosxr.iosxr_static_routes](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_static_routes_module.rst)|Static routes resource module +[cisco.iosxr.iosxr_system](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_system_module.rst)|Manage the system attributes on Cisco IOS XR devices +[cisco.iosxr.iosxr_user](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_user_module.rst)|Manage the aggregate of local users on Cisco IOS XR device + + + +Click the ``Content`` button to see the list of content included in this collection. + +## Installing this collection + +You can install the Cisco IOSXR collection with the Ansible Galaxy CLI: + + ansible-galaxy collection install cisco.iosxr + +You can also include it in a `requirements.yml` file and install it with `ansible-galaxy collection install -r requirements.yml`, using the format: + +```yaml +--- +collections: + - name: cisco.iosxr +``` +## Using this collection + + +This collection includes [network resource modules](https://docs.ansible.com/ansible/latest/network/user_guide/network_resource_modules.html). + +### Using modules from the Cisco IOSXR collection in your playbooks + +You can call modules by their Fully Qualified Collection Namespace (FQCN), such as `cisco.iosxr.iosxr_l2_interfaces`. +The following example task replaces configuration changes in the existing configuration on a Cisco IOSXR network device, using the FQCN: + +```yaml +--- + - name: Replace device configuration of specified L2 interfaces with provided configuration. + cisco.iosxr.iosxr_l2_interfaces: + config: + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + l2transport: True + l2protocol: + - stp: forward + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - any + state: replaced + +``` + +**NOTE**: For Ansible 2.9, you may not see deprecation warnings when you run your playbooks with this collection. Use this documentation to track when a module is deprecated. + + +### See Also: + +* [Cisco IOSXR Platform Options](https://docs.ansible.com/ansible/latest/network/user_guide/platform_iosxr.html) +* [Ansible Using collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html) for more details. + +## Contributing to this collection + +We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against the [Cisco IOSXR collection repository](https://github.com/ansible-collections/cisco.iosxr). See [Contributing to Ansible-maintained collections](https://docs.ansible.com/ansible/devel/community/contributing_maintained_collections.html#contributing-maintained-collections) for complete details. + +You can also join us on: + +- Freenode IRC - ``#ansible-network`` Freenode channel +- Slack - https://ansiblenetwork.slack.com + +See the [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html) for details on contributing to Ansible. + +### Code of Conduct +This collection follows the Ansible project's +[Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html). +Please read and familiarize yourself with this document. + +## Release notes + +Release notes are available [here](https://github.com/ansible-collections/cisco.iosxr/blob/main/changelogs/CHANGELOG.rst). + +## Roadmap + + + +## More information + +- [Ansible network resources](https://docs.ansible.com/ansible/latest/network/getting_started/network_resources.html) +- [Ansible Collection overview](https://github.com/ansible-collections/overview) +- [Ansible User guide](https://docs.ansible.com/ansible/latest/user_guide/index.html) +- [Ansible Developer guide](https://docs.ansible.com/ansible/latest/dev_guide/index.html) +- [Ansible Community code of conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html) + +## Licensing + +GNU General Public License v3.0 or later. + +See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) to see the full text. diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/bindep.txt b/collections-debian-merged/ansible_collections/cisco/iosxr/bindep.txt new file mode 100644 index 00000000..ba9c980f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/bindep.txt @@ -0,0 +1,6 @@ +# This is a cross-platform list tracking distribution packages needed by tests; +# see https://docs.openstack.org/infra/bindep/ for additional information. + +gcc-c++ [doc test platform:rpm] +python3-devel [test platform:rpm] +python3 [test platform:rpm] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/changelogs/CHANGELOG.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/changelogs/CHANGELOG.rst new file mode 100644 index 00000000..b217dbb7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/changelogs/CHANGELOG.rst @@ -0,0 +1,133 @@ +==================================== +Cisco Iosxr Collection Release Notes +==================================== + +.. contents:: Topics + + +v1.2.1 +====== + +Bugfixes +-------- + +- Update docs to clarify the idemptonecy releated caveat and add it in the output warnings (https://github.com/ansible-collections/ansible.netcommon/pull/189) + +v1.2.0 +====== + +Minor Changes +------------- + +- Added iosxr ospf_interfaces resource module (https://github.com/ansible-collections/cisco.iosxr/pull/84). + +Bugfixes +-------- + +- Add version key to galaxy.yaml to work around ansible-galaxy bug +- Fix iosxr_acls throwing a traceback with overridden (https://github.com/ansible-collections/cisco.iosxr/issues/87). +- require one to specify a banner delimiter in order to fix a timeout when using multi-line strings + +New Modules +----------- + +- iosxr_ospf_interfaces - OSPF Interfaces Resource Module. + +v1.1.0 +====== + +Minor Changes +------------- + +- Added iosxr ospfv3 resource module (https://github.com/ansible-collections/cisco.iosxr/pull/81). +- Platform supported coments token to be provided when invoking the object. + +New Modules +----------- + +- iosxr_ospfv3 - ospfv3 resource module + +v1.0.5 +====== + +Bugfixes +-------- + +- Confirmed commit fails with TypeError in IOS XR netconf plugin (https://github.com/ansible-collections/cisco.iosxr/issues/74) +- running config data for interface split when substring interface starts with newline + +v1.0.4 +====== + +Release Summary +--------------- + +- Rereleased 1.0.3 with updated changelog. + +v1.0.3 +====== + +Release Summary +--------------- + +- Rereleased 1.0.2 with regenerated documentation. + +v1.0.2 +====== + +Bugfixes +-------- + +- Make `src`, `backup` and `backup_options` in iosxr_config work when module alias is used (https://github.com/ansible-collections/cisco.iosxr/pull/63). +- Makes sure that docstring and argspec are in sync and removes sanity ignores (https://github.com/ansible-collections/cisco.iosxr/pull/62). +- Update docs after sanity fixes to modules. + +v1.0.1 +====== + +Minor Changes +------------- + +- Bring plugin table to correct position (https://github.com/ansible-collections/cisco.iosxr/pull/44) + +v1.0.0 +====== + +New Plugins +----------- + +Cliconf +~~~~~~~ + +- iosxr - Use iosxr cliconf to run command on Cisco IOS XR platform + +Netconf +~~~~~~~ + +- iosxr - Use iosxr netconf plugin to run netconf commands on Cisco IOSXR platform + +New Modules +----------- + +- iosxr_acl_interfaces - ACL interfaces resource module +- iosxr_acls - ACLs resource module +- iosxr_banner - Manage multiline banners on Cisco IOS XR devices +- iosxr_bgp - Configure global BGP protocol settings on Cisco IOS-XR +- iosxr_command - Run commands on remote devices running Cisco IOS XR +- iosxr_config - Manage Cisco IOS XR configuration sections +- iosxr_facts - Get facts about iosxr devices. +- iosxr_interface - (deprecated, removed after 2022-06-01) Manage Interface on Cisco IOS XR network devices +- iosxr_interfaces - Interfaces resource module +- iosxr_l2_interfaces - L2 interfaces resource module +- iosxr_l3_interfaces - L3 interfaces resource module +- iosxr_lacp - LACP resource module +- iosxr_lacp_interfaces - LACP interfaces resource module +- iosxr_lag_interfaces - LAG interfaces resource module +- iosxr_lldp_global - LLDP resource module +- iosxr_lldp_interfaces - LLDP interfaces resource module +- iosxr_logging - Configuration management of system logging services on network devices +- iosxr_netconf - Configures NetConf sub-system service on Cisco IOS-XR devices +- iosxr_ospfv2 - OSPFv2 resource module +- iosxr_static_routes - Static routes resource module +- iosxr_system - Manage the system attributes on Cisco IOS XR devices +- iosxr_user - Manage the aggregate of local users on Cisco IOS XR device diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/changelogs/changelog.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/changelogs/changelog.yaml new file mode 100644 index 00000000..399b9b6e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/changelogs/changelog.yaml @@ -0,0 +1,167 @@ +ancestor: null +releases: + 1.0.0: + modules: + - description: ACL interfaces resource module + name: iosxr_acl_interfaces + namespace: '' + - description: ACLs resource module + name: iosxr_acls + namespace: '' + - description: Manage multiline banners on Cisco IOS XR devices + name: iosxr_banner + namespace: '' + - description: Configure global BGP protocol settings on Cisco IOS-XR + name: iosxr_bgp + namespace: '' + - description: Run commands on remote devices running Cisco IOS XR + name: iosxr_command + namespace: '' + - description: Manage Cisco IOS XR configuration sections + name: iosxr_config + namespace: '' + - description: Get facts about iosxr devices. + name: iosxr_facts + namespace: '' + - description: (deprecated, removed after 2022-06-01) Manage Interface on Cisco + IOS XR network devices + name: iosxr_interface + namespace: '' + - description: Interfaces resource module + name: iosxr_interfaces + namespace: '' + - description: L2 interfaces resource module + name: iosxr_l2_interfaces + namespace: '' + - description: L3 interfaces resource module + name: iosxr_l3_interfaces + namespace: '' + - description: LACP resource module + name: iosxr_lacp + namespace: '' + - description: LACP interfaces resource module + name: iosxr_lacp_interfaces + namespace: '' + - description: LAG interfaces resource module + name: iosxr_lag_interfaces + namespace: '' + - description: LLDP resource module + name: iosxr_lldp_global + namespace: '' + - description: LLDP interfaces resource module + name: iosxr_lldp_interfaces + namespace: '' + - description: Configuration management of system logging services on network + devices + name: iosxr_logging + namespace: '' + - description: Configures NetConf sub-system service on Cisco IOS-XR devices + name: iosxr_netconf + namespace: '' + - description: OSPFv2 resource module + name: iosxr_ospfv2 + namespace: '' + - description: Static routes resource module + name: iosxr_static_routes + namespace: '' + - description: Manage the system attributes on Cisco IOS XR devices + name: iosxr_system + namespace: '' + - description: Manage the aggregate of local users on Cisco IOS XR device + name: iosxr_user + namespace: '' + plugins: + cliconf: + - description: Use iosxr cliconf to run command on Cisco IOS XR platform + name: iosxr + namespace: null + netconf: + - description: Use iosxr netconf plugin to run netconf commands on Cisco IOSXR + platform + name: iosxr + namespace: null + release_date: '2020-06-23' + 1.0.1: + changes: + minor_changes: + - Bring plugin table to correct position (https://github.com/ansible-collections/cisco.iosxr/pull/44) + fragments: + - 44-plugin-doc-fixes.yaml + release_date: '2020-06-23' + 1.0.2: + changes: + bugfixes: + - Make `src`, `backup` and `backup_options` in iosxr_config work when module + alias is used (https://github.com/ansible-collections/cisco.iosxr/pull/63). + - Makes sure that docstring and argspec are in sync and removes sanity ignores + (https://github.com/ansible-collections/cisco.iosxr/pull/62). + - Update docs after sanity fixes to modules. + fragments: + - handle_src_backup_with_module_alias.yaml + - remove_ignores_for_sanity.yaml + - update_docs.yaml + release_date: '2020-06-23' + 1.0.3: + changes: + release_summary: + - Rereleased 1.0.2 with regenerated documentation. + fragments: + - 1.0.3.yaml + release_date: '2020-07-31' + 1.0.4: + changes: + release_summary: + - Rereleased 1.0.3 with updated changelog. + fragments: + - 1.0.4.yaml + release_date: '2020-08-07' + 1.0.5: + changes: + bugfixes: + - Confirmed commit fails with TypeError in IOS XR netconf plugin (https://github.com/ansible-collections/cisco.iosxr/issues/74) + - running config data for interface split when substring interface starts with + newline + fragments: + - 64-incorrect-interface-decription-parsing-fix.yaml + - iosxr_netconf_config_commit_fix.yaml + release_date: '2020-08-28' + 1.1.0: + changes: + minor_changes: + - Added iosxr ospfv3 resource module (https://github.com/ansible-collections/cisco.iosxr/pull/81). + - Platform supported coments token to be provided when invoking the object. + fragments: + - 54_iosxr_ospfv3_module_added.yaml + - provide_fuctionality_to_utilize_remarks.yaml + modules: + - description: ospfv3 resource module + name: iosxr_ospfv3 + namespace: '' + release_date: '2020-10-01' + 1.2.0: + changes: + bugfixes: + - Add version key to galaxy.yaml to work around ansible-galaxy bug + - Fix iosxr_acls throwing a traceback with overridden (https://github.com/ansible-collections/cisco.iosxr/issues/87). + - require one to specify a banner delimiter in order to fix a timeout when using + multi-line strings + minor_changes: + - Added iosxr ospf_interfaces resource module (https://github.com/ansible-collections/cisco.iosxr/pull/84). + fragments: + - 79-iosxr-multi-line-banner-fix.yaml + - fix_iosxr_acls.yaml + - galaxy-version.yaml + - ospf_interfaces_resource_module_added.yaml + modules: + - description: OSPF Interfaces Resource Module. + name: iosxr_ospf_interfaces + namespace: '' + release_date: '2020-11-26' + 1.2.1: + changes: + bugfixes: + - Update docs to clarify the idemptonecy releated caveat and add it in the output + warnings (https://github.com/ansible-collections/ansible.netcommon/pull/189) + fragments: + - iosxr_config_diff_doc_update.yaml + release_date: '2021-01-28' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/changelogs/config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/changelogs/config.yaml new file mode 100644 index 00000000..b5f824ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/changelogs/config.yaml @@ -0,0 +1,30 @@ +changelog_filename_template: CHANGELOG.rst +changelog_filename_version_depth: 0 +changes_file: changelog.yaml +changes_format: combined +keep_fragments: false +mention_ancestor: true +new_plugins_after_name: removed_features +notesdir: fragments +prelude_section_name: release_summary +prelude_section_title: Release Summary +flatmap: true +sections: +- - major_changes + - Major Changes +- - minor_changes + - Minor Changes +- - breaking_changes + - Breaking Changes / Porting Guide +- - deprecated_features + - Deprecated Features +- - removed_features + - Removed Features (previously deprecated) +- - security_fixes + - Security Fixes +- - bugfixes + - Bugfixes +- - known_issues + - Known Issues +title: Cisco Iosxr Collection +trivial_section_name: trivial diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_acl_interfaces_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_acl_interfaces_module.rst new file mode 100644 index 00000000..7097b018 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_acl_interfaces_module.rst @@ -0,0 +1,774 @@ +.. _cisco.iosxr.iosxr_acl_interfaces_module: + + +******************************** +cisco.iosxr.iosxr_acl_interfaces +******************************** + +**ACL interfaces resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages adding and removing Access Control Lists (ACLs) from interfaces on devices running IOS-XR software. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A dictionary of ACL options for interfaces.
+
+
+ access_groups + +
+ list + / elements=dictionary +
+
+ +
Specifies ACLs attached to the interfaces.
+
+
+ acls + +
+ list + / elements=dictionary +
+
+ +
Specifies the ACLs for the provided AFI.
+
+
+ direction + +
+ string + / required +
+
+
    Choices: +
  • in
  • +
  • out
  • +
+
+
Specifies the direction of packets that the ACL will be applied on.
+
+
+ name + +
+ string + / required +
+
+ +
Specifies the name of the IPv4/IPv6 ACL for the interface.
+
+
+ afi + +
+ string + / required +
+
+
    Choices: +
  • ipv4
  • +
  • ipv6
  • +
+
+
Specifies the AFI for the ACL(s) to be configured on this interface.
+
+
+ name + +
+ string + / required +
+
+ +
Name/Identifier for the interface
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the IOS-XR device by executing the command show running-config interface.
+
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • merged ←
  • +
  • replaced
  • +
  • overridden
  • +
  • deleted
  • +
  • gathered
  • +
  • parsed
  • +
  • rendered
  • +
+
+
The state the configuration should be left in.
+
+
+ + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + + # Before state: + # ------------- + # + # RP/0/RP0/CPU0:ios#sh running-config interface + # Wed Jan 15 12:22:32.911 UTC + # interface MgmtEth0/RP0/CPU0/0 + # ipv4 address dhcp + # ! + # interface GigabitEthernet0/0/0/0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + + - name: Merge the provided configuration with the existing running configuration + cisco.iosxr.iosxr_acl_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + access_groups: + - afi: ipv4 + acls: + - name: acl_1 + direction: in + - name: acl_2 + direction: out + - afi: ipv6 + acls: + - name: acl6_1 + direction: in + - name: acl6_2 + direction: out + + - name: GigabitEthernet0/0/0/1 + access_groups: + - afi: ipv4 + acls: + - name: acl_1 + direction: out + state: merged + + # After state: + # ------------- + # + # RP/0/RP0/CPU0:ios#sh running-config interface + # Wed Jan 15 12:27:49.378 UTC + # interface MgmtEth0/RP0/CPU0/0 + # ipv4 address dhcp + # ! + # interface GigabitEthernet0/0/0/0 + # shutdown + # ipv4 access-group acl_1 ingress + # ipv4 access-group acl_2 egress + # ipv6 access-group acl6_1 ingress + # ipv6 access-group acl6_2 egress + # ! + # interface GigabitEthernet0/0/0/1 + # shutdown + # ipv4 access-group acl_1 egress + # ! + + # Using merged to update interface ACL configuration + + # Before state: + # ------------- + # + # RP/0/RP0/CPU0:ios#sh running-config interface + # Wed Jan 15 12:27:49.378 UTC + # interface MgmtEth0/RP0/CPU0/0 + # ipv4 address dhcp + # ! + # interface GigabitEthernet0/0/0/0 + # shutdown + # ipv4 access-group acl_1 ingress + # ipv4 access-group acl_2 egress + # ipv6 access-group acl6_1 ingress + # ipv6 access-group acl6_2 egress + # ! + # interface GigabitEthernet0/0/0/1 + # shutdown + # ipv4 access-group acl_1 egress + # ! + # + + - name: Update acl_interfaces configuration using merged + cisco.iosxr.iosxr_acl_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + access_groups: + - afi: ipv4 + acls: + - name: acl_2 + direction: out + - name: acl_1 + direction: in + state: merged + + # After state: + # ------------- + # + # RP/0/RP0/CPU0:ios#sh running-config interface + # Wed Jan 15 12:27:49.378 UTC + # interface MgmtEth0/RP0/CPU0/0 + # ipv4 address dhcp + # ! + # interface GigabitEthernet0/0/0/0 + # shutdown + # ipv4 access-group acl_1 ingress + # ipv4 access-group acl_2 egress + # ipv6 access-group acl6_1 ingress + # ipv6 access-group acl6_2 egress + # ! + # interface GigabitEthernet0/0/0/1 + # shutdown + # ipv4 access-group acl_1 ingress + # ipv4 access-group acl_2 egress + # ! + # + + # Using replaced + + # Before state: + # ------------- + # + # RP/0/RP0/CPU0:ios#sh running-config interface + # Wed Jan 15 12:34:56.689 UTC + # interface MgmtEth0/RP0/CPU0/0 + # ipv4 address dhcp + # ! + # interface GigabitEthernet0/0/0/0 + # shutdown + # ipv4 access-group acl_1 ingress + # ipv4 access-group acl_2 egress + # ipv6 access-group acl6_1 ingress + # ipv6 access-group acl6_2 egress + # ! + # interface GigabitEthernet0/0/0/1 + # shutdown + # ipv4 access-group acl_1 egress + # ! + + - name: Replace device configurations of listed interface with provided configurations + cisco.iosxr.iosxr_acl_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + access_groups: + - afi: ipv6 + acls: + - name: acl6_3 + direction: in + state: replaced + + # After state: + # ------------- + # + # RP/0/RP0/CPU0:ios#sh running-config interface + # Wed Jan 15 12:34:56.689 UTC + # interface MgmtEth0/RP0/CPU0/0 + # ipv4 address dhcp + # ! + # interface GigabitEthernet0/0/0/0 + # shutdown + # ipv6 access-group acl6_3 ingress + # ! + # interface GigabitEthernet0/0/0/1 + # shutdown + # ipv4 access-group acl_1 egress + # ! + # + + # Using overridden + + # Before state: + # ------------- + # + # RP/0/RP0/CPU0:ios#sh running-config interface + # Wed Jan 15 12:34:56.689 UTC + # interface MgmtEth0/RP0/CPU0/0 + # ipv4 address dhcp + # ! + # interface GigabitEthernet0/0/0/0 + # shutdown + # ipv4 access-group acl_1 ingress + # ipv4 access-group acl_2 egress + # ipv6 access-group acl6_1 ingress + # ipv6 access-group acl6_2 egress + # ! + # interface GigabitEthernet0/0/0/1 + # shutdown + # ipv4 access-group acl_1 egress + # ! + # + + - name: Overridde all interface ACL configuration with provided configuration + cisco.iosxr.iosxr_acl_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + access_groups: + - afi: ipv4 + acls: + - name: acl_2 + direction: in + - afi: ipv6 + acls: + - name: acl6_3 + direction: out + state: overridden + + # After state: + # ------------- + # + # RP/0/RP0/CPU0:ios#sh running-config interface + # Wed Jan 15 12:34:56.689 UTC + # interface MgmtEth0/RP0/CPU0/0 + # ipv4 address dhcp + # ! + # interface GigabitEthernet0/0/0/0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/1 + # shutdown + # ipv4 access-group acl_2 ingress + # ipv6 access-group acl6_3 egress + # ! + # + + # Using 'deleted' to delete all ACL attributes of a single interface + + # Before state: + # ------------- + # + # RP/0/RP0/CPU0:ios#sh running-config interface + # Wed Jan 15 12:34:56.689 UTC + # interface MgmtEth0/RP0/CPU0/0 + # ipv4 address dhcp + # ! + # interface GigabitEthernet0/0/0/0 + # shutdown + # ipv4 access-group acl_1 ingress + # ipv4 access-group acl_2 egress + # ipv6 access-group acl6_1 ingress + # ipv6 access-group acl6_2 egress + # ! + # interface GigabitEthernet0/0/0/1 + # shutdown + # ipv4 access-group acl_1 egress + # ! + # + + - name: Delete all ACL attributes of GigabitEthernet0/0/0/1 + cisco.iosxr.iosxr_acl_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + state: deleted + + # After state: + # ------------- + # + # RP/0/RP0/CPU0:ios#sh running-config interface + # Wed Jan 15 12:34:56.689 UTC + # interface MgmtEth0/RP0/CPU0/0 + # ipv4 address dhcp + # ! + # interface GigabitEthernet0/0/0/0 + # shutdown + # ipv4 access-group acl_1 ingress + # ipv4 access-group acl_2 egress + # ipv6 access-group acl6_1 ingress + # ipv6 access-group acl6_2 egress + # ! + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + # + + # Using 'deleted' to remove all ACLs attached to all the interfaces in the device + + # Before state: + # ------------- + # + # RP/0/RP0/CPU0:ios#sh running-config interface + # Wed Jan 15 12:34:56.689 UTC + # interface MgmtEth0/RP0/CPU0/0 + # ipv4 address dhcp + # ! + # interface GigabitEthernet0/0/0/0 + # shutdown + # ipv4 access-group acl_1 ingress + # ipv4 access-group acl_2 egress + # ipv6 access-group acl6_1 ingress + # ipv6 access-group acl6_2 egress + # ! + # interface GigabitEthernet0/0/0/1 + # shutdown + # ipv4 access-group acl_1 egress + # ! + # + + - name: Delete all ACL interfaces configuration from the device + cisco.iosxr.iosxr_acl_interfaces: + state: deleted + + # After state: + # ------------- + # + # RP/0/RP0/CPU0:ios#sh running-config interface + # Wed Jan 15 12:34:56.689 UTC + # interface MgmtEth0/RP0/CPU0/0 + # ipv4 address dhcp + # ! + # interface GigabitEthernet0/0/0/0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + # + + # Using parsed + + # parsed.cfg + # ------------ + # + # interface MgmtEth0/RP0/CPU0/0 + # ipv4 address dhcp + # ! + # interface GigabitEthernet0/0/0/0 + # shutdown + # ipv4 access-group acl_1 ingress + # ipv4 access-group acl_2 egress + # ipv6 access-group acl6_1 ingress + # ipv6 access-group acl6_2 egress + # ! + # interface GigabitEthernet0/0/0/1 + # shutdown + # ipv4 access-group acl_1 egress + # ! + + # - name: Convert ACL interfaces config to argspec without connecting to the appliance + # cisco.iosxr.iosxr_acl_interfaces: + # running_config: "{{ lookup('file', './parsed.cfg') }}" + # state: parsed + + + # Task Output (redacted) + # ----------------------- + + # "parsed": [ + # { + # "name": "MgmtEth0/RP0/CPU0/0" + # }, + # { + # "access_groups": [ + # { + # "acls": [ + # { + # "direction": "in", + # "name": "acl_1" + # }, + # { + # "direction": "out", + # "name": "acl_2" + # } + # ], + # "afi": "ipv4" + # }, + # { + # "acls": [ + # { + # "direction": "in", + # "name": "acl6_1" + # }, + # { + # "direction": "out", + # "name": "acl6_2" + # } + # ], + # "afi": "ipv6" + # } + # ], + # "name": "GigabitEthernet0/0/0/0" + # }, + # { + # "access_groups": [ + # { + # "acls": [ + # { + # "direction": "out", + # "name": "acl_1" + # } + # ], + # "afi": "ipv4" + # } + # ], + # "name": "GigabitEthernet0/0/0/1" + # } + # ] + # } + + + # Using gathered + + - name: Gather ACL interfaces facts using gathered state + cisco.iosxr.iosxr_acl_interfaces: + state: gathered + + + # Task Output (redacted) + # ----------------------- + # + # "gathered": [ + # { + # "name": "MgmtEth0/RP0/CPU0/0" + # }, + # { + # "access_groups": [ + # { + # "acls": [ + # { + # "direction": "in", + # "name": "acl_1" + # }, + # { + # "direction": "out", + # "name": "acl_2" + # } + # ], + # "afi": "ipv4" + # } + # "name": "GigabitEthernet0/0/0/0" + # }, + # { + # "access_groups": [ + # { + # "acls": [ + # { + # "direction": "in", + # "name": "acl6_1" + # } + # ], + # "afi": "ipv6" + # } + # "name": "GigabitEthernet0/0/0/1" + # } + # ] + + + # Using rendered + + - name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_acl_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + access_groups: + - afi: ipv4 + acls: + - name: acl_1 + direction: in + - name: acl_2 + direction: out + state: rendered + + # Task Output (redacted) + # ----------------------- + + # "rendered": [ + # "interface GigabitEthernet0/0/0/0", + # "ipv4 access-group acl_1 ingress", + # "ipv4 access-group acl_2 egress" + # ] + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ after + +
+ list +
+
when changed +
The resulting configuration model invocation.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ before + +
+ list +
+
always +
The configuration prior to the model invocation.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ commands + +
+ list +
+
always +
The set of commands pushed to the remote device.
+
+
Sample:
+
['interface GigabitEthernet0/0/0/1', 'ipv4 access-group acl_1 ingress', 'ipv4 access-group acl_2 egress', 'ipv6 access-group acl6_1 ingress', 'interface GigabitEthernet0/0/0/2', 'no ipv4 access-group acl_3 ingress', 'ipv4 access-group acl_4 egress']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Nilashish Chakraborty (@NilashishC) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_acls_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_acls_module.rst new file mode 100644 index 00000000..a03f2a21 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_acls_module.rst @@ -0,0 +1,4731 @@ +.. _cisco.iosxr.iosxr_acls_module: + + +********************** +cisco.iosxr.iosxr_acls +********************** + +**ACLs resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages Access Control Lists (ACLs) on devices running IOS-XR. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A list of dictionaries specifying ACL configurations.
+
+
+ acls + +
+ list + / elements=dictionary +
+
+ +
A list of Access Control Lists (ACLs).
+
+
+ aces + +
+ list + / elements=dictionary +
+
+ +
List of Access Control Entries (ACEs) for this Access Control List (ACL).
+
+
+ authen + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match if authentication header is present.
+
+
+ capture + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Capture matched packet.
+
+
+ destination + +
+ dictionary +
+
+ +
Specifies the packet destination.
+
+
+ address + +
+ string +
+
+ +
The destination IP address to match.
+
+
+ any + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match any destination address.
+
+
+ host + +
+ string +
+
+ +
The host IP address to match.
+
+
+ port_protocol + +
+ dictionary +
+
+ +
Specify the source port or protocol.
+
+
+ eq + +
+ string +
+
+ +
Match only packets on a given port number.
+
+
+ gt + +
+ string +
+
+ +
Match only packets with a greater port number.
+
+
+ lt + +
+ string +
+
+ +
Match only packets with a lower port number.
+
+
+ neq + +
+ string +
+
+ +
Match only packets not on a given port number.
+
+
+ range + +
+ dictionary +
+
+ +
Match only packets in the range of port numbers
+
+
+ end + +
+ string +
+
+ +
Specify the end of the port range
+
+
+ start + +
+ string +
+
+ +
Specify the start of the port range
+
+
+ prefix + +
+ string +
+
+ +
Destination network prefix.
+
+
+ wildcard_bits + +
+ string +
+
+ +
The Wildcard bits to apply to destination address.
+
+
+ destopts + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match if destination opts header is present.
+
+
+ dscp + +
+ dictionary +
+
+ +
Match packets with given DSCP value.
+
+
+ eq + +
+ string +
+
+ +
Match only packets on a given dscp value
+
+
+ gt + +
+ string +
+
+ +
Match only packets with a greater dscp value
+
+
+ lt + +
+ string +
+
+ +
Match only packets with a lower dscp value
+
+
+ neq + +
+ string +
+
+ +
Match only packets not on a given dscp value
+
+
+ range + +
+ dictionary +
+
+ +
Match only packets in the range of dscp values
+
+
+ end + +
+ string +
+
+ +
End of the dscp range
+
+
+ start + +
+ string +
+
+ +
Start of the dscp range
+
+
+ fragments + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Check non-intial fragments.
+
+
+ grant + +
+ string +
+
+
    Choices: +
  • permit
  • +
  • deny
  • +
+
+
Forward or drop packets matching the Access Control Entry (ACE).
+
+
+ hop_by_hop + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match if hop-by-hop opts header is present.
+
+
+ icmp_off + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/disable the ICMP message for this entry.
+
+
+ line + +
+ string +
+
+ +
An ACE excluding the sequence number.
+
This key is mutually exclusive with all the other attributes except 'sequence'.
+
When used with other attributes, the value of this key will get precedence and the other keys will be ignored.
+
This should only be used when an attribute doesn't exist in the argspec but is valid for the device.
+
For fact gathering, any ACE that is not fully parsed, will show up as a value of this attribute, excluding the sequence number, which will be populated as value of the sequence key.
+

aliases: ace
+
+
+ log + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/disable log matches against this entry.
+
+
+ log_input + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/disable log matches against this entry, including input interface.
+
+
+ packet_length + +
+ dictionary +
+
+ +
Match packets given packet length.
+
+
+ eq + +
+ integer +
+
+ +
Match only packets on a given packet length
+
+
+ gt + +
+ integer +
+
+ +
Match only packets with a greater packet length
+
+
+ lt + +
+ integer +
+
+ +
Match only packets with a lower packet length
+
+
+ neq + +
+ integer +
+
+ +
Match only packets not on a given packet length
+
+
+ range + +
+ dictionary +
+
+ +
Match only packets in the range of packet lengths
+
+
+ end + +
+ integer +
+
+ +
End of the packet length range
+
+
+ start + +
+ integer +
+
+ +
Start of the packet length range
+
+
+ precedence + +
+ string +
+
+ +
Match packets with given precedence value
+
+
+ protocol + +
+ string +
+
+ +
Specify the protocol to match.
+
Refer to vendor documentation for valid values.
+
+
+ protocol_options + +
+ dictionary +
+
+ +
Additional suboptions for the protocol.
+
+
+ icmp + +
+ dictionary +
+
+ +
Internet Control Message Protocol settings.
+
+
+ administratively_prohibited + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Administratively prohibited
+
+
+ alternate_address + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Alternate address
+
+
+ conversion_error + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Datagram conversion
+
+
+ dod_host_prohibited + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Host prohibited
+
+
+ dod_net_prohibited + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Net prohibited
+
+
+ echo + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Echo (ping)
+
+
+ echo_reply + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Echo reply
+
+
+ general_parameter_problem + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Parameter problem
+
+
+ host_isolated + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Host isolated
+
+
+ host_precedence_unreachable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Host unreachable for precedence
+
+
+ host_redirect + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Host redirect
+
+
+ host_tos_redirect + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Host redirect for TOS
+
+
+ host_tos_unreachable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Host unreachable for TOS
+
+
+ host_unknown + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Host unknown
+
+
+ host_unreachable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Host unreachable
+
+
+ information_reply + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Information replies
+
+
+ information_request + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Information requests
+
+
+ mask_reply + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Mask replies
+
+
+ mask_request + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Mask requests
+
+
+ mobile_redirect + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Mobile host redirect
+
+
+ net_redirect + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Network redirect
+
+
+ net_tos_redirect + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Net redirect for TOS
+
+
+ net_tos_unreachable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Network unreachable for TOS
+
+
+ net_unreachable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Net unreachable
+
+
+ network_unknown + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Network unknown
+
+
+ no_room_for_option + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Parameter required but no room
+
+
+ option_missing + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Parameter required but not present
+
+
+ packet_too_big + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Fragmentation needed and DF set
+
+
+ parameter_problem + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
All parameter problems
+
+
+ port_unreachable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Port unreachable
+
+
+ precedence_unreachable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Precedence cutoff
+
+
+ protocol_unreachable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Protocol unreachable
+
+
+ reassembly_timeout + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Reassembly timeout
+
+
+ redirect + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
All redirects
+
+
+ router_advertisement + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Router discovery advertisements
+
+
+ router_solicitation + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Router discovery solicitations
+
+
+ source_quench + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Source quenches
+
+
+ source_route_failed + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Source route failed
+
+
+ time_exceeded + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
All time exceededs
+
+
+ timestamp_reply + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Timestamp replies
+
+
+ timestamp_request + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Timestamp requests
+
+
+ traceroute + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Traceroute
+
+
+ ttl_exceeded + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
TTL exceeded
+
+
+ unreachable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
All unreachables
+
+
+ icmpv6 + +
+ dictionary +
+
+ +
Internet Control Message Protocol settings for IPv6.
+
+
+ address_unreachable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Address Unreachable
+
+
+ administratively_prohibited + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Administratively Prohibited
+
+
+ beyond_scope_of_source_address + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Administratively Prohibited
+
+
+ destination_unreachable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Destination Unreachable
+
+
+ echo + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Echo
+
+
+ echo_reply + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Echo Reply
+
+
+ erroneous_header_field + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Erroneous Header Field
+
+
+ group_membership_query + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Group Membership Query
+
+
+ group_membership_report + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Group Membership Report
+
+
+ group_membership_termination + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Group Membership Termination
+
+
+ host_unreachable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Host Unreachable
+
+
+ nd_na + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Neighbor Discovery - Neighbor Advertisement
+
+
+ nd_ns + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Neighbor Discovery - Neighbor Solicitation
+
+
+ neighbor_redirect + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Neighbor Redirect
+
+
+ no_route_to_destination + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
No Route To Destination
+
+
+ node_information_request_is_refused + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Node Information Request Is Refused
+
+
+ node_information_successful_reply + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Node Information Successful Reply
+
+
+ packet_too_big + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Packet Too Big
+
+
+ parameter_problem + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Parameter Problem
+
+
+ port_unreachable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Port Unreachable
+
+
+ query_subject_is_domainname + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Query Subject Is Domain name
+
+
+ query_subject_is_IPv4address + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Query Subject Is IPv4 address
+
+
+ query_subject_is_IPv6address + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Query Subject Is IPv6 address
+
+
+ reassembly_timeout + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Reassembly Timeout
+
+
+ redirect + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Redirect
+
+
+ router_advertisement + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Router Advertisement
+
+
+ router_renumbering + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Router Renumbering
+
+
+ router_solicitation + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Router Solicitation
+
+
+ rr_command + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
RR Command
+
+
+ rr_result + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
RR Result
+
+
+ rr_seqnum_reset + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
RR Seqnum Reset
+
+
+ time_exceeded + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Time Exceeded
+
+
+ ttl_exceeded + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
TTL Exceeded
+
+
+ unknown_query_type + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Unknown Query Type
+
+
+ unreachable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Unreachable
+
+
+ unrecognized_next_header + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Unrecognized Next Header
+
+
+ unrecognized_option + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Unrecognized Option
+
+
+ whoareyou_reply + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Whoareyou Reply
+
+
+ whoareyou_request + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Whoareyou Request
+
+
+ igmp + +
+ dictionary +
+
+ +
Internet Group Management Protocol (IGMP) settings.
+
+
+ dvmrp + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match Distance Vector Multicast Routing Protocol
+
+
+ host_query + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match Host Query
+
+
+ host_report + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match Host Report
+
+
+ mtrace + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match mtrace
+
+
+ mtrace_response + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match mtrace response
+
+
+ pim + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match Protocol Independent Multicast
+
+
+ trace + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Multicast trace
+
+
+ tcp + +
+ dictionary +
+
+ +
Match TCP packet flags
+
+
+ ack + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match on the ACK bit
+
+
+ established + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match established connections
+
+
+ fin + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match on the FIN bit
+
+
+ psh + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match on the PSH bit
+
+
+ rst + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match on the RST bit
+
+
+ syn + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match on the SYN bit
+
+
+ urg + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match on the URG bit
+
+
+ remark + +
+ string +
+
+ +
Comments or a description for the access list.
+
+
+ routing + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match if routing header is present.
+
+
+ sequence + +
+ integer +
+
+ +
Sequence number for the Access Control Entry (ACE).
+
+
+ source + +
+ dictionary +
+
+ +
Specifies the packet source.
+
+
+ address + +
+ string +
+
+ +
The source IP address to match.
+
+
+ any + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Match any source address.
+
+
+ host + +
+ string +
+
+ +
The host IP address to match.
+
+
+ port_protocol + +
+ dictionary +
+
+ +
Specify the source port or protocol.
+
+
+ eq + +
+ string +
+
+ +
Match only packets on a given port number.
+
+
+ gt + +
+ string +
+
+ +
Match only packets with a greater port number.
+
+
+ lt + +
+ string +
+
+ +
Match only packets with a lower port number.
+
+
+ neq + +
+ string +
+
+ +
Match only packets not on a given port number.
+
+
+ range + +
+ dictionary +
+
+ +
Match only packets in the range of port numbers
+
+
+ end + +
+ string +
+
+ +
Specify the end of the port range
+
+
+ start + +
+ string +
+
+ +
Specify the start of the port range
+
+
+ prefix + +
+ string +
+
+ +
Source network prefix.
+
+
+ wildcard_bits + +
+ string +
+
+ +
The Wildcard bits to apply to source address.
+
+
+ ttl + +
+ dictionary +
+
+ +
Match against specified TTL value.
+
+
+ eq + +
+ integer +
+
+ +
Match only packets with exact TTL value.
+
+
+ gt + +
+ integer +
+
+ +
Match only packets with a greater TTL value.
+
+
+ lt + +
+ integer +
+
+ +
Match only packets with a lower TTL value.
+
+
+ neq + +
+ integer +
+
+ +
Match only packets that won't have the given TTL value.
+
+
+ range + +
+ dictionary +
+
+ +
Match only packets in the range of given TTL values.
+
+
+ end + +
+ integer +
+
+ +
End of the TTL range.
+
+
+ start + +
+ integer +
+
+ +
Start of the TTL range.
+
+
+ name + +
+ string +
+
+ +
The name of the Access Control List (ACL).
+
+
+ afi + +
+ string + / required +
+
+
    Choices: +
  • ipv4
  • +
  • ipv6
  • +
+
+
The Address Family Indicator (AFI) for the Access Control Lists (ACL).
+
+
+ running_config + +
+ string +
+
+ +
The module, by default, will connect to the remote device and retrieve the current running-config to use as a base for comparing against the contents of source. There are times when it is not desirable to have the task get the current running-config for every task in a playbook. The running_config argument allows the implementer to pass in the configuration to use as the base config for comparison. This value of this option should be the output received from device by executing command show running-config router static.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • merged ←
  • +
  • replaced
  • +
  • overridden
  • +
  • deleted
  • +
  • gathered
  • +
  • rendered
  • +
  • parsed
  • +
+
+
The state the configuration should be left in.
+
+
+ + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged to add new ACLs + + # Before state: + # ------------- + + # RP/0/RP0/CPU0:ios#sh access-lists afi-all + # Thu Feb 20 05:07:45.767 UTC + # RP/0/RP0/CPU0:ios# + + - name: Merge the provided configuration with the exisiting running configuration + cisco.iosxr.iosxr_acls: + config: + - afi: ipv6 + acls: + - name: acl6_1 + aces: + - sequence: 10 + grant: deny + protocol: tcp + source: + prefix: 2001:db8:1234::/48 + port_protocol: + range: + start: ftp + end: telnet + destination: + any: true + protocol_options: + tcp: + syn: true + ttl: + range: + start: 180 + end: 250 + routing: true + authen: true + log: true + + - sequence: 20 + grant: permit + protocol: icmpv6 + source: + any: true + destination: + any: true + protocol_options: + icmpv6: + router_advertisement: true + precedence: network + destopts: true + + - afi: ipv4 + acls: + - name: acl_1 + aces: + - sequence: 16 + remark: TEST_ACL_1_REMARK + + - sequence: 21 + grant: permit + protocol: tcp + source: + host: 192.0.2.10 + port_protocol: + range: + start: pop3 + end: 121 + destination: + address: 198.51.100.0 + wildcard_bits: 0.0.0.15 + protocol_options: + tcp: + rst: true + + - sequence: 23 + grant: deny + protocol: icmp + source: + any: true + destination: + prefix: 198.51.100.0/28 + protocol_options: + icmp: + reassembly_timeout: true + dscp: + lt: af12 + + - name: acl_2 + aces: + - sequence: 10 + remark: TEST_ACL_2_REMARK + state: merged + + # After state: + # ------------- + + # RP/0/RP0/CPU0:ios#sh access-lists afi-all + # Thu Feb 20 05:22:57.021 UTC + # ipv4 access-list acl_1 + # 16 remark TEST_ACL_1_REMARK + # 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst + # 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 + # ipv4 access-list acl_2 + # 10 remark TEST_ACL_2_REMARK + # ipv6 access-list acl6_1 + # 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log + # 20 permit icmpv6 any any router-advertisement precedence network destopts + + # Using merged to update existing ACLs + + # Before state: + # ------------- + + # RP/0/RP0/CPU0:ios#sh access-lists afi-all + # Thu Feb 20 05:22:57.021 UTC + # ipv4 access-list acl_1 + # 16 remark TEST_ACL_1_REMARK + # 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst + # 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 + # ipv4 access-list acl_2 + # 10 remark TEST_ACL_2_REMARK + # ipv6 access-list acl6_1 + # 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log + # 20 permit icmpv6 any any router-advertisement precedence network destopts + + - name: Update existing ACEs + cisco.iosxr.iosxr_acls: + config: + - afi: ipv4 + acls: + - name: acl_1 + aces: + - sequence: 21 + source: + prefix: 198.51.100.32/28 + port_protocol: + range: + start: pop3 + end: 121 + protocol_options: + tcp: + syn: true + + - sequence: 23 + protocol_options: + icmp: + router_advertisement: true + dscp: + eq: af23 + + # After state: + # ------------- + + # RP/0/RP0/CPU0:ios#sh access-lists afi-all + # Thu Feb 20 05:47:18.711 UTC + # ipv4 access-list acl_1 + # 16 remark TEST_ACL_1_REMARK + # 21 permit tcp 198.51.100.32 0.0.0.15 range pop3 121 198.51.100.0 0.0.0.15 syn + # 23 deny icmp any 198.51.100.0 0.0.0.15 router-advertisement dscp eq af23 + # ipv4 access-list acl_2 + # 10 remark TEST_ACL_2_REMARK + # ipv6 access-list acl6_1 + # 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log + # 20 permit icmpv6 any any router-advertisement precedence network destopts + + # Using replaced to replace a whole ACL + + # Before state: + # ------------- + + # RP/0/RP0/CPU0:ios#sh access-lists afi-all + # Thu Feb 20 05:22:57.021 UTC + # ipv4 access-list acl_1 + # 16 remark TEST_ACL_1_REMARK + # 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst + # 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 + # ipv4 access-list acl_2 + # 10 remark TEST_ACL_2_REMARK + # ipv6 access-list acl6_1 + # 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log + # 20 permit icmpv6 any any router-advertisement precedence network destopts + + - name: Replace device configurations of listed ACL with provided configurations + cisco.iosxr.iosxr_acls: + config: + - afi: ipv4 + acls: + - name: acl_2 + aces: + - sequence: 11 + grant: permit + protocol: igmp + source: + host: 198.51.100.130 + destination: + any: true + ttl: + eq: 100 + + - sequence: 12 + grant: deny + source: + any: true + destination: + any: true + protocol: icmp + state: replaced + + # After state: + # ------------- + + # RP/0/RP0/CPU0:ios#sh access-lists afi-all + # Thu Feb 20 06:19:51.496 UTC + # ipv4 access-list acl_1 + # 16 remark TEST_ACL_1_REMARK + # 21 permit tcp 198.51.100.32 0.0.0.15 range pop3 121 198.51.100.0 0.0.0.15 syn + # 23 deny icmp any 198.51.100.0 0.0.0.15 router-advertisement dscp eq af23 + # ipv4 access-list acl_2 + # 11 permit igmp host 198.51.100.130 any ttl eq 100 + # 12 deny icmp any any + # ipv6 access-list acl6_1 + # 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log + # 20 permit icmpv6 any any router-advertisement precedence network destopts + + # Using overridden to override all ACLs in the device + + # Before state: + # ------------- + + # RP/0/RP0/CPU0:ios#sh access-lists afi-all + # Thu Feb 20 05:22:57.021 UTC + # ipv4 access-list acl_1 + # 16 remark TEST_ACL_1_REMARK + # 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst + # 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 + # ipv4 access-list acl_2 + # 10 remark TEST_ACL_2_REMARK + # ipv6 access-list acl6_1 + # 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log + # 20 permit icmpv6 any any router-advertisement precedence network destopts + + - name: Overridde all ACLs configuration with provided configuration + cisco.iosxr.iosxr_acls: + config: + - afi: ipv4 + acls: + - name: acl_1 + aces: + - sequence: 10 + grant: permit + source: + any: true + destination: + any: true + protocol: tcp + + - name: acl_2 + aces: + - sequence: 20 + grant: permit + source: + any: true + destination: + any: true + protocol: igmp + state: overridden + + # After state: + # ------------- + + # RP/0/RP0/CPU0:ios#sh access-lists afi-all + # Thu Feb 20 06:31:22.178 UTC + # ipv4 access-list acl_1 + # 10 permit tcp any any + # ipv4 access-list acl_2 + # 20 permit igmp any any + + # Using deleted to delete an entire ACL + + # Before state: + # ------------- + + # RP/0/RP0/CPU0:ios#sh access-lists afi-all + # Thu Feb 20 05:22:57.021 UTC + # ipv4 access-list acl_1 + # 16 remark TEST_ACL_1_REMARK + # 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst + # 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 + # ipv4 access-list acl_2 + # 10 remark TEST_ACL_2_REMARK + # ipv6 access-list acl6_1 + # 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log + # 20 permit icmpv6 any any router-advertisement precedence network destopts + + - name: Delete a single ACL + cisco.iosxr.iosxr_acls: + config: + - afi: ipv6 + acls: + - name: acl6_1 + state: deleted + + # After state: + # ------------- + + # RP/0/RP0/CPU0:ios#sh access-lists afi-all + # Thu Feb 20 05:22:57.021 UTC + # ipv4 access-list acl_1 + # 16 remark TEST_ACL_1_REMARK + # 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst + # 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 + # ipv4 access-list acl_2 + # 10 remark TEST_ACL_2_REMARK + + # Using deleted to delete all ACLs under one AFI + + # Before state: + # ------------- + + # RP/0/RP0/CPU0:ios#sh access-lists afi-all + # Thu Feb 20 05:22:57.021 UTC + # ipv4 access-list acl_1 + # 16 remark TEST_ACL_1_REMARK + # 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst + # 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 + # ipv4 access-list acl_2 + # 10 remark TEST_ACL_2_REMARK + # ipv6 access-list acl6_1 + # 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log + # 20 permit icmpv6 any any router-advertisement precedence network destopts + + - name: Delete all ACLs under one AFI + cisco.iosxr.iosxr_acls: + config: + - afi: ipv4 + state: deleted + + # After state: + # ------------- + + # RP/0/RP0/CPU0:ios#sh access-lists afi-all + # Thu Feb 20 05:22:57.021 UTC + # ipv6 access-list acl6_1 + # 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log + # 20 permit icmpv6 any any router-advertisement precedence network destopts + + # Using deleted to delete all ACLs from the device + + # Before state: + # ------------- + + # RP/0/RP0/CPU0:ios#sh access-lists afi-all + # Thu Feb 20 05:22:57.021 UTC + # ipv4 access-list acl_1 + # 16 remark TEST_ACL_1_REMARK + # 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst + # 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 + # ipv4 access-list acl_2 + # 10 remark TEST_ACL_2_REMARK + # ipv6 access-list acl6_1 + # 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log + # 20 permit icmpv6 any any router-advertisement precedence network destopts + + - name: Delete all ACLs from the device + cisco.iosxr.iosxr_acls: + state: deleted + + # After state: + # ------------- + + # RP/0/RP0/CPU0:ios#sh access-lists afi-all + # Thu Feb 20 05:07:45.767 UTC + # RP/0/RP0/CPU0:ios# + + # Using gathered to gather ACL facts from the device + + - name: Gather ACL interfaces facts using gathered state + cisco.iosxr.iosxr_acls: + state: gathered + + # Task Output (redacted) + # ----------------------- + # + + # "gathered": [ + # { + # "acls": [ + # { + # "aces": [ + # { + # "remark": "TEST_ACL_1_REMARK", + # "sequence": 16 + # }, + # { + # "destination": { + # "address": "198.51.100.0", + # "wildcard_bits": "0.0.0.15" + # }, + # "grant": "permit", + # "protocol": "tcp", + # "protocol_options": { + # "tcp": { + # "rst": true + # } + # }, + # "sequence": 21, + # "source": { + # "host": "192.0.2.10", + # "port_protocol": { + # "range": { + # "end": "121", + # "start": "pop3" + # } + # } + # } + # }, + # { + # "destination": { + # "address": "198.51.100.0", + # "wildcard_bits": "0.0.0.15" + # }, + # "dscp": { + # "lt": "af12" + # }, + # "grant": "deny", + # "protocol": "icmp", + # "protocol_options": { + # "icmp": { + # "reassembly_timeout": true + # } + # }, + # "sequence": 23, + # "source": { + # "any": true + # } + # } + # ], + # "name": "acl_1" + # }, + # { + # "aces": [ + # { + # "remark": "TEST_ACL_2_REMARK", + # "sequence": 10 + # } + # ], + # "name": "acl_2" + # } + # ], + # "afi": "ipv4" + # }, + # { + # "acls": [ + # { + # "aces": [ + # { + # "authen": true, + # "destination": { + # "any": true + # }, + # "grant": "deny", + # "log": true, + # "protocol": "tcp", + # "protocol_options": { + # "tcp": { + # "syn": true + # } + # }, + # "routing": true, + # "sequence": 10, + # "source": { + # "port_protocol": { + # "range": { + # "end": "telnet", + # "start": "ftp" + # } + # }, + # "prefix": "2001:db8:1234::/48" + # }, + # "ttl": { + # "range": { + # "end": 250, + # "start": 180 + # } + # } + # }, + # { + # "destination": { + # "any": true + # }, + # "destopts": true, + # "grant": "permit", + # "precedence": "network", + # "protocol": "icmpv6", + # "protocol_options": { + # "icmpv6": { + # "router_advertisement": true + # } + # }, + # "sequence": 20, + # "source": { + # "any": true + # } + # } + # ], + # "name": "acl6_1" + # } + # ], + # "afi": "ipv6" + # } + # ] + + # Using rendered + + - name: Render platform specific commands (without connecting to the device) + cisco.iosxr.iosxr_acls: + config: + - afi: ipv4 + acls: + - name: acl_2 + aces: + - sequence: 11 + grant: permit + protocol: igmp + source: + host: 198.51.100.130 + destination: + any: true + ttl: + eq: 100 + + - sequence: 12 + grant: deny + source: + any: true + destination: + any: true + protocol: icmp + state: rendered + + # Task Output (redacted) + # ----------------------- + + # "rendered": [ + # "ipv4 access-list acl_2", + # "11 permit igmp host 198.51.100.130 any ttl eq 100", + # "12 deny icmp any any" + + # Using parsed + + # parsed.cfg + # ------------ + # + # ipv4 access-list acl_1 + # 10 remark TEST_ACL_2_REMARK + # ipv4 access-list acl_2 + # 11 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 authen routing log + # 21 permit icmpv6 any any router-advertisement precedence network packet-length eq 576 destopts + # ipv6 access-list acl6_1 + # 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log + # 20 permit icmpv6 any any router-advertisement precedence network packet-length eq 576 destopts + + - name: Parse externally provided ACL config to agnostic model + cisco.iosxr.iosxr_acls: + running_config: "{{ lookup('file', 'parsed.cfg') }}" + state: parsed + + # Task Output (redacted) + # ----------------------- + # "parsed": [ + # { + # "acls": [ + # { + # "aces": [ + # { + # "remark": "TEST_ACL_2_REMARK", + # "sequence": 10 + # } + # ], + # "name": "acl_1" + # }, + # { + # "aces": [ + # { + # "authen": true, + # "destination": { + # "any": true + # }, + # "grant": "deny", + # "log": true, + # "protocol": "tcp", + # "protocol_options": { + # "tcp": { + # "syn": true + # } + # }, + # "routing": true, + # "sequence": 11, + # "source": { + # "port_protocol": { + # "range": { + # "end": "telnet", + # "start": "ftp" + # } + # }, + # "prefix": "2001:db8:1234::/48" + # }, + # "ttl": { + # "range": { + # "end": 250, + # "start": 180 + # } + # } + # }, + # { + # "destination": { + # "any": true + # }, + # "destopts": true, + # "grant": "permit", + # "packet_length": { + # "eq": 576 + # }, + # "precedence": "network", + # "protocol": "icmpv6", + # "protocol_options": { + # "icmpv6": { + # "router_advertisement": true + # } + # }, + # "sequence": 21, + # "source": { + # "any": true + # } + # } + # ], + # "name": "acl_2" + # } + # ], + # "afi": "ipv4" + # }, + # { + # "acls": [ + # { + # "aces": [ + # { + # "authen": true, + # "destination": { + # "any": true + # }, + # "grant": "deny", + # "log": true, + # "protocol": "tcp", + # "protocol_options": { + # "tcp": { + # "syn": true + # } + # }, + # "routing": true, + # "sequence": 10, + # "source": { + # "port_protocol": { + # "range": { + # "end": "telnet", + # "start": "ftp" + # } + # }, + # "prefix": "2001:db8:1234::/48" + # }, + # "ttl": { + # "range": { + # "end": 250, + # "start": 180 + # } + # } + # }, + # { + # "destination": { + # "any": true + # }, + # "destopts": true, + # "grant": "permit", + # "packet_length": { + # "eq": 576 + # }, + # "precedence": "network", + # "protocol": "icmpv6", + # "protocol_options": { + # "icmpv6": { + # "router_advertisement": true + # } + # }, + # "sequence": 20, + # "source": { + # "any": true + # } + # } + # ], + # "name": "acl6_1" + # } + # ], + # "afi": "ipv6" + # } + # ] + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ after + +
+ list +
+
when changed +
The resulting configuration model invocation.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ before + +
+ list +
+
always +
The configuration prior to the model invocation.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ commands + +
+ list +
+
always +
The set of commands pushed to the remote device.
+
+
Sample:
+
['ipv6 access-list acl6_1', '10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 authen routing log', '20 permit icmpv6 any any router-advertisement precedence network destopts', 'ipv4 access-list acl_1', '16 remark TEST_ACL_1_REMARK', '21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst', '23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Nilashish Chakraborty (@NilashishC) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_banner_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_banner_module.rst new file mode 100644 index 00000000..1790f614 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_banner_module.rst @@ -0,0 +1,331 @@ +.. _cisco.iosxr.iosxr_banner_module: + + +************************ +cisco.iosxr.iosxr_banner +************************ + +**Manage multiline banners on Cisco IOS XR devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module will configure both exec and motd banners on remote device running Cisco IOS XR. It allows playbooks to add or remove banner text from the running configuration. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient >= 0.5.3 when using netconf +- lxml >= 4.1.1 when using netconf + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ banner + +
+ string + / required +
+
+
    Choices: +
  • login
  • +
  • motd
  • +
+
+
Specifies the type of banner to configure on remote device.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli.
+
For more information please see the Network Guide.
+

+
A dict object containing connection details.
+
+
+ host + +
+ string +
+
+ +
Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.
+
+
+ password + +
+ string +
+
+ +
Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.
+
+
+ port + +
+ integer +
+
+ +
Specifies the port to use when building the connection to the remote device.
+
+
+ ssh_keyfile + +
+ path +
+
+ +
Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_SSH_KEYFILE will be used instead.
+
+
+ timeout + +
+ integer +
+
+ +
Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error.
+
+
+ transport + +
+ string +
+
+
    Choices: +
  • cli ←
  • +
  • netconf
  • +
+
+
Specifies the type of connection based transport.
+
+
+ username + +
+ string +
+
+ +
Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present ←
  • +
  • absent
  • +
+
+
Existential state of the configuration on the device.
+
+
+ text + +
+ string +
+
+ +
Banner text to be configured. Accepts multi line string, without empty lines. When using a multi line string, the first and last characters must be the start and end delimiters for the banner Requires state=present.
+
+
+ + +Notes +----- + +.. note:: + - Tested against IOS XRv 6.1.3. + - This module works with connection ``network_cli`` and ``netconf``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Cisco devices see the `Cisco integration page `_. + + + +Examples +-------- + +.. code-block:: yaml + + - name: configure the login banner + cisco.iosxr.iosxr_banner: + banner: login + text: | + @this is my login banner + that contains a multiline + string@ + state: present + - name: remove the motd banner + cisco.iosxr.iosxr_banner: + banner: motd + state: absent + - name: Configure banner from file + cisco.iosxr.iosxr_banner: + banner: motd + text: "{{ lookup('file', './config_partial/raw_banner.cfg') }}" + state: present + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ commands + +
+ list +
+
always (empty list when no commands to send) +
The list of configuration mode commands sent to device with transport cli
+
+
Sample:
+
['banner login', '@this is my login banner', 'that contains a multiline', 'string@']
+
+
+ xml + +
+ list +
+
always (empty list when no xml rpc to send) +
NetConf rpc xml sent to device with transport netconf
+
+
Sample:
+
['<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"> <banners xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-infra-infra-cfg"> <banner xc:operation="merge"> <banner-name>motd</banner-name> <banner-text>Ansible banner example</banner-text> </banner> </banners> </config>']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Trishna Guha (@trishnaguha) +- Kedar Kekan (@kedarX) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_bgp_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_bgp_module.rst new file mode 100644 index 00000000..57486f68 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_bgp_module.rst @@ -0,0 +1,718 @@ +.. _cisco.iosxr.iosxr_bgp_module: + + +********************* +cisco.iosxr.iosxr_bgp +********************* + +**Configure global BGP protocol settings on Cisco IOS-XR** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module provides configuration management of global BGP parameters on devices running Cisco IOS-XR + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ dictionary +
+
+ +
Specifies the BGP related configuration.
+
+
+ address_family + +
+ list + / elements=dictionary +
+
+ +
Specifies BGP address family related configurations.
+
+
+ afi + +
+ string + / required +
+
+
    Choices: +
  • ipv4
  • +
  • ipv6
  • +
+
+
Type of address family to configure.
+
+
+ networks + +
+ list + / elements=dictionary +
+
+ +
Specify networks to announce via BGP.
+
For operation replace, this option is mutually exclusive with root level networks option.
+
+
+ masklen + +
+ integer + / required +
+
+ +
Subnet mask length for the network to announce(e.g, 8, 16, 24, etc.).
+
+
+ network + +
+ string + / required +
+
+ +
Network ID to announce via BGP.
+

aliases: prefix
+
+
+ route_map + +
+ string +
+
+ +
Route map to modify the attributes.
+
+
+ redistribute + +
+ list + / elements=dictionary +
+
+ +
Specifies the redistribute information from another routing protocol.
+
+
+ id + +
+ string +
+
+ +
Identifier for the routing protocol for configuring redistribute information.
+
Valid for protocols 'ospf', 'eigrp', 'isis' and 'ospfv3'.
+
+
+ metric + +
+ integer +
+
+ +
Specifies the metric for redistributed routes.
+
+
+ protocol + +
+ string + / required +
+
+
    Choices: +
  • ospf
  • +
  • ospfv3
  • +
  • eigrp
  • +
  • isis
  • +
  • static
  • +
  • connected
  • +
  • lisp
  • +
  • mobile
  • +
  • rip
  • +
  • subscriber
  • +
+
+
Specifies the protocol for configuring redistribute information.
+
+
+ route_map + +
+ string +
+
+ +
Specifies the route map reference.
+
+
+ safi + +
+ string +
+
+
    Choices: +
  • flowspec
  • +
  • unicast ←
  • +
  • multicast
  • +
  • labeled-unicast
  • +
+
+
Specifies the type of cast for the address family.
+
+
+ bgp_as + +
+ integer + / required +
+
+ +
Specifies the BGP Autonomous System (AS) number to configure on the device.
+
+
+ log_neighbor_changes + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/disable logging neighbor up/down and reset reason.
+
+
+ neighbors + +
+ list + / elements=dictionary +
+
+ +
Specifies BGP neighbor related configurations.
+
+
+ advertisement_interval + +
+ integer +
+
+ +
Specifies the minimum interval (in seconds) between sending BGP routing updates.
+
The range is from 0 to 600.
+
+
+ description + +
+ string +
+
+ +
Neighbor specific description.
+
+
+ ebgp_multihop + +
+ integer +
+
+ +
Specifies the maximum hop count for EBGP neighbors not on directly connected networks.
+
The range is from 0 to 255.
+
+
+ enabled + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Administratively shutdown or enable a neighbor.
+
+
+ neighbor + +
+ string + / required +
+
+ +
Neighbor router address.
+
+
+ password + +
+ string +
+
+ +
Password to authenticate the BGP peer connection.
+
+
+ remote_as + +
+ integer + / required +
+
+ +
Remote AS of the BGP neighbor to configure.
+
+
+ tcp_mss + +
+ integer +
+
+ +
Specifies the TCP initial maximum segment size to use.
+
The range is from 68 to 10000.
+
+
+ timers + +
+ dictionary +
+
+ +
Specifies BGP neighbor timer related configurations.
+
+
+ holdtime + +
+ integer +
+
+ +
Interval after not receiving a keepalive message that the software declares a peer dead.
+
The range is from 3 to 65535.
+
+
+ keepalive + +
+ integer +
+
+ +
Frequency with which the Cisco IOS-XR software sends keepalive messages to its peer.
+
The range is from 0 to 65535.
+
+
+ min_neighbor_holdtime + +
+ integer +
+
+ +
Interval specifying the minimum acceptable hold-time from a BGP neighbor.
+
The minimum acceptable hold-time must be less than, or equal to, the interval specified in the holdtime argument.
+
The range is from 3 to 65535.
+
+
+ update_source + +
+ string +
+
+ +
Source of the routing updates.
+
+
+ router_id + +
+ string +
+
+ +
Configures the BGP routing process router-id value.
+
+
+ operation + +
+ string +
+
+
    Choices: +
  • merge ←
  • +
  • replace
  • +
  • override
  • +
  • delete
  • +
+
+
Specifies the operation to be performed on the BGP process configured on the device.
+
In case of merge, the input configuration will be merged with the existing BGP configuration on the device.
+
In case of replace, if there is a diff between the existing configuration and the input configuration, the existing configuration will be replaced by the input configuration for every option that has the diff.
+
In case of override, all the existing BGP configuration will be removed from the device and replaced with the input configuration.
+
In case of delete the existing BGP configuration will be removed from the device.
+
+
+ + +Notes +----- + +.. note:: + - Tested against Cisco IOS XR Software Version 6.1.3 + - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + - name: configure global bgp as 65000 + cisco.iosxr.iosxr_bgp: + bgp_as: 65000 + router_id: 1.1.1.1 + neighbors: + - neighbor: 182.168.10.1 + remote_as: 500 + description: PEER_1 + - neighbor: 192.168.20.1 + remote_as: 500 + update_source: GigabitEthernet 0/0/0/0 + address_family: + - name: ipv4 + cast: unicast + networks: + - network: 192.168.2.0/23 + - network: 10.0.0.0/8 + redistribute: + - protocol: ospf + id: 400 + metric: 110 + + - name: remove bgp as 65000 from config + ios_bgp: + bgp_as: 65000 + state: absent + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + +
KeyReturnedDescription
+
+ commands + +
+ list +
+
always +
The list of configuration mode commands to send to the device
+
+
Sample:
+
['router bgp 65000', 'bgp router-id 1.1.1.1', 'neighbor 182.168.10.1 remote-as 500', 'neighbor 182.168.10.1 description PEER_1', 'neighbor 192.168.20.1 remote-as 500', 'neighbor 192.168.20.1 update-source GigabitEthernet0/0/0/0', 'address-family ipv4 unicast', 'redistribute ospf 400 metric 110', 'network 192.168.2.0/23', 'network 10.0.0.0/8', 'exit']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Nilashish Chakraborty (@NilashishC) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_cliconf.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_cliconf.rst new file mode 100644 index 00000000..9f5dab9b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_cliconf.rst @@ -0,0 +1,43 @@ +.. _cisco.iosxr.iosxr_cliconf: + + +***************** +cisco.iosxr.iosxr +***************** + +**Use iosxr cliconf to run command on Cisco IOS XR platform** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This iosxr plugin provides low level abstraction apis for sending and receiving CLI commands from Cisco IOS XR network devices. + + + + + + + + + + + +Status +------ + + +Authors +~~~~~~~ + +- Ansible Networking Team + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_command_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_command_module.rst new file mode 100644 index 00000000..679e3b4d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_command_module.rst @@ -0,0 +1,382 @@ +.. _cisco.iosxr.iosxr_command_module: + + +************************* +cisco.iosxr.iosxr_command +************************* + +**Run commands on remote devices running Cisco IOS XR** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Sends arbitrary commands to an IOS XR node and returns the results read from the device. This module includes an argument that will cause the module to wait for a specific condition before returning or timing out if the condition is not met. +- This module does not support running commands in configuration mode. Please use :ref:`iosxr_config ` to configure iosxr devices. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ commands + +
+ list + / elements=raw + / required +
+
+ +
List of commands to send to the remote iosxr device over the configured provider. The resulting output from the command is returned. If the wait_for argument is provided, the module is not returned until the condition is satisfied or the number of retries has expired.
+
If a command sent to the device requires answering a prompt, it is possible to pass a dict containing command, answer and prompt. Common answers are 'y' or "\r" (carriage return, must be double quotes). See examples
+
+
+ interval + +
+ integer +
+
+ Default:
1
+
+
Configures the interval in seconds to wait between retries of the command. If the command does not pass the specified conditions, the interval indicates how long to wait before trying the command again.
+
+
+ match + +
+ string +
+
+
    Choices: +
  • any
  • +
  • all ←
  • +
+
+
The match argument is used in conjunction with the wait_for argument to specify the match policy. Valid values are all or any. If the value is set to all then all conditionals in the wait_for must be satisfied. If the value is set to any then only one of the values must be satisfied.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli.
+
For more information please see the Network Guide.
+

+
A dict object containing connection details.
+
+
+ host + +
+ string +
+
+ +
Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.
+
+
+ password + +
+ string +
+
+ +
Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.
+
+
+ port + +
+ integer +
+
+ +
Specifies the port to use when building the connection to the remote device.
+
+
+ ssh_keyfile + +
+ path +
+
+ +
Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_SSH_KEYFILE will be used instead.
+
+
+ timeout + +
+ integer +
+
+ +
Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error.
+
+
+ transport + +
+ string +
+
+
    Choices: +
  • cli ←
  • +
  • netconf
  • +
+
+
Specifies the type of connection based transport.
+
+
+ username + +
+ string +
+
+ +
Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.
+
+
+ retries + +
+ integer +
+
+ Default:
10
+
+
Specifies the number of retries a command should by tried before it is considered failed. The command is run on the target device every retry and evaluated against the wait_for conditions.
+
+
+ wait_for + +
+ list + / elements=string +
+
+ +
List of conditions to evaluate against the output of the command. The task will wait for each condition to be true before moving forward. If the conditional is not true within the configured number of retries, the task fails. See examples.
+

aliases: waitfor
+
+
+ + +Notes +----- + +.. note:: + - Make sure the user has been authorized to execute commands terminal length 0, terminal width 512 and terminal exec prompt no-timestamp. + - This module works with ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + - This module does not support ``netconf`` connection. + - Tested against IOS XR 6.1.3 + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Cisco devices see the `Cisco integration page `_. + + + +Examples +-------- + +.. code-block:: yaml + + - name: run show version on remote devices + cisco.iosxr.iosxr_command: + commands: show version + + - name: run show version and check to see if output contains iosxr + cisco.iosxr.iosxr_command: + commands: show version + wait_for: result[0] contains IOS-XR + + - name: run multiple commands on remote nodes + cisco.iosxr.iosxr_command: + commands: + - show version + - show interfaces + - {command: example command that prompts, prompt: expected prompt, answer: yes} + + - name: run multiple commands and evaluate the output + cisco.iosxr.iosxr_command: + commands: + - show version + - show interfaces + wait_for: + - result[0] contains IOS-XR + - result[1] contains Loopback0 + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ failed_conditions + +
+ list +
+
failed +
The list of conditionals that have failed
+
+
Sample:
+
['...', '...']
+
+
+ stdout + +
+ list +
+
always apart from low level errors (such as action plugin) +
The set of responses from the commands
+
+
Sample:
+
['...', '...']
+
+
+ stdout_lines + +
+ list +
+
always apart from low level errors (such as action plugin) +
The value of stdout split into a list
+
+
Sample:
+
[['...', '...'], ['...'], ['...']]
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Ricardo Carrillo Cruz (@rcarrillocruz) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_config_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_config_module.rst new file mode 100644 index 00000000..85523490 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_config_module.rst @@ -0,0 +1,649 @@ +.. _cisco.iosxr.iosxr_config_module: + + +************************ +cisco.iosxr.iosxr_config +************************ + +**Manage Cisco IOS XR configuration sections** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Cisco IOS XR configurations use a simple block indent file syntax for segmenting configuration into sections. This module provides an implementation for working with IOS XR configuration sections in a deterministic way. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ admin + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Enters into administration configuration mode for making config changes to the device.
+
+
+ after + +
+ list + / elements=string +
+
+ +
The ordered set of commands to append to the end of the command stack if a change needs to be made. Just like with before this allows the playbook designer to append a set of commands to be executed after the command set.
+
+
+ backup + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
This argument will cause the module to create a full backup of the current running-config from the remote device before any changes are made. If the backup_options value is not given, the backup file is written to the backup folder in the playbook root directory or role root directory, if playbook is part of an ansible role. If the directory does not exist, it is created.
+
+
+ backup_options + +
+ dictionary +
+
+ +
This is a dict object containing configurable options related to backup file path. The value of this option is read only when backup is set to yes, if backup is set to no this option will be silently ignored.
+
+
+ dir_path + +
+ path +
+
+ +
This option provides the path ending with directory name in which the backup configuration file will be stored. If the directory does not exist it will be first created and the filename is either the value of filename or default filename as described in filename options description. If the path value is not given in that case a backup directory will be created in the current working directory and backup configuration will be copied in filename within backup directory.
+
+
+ filename + +
+ string +
+
+ +
The filename to be used to store the backup configuration. If the filename is not given it will be generated based on the hostname, current time and date in format defined by <hostname>_config.<current-date>@<current-time>
+
+
+ before + +
+ list + / elements=string +
+
+ +
The ordered set of commands to push on to the command stack if a change needs to be made. This allows the playbook designer the opportunity to perform configuration commands prior to pushing any changes without affecting how the set of commands are matched against the system.
+
+
+ comment + +
+ string +
+
+ Default:
"configured by iosxr_config"
+
+
Allows a commit description to be specified to be included when the configuration is committed. If the configuration is not changed or committed, this argument is ignored.
+
+
+ config + +
+ string +
+
+ +
The module, by default, will connect to the remote device and retrieve the current running-config to use as a base for comparing against the contents of source. There are times when it is not desirable to have the task get the current running-config for every task in a playbook. The config argument allows the implementer to pass in the configuration to use as the base config for comparison. The configuration lines for this option should be similar to how it will appear if present in the running-configuration of the device to ensure idempotency and correct diff.
+
+
+ exclusive + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Enters into exclusive configuration mode that locks out all users from committing configuration changes until the exclusive session ends.
+
+
+ force + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
The force argument instructs the module to not consider the current devices running-config. When set to true, this will cause the module to push the contents of src into the device without first checking if already configured.
+
Note this argument should be considered deprecated. To achieve the equivalent, set the match=none which is idempotent. This argument will be removed in a future release.
+
+
+ label + +
+ string +
+
+ +
Allows a commit label to be specified to be included when the configuration is committed. A valid label must begin with an alphabet and not exceed 30 characters, only alphabets, digits, hyphens and underscores are allowed. If the configuration is not changed or committed, this argument is ignored.
+
+
+ lines + +
+ list + / elements=string +
+
+ +
The ordered set of commands that should be configured in the section. The commands must be the exact same commands as found in the device running-config as found in the device running-config to ensure idempotency and correct diff. Be sure to note the configuration command syntax as some commands are automatically modified by the device config parser.
+

aliases: commands
+
+
+ match + +
+ string +
+
+
    Choices: +
  • line ←
  • +
  • strict
  • +
  • exact
  • +
  • none
  • +
+
+
Instructs the module on the way to perform the matching of the set of commands against the current device config. If match is set to line, commands are matched line by line. If match is set to strict, command lines are matched with respect to position. If match is set to exact, command lines must be an equal match. Finally, if match is set to none, the module will not attempt to compare the source configuration with the running configuration on the remote device.
+
+
+ parents + +
+ list + / elements=string +
+
+ +
The ordered set of parents that uniquely identify the section or hierarchy the commands should be checked against. If the parents argument is omitted, the commands are checked against the set of top level or global commands.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli.
+
For more information please see the Network Guide.
+

+
A dict object containing connection details.
+
+
+ host + +
+ string +
+
+ +
Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.
+
+
+ password + +
+ string +
+
+ +
Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.
+
+
+ port + +
+ integer +
+
+ +
Specifies the port to use when building the connection to the remote device.
+
+
+ ssh_keyfile + +
+ path +
+
+ +
Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_SSH_KEYFILE will be used instead.
+
+
+ timeout + +
+ integer +
+
+ +
Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error.
+
+
+ transport + +
+ string +
+
+
    Choices: +
  • cli ←
  • +
  • netconf
  • +
+
+
Specifies the type of connection based transport.
+
+
+ username + +
+ string +
+
+ +
Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.
+
+
+ replace + +
+ string +
+
+
    Choices: +
  • line ←
  • +
  • block
  • +
  • config
  • +
+
+
Instructs the module on the way to perform the configuration on the device. If the replace argument is set to line then the modified lines are pushed to the device in configuration mode. If the replace argument is set to block then the entire command block is pushed to the device in configuration mode if any line is not correct.
+
+
+ src + +
+ path +
+
+ +
Specifies the source path to the file that contains the configuration or configuration template to load. The path to the source file can either be the full path on the Ansible control host or a relative path from the playbook or role root directory. This argument is mutually exclusive with lines, parents. The configuration lines in the source file should be similar to how it will appear if present in the running-configuration of the device to ensure idempotency and correct diff.
+
+
+ + +Notes +----- + +.. note:: + - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + - Tested against IOS XRv 6.1.3. + - This module does not support ``netconf`` connection + - Abbreviated commands are NOT idempotent, see L(Network FAQ,../network/user_guide/faq.html + - Avoid service disrupting changes (viz. Management IP) from config replace. + - Do not use ``end`` in the replace config file. + - To ensure idempotency and correct diff the configuration lines in the relevant module options should be similar to how they appear if present in the running configuration on device including the indentation. + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Cisco devices see the `Cisco integration page `_. + + + +Examples +-------- + +.. code-block:: yaml + + - name: configure top level configuration + cisco.iosxr.iosxr_config: + lines: hostname {{ inventory_hostname }} + + - name: configure interface settings + cisco.iosxr.iosxr_config: + lines: + - description test interface + - ip address 172.31.1.1 255.255.255.0 + parents: interface GigabitEthernet0/0/0/0 + + - name: load a config from disk and replace the current config + cisco.iosxr.iosxr_config: + src: config.cfg + replace: config + backup: yes + + - name: for idempotency, use full-form commands + cisco.iosxr.iosxr_config: + lines: + # - shut + - shutdown + # parents: int g0/0/0/1 + parents: interface GigabitEthernet0/0/0/1 + + - name: configurable backup path + cisco.iosxr.iosxr_config: + src: config.cfg + backup: yes + backup_options: + filename: backup.cfg + dir_path: /home/user + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ backup_path + +
+ string +
+
when backup is yes +
The full path to the backup file
+
+
Sample:
+
/playbooks/ansible/backup/iosxr01_config.2016-07-16@22:28:34
+
+
+ commands + +
+ list +
+
If there are commands to run against the host +
The set of commands that will be pushed to the remote device
+
+
Sample:
+
['hostname foo', 'router ospf 1', 'router-id 1.1.1.1']
+
+
+ date + +
+ string +
+
when backup is yes +
The date extracted from the backup file name
+
+
Sample:
+
2016-07-16
+
+
+ filename + +
+ string +
+
when backup is yes and filename is not specified in backup options +
The name of the backup file
+
+
Sample:
+
iosxr01_config.2016-07-16@22:28:34
+
+
+ shortname + +
+ string +
+
when backup is yes and filename is not specified in backup options +
The full path to the backup file excluding the timestamp
+
+
Sample:
+
/playbooks/ansible/backup/iosxr01_config
+
+
+ time + +
+ string +
+
when backup is yes +
The time extracted from the backup file name
+
+
Sample:
+
22:28:34
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Ricardo Carrillo Cruz (@rcarrillocruz) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_facts_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_facts_module.rst new file mode 100644 index 00000000..be3701fc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_facts_module.rst @@ -0,0 +1,533 @@ +.. _cisco.iosxr.iosxr_facts_module: + + +*********************** +cisco.iosxr.iosxr_facts +*********************** + +**Get facts about iosxr devices.** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- 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. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ gather_network_resources + +
+ list + / elements=string +
+
+ +
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, lacp etc. Can specify a list of values to include a larger subset. Values can also be used with an initial ! to specify that a specific subset should not be collected. Valid subsets are 'all', 'lacp', 'lacp_interfaces', 'lldp_global', 'lldp_interfaces', 'interfaces', 'l2_interfaces', 'l3_interfaces', 'lag_interfaces', 'acls', 'acl_interfaces', 'static_routes', 'ospfv2'.
+
+
+ gather_subset + +
+ list + / elements=string +
+
+ Default:
"!config"
+
+
When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include all, hardware, config, and interfaces. Can specify a list of values to include a larger subset. Values can also be used with an initial ! to specify that a specific subset should not be collected.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli.
+
For more information please see the Network Guide.
+

+
A dict object containing connection details.
+
+
+ host + +
+ string +
+
+ +
Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.
+
+
+ password + +
+ string +
+
+ +
Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.
+
+
+ port + +
+ integer +
+
+ +
Specifies the port to use when building the connection to the remote device.
+
+
+ ssh_keyfile + +
+ path +
+
+ +
Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_SSH_KEYFILE will be used instead.
+
+
+ timeout + +
+ integer +
+
+ +
Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error.
+
+
+ transport + +
+ string +
+
+
    Choices: +
  • cli ←
  • +
  • netconf
  • +
+
+
Specifies the type of connection based transport.
+
+
+ username + +
+ string +
+
+ +
Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.
+
+
+ + +Notes +----- + +.. note:: + - Tested against IOS-XR 6.1.3. + - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Cisco devices see the `Cisco integration page `_. + + + +Examples +-------- + +.. code-block:: yaml + + # Gather all facts + - cisco.iosxr.iosxr_facts: + gather_subset: all + gather_network_resources: all + + # Collect only the config and default facts + - cisco.iosxr.iosxr_facts: + gather_subset: + - config + + # Do not collect hardware facts + - cisco.iosxr.iosxr_facts: + gather_subset: + - '!hardware' + + # Collect only the lacp facts + - cisco.iosxr.iosxr_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - lacp + + # Do not collect lacp_interfaces facts + - cisco.iosxr.iosxr_facts: + gather_network_resources: + - '!lacp_interfaces' + + # Collect lacp and minimal default facts + - cisco.iosxr.iosxr_facts: + gather_subset: min + gather_network_resources: lacp + + # Collect only the interfaces facts + - cisco.iosxr.iosxr_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - interfaces + - l2_interfaces + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ ansible_net_all_ipv4_addresses + +
+ list +
+
when interfaces is configured +
All IPv4 addresses configured on the device
+
+
+
+ ansible_net_all_ipv6_addresses + +
+ list +
+
when interfaces is configured +
All IPv6 addresses configured on the device
+
+
+
+ ansible_net_api + +
+ string +
+
always +
The name of the transport
+
+
+
+ ansible_net_config + +
+ string +
+
when config is configured +
The current active config from the device
+
+
+
+ ansible_net_filesystems + +
+ list +
+
when hardware is configured +
All file system names available on the device
+
+
+
+ ansible_net_gather_network_resources + +
+ list +
+
always +
The list of fact resource subsets collected from the device
+
+
+
+ ansible_net_gather_subset + +
+ list +
+
always +
The list of fact subsets collected from the device
+
+
+
+ ansible_net_hostname + +
+ string +
+
always +
The configured hostname of the device
+
+
+
+ ansible_net_image + +
+ string +
+
always +
The image file the device is running
+
+
+
+ ansible_net_interfaces + +
+ dictionary +
+
when interfaces is configured +
A hash of all interfaces running on the system
+
+
+
+ ansible_net_memfree_mb + +
+ integer +
+
when hardware is configured +
The available free memory on the remote device in Mb
+
+
+
+ ansible_net_memtotal_mb + +
+ integer +
+
when hardware is configured +
The total memory on the remote device in Mb
+
+
+
+ ansible_net_model + +
+ string +
+
always +
The model name returned from the device
+
+
+
+ ansible_net_neighbors + +
+ dictionary +
+
when interfaces is configured +
The list of LLDP neighbors from the remote device
+
+
+
+ ansible_net_python_version + +
+ string +
+
always +
The Python version Ansible controller is using
+
+
+
+ ansible_net_version + +
+ string +
+
always +
The operating system version running on the remote device
+
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Ricardo Carrillo Cruz (@rcarrillocruz) +- Nilashish Chakraborty (@Nilashishc) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_interface_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_interface_module.rst new file mode 100644 index 00000000..977e369c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_interface_module.rst @@ -0,0 +1,748 @@ +.. _cisco.iosxr.iosxr_interface_module: + + +*************************** +cisco.iosxr.iosxr_interface +*************************** + +**(deprecated, removed after 2022-06-01) Manage Interface on Cisco IOS XR network devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + +DEPRECATED +---------- +:Removed in collection release after 2022-06-01 +:Why: Newer and updated modules released with more functionality in Ansible 2.9 +:Alternative: iosxr_interfaces + + + +Synopsis +-------- +- This module provides declarative management of Interfaces on Cisco IOS XR network devices. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient >= 0.5.3 when using netconf +- lxml >= 4.1.1 when using netconf + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ active + +
+ string +
+
+
    Choices: +
  • active ←
  • +
  • preconfigure
  • +
+
+
Whether the interface is active or preconfigured. Preconfiguration allows you to configure modular services cards before they are inserted into the router. When the cards are inserted, they are instantly configured. Active cards are the ones already inserted.
+
+
+ aggregate + +
+ list + / elements=dictionary +
+
+ +
List of interfaces definition
+
+
+ active + +
+ string +
+
+
    Choices: +
  • active
  • +
  • preconfigure
  • +
+
+
Whether the interface is active or preconfigured. Preconfiguration allows you to configure modular services cards before they are inserted into the router. When the cards are inserted, they are instantly configured. Active cards are the ones already inserted.
+
+
+ delay + +
+ integer +
+
+ +
Time in seconds to wait before checking for the operational state on remote device. This wait is applicable for operational state argument which are state with values up/down, tx_rate and rx_rate.
+
+
+ description + +
+ string +
+
+ +
Description of Interface being configured.
+
+
+ duplex + +
+ string +
+
+
    Choices: +
  • full
  • +
  • half
  • +
+
+
Configures the interface duplex mode. Default is auto-negotiation when not configured.
+
+
+ enabled + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Removes the shutdown configuration, which removes the forced administrative down on the interface, enabling it to move to an up or down state.
+
+
+ mtu + +
+ string +
+
+ +
Sets the MTU value for the interface. Range is between 64 and 65535'
+
+
+ name + +
+ string +
+
+ +
Name of the interface to configure in type + path format. e.g. GigabitEthernet0/0/0/0
+
+
+ rx_rate + +
+ string +
+
+ +
Receiver rate in bits per second (bps).
+
This is state check parameter only.
+
Supports conditionals, see Conditionals in Networking Modules
+
+
+ speed + +
+ string +
+
+
    Choices: +
  • 10
  • +
  • 100
  • +
  • 1000
  • +
+
+
Configure the speed for an interface. Default is auto-negotiation when not configured.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present
  • +
  • absent
  • +
  • up
  • +
  • down
  • +
+
+
State of the Interface configuration, up means present and operationally up and down means present and operationally down
+
+
+ tx_rate + +
+ string +
+
+ +
Transmit rate in bits per second (bps).
+
This is state check parameter only.
+
Supports conditionals, see Conditionals in Networking Modules
+
+
+ delay + +
+ integer +
+
+ Default:
10
+
+
Time in seconds to wait before checking for the operational state on remote device. This wait is applicable for operational state argument which are state with values up/down, tx_rate and rx_rate.
+
+
+ description + +
+ string +
+
+ +
Description of Interface being configured.
+
+
+ duplex + +
+ string +
+
+
    Choices: +
  • full
  • +
  • half
  • +
+
+
Configures the interface duplex mode. Default is auto-negotiation when not configured.
+
+
+ enabled + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Removes the shutdown configuration, which removes the forced administrative down on the interface, enabling it to move to an up or down state.
+
+
+ mtu + +
+ string +
+
+ +
Sets the MTU value for the interface. Range is between 64 and 65535'
+
+
+ name + +
+ string + / required +
+
+ +
Name of the interface to configure in type + path format. e.g. GigabitEthernet0/0/0/0
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli.
+
For more information please see the Network Guide.
+

+
A dict object containing connection details.
+
+
+ host + +
+ string +
+
+ +
Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.
+
+
+ password + +
+ string +
+
+ +
Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.
+
+
+ port + +
+ integer +
+
+ +
Specifies the port to use when building the connection to the remote device.
+
+
+ ssh_keyfile + +
+ path +
+
+ +
Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_SSH_KEYFILE will be used instead.
+
+
+ timeout + +
+ integer +
+
+ +
Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error.
+
+
+ transport + +
+ string +
+
+
    Choices: +
  • cli ←
  • +
  • netconf
  • +
+
+
Specifies the type of connection based transport.
+
+
+ username + +
+ string +
+
+ +
Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.
+
+
+ rx_rate + +
+ string +
+
+ +
Receiver rate in bits per second (bps).
+
This is state check parameter only.
+
Supports conditionals, see Conditionals in Networking Modules
+
+
+ speed + +
+ string +
+
+
    Choices: +
  • 10
  • +
  • 100
  • +
  • 1000
  • +
+
+
Configure the speed for an interface. Default is auto-negotiation when not configured.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present ←
  • +
  • absent
  • +
  • up
  • +
  • down
  • +
+
+
State of the Interface configuration, up means present and operationally up and down means present and operationally down
+
+
+ tx_rate + +
+ string +
+
+ +
Transmit rate in bits per second (bps).
+
This is state check parameter only.
+
Supports conditionals, see Conditionals in Networking Modules
+
+
+ + +Notes +----- + +.. note:: + - This module works with connection ``network_cli`` and ``netconf``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + - Tested against IOS XRv 6.1.3. + - Preconfiguration of physical interfaces is not supported with ``netconf`` transport. + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Cisco devices see the `Cisco integration page `_. + + + +Examples +-------- + +.. code-block:: yaml + + - name: configure interface + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/2 + description: test-interface + speed: 100 + duplex: half + mtu: 512 + + - name: remove interface + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/2 + state: absent + + - name: make interface up + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/2 + enabled: true + + - name: make interface down + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/2 + enabled: false + + - name: Create interface using aggregate + cisco.iosxr.iosxr_interface: + aggregate: + - name: GigabitEthernet0/0/0/3 + - name: GigabitEthernet0/0/0/2 + speed: 100 + duplex: full + mtu: 512 + state: present + + - name: Create interface using aggregate along with additional params in aggregate + cisco.iosxr.iosxr_interface: + aggregate: + - {name: GigabitEthernet0/0/0/3, description: test-interface 3} + - {name: GigabitEthernet0/0/0/2, description: test-interface 2} + speed: 100 + duplex: full + mtu: 512 + state: present + + - name: Delete interface using aggregate + cisco.iosxr.iosxr_interface: + aggregate: + - name: GigabitEthernet0/0/0/3 + - name: GigabitEthernet0/0/0/2 + state: absent + + - name: Check intent arguments + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/5 + state: up + delay: 20 + + - name: Config + intent + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/5 + enabled: false + state: down + delay: 20 + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ commands + +
+ list +
+
always (empty list when no commands to send) +
The list of configuration mode commands sent to device with transport cli
+
+
Sample:
+
['interface GigabitEthernet0/0/0/2', 'description test-interface', 'duplex half', 'mtu 512']
+
+
+ xml + +
+ list +
+
always (empty list when no xml rpc to send) +
NetConf rpc xml sent to device with transport netconf
+
+
Sample:
+
['<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"> <interface-configurations xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg"> <interface-configuration xc:operation="merge"> <active>act</active> <interface-name>GigabitEthernet0/0/0/0</interface-name> <description>test-interface-0</description> <mtus><mtu> <owner>GigabitEthernet</owner> <mtu>512</mtu> </mtu></mtus> <ethernet xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-drivers-media-eth-cfg"> <speed>100</speed> <duplex>half</duplex> </ethernet> </interface-configuration> </interface-configurations></config>']
+
+

+ + +Status +------ + + +- This module will be removed in version . *[deprecated]* +- For more information see `DEPRECATED`_. + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) +- Kedar Kekan (@kedarX) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_interfaces_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_interfaces_module.rst new file mode 100644 index 00000000..6afcf871 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_interfaces_module.rst @@ -0,0 +1,697 @@ +.. _cisco.iosxr.iosxr_interfaces_module: + + +**************************** +cisco.iosxr.iosxr_interfaces +**************************** + +**Interfaces resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages the interface attributes on Cisco IOS-XR network devices. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A dictionary of interface options
+
+
+ description + +
+ string +
+
+ +
Interface description.
+
+
+ duplex + +
+ string +
+
+
    Choices: +
  • full
  • +
  • half
  • +
+
+
Configures the interface duplex mode. Default is auto-negotiation when not configured.
+
+
+ enabled + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Administrative state of the interface.
+
Set the value to True to administratively enable the interface or False to disable it.
+
+
+ mtu + +
+ integer +
+
+ +
Sets the MTU value for the interface. Applicable for Ethernet interfaces only.
+
Refer to vendor documentation for valid values.
+
+
+ name + +
+ string + / required +
+
+ +
Full name of the interface to configure in type + path format. e.g. GigabitEthernet0/0/0/0
+
+
+ speed + +
+ integer +
+
+ +
Configure the speed for an interface. Default is auto-negotiation when not configured.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the IOS-XR device by executing the command show running-config interface.
+
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • merged ←
  • +
  • parsed
  • +
  • deleted
  • +
  • replaced
  • +
  • rendered
  • +
  • gathered
  • +
  • overridden
  • +
+
+
The state of the configuration after module completion
+
+
+ + +Notes +----- + +.. note:: + - Tested against Cisco IOS-XRv Version 6.1.3 on VIRL. + - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + # Before state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # vrf custB + # ipv4 address 178.18.169.23 255.255.255.0 + # dot1q native vlan 30 + # ! + # interface GigabitEthernet0/0/0/3 + # description Replaced by Ansible Team + # mtu 2000 + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # dot1q native vlan 1021 + # ! + - name: Configure Ethernet interfaces + cisco.iosxr.iosxr_interfaces: + config: + - name: GigabitEthernet0/0/0/2 + description: Configured by Ansible + enabled: true + - name: GigabitEthernet0/0/0/3 + description: Configured by Ansible Network + enabled: false + duplex: full + state: merged + # After state: + # ------------ + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # description Configured and Merged by Ansible Network + # vrf custB + # ipv4 address 178.18.169.23 255.255.255.0 + # dot1q native vlan 30 + # ! + # interface GigabitEthernet0/0/0/3 + # description Configured and Merged by Ansible Network + # mtu 2600 + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # duplex full + # shutdown + # dot1q native vlan 1021 + # ! + # Using replaced + # Before state: + # ------------ + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # description Configured by Ansible + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # description Test + # vrf custB + # ipv4 address 178.18.169.23 255.255.255.0 + # dot1q native vlan 30 + # ! + # interface GigabitEthernet0/0/0/3 + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # dot1q native vlan 1021 + # ! + - name: Configure following interfaces and replace their existing config + cisco.iosxr.iosxr_interfaces: + config: + - name: GigabitEthernet0/0/0/2 + description: Configured by Ansible + enabled: true + mtu: 2000 + - name: GigabitEthernet0/0/0/3 + description: Configured by Ansible Network + enabled: false + duplex: auto + state: replaced + # After state: + # ------------ + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # description Configured by Ansible + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # description Configured and Replaced by Ansible + # mtu 2000 + # vrf custB + # ipv4 address 178.18.169.23 255.255.255.0 + # dot1q native vlan 30 + # ! + # interface GigabitEthernet0/0/0/3 + # description Configured and Replaced by Ansible Network + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # duplex half + # shutdown + # dot1q native vlan 1021 + # ! + # Using overridden + # Before state: + # ------------ + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # description Configured by Ansible + # vrf custB + # ipv4 address 178.18.169.23 255.255.255.0 + # dot1q native vlan 30 + # ! + # interface GigabitEthernet0/0/0/3 + # description Configured by Ansible + # mtu 2600 + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # duplex full + # shutdown + # dot1q native vlan 1021 + # ! + - name: Override interfaces + cisco.iosxr.iosxr_interfaces: + config: + - name: GigabitEthernet0/0/0/2 + description: Configured by Ansible + enabled: true + duplex: auto + - name: GigabitEthernet0/0/0/3 + description: Configured by Ansible Network + enabled: false + speed: 1000 + state: overridden + # After state: + # ------------ + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # description Configured and Overridden by Ansible Network + # vrf custB + # ipv4 address 178.18.169.23 255.255.255.0 + # speed 1000 + # dot1q native vlan 30 + # ! + # interface GigabitEthernet0/0/0/3 + # description Configured and Overridden by Ansible Network + # mtu 2000 + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # duplex full + # shutdown + # dot1q native vlan 1021 + # ! + # Using deleted + # Before state: + # ------------ + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # description Configured and Overridden by Ansible Network + # vrf custB + # ipv4 address 178.18.169.23 255.255.255.0 + # speed 1000 + # dot1q native vlan 30 + # ! + # interface GigabitEthernet0/0/0/3 + # description Configured and Overridden by Ansible Network + # mtu 2000 + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # duplex full + # shutdown + # dot1q native vlan 1021 + # ! + - name: Delete IOSXR interfaces as in given arguments + cisco.iosxr.iosxr_interfaces: + config: + - name: GigabitEthernet0/0/0/2 + - name: GigabitEthernet0/0/0/3 + state: deleted + # After state: + # ------------ + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # vrf custB + # ipv4 address 178.18.169.23 255.255.255.0 + # dot1q native vlan 30 + # ! + # interface GigabitEthernet0/0/0/3 + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # dot1q native vlan 1021 + # ! + # Using parsed + # parsed.cfg + # ------------ + # + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 10.8.38.70 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/0 + # description Configured and Merged by Ansible-Network + # mtu 110 + # ipv4 address 172.31.1.1 255.255.255.0 + # duplex half + # ! + # interface GigabitEthernet0/0/0/3 + # shutdown + # ! + # interface GigabitEthernet0/0/0/4 + # shutdown + # ! + # - name: Convert ACL interfaces config to argspec without connecting to the appliance + # cisco.iosxr.iosxr_interfaces: + # running_config: "{{ lookup('file', './parsed.cfg') }}" + # state: parsed + # Task Output (redacted) + # ----------------------- + # "parsed": [ + # { + # "name": "MgmtEth0/RP0/CPU0/0" + # }, + # { + # "access_groups": [ + # { + # "acls": [ + # { + # "direction": "in", + # "name": "acl_1" + # }, + # { + # "direction": "out", + # "name": "acl_2" + # } + # ], + # "afi": "ipv4" + # }, + # { + # "acls": [ + # { + # "direction": "in", + # "name": "acl6_1" + # }, + # { + # "direction": "out", + # "name": "acl6_2" + # } + # ], + # "afi": "ipv6" + # } + # ], + # "name": "GigabitEthernet0/0/0/0" + # }, + # { + # "access_groups": [ + # { + # "acls": [ + # { + # "direction": "out", + # "name": "acl_1" + # } + # ], + # "afi": "ipv4" + # } + # ], + # "name": "GigabitEthernet0/0/0/1" + # } + # ] + # } + # Using rendered + - name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + description: Configured and Merged by Ansible-Network + mtu: 110 + enabled: true + duplex: half + - name: GigabitEthernet0/0/0/1 + description: Configured and Merged by Ansible-Network + mtu: 2800 + enabled: false + speed: 100 + duplex: full + state: rendered + # Task Output (redacted) + # ----------------------- + # "rendered": [ + # "interface GigabitEthernet0/0/0/0", + # "description Configured and Merged by Ansible-Network", + # "mtu 110", + # "duplex half", + # "no shutdown", + # "interface GigabitEthernet0/0/0/1", + # "description Configured and Merged by Ansible-Network", + # "mtu 2800", + # "speed 100", + # "duplex full", + # "shutdown" + # ] + # Using gathered + # Before state: + # ------------ + # + # RP/0/0/CPU0:an-iosxr-02#show running-config interface + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 10.8.38.70 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/0 + # description Configured and Merged by Ansible-Network + # mtu 110 + # ipv4 address 172.31.1.1 255.255.255.0 + # duplex half + # ! + # interface GigabitEthernet0/0/0/3 + # shutdown + # ! + # interface GigabitEthernet0/0/0/4 + # shutdown + # ! + - name: Gather IOSXR interfaces as in given arguments + cisco.iosxr.iosxr_interfaces: + config: + state: gathered + # Task Output (redacted) + # ----------------------- + # + # "gathered": [ + # { + # "description": "test for ansible", + # "enabled": false, + # "name": "Loopback888" + # }, + # { + # "description": "Configured and Merged by Ansible-Network", + # "duplex": "half", + # "enabled": true, + # "mtu": 110, + # "name": "GigabitEthernet0/0/0/0" + # }, + # { + # "enabled": false, + # "name": "GigabitEthernet0/0/0/3" + # }, + # { + # "enabled": false, + # "name": "GigabitEthernet0/0/0/4" + # } + # ] + # After state: + # ------------ + # + # RP/0/0/CPU0:an-iosxr-02#show running-config interface + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 10.8.38.70 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/0 + # description Configured and Merged by Ansible-Network + # mtu 110 + # ipv4 address 172.31.1.1 255.255.255.0 + # duplex half + # ! + # interface GigabitEthernet0/0/0/3 + # shutdown + # ! + # interface GigabitEthernet0/0/0/4 + # shutdown + # ! + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ after + +
+ list +
+
when changed +
The configuration as structured data after module completion.
+
+
Sample:
+
The configuration returned will always be in the same format of the parameters above.
+
+
+ before + +
+ list +
+
always +
The configuration as structured data prior to module invocation.
+
+
Sample:
+
The configuration returned will always be in the same format of the parameters above.
+
+
+ commands + +
+ list +
+
always +
The set of commands pushed to the remote device
+
+
Sample:
+
['interface GigabitEthernet0/0/0/2', 'description: Configured by Ansible', 'shutdown']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Sumit Jaiswal (@justjais) +- Rohit Thakur (@rohitthakur2590) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_l2_interfaces_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_l2_interfaces_module.rst new file mode 100644 index 00000000..e9d2bd66 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_l2_interfaces_module.rst @@ -0,0 +1,879 @@ +.. _cisco.iosxr.iosxr_l2_interfaces_module: + + +******************************* +cisco.iosxr.iosxr_l2_interfaces +******************************* + +**L2 interfaces resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages the Layer-2 interface attributes on Cisco IOS-XR devices. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A dictionary of Layer-2 interface options
+
+
+ l2protocol + +
+ list + / elements=dictionary +
+
+ +
Configures Layer 2 protocol tunneling and protocol data unit (PDU) filtering on an interface.
+
+
+ cdp + +
+ string +
+
+
    Choices: +
  • drop
  • +
  • forward
  • +
  • tunnel
  • +
+
+
Cisco Discovery Protocol (CDP) tunneling and data unit parameters.
+
+
+ pvst + +
+ string +
+
+
    Choices: +
  • drop
  • +
  • forward
  • +
  • tunnel
  • +
+
+
Configures the per-VLAN Spanning Tree Protocol (PVST) tunneling and data unit parameters.
+
+
+ stp + +
+ string +
+
+
    Choices: +
  • drop
  • +
  • forward
  • +
  • tunnel
  • +
+
+
Spanning Tree Protocol (STP) tunneling and data unit parameters.
+
+
+ vtp + +
+ string +
+
+
    Choices: +
  • drop
  • +
  • forward
  • +
  • tunnel
  • +
+
+
VLAN Trunk Protocol (VTP) tunneling and data unit parameters.
+
+
+ l2transport + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Switchport mode access command to configure the interface as a layer 2 access
+
+
+ name + +
+ string + / required +
+
+ +
Full name of the interface/sub-interface excluding any logical unit number, e.g. GigabitEthernet0/0/0/1 or GigabitEthernet0/0/0/1.100.
+
+
+ native_vlan + +
+ integer +
+
+ +
Configure a native VLAN ID for the trunk
+
+
+ propagate + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Propagate Layer 2 transport events. Note that it will work only when the l2tranport option is set to TRUE
+
+
+ q_vlan + +
+ list + / elements=integer +
+
+ +
802.1Q VLAN configuration. Note that it can accept either 2 VLAN IDs when configuring Q-in-Q VLAN, or it will accept 1 VLAN ID and 'any' as input list when configuring Q-in-any vlan as input. Note, that this option is valid only with respect to Sub-Interface and is not valid when configuring for Interface.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the IOS-XR device by executing the command show running-config interface.
+
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • merged ←
  • +
  • replaced
  • +
  • overridden
  • +
  • deleted
  • +
  • rendered
  • +
  • gathered
  • +
  • parsed
  • +
+
+
The state of the configuration after module completion
+
+
+ + +Notes +----- + +.. note:: + - Tested against Cisco IOS-XRv Version 6.1.3 on VIRL. + - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + # + # Before state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/3 + # description Ansible Network + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # duplex half + # shutdown + # ! + # interface GigabitEthernet0/0/0/4 + # description Test description + # ! + + - name: Merge provided configuration with device configuration + cisco.iosxr.iosxr_l2_interfaces: + config: + - name: GigabitEthernet0/0/0/3 + native_vlan: 20 + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + l2transport: true + l2protocol: + - stp: tunnel + - name: GigabitEthernet0/0/0/3.900 + l2transport: true + q_vlan: + - 20 + - 40 + state: merged + + # After state: + # ------------ + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/3 + # description Ansible Network + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # duplex half + # shutdown + # dot1q native vlan 20 + # ! + # interface GigabitEthernet0/0/0/4 + # description Test description + # dot1q native vlan 10 + # l2transport + # l2protocol stp tunnel + # ! + # ! + # interface GigabitEthernet0/0/0/3.900 l2transport + # dot1q vlan 20 40 + # ! + + # Using replaced + # + # Before state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/3 + # description Ansible Network + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # duplex half + # shutdown + # dot1q native vlan 20 + # ! + # interface GigabitEthernet0/0/0/4 + # description Test description + # dot1q native vlan 10 + # l2transport + # l2protocol stp tunnel + # ! + # ! + # interface GigabitEthernet0/0/0/3.900 l2transport + # dot1q vlan 20 40 + # ! + + - name: Replaces device configuration of listed interfaces with provided configuration + cisco.iosxr.iosxr_l2_interfaces: + config: + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + l2transport: true + l2protocol: + - stp: forward + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - any + state: replaced + + # After state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/3 + # description Ansible Network + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # duplex half + # shutdown + # dot1q native vlan 20 + # ! + # interface GigabitEthernet0/0/0/4 + # description Test description + # dot1q native vlan 40 + # l2transport + # l2protocol stp forward + # ! + # ! + # interface GigabitEthernet0/0/0/3.900 l2transport + # dot1q vlan 20 any + # ! + + # Using overridden + # + # Before state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/3 + # description Ansible Network + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # duplex half + # shutdown + # dot1q native vlan 20 + # ! + # interface GigabitEthernet0/0/0/4 + # description Test description + # dot1q native vlan 10 + # l2transport + # l2protocol stp tunnel + # ! + # ! + # interface GigabitEthernet0/0/0/3.900 l2transport + # dot1q vlan 20 40 + # ! + + - name: Override device configuration of all interfaces with provided configuration + cisco.iosxr.iosxr_l2_interfaces: + config: + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + l2transport: true + l2protocol: + - stp: forward + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - any + state: overridden + + # After state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/3 + # description Ansible Network + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # duplex half + # shutdown + # ! + # interface GigabitEthernet0/0/0/4 + # description Test description + # dot1q native vlan 40 + # l2transport + # l2protocol stp forward + # ! + # ! + # interface GigabitEthernet0/0/0/3.900 + # dot1q vlan 20 any + # ! + + # Using deleted + # + # Before state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/3 + # description Ansible Network + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # duplex half + # shutdown + # dot1q native vlan 20 + # ! + # interface GigabitEthernet0/0/0/4 + # description Test description + # dot1q native vlan 10 + # l2transport + # l2protocol stp tunnel + # ! + # ! + # + + - name: "Delete L2 attributes of given interfaces (Note: This won't delete the interface itself)" + cisco.iosxr.iosxr_l2_interfaces: + config: + - name: GigabitEthernet0/0/0/4 + state: deleted + + # After state: + # ------------ + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/3 + # description Ansible Network + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # duplex half + # shutdown + # dot1q native vlan 20 + # ! + # interface GigabitEthernet0/0/0/4 + # description Test description + # ! + + # Using Deleted without any config passed + # "(NOTE: This will delete all of configured resource module attributes from each configured interface)" + # + # Before state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/3 + # description Ansible Network + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # duplex half + # shutdown + # dot1q native vlan 20 + # ! + # interface GigabitEthernet0/0/0/4 + # description Test description + # dot1q native vlan 10 + # l2transport + # l2protocol stp tunnel + # ! + # ! + + - name: "Delete L2 attributes of all interfaces (Note: This won't delete the interface itself)" + cisco.iosxr.iosxr_l2_interfaces: + state: deleted + + # After state: + # ------------ + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/3 + # description Ansible Network + # vrf custB + # ipv4 address 10.10.0.2 255.255.255.0 + # duplex half + # shutdown + # ! + # interface GigabitEthernet0/0/0/4 + # description Test description + # ! + + + # Using parsed + # parsed.cfg + # ------------ + # + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 10.8.38.70 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/0 + # description Configured and Merged by Ansible-Network + # mtu 110 + # ipv4 address 172.31.1.1 255.255.255.0 + # duplex half + # ! + # interface GigabitEthernet0/0/0/1 + # dot1q native vlan 10 + # l2transport + # l2protocol cdp forward + # l2protocol pvst tunnel + # propagate remote-status + # ! + # ! + # interface GigabitEthernet0/0/0/3 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3.900 + # encapsulation dot1q 20 second-dot1q 40 + # ! + # interface GigabitEthernet0/0/0/4 + # shutdown + # dot1q native vlan 40 + # ! + - name: Convert L2 interfaces config to argspec without connecting to the appliance + cisco.iosxr.iosxr_l2_interfaces: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed + # Task Output (redacted) + # ----------------------- + # "parsed": [ + # { + # "name": "GigabitEthernet0/0/0/0" + # }, + # { + # "l2protocol": [ + # { + # "cdp": "forward" + # }, + # { + # "pvst": "tunnel" + # } + # ], + # "l2transport": true, + # "name": "GigabitEthernet0/0/0/1", + # "native_vlan": 10, + # "propagate": true + # }, + # { + # "name": "GigabitEthernet0/0/0/3" + # }, + # { + # "name": "GigabitEthernet0/0/0/3.900", + # "q_vlan": [ + # 20, + # 40 + # ] + # }, + # { + # "name": "GigabitEthernet0/0/0/4", + # "native_vlan": 40 + # } + # ] + + + # Using rendered + - name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_l2_interfaces: + config: + + - name: GigabitEthernet0/0/0/1 + native_vlan: 10 + l2transport: true + l2protocol: + + - pvst: tunnel + + - cdp: forward + propagate: true + + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - 40 + + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + state: rendered + # Task Output (redacted) + # ----------------------- + # "rendered": [ + # "interface GigabitEthernet0/0/0/1", + # "dot1q native vlan 10", + # "l2transport l2protocol pvst tunnel", + # "l2transport l2protocol cdp forward", + # "l2transport propagate remote-status", + # "interface GigabitEthernet0/0/0/3.900", + # "dot1q vlan 20 40", + # "interface GigabitEthernet0/0/0/4", + # "dot1q native vlan 40" + # ] + + + # Using gathered + # Before state: + # ------------ + # + # RP/0/0/CPU0:an-iosxr-02#show running-config interface + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 10.8.38.70 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/0 + # description Configured and Merged by Ansible-Network + # mtu 110 + # ipv4 address 172.31.1.1 255.255.255.0 + # duplex half + # ! + # interface GigabitEthernet0/0/0/1 + # dot1q native vlan 10 + # l2transport + # l2protocol cdp forward + # l2protocol pvst tunnel + # propagate remote-status + # ! + # ! + # interface GigabitEthernet0/0/0/3 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3.900 + # encapsulation dot1q 20 second-dot1q 40 + # ! + # interface GigabitEthernet0/0/0/4 + # shutdown + # dot1q native vlan 40 + # ! + - name: Gather IOSXR l2 interfaces as in given arguments + cisco.iosxr.iosxr_l2_interfaces: + config: + state: gathered + # Task Output (redacted) + # ----------------------- + # + # "gathered": [ + # { + # "name": "GigabitEthernet0/0/0/0" + # }, + # { + # "l2protocol": [ + # { + # "cdp": "forward" + # }, + # { + # "pvst": "tunnel" + # } + # ], + # "l2transport": true, + # "name": "GigabitEthernet0/0/0/1", + # "native_vlan": 10, + # "propagate": true + # }, + # { + # "name": "GigabitEthernet0/0/0/3" + # }, + # { + # "name": "GigabitEthernet0/0/0/3.900", + # "q_vlan": [ + # 20, + # 40 + # ] + # }, + # { + # "name": "GigabitEthernet0/0/0/4", + # "native_vlan": 40 + # } + # ] + # After state: + # ------------ + # + # RP/0/0/CPU0:an-iosxr-02#show running-config interface + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 10.8.38.70 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/0 + # description Configured and Merged by Ansible-Network + # mtu 110 + # ipv4 address 172.31.1.1 255.255.255.0 + # duplex half + # ! + # interface GigabitEthernet0/0/0/1 + # dot1q native vlan 10 + # l2transport + # l2protocol cdp forward + # l2protocol pvst tunnel + # propagate remote-status + # ! + # ! + # interface GigabitEthernet0/0/0/3 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3.900 + # encapsulation dot1q 20 second-dot1q 40 + # ! + # interface GigabitEthernet0/0/0/4 + # shutdown + # dot1q native vlan 40 + # ! + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ after + +
+ list +
+
when changed +
The configuration as structured data after module completion.
+
+
Sample:
+
The configuration returned will always be in the same format of the parameters above.
+
+
+ before + +
+ list +
+
always +
The configuration as structured data prior to module invocation.
+
+
Sample:
+
The configuration returned will always be in the same format of the parameters above.
+
+
+ commands + +
+ list +
+
always +
The set of commands pushed to the remote device
+
+
Sample:
+
['interface GigabitEthernet0/0/0/2', 'l2transport l2protocol pvst tunnel']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Sumit Jaiswal (@justjais) +- Rohit Thakur (@rohitthakur2590) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_l3_interfaces_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_l3_interfaces_module.rst new file mode 100644 index 00000000..a13faf8d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_l3_interfaces_module.rst @@ -0,0 +1,803 @@ +.. _cisco.iosxr.iosxr_l3_interfaces_module: + + +******************************* +cisco.iosxr.iosxr_l3_interfaces +******************************* + +**L3 interfaces resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module provides declarative management of Layer-3 interface on Cisco IOS-XR devices. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A dictionary of Layer-3 interface options
+
+
+ ipv4 + +
+ list + / elements=dictionary +
+
+ +
IPv4 address to be set for the Layer-3 interface mentioned in name option.
+
The address format is <ipv4 address>/<mask>, the mask is number in range 0-32 eg. 192.168.0.1/24
+
+
+ address + +
+ string +
+
+ +
Configures the IPv4 address for Interface.
+
+
+ secondary + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configures the IP address as a secondary address.
+
+
+ ipv6 + +
+ list + / elements=dictionary +
+
+ +
IPv6 address to be set for the Layer-3 interface mentioned in name option.
+
The address format is <ipv6 address>/<mask>, the mask is number in range 0-128 eg. fd5d:12c9:2201:1::1/64
+
+
+ address + +
+ string +
+
+ +
Configures the IPv6 address for Interface.
+
+
+ name + +
+ string + / required +
+
+ +
Full name of the interface excluding any logical unit number, i.e. GigabitEthernet0/1.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the IOS-XR device by executing the command show running-config interface.
+
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • merged ←
  • +
  • replaced
  • +
  • overridden
  • +
  • deleted
  • +
  • parsed
  • +
  • rendered
  • +
  • gathered
  • +
+
+
The state of the configuration after module completion
+
+
+ + +Notes +----- + +.. note:: + - Tested against Cisco IOS-XRv Version 6.1.3 on VIRL. + - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + + # Before state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3 + # ipv4 address 192.168.0.2 255.255.255.0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3.700 + # ! + # interface GigabitEthernet0/0/0/4 + # ipv6 address fd5d:12c9:2201:1::1/64 + # shutdown + # ! + + - name: Merge provided configuration with device configuration + cisco.iosxr.iosxr_l3_interfaces: + config: + - name: GigabitEthernet0/0/0/2 + ipv4: + - address: 192.168.0.1/24 + - name: GigabitEthernet0/0/0/3 + ipv4: + - address: 192.168.2.1/24 + secondary: true + state: merged + + # After state: + # ------------ + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # ipv4 address 192.168.0.1 255.255.255.0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3 + # ipv4 address 192.168.1.0 255.255.255.0 + # ipv4 address 192.168.2.1 255.255.255.0 secondary + # shutdown + # ! + # interface GigabitEthernet0/0/0/3.700 + # ! + # interface GigabitEthernet0/0/0/4 + # ipv6 address fd5d:12c9:2201:1::1/64 + # shutdown + # ! + + # Using overridden + + # Before state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # ipv4 address 192.168.0.1 255.255.255.0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3 + # ipv4 address 192.168.1.0 255.255.255.0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3.700 + # ! + # interface GigabitEthernet0/0/0/4 + # ipv6 address fd5d:12c9:2201:1::1/64 + # shutdown + # ! + + - name: Override device configuration of all interfaces with provided configuration + cisco.iosxr.iosxr_l3_interfaces: + config: + - name: GigabitEthernet0/0/0/3 + ipv4: + - address: 192.168.0.1/24 + - name: GigabitEthernet0/0/0/3.700 + ipv4: + - address: 192.168.0.2/24 + - address: 192.168.2.1/24 + secondary: true + state: overridden + + # After state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3 + # ipv4 address 192.168.0.1 255.255.255.0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3.700 + # ipv4 address 192.168.0.2 255.255.255.0 + # ipv4 address 192.168.2.1 255.255.255.0 secondary + # ! + # interface GigabitEthernet0/0/0/4 + # shutdown + # ! + + # Using replaced + + # Before state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3 + # ipv4 address 192.168.0.2 255.255.255.0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3.700 + # ipv4 address 192.168.0.1 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/4 + # ipv6 address fd5d:12c9:2201:1::1/64 + # shutdown + # ! + + - name: Replaces device configuration of listed interfaces with provided configuration + cisco.iosxr.iosxr_l3_interfaces: + config: + - name: GigabitEthernet0/0/0/3 + ipv6: + - address: fd5d:12c9:2201:1::1/64 + - name: GigabitEthernet0/0/0/4 + ipv4: + - address: 192.168.0.2/24 + state: replaced + + # After state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3 + # ipv6 address fd5d:12c9:2201:1::1/64 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3.700 + # ipv4 address 192.168.0.1 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/4 + # ipv4 address 192.168.0.2 255.255.255.0 + # shutdown + # ! + + # Using deleted + + # Before state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # ipv4 address 192.168.2.1 255.255.255.0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # ipv4 address 192.168.3.1 255.255.255.0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3 + # ipv4 address 192.168.0.2 255.255.255.0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3.700 + # ipv4 address 192.168.0.1 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/4 + # ipv6 address fd5d:12c9:2201:1::1/64 + # shutdown + # ! + + - name: "Delete L3 attributes of given interfaces (Note: This won't delete the interface itself)" + cisco.iosxr.iosxr_l3_interfaces: + config: + - name: GigabitEthernet0/0/0/3 + - name: GigabitEthernet0/0/0/4 + - name: GigabitEthernet0/0/0/3.700 + state: deleted + + # After state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # ipv4 address 192.168.2.1 255.255.255.0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # ipv4 address 192.168.3.1 255.255.255.0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3.700 + # ! + # interface GigabitEthernet0/0/0/4 + # shutdown + # ! + + # Using Deleted without any config passed + # "(NOTE: This will delete all of configured resource module attributes from each configured interface)" + + # Before state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # ipv4 address 192.168.2.1 255.255.255.0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # ipv4 address 192.168.3.1 255.255.255.0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3 + # ipv4 address 192.168.0.2 255.255.255.0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3.700 + # ipv4 address 192.168.0.1 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/4 + # ipv6 address fd5d:12c9:2201:1::1/64 + # shutdown + # ! + + + - name: "Delete L3 attributes of all interfaces (Note: This won't delete the interface itself)" + cisco.iosxr.iosxr_l3_interfaces: + state: deleted + + # After state: + # ------------- + # + # viosxr#show running-config interface + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3.700 + # ! + # interface GigabitEthernet0/0/0/4 + # shutdown + # ! + + + # Using parsed + # parsed.cfg + # ------------ + # + # nterface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 10.8.38.70 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/0 + # description Configured and Merged by Ansible-Network + # mtu 66 + # ipv4 address 192.0.2.1 255.255.255.0 + # ipv4 address 192.0.2.2 255.255.255.0 secondary + # ipv6 address 2001:db8:0:3::/64 + # duplex half + # ! + # interface GigabitEthernet0/0/0/1 + # description Configured and Merged by Ansible-Network + # mtu 66 + # speed 100 + # duplex full + # dot1q native vlan 10 + # l2transport + # l2protocol cdp forward + # l2protocol pvst tunnel + # propagate remote-status + # ! + # ! + # interface GigabitEthernet0/0/0/3 + # ipv4 address 192.0.22.1 255.255.255.0 + # ipv4 address 192.0.23.1 255.255.255.0 + # ! + # - name: Convert L3 interfaces config to argspec without connecting to the appliance + # cisco.iosxr.iosxr_l3_interfaces: + # running_config: "{{ lookup('file', './parsed.cfg') }}" + # state: parsed + # Task Output (redacted) + # ----------------------- + # "parsed": [ + # { + # "ipv4": [ + # { + # "address": "192.0.2.1 255.255.255.0" + # }, + # { + # "address": "192.0.2.2 255.255.255.0", + # "secondary": true + # } + # ], + # "ipv6": [ + # { + # "address": "2001:db8:0:3::/64" + # } + # ], + # "name": "GigabitEthernet0/0/0/0" + # }, + # { + # "name": "GigabitEthernet0/0/0/1" + # }, + # { + # "ipv4": [ + # { + # "address": "192.0.22.1 255.255.255.0" + # }, + # { + # "address": "192.0.23.1 255.255.255.0" + # } + # ], + # "name": "GigabitEthernet0/0/0/3" + # } + # ] + + + # Using rendered + - name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_l3_interfaces: + config: + + - name: GigabitEthernet0/0/0/0 + ipv4: + + - address: 198.51.100.1/24 + + - name: GigabitEthernet0/0/0/1 + ipv6: + + - address: 2001:db8:0:3::/64 + ipv4: + + - address: 192.0.2.1/24 + + - address: 192.0.2.2/24 + secondary: true + state: rendered + # Task Output (redacted) + # ----------------------- + # "rendered": [ + # "interface GigabitEthernet0/0/0/0", + # "ipv4 address 198.51.100.1 255.255.255.0", + # "interface GigabitEthernet0/0/0/1", + # "ipv4 address 192.0.2.2 255.255.255.0 secondary", + # "ipv4 address 192.0.2.1 255.255.255.0", + # "ipv6 address 2001:db8:0:3::/64" + # ] + # Using gathered + # Before state: + # ------------ + # + # RP/0/0/CPU0:an-iosxr-02#show running-config interface + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 10.8.38.70 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/0 + # description Configured and Merged by Ansible-Network + # mtu 66 + # ipv4 address 192.0.2.1 255.255.255.0 + # ipv4 address 192.0.2.2 255.255.255.0 secondary + # ipv6 address 2001:db8:0:3::/64 + # duplex half + # ! + # interface GigabitEthernet0/0/0/1 + # description Configured and Merged by Ansible-Network + # mtu 66 + # speed 100 + # duplex full + # dot1q native vlan 10 + # l2transport + # l2protocol cdp forward + # l2protocol pvst tunnel + # propagate remote-status + # ! + # ! + # interface GigabitEthernet0/0/0/3 + # shutdown + # ! + # interface GigabitEthernet0/0/0/4 + # shutdown + # dot1q native vlan 40 + # ! + - name: Gather IOSXR l3 interfaces as in given arguments + cisco.iosxr.iosxr_l3_interfaces: + config: + state: gathered + # Task Output (redacted) + # ----------------------- + # + # "gathered": [ + # { + # "name": "Loopback888" + # }, + # { + # "ipv4": [ + # { + # "address": "192.0.2.1 255.255.255.0" + # }, + # { + # "address": "192.0.2.2 255.255.255.0", + # "secondary": true + # } + # ], + # "ipv6": [ + # { + # "address": "2001:db8:0:3::/64" + # } + # ], + # "name": "GigabitEthernet0/0/0/0" + # }, + # { + # "name": "GigabitEthernet0/0/0/1" + # }, + # { + # "name": "GigabitEthernet0/0/0/3" + # }, + # { + # "name": "GigabitEthernet0/0/0/4" + # } + # ] + # After state: + # ------------ + # + # RP/0/0/CPU0:an-iosxr-02#show running-config interface + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 10.8.38.70 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/0 + # description Configured and Merged by Ansible-Network + # mtu 66 + # ipv4 address 192.0.2.1 255.255.255.0 + # ipv4 address 192.0.2.2 255.255.255.0 secondary + # ipv6 address 2001:db8:0:3::/64 + # duplex half + # ! + # interface GigabitEthernet0/0/0/1 + # description Configured and Merged by Ansible-Network + # mtu 66 + # speed 100 + # duplex full + # dot1q native vlan 10 + # l2transport + # l2protocol cdp forward + # l2protocol pvst tunnel + # propagate remote-status + # ! + # ! + # interface GigabitEthernet0/0/0/3 + # shutdown + # ! + # interface GigabitEthernet0/0/0/4 + # shutdown + # dot1q native vlan 40 + # ! + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ after + +
+ list +
+
when changed +
The configuration as structured data after module completion.
+
+
Sample:
+
The configuration returned will always be in the same format of the parameters above.
+
+
+ before + +
+ list +
+
always +
The configuration as structured data prior to module invocation.
+
+
Sample:
+
The configuration returned will always be in the same format of the parameters above.
+
+
+ commands + +
+ list +
+
always +
The set of commands pushed to the remote device
+
+
Sample:
+
['interface GigabitEthernet0/0/0/1', 'ipv4 address 192.168.0.1 255.255.255.0']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Sumit Jaiswal (@justjais) +- Rohit Thakur (@rohitthakur2590) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lacp_interfaces_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lacp_interfaces_module.rst new file mode 100644 index 00000000..badc6eb8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lacp_interfaces_module.rst @@ -0,0 +1,802 @@ +.. _cisco.iosxr.iosxr_lacp_interfaces_module: + + +********************************* +cisco.iosxr.iosxr_lacp_interfaces +********************************* + +**LACP interfaces resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages Link Aggregation Control Protocol (LACP) attributes of interfaces on IOS-XR devices. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A dictionary of LACP interfaces options.
+
+
+ churn_logging + +
+ string +
+
+
    Choices: +
  • actor
  • +
  • partner
  • +
  • both
  • +
+
+
Specifies the parameter for logging of LACP churn events.
+
Valid only for ether-bundles.
+
Mode 'actor' logs actor churn events only.
+
Mode 'partner' logs partner churn events only.
+
Mode 'both' logs actor and partner churn events only.
+
+
+ collector_max_delay + +
+ integer +
+
+ +
Specifies the collector max delay to be signaled to the LACP partner.
+
Valid only for ether-bundles.
+
Refer to vendor documentation for valid values.
+
+
+ name + +
+ string +
+
+ +
Name/Identifier of the interface or Ether-Bundle.
+
+
+ period + +
+ integer +
+
+ +
Specifies the rate at which packets are sent or received.
+
For ether-bundles, this specifies the period to be used by its member links.
+
Refer to vendor documentation for valid values.
+
+
+ switchover_suppress_flaps + +
+ integer +
+
+ +
Specifies the time for which to suppress flaps during a LACP switchover.
+
Valid only for ether-bundles.
+
Refer to vendor documentation for valid values.
+
+
+ system + +
+ dictionary +
+
+ +
This dict object contains configurable options related to LACP system parameters for ether-bundles.
+
+
+ mac + +
+ string +
+
+ +
Specifies the system ID to use in LACP negotiations for the bundle, encoded as a MAC address.
+
+
+ priority + +
+ integer +
+
+ +
Specifies the system priority to use in LACP negotiations for the bundle.
+
Refer to vendor documentation for valid values.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the IOS-XR device by executing the command show running-config int.
+
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • merged ←
  • +
  • replaced
  • +
  • overridden
  • +
  • deleted
  • +
  • parsed
  • +
  • gathered
  • +
  • rendered
  • +
+
+
The state of the configuration after module completion.
+
+
+ + +Notes +----- + +.. note:: + - Tested against IOS-XR 6.1.3. + - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + # + # + # ------------ + # Before state + # ------------ + # + # + # + # RP/0/0/CPU0:an-iosxr#sh running-config interface + # Sun Jul 21 18:01:35.079 UTC + # interface Bundle-Ether10 + # ! + # interface Bundle-Ether11 + # ! + # interface Bundle-Ether12 + # ! + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description 'GigabitEthernet - 1' + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # ! + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # ! + # + # + + - name: Merge provided configuration with device configuration + cisco.iosxr.iosxr_lacp_interfaces: + config: + - name: Bundle-Ether10 + churn_logging: actor + collector_max_delay: 100 + switchover_suppress_flaps: 500 + + - name: Bundle-Ether11 + system: + mac: 00c2.4c00.bd15 + + - name: GigabitEthernet0/0/0/1 + period: 200 + state: merged + + # + # + # ----------- + # After state + # ----------- + # + # + # RP/0/0/CPU0:an-iosxr#sh run int + # Sun Jul 21 18:24:52.413 UTC + # interface Bundle-Ether10 + # lacp churn logging actor + # lacp switchover suppress-flaps 500 + # lacp collector-max-delay 100 + # ! + # interface Bundle-Ether11 + # lacp system mac 00c2.4c00.bd15 + # ! + # interface Bundle-Ether12 + # ! + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description 'GigabitEthernet - 1" + # lacp period 200 + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # ! + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # ! + # + + + # Using replaced + # + # + # ------------ + # Before state + # ------------ + # + # + # RP/0/0/CPU0:an-iosxr#sh run int + # Sun Jul 21 18:24:52.413 UTC + # interface Bundle-Ether10 + # lacp churn logging actor + # lacp switchover suppress-flaps 500 + # lacp collector-max-delay 100 + # ! + # interface Bundle-Ether11 + # lacp system mac 00c2.4c00.bd15 + # ! + # interface Bundle-Ether12 + # ! + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description 'GigabitEthernet - 1" + # lacp period 200 + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # ! + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # ! + # + + - name: Replace LACP configuration of listed interfaces with provided configuration + cisco.iosxr.iosxr_lacp_interfaces: + config: + - name: Bundle-Ether10 + churn_logging: partner + + - name: GigabitEthernet0/0/0/2 + period: 300 + state: replaced + + # + # + # ----------- + # After state + # ----------- + # + # + # RP/0/0/CPU0:an-iosxr#sh run int + # Sun Jul 21 18:50:21.929 UTC + # interface Bundle-Ether10 + # lacp churn logging partner + # ! + # interface Bundle-Ether11 + # lacp system mac 00c2.4c00.bd15 + # ! + # interface Bundle-Ether12 + # ! + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description 'GigabitEthernet - 1" + # lacp period 200 + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # lacp period 300 + # ! + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # ! + # + # + + + # Using overridden + # + # + # ------------ + # Before state + # ------------ + # + # + # RP/0/0/CPU0:an-iosxr#sh run int + # Sun Jul 21 18:24:52.413 UTC + # interface Bundle-Ether10 + # lacp churn logging actor + # lacp switchover suppress-flaps 500 + # lacp collector-max-delay 100 + # ! + # interface Bundle-Ether11 + # lacp system mac 00c2.4c00.bd15 + # ! + # interface Bundle-Ether12 + # ! + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description 'GigabitEthernet - 1" + # lacp period 200 + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # lacp period 200 + # ! + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # ! + # + # + + - name: Override all interface LACP configuration with provided configuration + cisco.iosxr.iosxr_lacp_interfaces: + config: + - name: Bundle-Ether12 + churn_logging: both + collector_max_delay: 100 + switchover_suppress_flaps: 500 + + - name: GigabitEthernet0/0/0/1 + period: 300 + state: overridden + + # + # + # ----------- + # After state + # ----------- + # + # + # RP/0/0/CPU0:an-iosxr(config-if)#do sh run int + # Sun Jul 21 19:32:36.115 UTC + # interface Bundle-Ether10 + # ! + # interface Bundle-Ether11 + # ! + # interface Bundle-Ether12 + # lacp churn logging both + # lacp switchover suppress-flaps 500 + # lacp collector-max-delay 100 + # ! + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description 'GigabitEthernet - 1" + # lacp period 300 + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # ! + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # ! + # + + + # Using deleted + # + # + # ------------ + # Before state + # ------------ + # + # + # RP/0/0/CPU0:an-iosxr#sh run int + # Sun Jul 21 18:24:52.413 UTC + # interface Bundle-Ether10 + # lacp churn logging actor + # lacp switchover suppress-flaps 500 + # lacp collector-max-delay 100 + # ! + # interface Bundle-Ether11 + # lacp non-revertive + # ! + # interface Bundle-Ether12 + # ! + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description 'GigabitEthernet - 1" + # lacp period 200 + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # lacp period 300 + # ! + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # ! + # + + - name: Deleted LACP configurations of provided interfaces (Note - This won't delete + the interface itself) + cisco.iosxr.iosxr_lacp_interfaces: + config: + - name: Bundle-Ether10 + - name: Bundle-Ether11 + - name: GigabitEthernet0/0/0/1 + - name: GigabitEthernet0/0/0/2 + state: deleted + + # + # + # ----------- + # After state + # ----------- + # + # + # Using parsed: + + # parsed.cfg + # interface Bundle-Ether10 + # lacp churn logging actor + # lacp switchover suppress-flaps 500 + # lacp collector-max-delay 100 + # ! + # interface Bundle-Ether11 + # lacp system mac 00c2.4c00.bd15 + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # lacp period 200 + # ! + # + + - name: Convert lacp interfaces config to argspec without connecting to the appliance + cisco.iosxr.iosxr_lacp_interfaces: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed + + # -------------- + # Output: + # -------------- + + # parsed: + # - name: Bundle-Ether10 + # churn_logging: actor + # collector_max_delay: 100 + # switchover_suppress_flaps: 500 + # + # - name: Bundle-Ether11 + # system: + # mac: 00c2.4c00.bd15 + # + # - name: GigabitEthernet0/0/0/1 + # period: 200 + # + # + + # Using gathered: + + # Native config: + # interface Bundle-Ether10 + # lacp churn logging actor + # lacp switchover suppress-flaps 500 + # lacp collector-max-delay 100 + # ! + # interface Bundle-Ether11 + # lacp system mac 00c2.4c00.bd15 + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # lacp period 200 + # ! + # + + - name: Gather IOSXR lacp interfaces configuration + cisco.iosxr.iosxr_lacp_interfaces: + config: + state: gathered + + # ---------- + # Output + # --------- + # gathered: + # - name: Bundle-Ether10 + # churn_logging: actor + # collector_max_delay: 100 + # switchover_suppress_flaps: 500 + # + # - name: Bundle-Ether11 + # system: + # mac: 00c2.4c00.bd15 + # + # - name: GigabitEthernet0/0/0/1 + # period: 200 + + # Using rendered: + + - name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_lacp_interfaces: + config: + - name: Bundle-Ether10 + churn_logging: actor + collector_max_delay: 100 + switchover_suppress_flaps: 500 + + - name: Bundle-Ether11 + system: + mac: 00c2.4c00.bd15 + + - name: GigabitEthernet0/0/0/1 + period: 200 + state: rendered + + # ------------- + # Output + # ------------- + # rendered: [ + # - "interface Bundle-Ether10" + # - " lacp churn logging actor" + # - " lacp switchover suppress-flaps 500" + # - " lacp collector-max-delay 100" + # - "interface Bundle-Ether11" + # - " lacp system mac 00c2.4c00.bd15" + # - "interface MgmtEth0/0/CPU0/0" + # - " ipv4 address 192.0.2.11 255.255.255.0" + # - "interface GigabitEthernet0/0/0/1" + # - " lacp period 200" + # + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ after + +
+ list +
+
when changed +
The configuration as structured data after module completion.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ before + +
+ list +
+
always +
The configuration as structured data prior to module invocation.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ commands + +
+ list +
+
always +
The set of commands pushed to the remote device.
+
+
Sample:
+
['interface Bundle-Ether10', 'lacp churn logging partner', 'lacp period 150']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Nilashish Chakraborty (@nilashishc) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lacp_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lacp_module.rst new file mode 100644 index 00000000..a42ae0d6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lacp_module.rst @@ -0,0 +1,500 @@ +.. _cisco.iosxr.iosxr_lacp_module: + + +********************** +cisco.iosxr.iosxr_lacp +********************** + +**LACP resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages Global Link Aggregation Control Protocol (LACP) on IOS-XR devices. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ dictionary +
+
+ +
The provided configurations.
+
+
+ system + +
+ dictionary +
+
+ +
This option sets the default system parameters for LACP bundles.
+
+
+ mac + +
+ dictionary +
+
+ +
The system MAC related configuration for LACP.
+
+
+ address + +
+ string +
+
+ +
The system ID to use in LACP negotiations.
+
+
+ priority + +
+ integer +
+
+ +
The system priority to use in LACP negotiations.
+
Lower value is higher priority.
+
Refer to vendor documentation for valid values.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the IOS-XR device by executing the command show running-config lacp.
+
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • merged ←
  • +
  • replaced
  • +
  • deleted
  • +
  • parsed
  • +
  • rendered
  • +
  • gathered
  • +
+
+
The state of the configuration after module completion.
+
+
+ + +Notes +----- + +.. note:: + - Tested against IOS-XR 6.1.3. + - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + # + # + # ------------ + # Before state + # ------------ + # + # + # RP/0/0/CPU0:iosxr01#show running-config lacp + # Tue Jul 16 17:46:08.147 UTC + # % No such configuration item(s) + # + # + + - name: Merge provided configuration with device configuration + cisco.iosxr.iosxr_lacp: + config: + system: + priority: 10 + mac: + address: 00c1.4c00.bd15 + state: merged + + # + # + # ----------------------- + # Module Execution Result + # ----------------------- + # + # "before": {} + # + # + # "commands": [ + # "lacp system priority 10", + # "lacp system mac 00c1.4c00.bd15" + # ] + # + # + # "after": { + # "system": { + # "mac": { + # "address": "00c1.4c00.bd15" + # }, + # "priority": 10 + # } + # } + # + # ----------- + # After state + # ----------- + # + # + # RP/0/0/CPU0:iosxr01#sh run lacp + # Tue Jul 16 17:51:29.365 UTC + # lacp system mac 00c1.4c00.bd15 + # lacp system priority 10 + # + # + + # Using replaced + # + # + # ------------- + # Before state + # ------------- + # + # + # RP/0/0/CPU0:iosxr01#sh run lacp + # Tue Jul 16 17:53:59.904 UTC + # lacp system mac 00c1.4c00.bd15 + # lacp system priority 10 + # + + - name: Replace device global lacp configuration with the given configuration + cisco.iosxr.iosxr_lacp: + config: + system: + priority: 11 + state: replaced + # + # + # ----------------------- + # Module Execution Result + # ----------------------- + # "before": { + # "system": { + # "mac": { + # "address": "00c1.4c00.bd15" + # }, + # "priority": 10 + # } + # } + # + # + # "commands": [ + # "no lacp system mac", + # "lacp system priority 11" + # ] + # + # + # "after": { + # "system": { + # "priority": 11 + # } + # } + # + # ----------- + # After state + # ----------- + # + # + # RP/0/0/CPU0:iosxr01#sh run lacp + # Tue Jul 16 18:02:40.379 UTC + # lacp system priority 11 + # + # + + # Using deleted + # + # + # ------------ + # Before state + # ------------ + # + # + # RP/0/0/CPU0:iosxr01#sh run lacp + # Tue Jul 16 18:37:09.727 UTC + # lacp system mac 00c1.4c00.bd15 + # lacp system priority 11 + # + # + + - name: Delete global LACP configurations from the device + cisco.iosxr.iosxr_lacp: + state: deleted + + # + # + # ----------------------- + # Module Execution Result + # ----------------------- + # "before": { + # "system": { + # "mac": { + # "address": "00c1.4c00.bd15" + # }, + # "priority": 11 + # } + # } + # + # + # "commands": [ + # "no lacp system mac", + # "no lacp system priority" + # ] + # + # + # "after": {} + # + # ------------ + # After state + # ------------ + # + # + # RP/0/0/CPU0:iosxr01#sh run lacp + # Tue Jul 16 18:39:44.116 UTC + # % No such configuration item(s) + # + # + + + # Using parsed + # parsed.cfg + # ------------ + # + # lacp system mac 00c1.4c00.bd15 + # lacp system priority 11 + # - name: Convert LACP config to argspec without connecting to the appliance + # cisco.iosxr.iosxr_lacp: + # running_config: "{{ lookup('file', './parsed.cfg') }}" + # state: parsed + # Task Output (redacted) + # ----------------------- + # "parsed": { + # "system": { + # "mac": { + # "address": "00c1.4c00.bd15" + # }, + # "priority": 11 + # } + # } + + + # Using rendered + - name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_lacp: + config: + system: + priority: 11 + mac: + address: 00c1.4c00.bd15 + state: rendered + # Task Output (redacted) + # ----------------------- + # "rendered": [ + # "lacp system priority 11", + # "lacp system mac 00c1.4c00.bd15" + # ] + + + # Using gathered + # Before state: + # ------------ + # + # RP/0/0/CPU0:an-iosxr-02#show running-config lacp + # lacp system mac 00c1.4c00.bd15 + # lacp system priority 11 + - name: Gather IOSXR LACP configuration + cisco.iosxr.iosxr_lacp: + config: + state: gathered + # Task Output (redacted) + # ----------------------- + # + # "gathered": { + # "system": { + # "mac": { + # "address": "00c1.4c00.bd15" + # }, + # "priority": 11 + # } + # } + # After state: + # ------------ + # + # RP/0/0/CPU0:an-iosxr-02#show running-config lacp + # lacp system mac 00c1.4c00.bd15 + # lacp system priority + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ after + +
+ dictionary +
+
when changed +
The configuration as structured data after module completion.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ before + +
+ dictionary +
+
always +
The configuration as structured data prior to module invocation.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ commands + +
+ list +
+
always +
The set of commands pushed to the remote device.
+
+
Sample:
+
['lacp system priority 10', 'lacp system mac 00c1.4c00.bd15']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Nilashish Chakraborty (@nilashishc) +- Rohit Thakur (@rohitthakur2590) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lag_interfaces_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lag_interfaces_module.rst new file mode 100644 index 00000000..12463e21 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lag_interfaces_module.rst @@ -0,0 +1,1033 @@ +.. _cisco.iosxr.iosxr_lag_interfaces_module: + + +******************************** +cisco.iosxr.iosxr_lag_interfaces +******************************** + +**LAG interfaces resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages the attributes of LAG/Ether-Bundle interfaces on IOS-XR devices. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A provided Link Aggregation Group (LAG) configuration.
+
+
+ links + +
+ dictionary +
+
+ +
This dict contains configurable options related to LAG/Ether-Bundle links.
+
+
+ max_active + +
+ integer +
+
+ +
Specifies the limit on the number of links that can be active in the LAG/Ether-Bundle.
+
Refer to vendor documentation for valid values.
+
+
+ min_active + +
+ integer +
+
+ +
Specifies the minimum number of active links needed to bring up the LAG/Ether-Bundle.
+
Refer to vendor documentation for valid values.
+
+
+ load_balancing_hash + +
+ string +
+
+
    Choices: +
  • dst-ip
  • +
  • src-ip
  • +
+
+
Specifies the hash function used for traffic forwarded over the LAG/Ether-Bundle.
+
Option 'dst-ip' uses the destination IP as the hash function.
+
Option 'src-ip' uses the source IP as the hash function.
+
+
+ members + +
+ list + / elements=dictionary +
+
+ +
List of member interfaces for the LAG/Ether-Bundle.
+
+
+ member + +
+ string +
+
+ +
Name of the member interface.
+
+
+ mode + +
+ string +
+
+
    Choices: +
  • on
  • +
  • active
  • +
  • passive
  • +
  • inherit
  • +
+
+
Specifies the mode of the operation for the member interface.
+
Mode 'active' runs LACP in active mode.
+
Mode 'on' does not run LACP over the port.
+
Mode 'passive' runs LACP in passive mode over the port.
+
Mode 'inherit' runs LACP as configured in the bundle.
+
+
+ mode + +
+ string +
+
+
    Choices: +
  • on
  • +
  • active
  • +
  • passive
  • +
+
+
LAG mode.
+
Mode 'active' runs LACP in active mode over the port.
+
Mode 'on' does not run LACP over the port.
+
Mode 'passive' runs LACP in passive mode over the port.
+
+
+ name + +
+ string + / required +
+
+ +
Name/Identifier of the LAG/Ether-Bundle to configure.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the IOS-XR device by executing the command show running-config int.
+
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • merged ←
  • +
  • replaced
  • +
  • overridden
  • +
  • deleted
  • +
  • parsed
  • +
  • rendered
  • +
  • gathered
  • +
+
+
The state of the configuration after module completion.
+
+
+ + +Notes +----- + +.. note:: + - Tested against IOS-XR 6.1.3. + - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + # + # + # ------------ + # Before state + # ------------ + # + # RP/0/0/CPU0:iosxr01#show run int + # Sun Jul 7 19:42:59.416 UTC + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description "GigabitEthernet - 1" + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # ! + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # ! + # + # + - name: Merge provided configuration with device configuration + cisco.iosxr.iosxr_lag_interfaces: + config: + - name: Bundle-Ether10 + members: + - member: GigabitEthernet0/0/0/1 + mode: inherit + - member: GigabitEthernet0/0/0/3 + mode: inherit + mode: active + links: + max_active: 5 + min_active: 2 + load_balancing_hash: src-ip + + - name: Bundle-Ether12 + members: + - member: GigabitEthernet0/0/0/2 + mode: passive + - member: GigabitEthernet0/0/0/4 + mode: passive + load_balancing_hash: dst-ip + state: merged + # + # + # ----------- + # After state + # ----------- + # + # RP/0/0/CPU0:iosxr01#show run int + # Sun Jul 7 20:51:17.685 UTC + # interface Bundle-Ether10 + # lacp mode active + # bundle load-balancing hash src-ip + # bundle maximum-active links 5 + # bundle minimum-active links 2 + # ! + # interface Bundle-Ether12 + # bundle load-balancing hash dst-ip + # ! + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description 'GigabitEthernet - 1" + # bundle id 10 mode inherit + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # bundle id 12 mode passive + # ! + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # bundle id 10 mode inherit + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # bundle id 12 mode passive + # ! + # + + + # Using replaced + # + # + # ------------- + # Before state + # ------------- + # + # + # RP/0/0/CPU0:iosxr01#sho run int + # Sun Jul 7 20:58:06.527 UTC + # interface Bundle-Ether10 + # lacp mode active + # bundle load-balancing hash src-ip + # bundle maximum-active links 5 + # bundle minimum-active links 2 + # ! + # interface Bundle-Ether12 + # bundle load-balancing hash dst-ip + # ! + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description 'GigabitEthernet - 1" + # bundle id 10 mode inherit + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # bundle id 12 mode passive + # ! + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # bundle id 10 mode inherit + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # bundle id 12 mode passive + # ! + # + # + - name: Replace device configuration of listed Bundles with provided configurations + cisco.iosxr.iosxr_lag_interfaces: + config: + - name: Bundle-Ether12 + members: + - name: GigabitEthernet0/0/0/2 + mode: passive + + - name: Bundle-Ether11 + members: + - name: GigabitEthernet0/0/0/4 + load_balancing_hash: src-ip + state: replaced + # + # + # ----------- + # After state + # ----------- + # + # + # RP/0/0/CPU0:iosxr01#sh run int + # Sun Jul 7 21:22:27.397 UTC + # interface Bundle-Ether10 + # lacp mode active + # bundle load-balancing hash src-ip + # bundle maximum-active links 5 + # bundle minimum-active links 2 + # ! + # interface Bundle-Ether11 + # bundle load-balancing hash src-ip + # ! + # interface Bundle-Ether12 + # lacp mode passive + # ! + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description 'GigabitEthernet - 1" + # bundle id 10 mode inherit + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # bundle id 12 mode on + # ! + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # bundle id 10 mode inherit + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # bundle id 11 mode on + # ! + # + # + + + # Using overridden + # + # + # ------------ + # Before state + # ------------ + # + # + # RP/0/0/CPU0:iosxr01#sh run int + # Sun Jul 7 21:22:27.397 UTC + # interface Bundle-Ether10 + # lacp mode active + # bundle load-balancing hash src-ip + # bundle maximum-active links 5 + # bundle minimum-active links 2 + # ! + # interface Bundle-Ether11 + # bundle load-balancing hash src-ip + # ! + # interface Bundle-Ether12 + # lacp mode passive + # ! + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description 'GigabitEthernet - 1" + # bundle id 10 mode inherit + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # bundle id 12 mode on + # ! + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # bundle id 10 mode inherit + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # bundle id 11 mode on + # ! + # + # + + - name: Overrides all device configuration with provided configuration + cisco.iosxr.iosxr_lag_interfaces: + config: + - name: Bundle-Ether10 + members: + - member: GigabitEthernet0/0/0/1 + mode: inherit + - member: GigabitEthernet0/0/0/2 + mode: inherit + mode: active + load_balancing_hash: dst-ip + state: overridden + # + # + # ------------ + # After state + # ------------ + # + # + # RP/0/0/CPU0:iosxr01#sh run int + # Sun Jul 7 21:43:04.802 UTC + # interface Bundle-Ether10 + # lacp mode active + # bundle load-balancing hash dst-ip + # ! + # interface Bundle-Ether11 + # ! + # interface Bundle-Ether12 + # ! + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description 'GigabitEthernet - 1" + # bundle id 10 mode inherit + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # bundle id 10 mode inherit + # ! + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # ! + # + # + + + # Using deleted + # + # + # ------------ + # Before state + # ------------ + # + # RP/0/0/CPU0:iosxr01#sh run int + # Sun Jul 7 21:22:27.397 UTC + # interface Bundle-Ether10 + # lacp mode active + # bundle load-balancing hash src-ip + # bundle maximum-active links 5 + # bundle minimum-active links 2 + # ! + # interface Bundle-Ether11 + # bundle load-balancing hash src-ip + # ! + # interface Bundle-Ether12 + # lacp mode passive + # ! + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description 'GigabitEthernet - 1" + # bundle id 10 mode inherit + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # bundle id 12 mode on + # !n + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # bundle id 10 mode inherit + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # bundle id 11 mode on + # ! + # + # + + - name: Delete attributes of given bundles and removes member interfaces from them + (Note - This won't delete the bundles themselves) + cisco.iosxr.iosxr_lag_interfaces: + config: + - name: Bundle-Ether10 + - name: Bundle-Ether11 + - name: Bundle-Ether12 + state: deleted + + # + # + # ------------ + # After state + # ------------ + # + # RP/0/0/CPU0:iosxr01#sh run int + # Sun Jul 7 21:49:50.004 UTC + # interface Bundle-Ether10 + # ! + # interface Bundle-Ether11 + # ! + # interface Bundle-Ether12 + # ! + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description 'GigabitEthernet - 1" + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # ! + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # ! + # + # + + # Using deleted (without config) + # + # + # ------------ + # Before state + # ------------ + # + # RP/0/0/CPU0:an-iosxr#sh run int + # Sun Aug 18 19:49:51.908 UTC + # interface Bundle-Ether10 + # lacp mode active + # bundle load-balancing hash src-ip + # bundle maximum-active links 10 + # bundle minimum-active links 2 + # ! + # interface Bundle-Ether11 + # bundle load-balancing hash dst-ip + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/1 + # bundle id 10 mode inherit + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # bundle id 10 mode passive + # shutdown + # ! + # interface GigabitEthernet0/0/0/3 + # bundle id 11 mode passive + # shutdown + # ! + # interface GigabitEthernet0/0/0/4 + # bundle id 11 mode passive + # shutdown + # ! + # + + - name: Delete attributes of all bundles and removes member interfaces from them (Note + - This won't delete the bundles themselves) + cisco.iosxr.iosxr_lag_interfaces: + state: deleted + + # + # + # ------------ + # After state + # ------------ + # + # + # RP/0/0/CPU0:an-iosxr#sh run int + # Sun Aug 18 19:54:22.389 UTC + # interface Bundle-Ether10 + # ! + # interface Bundle-Ether11 + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 10.8.38.69 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/0 + # shutdown + # ! + # interface GigabitEthernet0/0/0/1 + # shutdown + # ! + # interface GigabitEthernet0/0/0/2 + # shutdown + # ! + # interface GigabitEthernet0/0/0/3 + # shutdown + # ! + # interface GigabitEthernet0/0/0/4 + # shutdown + # ! + + # Using parsed: + + # parsed.cfg + + # interface Bundle-Ether10 + # lacp mode active + # bundle load-balancing hash src-ip + # bundle maximum-active links 5 + # bundle minimum-active links 2 + # ! + # interface Bundle-Ether12 + # bundle load-balancing hash dst-ip + # ! + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description 'GigabitEthernet - 1" + # bundle id 10 mode inherit + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # bundle id 12 mode passive + # ! + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # bundle id 10 mode inherit + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # bundle id 12 mode passive + # ! + # + - name: Convert lag interfaces config to argspec without connecting to the appliance + cisco.iosxr.iosxr_lag_interfaces: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed + + # -------------- + # Output + # -------------- + # parsed: + # - name: Bundle-Ether10 + # members: + # - member: GigabitEthernet0/0/0/1 + # mode: inherit + # - member: GigabitEthernet0/0/0/3 + # mode: inherit + # mode: active + # links: + # max_active: 5 + # min_active: 2 + # load_balancing_hash: src-ip + + # - name: Bundle-Ether12 + # members: + # - member: GigabitEthernet0/0/0/2 + # mode: passive + # - member: GigabitEthernet0/0/0/4 + # mode: passive + # load_balancing_hash: dst-ip + + # using gathered + + # Device Config: + # ------------- + + # interface Bundle-Ether10 + # lacp mode active + # bundle load-balancing hash src-ip + # bundle maximum-active links 5 + # bundle minimum-active links 2 + # ! + # interface Bundle-Ether12 + # bundle load-balancing hash dst-ip + # ! + # interface Loopback888 + # description test for ansible + # shutdown + # ! + # interface MgmtEth0/0/CPU0/0 + # ipv4 address 192.0.2.11 255.255.255.0 + # ! + # interface GigabitEthernet0/0/0/1 + # description 'GigabitEthernet - 1" + # bundle id 10 mode inherit + # ! + # interface GigabitEthernet0/0/0/2 + # description "GigabitEthernet - 2" + # bundle id 12 mode passive + # ! + # interface GigabitEthernet0/0/0/3 + # description "GigabitEthernet - 3" + # bundle id 10 mode inherit + # ! + # interface GigabitEthernet0/0/0/4 + # description "GigabitEthernet - 4" + # bundle id 12 mode passive + # ! + # + + - name: Gather IOSXR lag interfaces configuration + cisco.iosxr.iosxr_lag_interfaces: + config: + state: gathered + + # -------------- + # Output + # -------------- + # gathered: + # - name: Bundle-Ether10 + # members: + # - member: GigabitEthernet0/0/0/1 + # mode: inherit + # - member: GigabitEthernet0/0/0/3 + # mode: inherit + # mode: active + # links: + # max_active: 5 + # min_active: 2 + # load_balancing_hash: src-ip + + # - name: Bundle-Ether12 + # members: + # - member: GigabitEthernet0/0/0/2 + # mode: passive + # - member: GigabitEthernet0/0/0/4 + # mode: passive + # load_balancing_hash: dst-ip + + # Using rendered: + - name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_lag_interfaces: + config: + - name: Bundle-Ether10 + members: + - member: GigabitEthernet0/0/0/1 + mode: inherit + - member: GigabitEthernet0/0/0/3 + mode: inherit + mode: active + links: + max_active: 5 + min_active: 2 + load_balancing_hash: src-ip + + - name: Bundle-Ether12 + members: + - member: GigabitEthernet0/0/0/2 + mode: passive + - member: GigabitEthernet0/0/0/4 + mode: passive + load_balancing_hash: dst-ip + state: rendered + + # Output: + + # rendered: + # [ + # - "interface Bundle-Ether10" + # - " lacp mode active" + # - " bundle load-balancing hash src-ip" + # - " bundle maximum-active links 5" + # - " bundle minimum-active links 2" + # - "interface Bundle-Ether12" + # - " bundle load-balancing hash dst-ip" + # - "interface Loopback888" + # - " description test for ansible" + # - " shutdown" + # - "interface MgmtEth0/0/CPU0/0" + # - " ipv4 address 192.0.2.11 255.255.255.0" + # - "interface GigabitEthernet0/0/0/1" + # - " description 'GigabitEthernet - 1"" + # - " bundle id 10 mode inherit" + # - "interface GigabitEthernet0/0/0/2" + # - " description "GigabitEthernet - 2"" + # - " bundle id 12 mode passive" + # - "interface GigabitEthernet0/0/0/3" + # - " description "GigabitEthernet - 3"" + # - " bundle id 10 mode inherit" + # - "interface GigabitEthernet0/0/0/4" + # - " description "GigabitEthernet - 4"" + # - " bundle id 12 mode passive" + # ] + # + # + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ after + +
+ list +
+
when changed +
The configuration as structured data after module completion.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ before + +
+ list +
+
always +
The configuration as structured data prior to module invocation.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ commands + +
+ list +
+
always +
The set of commands pushed to the remote device.
+
+
Sample:
+
['interface Bundle-Ether10', 'bundle minimum-active links 2', 'bundle load-balancing hash src-ip']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Nilashish Chakraborty (@NilashishC) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lldp_global_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lldp_global_module.rst new file mode 100644 index 00000000..a667db37 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lldp_global_module.rst @@ -0,0 +1,692 @@ +.. _cisco.iosxr.iosxr_lldp_global_module: + + +***************************** +cisco.iosxr.iosxr_lldp_global +***************************** + +**LLDP resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages Global Link Layer Discovery Protocol (LLDP) settings on IOS-XR devices. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ dictionary +
+
+ +
The provided global LLDP configuration.
+
+
+ holdtime + +
+ integer +
+
+ +
Specifies the holdtime (in sec) to be sent in packets.
+
+
+ reinit + +
+ integer +
+
+ +
Specifies the delay (in sec) for LLDP initialization on any interface.
+
+
+ subinterfaces + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable or disable LLDP over sub-interfaces.
+
+
+ timer + +
+ integer +
+
+ +
Specifies the rate at which LLDP packets are sent (in sec).
+
+
+ tlv_select + +
+ dictionary +
+
+ +
Specifies the LLDP TLVs to enable or disable.
+
+
+ management_address + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable or disable management address TLV.
+
+
+ port_description + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable or disable port description TLV.
+
+
+ system_capabilities + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable or disable system capabilities TLV.
+
+
+ system_description + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable or disable system description TLV.
+
+
+ system_name + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable or disable system name TLV.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the IOS-XR device by executing the command show running-config lldp.
+
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • merged ←
  • +
  • replaced
  • +
  • deleted
  • +
  • parsed
  • +
  • gathered
  • +
  • rendered
  • +
+
+
The state of the configuration after module completion.
+
+
+ + +Notes +----- + +.. note:: + - Tested against IOS-XR 6.1.3. + - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + # + # + # ------------- + # Before State + # ------------- + # + # + # RP/0/0/CPU0:an-iosxr#sh run lldp + # Tue Aug 6 19:27:54.933 UTC + # % No such configuration item(s) + # + # + + - name: Merge provided LLDP configuration with the existing configuration + cisco.iosxr.iosxr_lldp_global: + config: + holdtime: 100 + reinit: 2 + timer: 3000 + subinterfaces: true + tlv_select: + management_address: false + system_description: false + state: merged + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "before": {} + # + # "commands": [ + # "lldp subinterfaces enable", + # "lldp holdtime 100", + # "lldp reinit 2", + # "lldp tlv-select system-description disable", + # "lldp tlv-select management-address disable", + # "lldp timer 3000" + # ] + # + # "after": { + # "holdtime": 100, + # "reinit": 2, + # "subinterfaces": true, + # "timer": 3000, + # "tlv_select": { + # "management_address": false, + # "system_description": false + # } + # } + # + # + # ------------ + # After state + # ------------ + # + # + # RP/0/0/CPU0:an-iosxr#sh run lldp + # Tue Aug 6 21:31:10.587 UTC + # lldp + # timer 3000 + # reinit 2 + # subinterfaces enable + # holdtime 100 + # tlv-select + # management-address disable + # system-description disable + # ! + # ! + # + # + + + # Using replaced + # + # + # ------------- + # Before State + # ------------- + # + # RP/0/0/CPU0:an-iosxr#sh run lldp + # Tue Aug 6 21:31:10.587 UTC + # lldp + # timer 3000 + # reinit 2 + # subinterfaces enable + # holdtime 100 + # tlv-select + # management-address disable + # system-description disable + # ! + # ! + # + # + + - name: Replace existing LLDP device configuration with provided configuration + cisco.iosxr.iosxr_lldp_global: + config: + holdtime: 100 + tlv_select: + port_description: false + system_description: true + management_description: true + state: replaced + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "before": { + # "holdtime": 100, + # "reinit": 2, + # "subinterfaces": true, + # "timer": 3000, + # "tlv_select": { + # "management_address": false, + # "system_description": false + # } + # } + # + # "commands": [ + # "no lldp reinit 2", + # "no lldp subinterfaces enable", + # "no lldp timer 3000", + # "no lldp tlv-select management-address disable", + # "no lldp tlv-select system-description disable", + # "lldp tlv-select port-description disable" + # ] + # + # "after": { + # "holdtime": 100, + # "tlv_select": { + # "port_description": false + # } + # } + # + # + # ------------ + # After state + # ------------ + # + # RP/0/0/CPU0:an-iosxr#sh run lldp + # Tue Aug 6 21:53:08.407 UTC + # lldp + # holdtime 100 + # tlv-select + # port-description disable + # ! + # ! + # + # + + + # Using deleted + # + # ------------ + # Before state + # ------------ + # + # + # RP/0/0/CPU0:an-iosxr#sh run lldp + # Tue Aug 6 21:31:10.587 UTC + # lldp + # timer 3000 + # reinit 2 + # subinterfaces enable + # holdtime 100 + # tlv-select + # management-address disable + # system-description disable + # ! + # ! + # + # + + - name: Deleted existing LLDP configurations from the device + cisco.iosxr.iosxr_lldp_global: + state: deleted + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "before": { + # "holdtime": 100, + # "reinit": 2, + # "subinterfaces": true, + # "timer": 3000, + # "tlv_select": { + # "management_address": false, + # "system_description": false + # } + # }, + # + # "commands": [ + # "no lldp holdtime 100", + # "no lldp reinit 2", + # "no lldp subinterfaces enable", + # "no lldp timer 3000", + # "no lldp tlv-select management-address disable", + # "no lldp tlv-select system-description disable" + # ] + # + # "after": {} + # + # + # ----------- + # After state + # ----------- + # + # RP/0/0/CPU0:an-iosxr#sh run lldp + # Tue Aug 6 21:38:31.187 UTC + # lldp + # ! + # + # Using parsed: + + # parsed.cfg + # lldp + # timer 3000 + # reinit 2 + # subinterfaces enable + # holdtime 100 + # tlv-select + # management-address disable + # system-description disable + # ! + # ! + + - name: Convert lldp global config to argspec without connecting to the appliance + cisco.iosxr.iosxr_lldp_global: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed + + # ------------------------ + # Module Execution Result + # ------------------------ + # parsed: + # holdtime: 100 + # reinit: 2 + # timer: 3000 + # subinterfaces: True + # tlv_select: + # management_address: False + # system_description: False + + # using gathered: + + # Device config: + # lldp + # timer 3000 + # reinit 2 + # subinterfaces enable + # holdtime 100 + # tlv-select + # management-address disable + # system-description disable + # ! + # ! + + - name: Gather IOSXR lldp global configuration + cisco.iosxr.iosxr_lldp_global: + config: + state: gathered + + + # ------------------------ + # Module Execution Result + # ------------------------ + # gathered: + # holdtime: 100 + # reinit: 2 + # timer: 3000 + # subinterfaces: True + # tlv_select: + # management_address: False + # system_description: False + + # using rendered: + + - name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_lldp_global: + config: + holdtime: 100 + reinit: 2 + timer: 3000 + subinterfaces: true + tlv_select: + management_address: false + system_description: false + state: rendered + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "rendered": [ + # "lldp subinterfaces enable", + # "lldp holdtime 100", + # "lldp reinit 2", + # "lldp tlv-select system-description disable", + # "lldp tlv-select management-address disable", + # "lldp timer 3000" + # ] + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ after + +
+ dictionary +
+
when changed +
The configuration as structured data after module completion.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ before + +
+ dictionary +
+
always +
The configuration as structured data prior to module invocation.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ commands + +
+ list +
+
always +
The set of commands pushed to the remote device.
+
+
Sample:
+
['lldp subinterfaces enable', 'lldp holdtime 100', 'no lldp tlv-select management-address disable']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Nilashish Chakraborty (@NilashishC) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lldp_interfaces_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lldp_interfaces_module.rst new file mode 100644 index 00000000..1ecb8fa5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lldp_interfaces_module.rst @@ -0,0 +1,849 @@ +.. _cisco.iosxr.iosxr_lldp_interfaces_module: + + +********************************* +cisco.iosxr.iosxr_lldp_interfaces +********************************* + +**LLDP interfaces resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages Link Layer Discovery Protocol (LLDP) attributes of interfaces on IOS-XR devices. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A dictionary of LLDP interfaces options.
+
+
+ destination + +
+ dictionary +
+
+ +
Specifies LLDP destination configuration on the interface.
+
+
+ mac_address + +
+ string +
+
+
    Choices: +
  • ieee-nearest-bridge
  • +
  • ieee-nearest-non-tmpr-bridge
  • +
+
+
Specifies the LLDP destination mac address on the interface.
+
+
+ name + +
+ string +
+
+ +
Name/Identifier of the interface or Ether-Bundle.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/disable LLDP RX on an interface.
+
+
+ transmit + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/disable LLDP TX on an interface.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the IOS-XR device by executing the command show running-config int.
+
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • merged ←
  • +
  • replaced
  • +
  • overridden
  • +
  • deleted
  • +
  • parsed
  • +
  • rendered
  • +
  • gathered
  • +
+
+
The state of the configuration after module completion.
+
+
+ + +Notes +----- + +.. note:: + - Tested against IOS-XR 6.1.3. + - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + # + # + # ------------ + # Before state + # ------------ + # + # + # RP/0/RP0/CPU0:ios#sh run int + # Mon Aug 12 12:40:23.104 UTC + # interface TenGigE0/0/0/0 + # ipv4 address 192.0.2.11 255.255.255.192 + # ! + # interface preconfigure GigabitEthernet0/0/0/1 + # ! + # interface preconfigure GigabitEthernet0/0/0/2 + # ! + # + # + + - name: Merge provided configuration with running configuration + cisco.iosxr.iosxr_lldp_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + destination: + mac_address: ieee-nearest-non-tmpr-bridge + transmit: false + + - name: GigabitEthernet0/0/0/2 + destination: + mac_address: ieee-nearest-bridge + receive: false + state: merged + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # + # "before": [ + # { + # "name": "TenGigE0/0/0/0" + # }, + # { + # "name": "GigabitEthernet0/0/0/1" + # }, + # { + # "name": "GigabitEthernet0/0/0/2" + # } + # ] + # + # "commands": [ + # "interface GigabitEthernet0/0/0/2", + # "lldp destination mac-address ieee-nearest-non-tmpr-bridge", + # "lldp transmit disable", + # "interface GigabitEthernet0/0/0/1", + # "lldp receive disable", + # "lldp destination mac-address ieee-nearest-bridge" + # ] + # + # "after": [ + # { + # "name": "TenGigE0/0/0/0" + # }, + # { + # "destination": { + # "mac_address": "ieee-nearest-bridge" + # }, + # "name": "GigabitEthernet0/0/0/1", + # "receive": false + # }, + # { + # "destination": { + # "mac_address": "ieee-nearest-non-tmpr-bridge" + # }, + # "name": "GigabitEthernet0/0/0/2", + # "transmit": false + # } + # ] + # + # + # ------------ + # After state + # ------------ + # + # + # RP/0/RP0/CPU0:ios#sh run int + # Mon Aug 12 12:49:51.517 UTC + # interface TenGigE0/0/0/0 + # ipv4 address 192.0.2.11 255.255.255.192 + # ! + # interface preconfigure GigabitEthernet0/0/0/1 + # lldp + # receive disable + # destination mac-address + # ieee-nearest-bridge + # ! + # ! + # ! + # interface preconfigure GigabitEthernet0/0/0/2 + # lldp + # transmit disable + # destination mac-address + # ieee-nearest-non-tmpr-bridge + # ! + # ! + # ! + # + # + + + # Using replaced + # + # + # ------------- + # Before state + # ------------- + # + # + # RP/0/RP0/CPU0:ios#sh run int + # Mon Aug 12 12:49:51.517 UTC + # interface TenGigE0/0/0/0 + # ipv4 address 192.0.2.11 255.255.255.192 + # ! + # interface preconfigure GigabitEthernet0/0/0/1 + # lldp + # receive disable + # destination mac-address + # ieee-nearest-bridge + # ! + # ! + # ! + # interface preconfigure GigabitEthernet0/0/0/2 + # lldp + # transmit disable + # destination mac-address + # ieee-nearest-non-tmpr-bridge + # ! + # ! + # ! + # + # + + - name: Replace existing LLDP configurations of specified interfaces with provided + configuration + cisco.iosxr.iosxr_lldp_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + destination: + mac_address: ieee-nearest-non-tmpr-bridge + state: replaced + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "before": [ + # { + # "name": "TenGigE0/0/0/0" + # }, + # { + # "destination": { + # "mac_address": "ieee-nearest-bridge" + # }, + # "name": "GigabitEthernet0/0/0/1", + # "receive": false + # }, + # { + # "destination": { + # "mac_address": "ieee-nearest-non-tmpr-bridge" + # }, + # "name": "GigabitEthernet0/0/0/2", + # "transmit": false + # } + # ] + # + # + # "commands": [ + # "interface GigabitEthernet0/0/0/1", + # "no lldp receive disable", + # "lldp destination mac-address ieee-nearest-non-tmpr-bridge" + # ] + # + # + # "after": [ + # { + # "name": "TenGigE0/0/0/0" + # }, + # { + # "destination": { + # "mac_address": "ieee-nearest-non-tmpr-bridge" + # }, + # "name": "GigabitEthernet0/0/0/1" + # }, + # { + # "destination": { + # "mac_address": "ieee-nearest-non-tmpr-bridge" + # }, + # "name": "GigabitEthernet0/0/0/2", + # "transmit": false + # } + # ] + # + # + # ------------ + # After state + # ------------ + # + # + # RP/0/RP0/CPU0:ios#sh run int + # Mon Aug 12 13:02:57.062 UTC + # interface TenGigE0/0/0/0 + # ipv4 address 192.0.2.11 255.255.255.192 + # ! + # interface preconfigure GigabitEthernet0/0/0/1 + # lldp + # destination mac-address + # ieee-nearest-non-tmpr-bridge + # ! + # ! + # ! + # interface preconfigure GigabitEthernet0/0/0/2 + # lldp + # transmit disable + # destination mac-address + # ieee-nearest-non-tmpr-bridge + # ! + # ! + # ! + # + # + + + # Using overridden + # + # + # ------------- + # Before state + # ------------- + # + # + # RP/0/RP0/CPU0:ios#sh run int + # Mon Aug 12 13:15:40.465 UTC + # interface TenGigE0/0/0/0 + # ipv4 address 192.0.2.11 255.255.255.192 + # ! + # interface preconfigure GigabitEthernet0/0/0/1 + # lldp + # receive disable + # destination mac-address + # ieee-nearest-bridge + # ! + # ! + # ! + # interface preconfigure GigabitEthernet0/0/0/2 + # lldp + # transmit disable + # destination mac-address + # ieee-nearest-non-tmpr-bridge + # ! + # ! + # ! + # + # + + - name: Override the LLDP configurations of all the interfaces with provided configurations + cisco.iosxr.iosxr_lldp_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + transmit: false + state: overridden + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # + # "before": [ + # { + # "name": "TenGigE0/0/0/0" + # }, + # { + # "destination": { + # "mac_address": "ieee-nearest-bridge" + # }, + # "name": "GigabitEthernet0/0/0/1", + # "receive": false + # }, + # { + # "destination": { + # "mac_address": "ieee-nearest-non-tmpr-bridge" + # }, + # "name": "GigabitEthernet0/0/0/2", + # "transmit": false + # } + # ] + # + # "commands": [ + # "interface GigabitEthernet0/0/0/2", + # "no lldp destination mac-address ieee-nearest-non-tmpr-bridge", + # "no lldp transmit disable", + # "interface GigabitEthernet0/0/0/1", + # "no lldp destination mac-address ieee-nearest-bridge", + # "no lldp receive disable", + # "lldp transmit disable" + # ] + # + # + # "after": [ + # { + # "name": "TenGigE0/0/0/0" + # }, + # { + # "name": "GigabitEthernet0/0/0/1", + # "transmit": false + # }, + # { + # "name": "GigabitEthernet0/0/0/2" + # } + # ] + # + # + # ------------ + # After state + # ------------ + # + # + # RP/0/RP0/CPU0:ios#sh run int + # Mon Aug 12 13:22:25.604 UTC + # interface TenGigE0/0/0/0 + # ipv4 address 192.0.2.11 255.255.255.192 + # ! + # interface preconfigure GigabitEthernet0/0/0/1 + # lldp + # transmit disable + # ! + # ! + # interface preconfigure GigabitEthernet0/0/0/2 + # ! + # + # + + + # Using deleted + # + # + # ------------- + # Before state + # ------------- + # + # + # RP/0/RP0/CPU0:ios#sh run int + # Mon Aug 12 13:26:21.498 UTC + # interface TenGigE0/0/0/0 + # ipv4 address 192.0.2.11 255.255.255.192 + # ! + # interface preconfigure GigabitEthernet0/0/0/1 + # lldp + # receive disable + # destination mac-address + # ieee-nearest-bridge + # ! + # ! + # ! + # interface preconfigure GigabitEthernet0/0/0/2 + # lldp + # transmit disable + # destination mac-address + # ieee-nearest-non-tmpr-bridge + # ! + # ! + # ! + # + # + + - name: Delete LLDP configurations of all interfaces (Note - This won't delete the + interfaces themselves) + cisco.iosxr.iosxr_lldp_interfaces: + state: deleted + + # + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # + # "before": [ + # { + # "name": "TenGigE0/0/0/0" + # }, + # { + # "destination": { + # "mac_address": "ieee-nearest-bridge" + # }, + # "name": "GigabitEthernet0/0/0/1", + # "receive": false + # }, + # { + # "destination": { + # "mac_address": "ieee-nearest-non-tmpr-bridge" + # }, + # "name": "GigabitEthernet0/0/0/2", + # "transmit": false + # } + # ] + # + # + # "commands": [ + # "interface GigabitEthernet0/0/0/1", + # "no lldp destination mac-address ieee-nearest-bridge", + # "no lldp receive disable", + # "interface GigabitEthernet0/0/0/2", + # "no lldp destination mac-address ieee-nearest-non-tmpr-bridge", + # "no lldp transmit disable" + # ] + # + # + # "after": [ + # { + # "name": "TenGigE0/0/0/0" + # }, + # { + # "name": "GigabitEthernet0/0/0/1" + # }, + # { + # "name": "GigabitEthernet0/0/0/2" + # } + # ] + # + # + # ------------ + # After state + # ------------ + # + # + # RP/0/RP0/CPU0:ios#sh run int + # Mon Aug 12 13:30:14.618 UTC + # interface TenGigE0/0/0/0 + # ipv4 address 192.0.2.11 255.255.255.192 + # ! + # interface preconfigure GigabitEthernet0/0/0/1 + # ! + # interface preconfigure GigabitEthernet0/0/0/2 + # ! + # + # + # Using parsed: + # parsed.cfg + + # interface TenGigE0/0/0/0 + # ipv4 address 192.0.2.11 255.255.255.192 + # ! + # interface preconfigure GigabitEthernet0/0/0/1 + # lldp + # receive disable + # destination mac-address + # ieee-nearest-bridge + # ! + # ! + # ! + # interface preconfigure GigabitEthernet0/0/0/2 + # lldp + # transmit disable + # destination mac-address + # ieee-nearest-non-tmpr-bridge + + - name: Convert lacp interfaces config to argspec without connecting to the appliance + cisco.iosxr.iosxr_lldp_interfaces: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed + + # ------------------------ + # Module Execution Result + # ------------------------ + + # parsed: [ + # - name: GigabitEthernet0/0/0/1 + # destination: + # mac_address: ieee-nearest-non-tmpr-bridge + # transmit: False + + # - name: GigabitEthernet0/0/0/2 + # destination: + # mac_address: ieee-nearest-bridge + # receive: False + # ] + + # Using gathered: + # Device config: + + # RP/0/RP0/CPU0:ios#sh run int + # Mon Aug 12 12:49:51.517 UTC + # interface TenGigE0/0/0/0 + # ipv4 address 192.0.2.11 255.255.255.192 + # ! + # interface preconfigure GigabitEthernet0/0/0/1 + # lldp + # receive disable + # destination mac-address + # ieee-nearest-bridge + # ! + # ! + # ! + # interface preconfigure GigabitEthernet0/0/0/2 + # lldp + # transmit disable + # destination mac-address + # ieee-nearest-non-tmpr-bridge + + - name: Gather IOSXR lldp interfaces configuration + cisco.iosxr.iosxr_lldp_interfaces: + config: + state: gathered + + # ------------------------ + # Module Execution Result + # ------------------------ + + # gathered: + # - name: GigabitEthernet0/0/0/1 + # destination: + # mac_address: ieee-nearest-non-tmpr-bridge + # transmit: False + + # - name: GigabitEthernet0/0/0/2 + # destination: + # mac_address: ieee-nearest-bridge + # receive: False + + # Using rendred: + - name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_lldp_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + destination: + mac_address: ieee-nearest-non-tmpr-bridge + transmit: false + + - name: GigabitEthernet0/0/0/2 + destination: + mac_address: ieee-nearest-bridge + receive: false + state: rendered + + # ------------------------ + # Module Execution Result + # ------------------------ + + # "rendered": [ + # "interface GigabitEthernet0/0/0/2", + # "lldp destination mac-address ieee-nearest-non-tmpr-bridge", + # "lldp transmit disable", + # "interface GigabitEthernet0/0/0/1", + # "lldp receive disable", + # "lldp destination mac-address ieee-nearest-bridge" + # ] + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ after + +
+ list +
+
when changed +
The configuration as structured data after module completion.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ before + +
+ list +
+
always +
The configuration as structured data prior to module invocation.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ commands + +
+ list +
+
always +
The set of commands pushed to the remote device.
+
+
Sample:
+
['interface GigabitEthernet0/0/0/1', 'lldp destination mac-address ieee-nearest-non-tmpr-bridge', 'no lldp transmit disable']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Nilashish Chakraborty (@nilashishc) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_logging_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_logging_module.rst new file mode 100644 index 00000000..f361af44 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_logging_module.rst @@ -0,0 +1,633 @@ +.. _cisco.iosxr.iosxr_logging_module: + + +************************* +cisco.iosxr.iosxr_logging +************************* + +**Configuration management of system logging services on network devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module provides declarative management configuration of system logging (syslog) on Cisco IOS XR devices. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient >= 0.5.3 when using netconf +- lxml >= 4.1.1 when using netconf + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ aggregate + +
+ list + / elements=dictionary +
+
+ +
List of syslog logging configuration definitions.
+
+
+ dest + +
+ string +
+
+
    Choices: +
  • host
  • +
  • console
  • +
  • monitor
  • +
  • buffered
  • +
  • file
  • +
+
+
Destination for system logging (syslog) messages.
+
+
+ facility + +
+ string +
+
+ +
To configure the type of syslog facility in which system logging (syslog) messages are sent to syslog servers Optional config for dest = host
+
+
+ hostnameprefix + +
+ string +
+
+ +
To append a hostname prefix to system logging (syslog) messages logged to syslog servers. Optional config for dest = host
+
+
+ level + +
+ string +
+
+
    Choices: +
  • emergencies
  • +
  • alerts
  • +
  • critical
  • +
  • errors
  • +
  • warning
  • +
  • notifications
  • +
  • informational
  • +
  • debugging
  • +
+
+
Specifies the severity level for the logging.
+

aliases: severity
+
+
+ name + +
+ string +
+
+ +
When dest = file name indicates file-name
+
When dest = host name indicates the host-name or ip-address of syslog server.
+
+
+ size + +
+ integer +
+
+ +
Size of buffer when dest = buffered. The acceptable value is in the range 307200 to 125000000 bytes. Default 307200
+
Size of file when dest = file. The acceptable value is in the range 1 to 2097152KB. Default 2 GB
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present
  • +
  • absent
  • +
+
+
Existential state of the logging configuration on the node.
+
+
+ vrf + +
+ string +
+
+ +
vrf name when syslog server is configured, dest = host
+
+
+ dest + +
+ string +
+
+
    Choices: +
  • host
  • +
  • console
  • +
  • monitor
  • +
  • buffered
  • +
  • file
  • +
+
+
Destination for system logging (syslog) messages.
+
+
+ facility + +
+ string +
+
+ Default:
"local7"
+
+
To configure the type of syslog facility in which system logging (syslog) messages are sent to syslog servers Optional config for dest = host
+
+
+ hostnameprefix + +
+ string +
+
+ +
To append a hostname prefix to system logging (syslog) messages logged to syslog servers. Optional config for dest = host
+
+
+ level + +
+ string +
+
+
    Choices: +
  • emergencies
  • +
  • alerts
  • +
  • critical
  • +
  • errors
  • +
  • warning
  • +
  • notifications
  • +
  • informational
  • +
  • debugging ←
  • +
+
+
Specifies the severity level for the logging.
+

aliases: severity
+
+
+ name + +
+ string +
+
+ +
When dest = file name indicates file-name
+
When dest = host name indicates the host-name or ip-address of syslog server.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli.
+
For more information please see the Network Guide.
+

+
A dict object containing connection details.
+
+
+ host + +
+ string +
+
+ +
Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.
+
+
+ password + +
+ string +
+
+ +
Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.
+
+
+ port + +
+ integer +
+
+ +
Specifies the port to use when building the connection to the remote device.
+
+
+ ssh_keyfile + +
+ path +
+
+ +
Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_SSH_KEYFILE will be used instead.
+
+
+ timeout + +
+ integer +
+
+ +
Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error.
+
+
+ transport + +
+ string +
+
+
    Choices: +
  • cli ←
  • +
  • netconf
  • +
+
+
Specifies the type of connection based transport.
+
+
+ username + +
+ string +
+
+ +
Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.
+
+
+ size + +
+ integer +
+
+ +
Size of buffer when dest = buffered. The acceptable value is in the range 307200 to 125000000 bytes. Default 307200
+
Size of file when dest = file. The acceptable value is in the range 1 to 2097152KB. Default 2 GB
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present ←
  • +
  • absent
  • +
+
+
Existential state of the logging configuration on the node.
+
+
+ vrf + +
+ string +
+
+ Default:
"default"
+
+
vrf name when syslog server is configured, dest = host
+
+
+ + +Notes +----- + +.. note:: + - This module works with connection ``network_cli`` and ``netconf``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + - Tested against IOS XRv 6.1.3 + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Cisco devices see the `Cisco integration page `_. + + + +Examples +-------- + +.. code-block:: yaml + + - name: configure logging for syslog server host + cisco.iosxr.iosxr_logging: + dest: host + name: 10.10.10.1 + level: critical + state: present + + - name: add hostnameprefix configuration + cisco.iosxr.iosxr_logging: + hostnameprefix: host1 + state: absent + + - name: add facility configuration + cisco.iosxr.iosxr_logging: + facility: local1 + state: present + + - name: configure console logging level + cisco.iosxr.iosxr_logging: + dest: console + level: debugging + state: present + + - name: configure monitor logging level + cisco.iosxr.iosxr_logging: + dest: monitor + level: errors + state: present + + - name: configure syslog to a file + cisco.iosxr.iosxr_logging: + dest: file + name: file_name + size: 2048 + level: errors + state: present + + - name: configure buffered logging with size + cisco.iosxr.iosxr_logging: + dest: buffered + size: 5100000 + + - name: Configure logging using aggregate + cisco.iosxr.iosxr_logging: + aggregate: + - {dest: console, level: warning} + - {dest: buffered, size: 4800000} + - {dest: file, name: file3, size: 2048} + - {dest: host, name: host3, level: critical} + + - name: Delete logging using aggregate + cisco.iosxr.iosxr_logging: + aggregate: + - {dest: console, level: warning} + - {dest: buffered, size: 4800000} + - {dest: file, name: file3, size: 2048} + - {dest: host, name: host3, level: critical} + state: absent + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ commands + +
+ list +
+
always (empty list when no commands to send) +
The list of configuration mode commands to send to the device
+
+
Sample:
+
['logging 10.10.10.1 vrf default severity debugging', 'logging facility local7', 'logging hostnameprefix host1', 'logging console critical', 'logging buffered 2097153', 'logging buffered warnings', 'logging monitor errors', 'logging file log_file maxfilesize 1024 severity info']
+
+
+ xml + +
+ list +
+
always (empty list when no xml rpc to send) +
NetConf rpc xml sent to device with transport netconf
+
+
Sample:
+
['<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"> <syslog xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-infra-syslog-cfg"> <files> <file xc:operation="delete"> <file-name>file1</file-name> <file-log-attributes> <max-file-size>2097152</max-file-size> <severity>2</severity> </file-log-attributes> </file> </files> </syslog> </config>']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Trishna Guha (@trishnaguha) +- Kedar Kekan (@kedarX) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_netconf.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_netconf.rst new file mode 100644 index 00000000..927cb82a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_netconf.rst @@ -0,0 +1,76 @@ +.. _cisco.iosxr.iosxr_netconf: + + +***************** +cisco.iosxr.iosxr +***************** + +**Use iosxr netconf plugin to run netconf commands on Cisco IOSXR platform** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This iosxr plugin provides low level abstraction apis for sending and receiving netconf commands from Cisco iosxr network devices. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + +
ParameterChoices/DefaultsConfigurationComments
+
+ ncclient_device_handler + +
+ string +
+
+ Default:
"iosxr"
+
+ +
Specifies the ncclient device handler name for Cisco iosxr network os. To identify the ncclient device handler name refer ncclient library documentation.
+
+
+ + + + + + + + +Status +------ + + +Authors +~~~~~~~ + +- Ansible Networking Team + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_netconf_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_netconf_module.rst new file mode 100644 index 00000000..a1078284 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_netconf_module.rst @@ -0,0 +1,296 @@ +.. _cisco.iosxr.iosxr_netconf_module: + + +************************* +cisco.iosxr.iosxr_netconf +************************* + +**Configures NetConf sub-system service on Cisco IOS-XR devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module provides an abstraction that enables and configures the netconf system service running on Cisco IOS-XR Software. This module can be used to easily enable the Netconf API. Netconf provides a programmatic interface for working with configuration and state resources as defined in RFC 6242. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ netconf_port + +
+ integer +
+
+ Default:
830
+
+
This argument specifies the port the netconf service should listen on for SSH connections. The default port as defined in RFC 6242 is 830.
+

aliases: listens_on
+
+
+ netconf_vrf + +
+ string +
+
+ Default:
"default"
+
+
netconf vrf name
+

aliases: vrf
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli.
+
For more information please see the Network Guide.
+

+
A dict object containing connection details.
+
+
+ host + +
+ string +
+
+ +
Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.
+
+
+ password + +
+ string +
+
+ +
Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.
+
+
+ port + +
+ integer +
+
+ +
Specifies the port to use when building the connection to the remote device.
+
+
+ ssh_keyfile + +
+ path +
+
+ +
Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_SSH_KEYFILE will be used instead.
+
+
+ timeout + +
+ integer +
+
+ +
Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error.
+
+
+ transport + +
+ string +
+
+
    Choices: +
  • cli ←
  • +
  • netconf
  • +
+
+
Specifies the type of connection based transport.
+
+
+ username + +
+ string +
+
+ +
Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present ←
  • +
  • absent
  • +
+
+
Specifies the state of the iosxr_netconf resource on the remote device. If the state argument is set to present the netconf service will be configured. If the state argument is set to absent the netconf service will be removed from the configuration.
+
+
+ + +Notes +----- + +.. note:: + - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + - Tested against Cisco IOS XR Software, Version 6.1.3 + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Cisco devices see the `Cisco integration page `_. + + + +Examples +-------- + +.. code-block:: yaml + + - name: enable netconf service on port 830 + cisco.iosxr.iosxr_netconf: + listens_on: 830 + state: present + + - name: disable netconf service + cisco.iosxr.iosxr_netconf: + state: absent + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + +
KeyReturnedDescription
+
+ commands + +
+ string +
+
when changed is True +
Returns the command sent to the remote device
+
+
Sample:
+
ssh server netconf port 830
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Kedar Kekan (@kedarX) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_ospf_interfaces_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_ospf_interfaces_module.rst new file mode 100644 index 00000000..d7497835 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_ospf_interfaces_module.rst @@ -0,0 +1,3089 @@ +.. _cisco.iosxr.iosxr_ospf_interfaces_module: + + +********************************* +cisco.iosxr.iosxr_ospf_interfaces +********************************* + +**OSPF Interfaces Resource Module.** + + +Version added: 1.2.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages OSPF(v2/v3) configuration of interfaces on devices running Cisco IOS-XR. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A list of OSPF configuration for interfaces.
+
+
+ address_family + +
+ list + / elements=dictionary +
+
+ +
OSPF settings on the interfaces in address-family context.
+
+
+ afi + +
+ string + / required +
+
+
    Choices: +
  • ipv4
  • +
  • ipv6
  • +
+
+
Address Family Identifier (AFI) for OSPF settings on the interfaces.
+
+
+ apply_group_option + +
+ dictionary +
+
+ +
Specify configuration from a group
+
+
+ group_name + +
+ string +
+
+ +
Specify the name of the group
+
+
+ operation + +
+ string +
+
+
    Choices: +
  • add
  • +
  • remove
  • +
  • append
  • +
+
+
Specify the group config operation
+
+
+ authentication + +
+ dictionary +
+
+ +
Enable authentication
+
+
+ message_digest + +
+ dictionary +
+
+ +
Use message-digest authentication
+
+
+ keychain + +
+ string +
+
+ +
Specify keychain name
+
+
+ null_auth + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Use no authentication
+
+
+ authentication_key + +
+ dictionary +
+
+ +
Specify authentication password (key)
+
+
+ clear + +
+ string +
+
+ +
Specifies an UNENCRYPTED password (key) will follow
+
+
+ encrypted + +
+ string +
+
+ +
Specifies an ENCRYPTED password (key) will follow
+
+
+ password + +
+ string +
+
+ +
The OSPFv2 password (key)
+
+
+ bfd + +
+ dictionary +
+
+ +
Configure BFD parameters
+
+
+ fast_detect + +
+ dictionary +
+
+ +
Configure fast detection
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable fast detection only
+
+
+ strict_mode + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Hold down neighbor session until BFD session is up
+
+
+ minimum_interval + +
+ integer +
+
+ +
Hello interval in milli-seconds
+
+
+ multiplier + +
+ integer +
+
+ +
Detect multiplier
+
+
+ cost + +
+ integer +
+
+ +
Specify Interface cost
+
+
+ cost_fallback + +
+ dictionary +
+
+ +
Specify Cost when cumulative bandwidth goes below the theshold
+
+
+ cost + +
+ integer +
+
+ +
Specify cost w.r.t cummulative bandwidth
+
+
+ threshold + +
+ integer +
+
+ +
Specify threshold bandwidth when cost-fallback is applied
+
+
+ database_filter + +
+ dictionary +
+
+ +
Filter OSPF LSAs during synchronization and flooding
+
+
+ all_outgoing_lsa + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Filter all outgoing LSA
+
+
+ dead_interval + +
+ integer +
+
+ +
Specify interval after which a neighbor is declared dead
+
+
+ demand_circuit + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable demand circuits
+
+
+ fast_reroute + +
+ dictionary +
+
+ +
Specify IP Fast Reroute
+
+
+ disabled + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable IP fast reroute
+
+
+ per_link + +
+ dictionary +
+
+ +
Specify per-prefix computation
+
+
+ information_type + +
+ string +
+
+
    Choices: +
  • exclude
  • +
  • lfa_candidate
  • +
+
+
Specify per-link LFA exclusion or FRR LFA candidate information
+
+
+ interface + +
+ dictionary +
+
+ +
Specify Per-link LFA exclusion information
+
+
+ bundle_ether + +
+ list + / elements=dictionary +
+
+ +
Specify Aggregated Ethernet interface(s)
+
+
+ name + +
+ integer +
+
+ +
Specify the interface id
+
+
+ bvi + +
+ list + / elements=dictionary +
+
+ +
Specify Bridge-Group Virtual Interface
+
+
+ name + +
+ integer +
+
+ +
Specify the interface id
+
+
+ fast_ethernet + +
+ list + / elements=dictionary +
+
+ +
Specify FastEthernet/IEEE 802.3 interface(s)
+
+
+ name + +
+ string +
+
+ +
Specify the interface id
+
+
+ fiftygige + +
+ list + / elements=dictionary +
+
+ +
Specify FiftyGigE/IEEE 802.3 interface(s)
+
+
+ name + +
+ string +
+
+ +
Specify the interface id
+
+
+ fortygige + +
+ list + / elements=dictionary +
+
+ +
Specify FortyGigE/IEEE 802.3 interface(s)
+
+
+ name + +
+ string +
+
+ +
Specify the interface id
+
+
+ fourhundredgige + +
+ list + / elements=dictionary +
+
+ +
Specify FourHundredGigE/IEEE 802.3 interface(s)
+
+
+ name + +
+ string +
+
+ +
Specify the interface id
+
+
+ gigabitethernet + +
+ list + / elements=dictionary +
+
+ +
Specify GigabitEthernet/IEEE 802.3 interface(s)
+
+
+ name + +
+ string +
+
+ +
Specify the interface id
+
+
+ hundredgige + +
+ list + / elements=dictionary +
+
+ +
Specify HundredGigE/IEEE 802.3 interface(s)
+
+
+ name + +
+ string +
+
+ +
Specify the interface id
+
+
+ mgmteth + +
+ list + / elements=dictionary +
+
+ +
Specify MgmtEth/IEEE 802.3 interface(s)
+
+
+ name + +
+ string +
+
+ +
Specify the interface id
+
+
+ multilink + +
+ list + / elements=dictionary +
+
+ +
Specify Multilink network interface(s)
+
+
+ name + +
+ string +
+
+ +
Specify the interface id
+
+
+ nve + +
+ list + / elements=dictionary +
+
+ +
Specify Network Virtualization Endpoint Interface(s)
+
+
+ name + +
+ integer +
+
+ +
Specify the interface id
+
+
+ pos_int + +
+ list + / elements=dictionary +
+
+ +
Specify Aggregated pos interface(s)
+
+
+ name + +
+ integer +
+
+ +
Specify the interface id
+
+
+ pw_ether + +
+ list + / elements=dictionary +
+
+ +
Specify PWHE Ethernet Interface
+
+
+ name + +
+ integer +
+
+ +
Specify the interface id
+
+
+ pw_iw + +
+ list + / elements=dictionary +
+
+ +
Specify PWHE VC11 IP Interworking Interface
+
+
+ name + +
+ integer +
+
+ +
Specify the interface id
+
+
+ serial + +
+ list + / elements=dictionary +
+
+ +
Specify Serial network interface(s)
+
+
+ name + +
+ string +
+
+ +
Specify the interface id
+
+
+ srp + +
+ list + / elements=dictionary +
+
+ +
Specify SRP interface(s)
+
+
+ name + +
+ string +
+
+ +
Specify the interface id
+
+
+ tengige + +
+ list + / elements=dictionary +
+
+ +
Specify TenGigabitEthernet/IEEE 802.3 interface(s)
+
+
+ name + +
+ string +
+
+ +
Specify the interface id
+
+
+ tunnel_ip + +
+ list + / elements=dictionary +
+
+ +
Specify GRE/IPinIP Tunnel Interface(s)
+
+
+ name + +
+ integer +
+
+ +
Specify the interface id
+
+
+ tunnel_ipsec + +
+ list + / elements=dictionary +
+
+ +
Specify IPSec Tunnel interface(s)
+
+
+ name + +
+ integer +
+
+ +
Specify the interface id
+
+
+ tunnel_mpls + +
+ list + / elements=dictionary +
+
+ +
MPLS Transport Protocol Tunnel interface
+
+
+ name + +
+ string +
+
+ +
Specify the interface id
+
+
+ tunnel_mte + +
+ list + / elements=dictionary +
+
+ +
Specify MPLS Traffic Engineering P2MP Tunnel interface(s)
+
+
+ name + +
+ integer +
+
+ +
Specify the interface id
+
+
+ twentyfivegige + +
+ list + / elements=dictionary +
+
+ +
Specify TwentyFiveGigabitEthernet/IEEE 802.3 interface(s)
+
+
+ name + +
+ string +
+
+ +
Specify the interface id
+
+
+ twohundredgige + +
+ list + / elements=dictionary +
+
+ +
Specify TwoHundredGigE/IEEE 802.3 interface(s)
+
+
+ name + +
+ string +
+
+ +
Specify the interface id
+
+
+ use_candidate_only + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable backup selection from candidate-list only
+
+
+ flood_reduction + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable flood reduction
+
+
+ hello_interval + +
+ integer +
+
+ +
Specify Time between HELLO packets
+
+
+ link_down_fast_detect + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure interface down parameters
+
+
+ message_digest_key + +
+ dictionary +
+
+ +
Message digest authentication password (key)
+
+
+ id + +
+ integer + / required +
+
+ +
Key ID
+
+
+ md5 + +
+ dictionary + / required +
+
+ +
Use MD5 Algorithm
+
+
+ clear + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies an UNENCRYPTED password (key) will follow
+
+
+ encrypted + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies an ENCRYPTED password (key) will follow
+
+
+ password + +
+ string +
+
+ +
The OSPFv2 password (key)
+
+
+ mpls_ldp_sync + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable MPLS LDP Sync
+
+
+ mtu_ignore + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable ignoring of MTU in DBD packets
+
+
+ neighbors + +
+ list + / elements=dictionary +
+
+ +
Specify a neighbor routers
+
+
+ cost + +
+ integer +
+
+ +
Specify OSPF cost for point-to-multipoint neighbor
+
+
+ db_filter_all_out + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify Filter OSPF LSA during synchronization and flooding for point-to-multipoint neighbor
+
+
+ neighbor_id + +
+ string +
+
+ +
Specify Neighbor address (name)
+
+
+ poll_interval + +
+ integer +
+
+ +
Specify OSPF dead-router polling interval
+
+
+ priority + +
+ integer +
+
+ +
Specify OSPF priority of non-broadcast neighbor
+
+
+ network + +
+ string +
+
+
    Choices: +
  • broadcast
  • +
  • non-broadcast
  • +
  • point-to-multipoint
  • +
  • point-to-point
  • +
+
+
Specify Network type
+
+
+ packet_size + +
+ integer +
+
+ +
Customize size of OSPF packets upto MTU
+
+
+ passive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable passive
+
+
+ prefix_suppression + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Suppress advertisement of the prefixes
+
+
+ priority + +
+ integer +
+
+ +
Specify Router priority
+
+
+ processes + +
+ list + / elements=dictionary +
+
+ +
Interfaces configuration for an OSPF process.
+
+
+ area + +
+ dictionary +
+
+ +
Specify the area-id
+
+
+ area_id + +
+ string +
+
+ +
OSPF interfaces area ID as a decimal value. Please refer vendor documentation of Valid values.
+
OSPF interfaces area ID in IP address format(e.g. A.B.C.D)
+
+
+ process_id + +
+ string + / required +
+
+ +
OSPF process tag.
+
+
+ retransmit_interval + +
+ integer +
+
+ +
Specify time between retransmitting lost link state advertisements
+
+
+ security_ttl + +
+ dictionary +
+
+ +
Enable security
+
+
+ hops + +
+ integer +
+
+ +
Maximum number of IP hops allowed <1-254>
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable ttl security
+
+
+ transmit_delay + +
+ integer +
+
+ +
Specify estimated time needed to send link-state update packet
+
+
+ name + +
+ string + / required +
+
+ +
Name/Identifier of the interface.
+
+
+ type + +
+ string + / required +
+
+ +
Type of the interface.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the IOS-XR device by executing the command show running-config router ospf'.
+
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • merged ←
  • +
  • replaced
  • +
  • overridden
  • +
  • deleted
  • +
  • gathered
  • +
  • parsed
  • +
  • rendered
  • +
+
+
The state the configuration should be left in.
+
+
+ + +Notes +----- + +.. note:: + - Tested against IOS-XR 6.1.3 + - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_ + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + + # Before state: + # ------------- + # + # RP/0/RP0/CPU0:anton#show running-config router ospf + # % No such configuration item(s) + # + + - name: Merge provided OSPF interfaces configuration with the existing configuration + cisco.iosxr.iosxr_ospf_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.3 + cost: 20 + authentication: + message_digest: + keychain: cisco + - afi: ipv6 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.2 + cost: 30 + state: merged + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "before": [] + # + # "commands": [ + # "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 cost 20", + # "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest", + # "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest keychain cisco", + # "router ospfv3 LAB3 area 0.0.0.2 interface GigabitEthernet 0/0/0/0 cost 30" + # ] + # + # "after": [ + # { + # "address_family": [ + # { + # "afi": "ipv4", + # "authentication": { + # "message_digest": { + # "keychain": "cisco" + # } + # }, + # "cost": 20, + # "processes": [ + # { + # "area": { + # "area_id": "0.0.0.3" + # }, + # "process_id": "LAB3" + # } + # ] + # }, + # { + # "afi": "ipv6", + # "cost": 30, + # "processes": [ + # { + # "area": { + # "area_id": "0.0.0.2" + # }, + # "process_id": "LAB3" + # } + # ] + # } + # ], + # "name": "GigabitEthernet0/0/0/0", + # "type": "gigabitethernet" + # } + # ] + # + # + # ------------ + # After state + # ------------ + # + # RP/0/0/CPU0:an-iosxr-02#show running-config router ospf + # Thu Oct 23 06:00:57.217 UTC + # router ospf LAB + # area 0.0.0.0 + # ! + # area 0.0.0.9 + # ! + # ! + # router ospf LAB1 + # area 0.0.0.1 + # ! + # area 0.0.0.3 + # ! + # ! + # router ospf LAB3 + # area 0.0.0.3 + # interface GigabitEthernet0/0/0/0 + # cost 20 + # authentication message-digest keychain cisco + # ! + # ! + # ! + # router ospf ipv4 + # ! + + # Using replaced + # + # ------------ + # Before state + # ------------ + # + # + # RP/0/0/CPU0:an-iosxr-02#show running-config router ospf + # Thu Oct 23 06:00:57.217 UTC + # router ospf LAB + # area 0.0.0.0 + # ! + # area 0.0.0.9 + # ! + # ! + # router ospf LAB1 + # area 0.0.0.1 + # ! + # area 0.0.0.3 + # ! + # ! + # router ospf LAB3 + # area 0.0.0.3 + # interface GigabitEthernet0/0/0/0 + # cost 20 + # authentication message-digest keychain cisco + # ! + # ! + # ! + # router ospf ipv4 + # ! + + - name: Replace OSPF interfaces configuration + cisco.iosxr.iosxr_ospf_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.3 + cost: 30 + authentication: + message_digest: + keychain: ciscoiosxr + - afi: ipv6 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.2 + cost: 30 + state: replaced + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "before": [ + # { + # "address_family": [ + # { + # "afi": "ipv4", + # "authentication": { + # "message_digest": { + # "keychain": "cisco" + # } + # }, + # "cost": 20, + # "processes": [ + # { + # "area": { + # "area_id": "0.0.0.3" + # }, + # "process_id": "LAB3" + # } + # ] + # }, + # { + # "afi": "ipv6", + # "cost": 30, + # "processes": [ + # { + # "area": { + # "area_id": "0.0.0.2" + # }, + # "process_id": "LAB3" + # } + # ] + # } + # ], + # "name": "GigabitEthernet0/0/0/0", + # "type": "gigabitethernet" + # } + # ] + # + # "commands": [ + # "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 cost 30", + # "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest", + # "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest keychain ciscoiosxr" + # ] + # + # "after": [ + # { + # "address_family": [ + # { + # "afi": "ipv4", + # "authentication": { + # "message_digest": { + # "keychain": "ciscoiosxr" + # } + # }, + # "cost": 30, + # "processes": [ + # { + # "area": { + # "area_id": "0.0.0.3" + # }, + # "process_id": "LAB3" + # } + # ] + # }, + # { + # "afi": "ipv6", + # "cost": 30, + # "processes": [ + # { + # "area": { + # "area_id": "0.0.0.2" + # }, + # "process_id": "LAB3" + # } + # ] + # } + # ], + # "name": "GigabitEthernet0/0/0/0", + # "type": "gigabitethernet" + # } + # ] + # + # + # ----------- + # After state + # ----------- + # + # RP/0/0/CPU0:an-iosxr-02#show running-config router ospf + # Thu Oct 23 06:10:39.827 UTC + # router ospf LAB + # area 0.0.0.0 + # ! + # area 0.0.0.9 + # ! + # ! + # router ospf LAB1 + # area 0.0.0.1 + # ! + # area 0.0.0.3 + # ! + # ! + # router ospf LAB3 + # area 0.0.0.3 + # interface GigabitEthernet0/0/0/0 + # cost 30 + # authentication message-digest keychain ciscoiosxr + # ! + # ! + # ! + # router ospf ipv4 + # ! + + - name: Override existing OSPF interfaces configuration + cisco.iosxr.iosxr_ospf_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB1" + area: + area_id: 0.0.0.3 + cost: 10 + authentication: + message_digest: + keychain: iosxr + state: overridden + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "before": [ + # { + # "address_family": [ + # { + # "afi": "ipv4", + # "authentication": { + # "message_digest": { + # "keychain": "ciscoiosxr" + # } + # }, + # "cost": 30, + # "processes": [ + # { + # "area": { + # "area_id": "0.0.0.3" + # }, + # "process_id": "LAB3" + # } + # ] + # }, + # { + # "afi": "ipv6", + # "cost": 30, + # "processes": [ + # { + # "area": { + # "area_id": "0.0.0.2" + # }, + # "process_id": "LAB3" + # } + # ] + # } + # ], + # "name": "GigabitEthernet0/0/0/0", + # "type": "gigabitethernet" + # } + # ] + # + # "commands": [ + # "no router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0", + # "no router ospfv3 LAB3 area 0.0.0.2 interface GigabitEthernet 0/0/0/0", + # "router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 cost 10", + # "router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 authentication message-digest", + # "router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 authentication message-digest keychain iosxr" + # ] + # + # "after": [ + # { + # "address_family": [ + # { + # "afi": "ipv4", + # "authentication": { + # "message_digest": { + # "keychain": "iosxr" + # } + # }, + # "cost": 10, + # "processes": [ + # { + # "area": { + # "area_id": "0.0.0.3" + # }, + # "process_id": "LAB1" + # } + # ] + # } + # ], + # "name": "GigabitEthernet0/0/0/1", + # "type": "gigabitethernet" + # } + # ] + # + # + # ----------- + # After state + # ----------- + # + # RP/0/0/CPU0:an-iosxr-02#show running-config router ospf + # Thu Oct 23 06:28:15.025 UTC + # router ospf LAB + # area 0.0.0.0 + # ! + # area 0.0.0.9 + # ! + # ! + # router ospf LAB1 + # area 0.0.0.1 + # ! + # area 0.0.0.3 + # interface GigabitEthernet0/0/0/1 + # cost 10 + # authentication message-digest keychain iosxr + # ! + # ! + # ! + # router ospf LAB3 + # area 0.0.0.3 + # ! + # ! + # router ospf ipv4 + # ! + + # Using deleted + # + # ------------ + # Before state + # ------------ + # + # + # RP/0/0/CPU0:an-iosxr-02#show running-config router ospf + # Thu Oct 23 06:28:15.025 UTC + # router ospf LAB + # area 0.0.0.0 + # ! + # area 0.0.0.9 + # ! + # ! + # router ospf LAB1 + # area 0.0.0.1 + # ! + # area 0.0.0.3 + # interface GigabitEthernet0/0/0/1 + # cost 10 + # authentication message-digest keychain iosxr + # ! + # ! + # ! + # router ospf LAB3 + # area 0.0.0.3 + # ! + # ! + # router ospf ipv4 + # ! + + - name: Deleted existing OSPF interfaces from the device + cisco.iosxr.iosxr_ospf_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + type: gigabitethernet + state: deleted + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "before": [ + # { + # "address_family": [ + # { + # "afi": "ipv4", + # "authentication": { + # "message_digest": { + # "keychain": "iosxr" + # } + # }, + # "cost": 10, + # "processes": [ + # { + # "area": { + # "area_id": "0.0.0.3" + # }, + # "process_id": "LAB1" + # } + # ] + # } + # ], + # "name": "GigabitEthernet0/0/0/1", + # "type": "gigabitethernet" + # } + # ], + # + # "commands": [ + # "no router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1" + # ] + # + # "after": [] + # + # + # ----------- + # After state + # ----------- + # + # RP/0/0/CPU0:an-iosxr-02#show running-config router ospf + # Thu Oct 23 06:34:38.319 UTC + # router ospf LAB + # area 0.0.0.0 + # ! + # area 0.0.0.9 + # ! + # ! + # router ospf LAB1 + # area 0.0.0.1 + # ! + # area 0.0.0.3 + # ! + # ! + # router ospf LAB3 + # area 0.0.0.3 + # ! + # ! + # router ospf ipv4 + # ! + + # Using parsed + # parsed.cfg + # ------------ + # router ospf LAB + # area 0.0.0.0 + # ! + # area 0.0.0.9 + # ! + # ! + # router ospf LAB1 + # area 0.0.0.1 + # ! + # area 0.0.0.3 + # ! + # ! + # router ospf LAB3 + # area 0.0.0.3 + # interface GigabitEthernet0/0/0/0 + # cost 20 + # authentication message-digest keychain cisco + # ! + # ! + # ! + # router ospf ipv4 + # ! + - name: Parsed the device configuration to get output commands + cisco.iosxr.iosxr_ospf_interfaces: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # + # "parsed": [ + # { + # "address_family": [ + # { + # "afi": "ipv4", + # "authentication": { + # "message_digest": { + # "keychain": "cisco" + # } + # }, + # "cost": 20, + # "processes": [ + # { + # "area": { + # "area_id": "0.0.0.3" + # }, + # "process_id": "LAB3" + # } + # ] + # } + # ], + # "name": "GigabitEthernet0/0/0/0", + # "type": "gigabitethernet" + # } + # ] + # + # Using rendered + # + # + - name: Render the commands for provided configuration + cisco.iosxr.iosxr_ospf_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.3 + cost: 20 + authentication: + message_digest: + keychain: cisco + - afi: ipv6 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.2 + cost: 30 + state: rendered + + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # + # "rendered": [ + # "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 cost 20", + # "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest", + # "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest keychain cisco", + # "router ospfv3 LAB3 area 0.0.0.2 interface GigabitEthernet 0/0/0/0 cost 30" + # ] + + + # Using gathered + # + # Before state: + # ------------- + # + # RP/0/0/CPU0:an-iosxr-02#show running-config router ospf + # Thu Oct 23 06:50:38.743 UTC + # router ospf LAB + # area 0.0.0.0 + # ! + # area 0.0.0.9 + # ! + # ! + # router ospf LAB1 + # area 0.0.0.1 + # ! + # area 0.0.0.3 + # ! + # ! + # router ospf LAB3 + # area 0.0.0.3 + # interface GigabitEthernet0/0/0/0 + # cost 20 + # authentication message-digest keychain cisco + # ! + # ! + # ! + # router ospf ipv4 + # ! + + + - name: Gather ospf_interfaces routes configuration + cisco.iosxr.iosxr_ospf_interfaces: + state: gathered + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # "gathered": [ + # { + # "address_family": [ + # { + # "afi": "ipv4", + # "authentication": { + # "message_digest": { + # "keychain": "cisco" + # } + # }, + # "cost": 20, + # "processes": [ + # { + # "area": { + # "area_id": "0.0.0.3" + # }, + # "process_id": "LAB3" + # } + # ] + # }, + # { + # "afi": "ipv6", + # "cost": 30, + # "processes": [ + # { + # "area": { + # "area_id": "0.0.0.2" + # }, + # "process_id": "LAB3" + # } + # ] + # } + # ], + # "name": "GigabitEthernet0/0/0/0", + # "type": "gigabitethernet" + # } + # ] + # + + + + +Status +------ + + +Authors +~~~~~~~ + +- Rohit Thakur (@rohitthakur2590) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_ospfv2_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_ospfv2_module.rst new file mode 100644 index 00000000..5cdfbd84 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_ospfv2_module.rst @@ -0,0 +1,7069 @@ +.. _cisco.iosxr.iosxr_ospfv2_module: + + +************************ +cisco.iosxr.iosxr_ospfv2 +************************ + +**OSPFv2 resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages global OSPFv2 configuration on devices running Cisco IOS-XR + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ dictionary +
+
+ +
A list of OSPFv2 process configuration
+
+
+ processes + +
+ list + / elements=dictionary +
+
+ +
A list of OSPFv2 instances configuration
+
+
+ address_family_unicast + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable unicast topology for ipv4 address family
+
+
+ adjacency_stagger + +
+ dictionary +
+
+ +
Stagger OSPFv2 adjacency bring up
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable stagger OSPFv2 adjacency
+
+
+ max_adjacency + +
+ integer +
+
+ +
Maximum simultaneous neighbors to bring up
+
+
+ min_adjacency + +
+ integer +
+
+ +
Initial number of neighbors to bring up per area (default 2)
+
+
+ apply_weight + +
+ dictionary +
+
+ +
Enable weights configured under interfaces for load sharing
+
+
+ bandwidth + +
+ integer +
+
+ +
Reference bandwidth to use for calculation (Mbits/sec)
+
+
+ default_weight + +
+ integer +
+
+ +
Specify default weight value to use when it is not configured under interface
+
+
+ areas + +
+ list + / elements=dictionary +
+
+ +
Configure OSPFv2 areas' properties
+
+
+ area_id + +
+ string + / required +
+
+ +
Area ID as IP address or integer
+
+
+ authentication + +
+ dictionary +
+
+ +
Enable authentication
+
+
+ keychain + +
+ string +
+
+ +
Specify keychain name
+
+
+ message_digest + +
+ dictionary +
+
+ +
Use message-digest authentication
+
+
+ keychain + +
+ string +
+
+ +
Specify keychain name
+
+
+ no_auth + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Use no authentication
+
+
+ authentication_key + +
+ dictionary +
+
+ +
Used to mention authentication password (key)
+
+
+ clear + +
+ string +
+
+ +
Specifies an UNENCRYPTED password (key) will follow
+
+
+ encrypted + +
+ string +
+
+ +
Specifies an ENCRYPTED password (key) will follow
+
+
+ password + +
+ string +
+
+ +
The OSPFv2 password (key)
+
+
+ bfd + +
+ dictionary +
+
+ +
Configure BFD parameters
+
+
+ fast_detect + +
+ dictionary +
+
+ +
Configure fast detection
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable fast detection only
+
+
+ strict_mode + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Hold down neighbor session until BFD session is up
+
+
+ minimum_interval + +
+ integer +
+
+ +
Hello interval in milli-seconds
+
+
+ multiplier + +
+ integer +
+
+ +
Detect multiplier
+
+
+ cost + +
+ integer +
+
+ +
Interface cost
+
+
+ dead_interval + +
+ integer +
+
+ +
Interval after which a neighbor is declared dead
+
+
+ default_cost + +
+ integer +
+
+ +
Set the summary default-cost of a NSSA/stub area. Stub's advertised external route metric
+
+
+ hello_interval + +
+ integer +
+
+ +
Time between HELLO packets
+
+
+ mpls + +
+ dictionary +
+
+ +
Configure MPLS routing protocol parameters
+
+
+ ldp + +
+ dictionary +
+
+ +
Configure LDP parameters
+
+
+ auto_config + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable LDP IGP interface auto-configuration
+
+
+ sync + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable LDP IGP synchronization
+
+
+ sync_igp_shortcuts + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
LDP sync for igp-shortcut tunnels
+
+
+ traffic_eng + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure an ospf area to run MPLS Traffic Engineering
+
+
+ mtu_ignore + +
+ string +
+
+
    Choices: +
  • enable
  • +
  • disable
  • +
+
+
Enable/Disable ignoring of MTU in DBD packets
+
+
+ nssa + +
+ dictionary +
+
+ +
NSSA settings for the area
+
+
+ default_information_originate + +
+ dictionary +
+
+ +
Originate default Type 7 LSA
+
+
+ metric + +
+ integer +
+
+ +
OSPFv2 default metric
+
+
+ metric_type + +
+ integer +
+
+ +
Metric type for default routes
+
+
+ no_redistribution + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Do not send redistributed LSAs into NSSA area
+
+
+ no_summary + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Do not send summary LSAs into NSSA area
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure area as NSSA
+
+
+ translate + +
+ dictionary +
+
+ +
Translate LSA
+
+
+ type7 + +
+ dictionary +
+
+ +
Translate from Type 7 to Type 5
+
+
+ always + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Always translate LSAs
+
+
+ ranges + +
+ list + / elements=dictionary +
+
+ +
Summarize routes matching address/mask (border routers only)
+
+
+ address + +
+ string + / required +
+
+ +
IP in Prefix format (x.x.x.x/len)
+
+
+ advertise + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Advertise this range (default)
+
+
+ not_advertise + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
DoNotAdvertise this range
+
+
+ route_policy + +
+ list + / elements=dictionary +
+
+ +
Specify the route-policy to filter type 3 LSAs (list can have one inbound and/or one outbound policy only)
+
+
+ direction + +
+ string +
+
+
    Choices: +
  • in
  • +
  • out
  • +
+
+
Specify inbound or outbound
+
+
+ parameters + +
+ list + / elements=string +
+
+ +
Specify parameter values for the policy
+
+
+ stub + +
+ dictionary +
+
+ +
Settings for configuring the area as a stub
+
+
+ no_summary + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Do not send summary LSA into stub area
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure the area as a stub
+
+
+ transmit_delay + +
+ integer +
+
+ +
Estimated time needed to send link-state update packet
+
+
+ virtual_link + +
+ list + / elements=dictionary +
+
+ +
Define a virtual link
+
+
+ authentication + +
+ dictionary +
+
+ +
Enable authentication
+
+
+ keychain + +
+ string +
+
+ +
Specify keychain name
+
+
+ message_digest + +
+ dictionary +
+
+ +
Use message-digest authentication
+
+
+ keychain + +
+ string +
+
+ +
Specify keychain name
+
+
+ no_auth + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Use no authentication
+
+
+ authentication_key + +
+ dictionary +
+
+ +
Used to mention authentication password (key)
+
+
+ clear + +
+ string +
+
+ +
Specifies an UNENCRYPTED password (key) will follow
+
+
+ encrypted + +
+ string +
+
+ +
Specifies an ENCRYPTED password (key) will follow
+
+
+ password + +
+ string +
+
+ +
The OSPFv2 password (key)
+
+
+ dead_interval + +
+ integer +
+
+ +
Interval after which a neighbor is declared dead
+
+
+ hello_interval + +
+ integer +
+
+ +
Time between HELLO packets
+
+
+ id + +
+ string + / required +
+
+ +
Router-ID of virtual link neighbor (A.B.C.D)
+
+
+ message_digest_key + +
+ dictionary +
+
+ +
Message digest authentication password (key)
+
+
+ id + +
+ integer + / required +
+
+ +
Key ID (1-255)
+
+
+ md5 + +
+ dictionary +
+
+ +
Use MD5 Algorithm
+
+
+ clear + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies an UNENCRYPTED password (key) will follow
+
+
+ encrypted + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies an ENCRYPTED password (key) will follow
+
+
+ password + +
+ string +
+
+ +
The OSPFv2 password (key)
+
+
+ retransmit_interval + +
+ integer +
+
+ +
Delay between LSA retransmissions
+
+
+ transmit_delay + +
+ integer +
+
+ +
Link state transmit delay
+
+
+ authentication + +
+ dictionary +
+
+ +
Enable authentication
+
+
+ keychain + +
+ string +
+
+ +
Specify keychain name
+
+
+ message_digest + +
+ dictionary +
+
+ +
Use message-digest authentication
+
+
+ keychain + +
+ string +
+
+ +
Specify keychain name
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify message-digest selection
+
+
+ no_auth + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Use no authentication
+
+
+ authentication_key + +
+ dictionary +
+
+ +
Used to mention authentication password (key)
+
+
+ clear + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies an UNENCRYPTED password (key) will follow
+
+
+ encrypted + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies an ENCRYPTED password (key) will follow
+
+
+ password + +
+ string +
+
+ +
The OSPFv2 password (key)
+
+
+ auto_cost + +
+ dictionary +
+
+ +
Calculate OSPFv2 interface cost according to bandwidth
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Assign OSPFv2 cost based on interface type
+
+
+ reference_bandwidth + +
+ integer +
+
+ +
Specify reference bandwidth in megabits per sec
+
+
+ bfd + +
+ dictionary +
+
+ +
Configure BFD parameters
+
+
+ fast_detect + +
+ dictionary +
+
+ +
Configure fast detection
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable fast detection only
+
+
+ strict_mode + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Hold down neighbor session until BFD session is up
+
+
+ minimum_interval + +
+ integer +
+
+ +
Hello interval in milli-seconds
+
+
+ multiplier + +
+ integer +
+
+ +
Detect multiplier
+
+
+ capability + +
+ dictionary +
+
+ +
Enable specific OSPFv2 feature
+
+
+ opaque + +
+ dictionary +
+
+ +
Configure opaque LSA
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable Opaque LSA capability
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable opaque LSA
+
+
+ type7 + +
+ string +
+
+ +
NSSA capability
+
+
+ cost + +
+ integer +
+
+ +
Interface cost (1-65535)
+
+
+ database_filter + +
+ string +
+
+
    Choices: +
  • enable
  • +
  • disable
  • +
+
+
Filter OSPFv2 LSA during synchronization and flooding (all outgoing LSA). Enable/Disable filtering
+
+
+ dead_interval + +
+ integer +
+
+ +
Interval after which a neighbor is declared dead
+
+
+ default_information_originate + +
+ dictionary +
+
+ +
Distribute default route
+
+
+ always + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Always advertise default route
+
+
+ metric + +
+ integer +
+
+ +
OSPFv2 default metric
+
+
+ metric_type + +
+ integer +
+
+ +
OSPFv2 metric type for default routes
+
+
+ route_policy + +
+ string +
+
+ +
Apply route-policy to default-information origination
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable distribution of default route
+
+
+ default_metric + +
+ integer +
+
+ +
Set metric of redistributed routes
+
+
+ demand_circuit + +
+ string +
+
+
    Choices: +
  • enable
  • +
  • disable
  • +
+
+
Enable/Disable OSPFv2 demand circuit
+
+
+ distance + +
+ dictionary +
+
+ +
Define an administrative distance
+
+
+ admin_distance + +
+ list + / elements=dictionary +
+
+ +
Administrative distance
+
+
+ access_list + +
+ string +
+
+ +
Access list name
+
+
+ source + +
+ string +
+
+ +
Source IP address
+
+
+ value + +
+ integer +
+
+ +
Distance value
+
+
+ wildcard + +
+ string +
+
+ +
IP wild card bits (A.B.C.D)
+
+
+ ospf_distance + +
+ dictionary +
+
+ +
OSPFv2 administrative distance
+
+
+ external + +
+ integer +
+
+ +
Distance for external routes
+
+
+ inter_area + +
+ integer +
+
+ +
Distance for inter-area routes
+
+
+ intra_area + +
+ integer +
+
+ +
Distance for intra-area routes
+
+
+ distribute_bgp_ls + +
+ dictionary +
+
+ +
Enable Distribution of LSAs to external services
+
+
+ instance_id + +
+ integer +
+
+ +
Set distribution process instance identifier
+
+
+ throttle + +
+ integer +
+
+ +
Throttle time between successive LSA updates
+
+
+ distribute_link_state + +
+ dictionary +
+
+ +
Enable Distribution of LSAs to external services
+
+
+ instance_id + +
+ integer +
+
+ +
Set distribution process instance identifier
+
+
+ throttle + +
+ integer +
+
+ +
Throttle time between successive LSA updates
+
+
+ distribute_list + +
+ list + / elements=dictionary +
+
+ +
Filter networks in routing updates (list can have one inbound and/or one outbound policy only)
+
+
+ access_list + +
+ string +
+
+ +
Inbound/outbound access-list
+
+
+ direction + +
+ string +
+
+
    Choices: +
  • in
  • +
  • out
  • +
+
+
Filter incoming/outgoing routing updates
+
+
+ outgoing_params + +
+ dictionary +
+
+ +
Specify additional parameters for outgoing updates only
+
+
+ id + +
+ string +
+
+ +
For BGP, specify AS number. 2-byte AS number (or) 4-byte AS number in asdot (X.Y) format (or) 4-byte AS number in asplain format
+
For OSPF, specify OSPFv2 instance name
+
+
+ route_type + +
+ string +
+
+
    Choices: +
  • bgp
  • +
  • connected
  • +
  • dagr
  • +
  • ospf
  • +
  • static
  • +
+
+
Type of routes
+
+
+ route_policy + +
+ string +
+
+ +
Route Policy to filter OSPFv2 prefixes (for incoming updates only)
+
+
+ external_out + +
+ string +
+
+
    Choices: +
  • enable
  • +
  • disable
  • +
+
+
Enable/Disable advertisement of intra-area prefixes as external
+
+
+ flood_reduction + +
+ string +
+
+
    Choices: +
  • enable
  • +
  • disable
  • +
+
+
Enable/Disable OSPFv2 Flood Reduction
+
+
+ hello_interval + +
+ integer +
+
+ +
Time between HELLO packets (<1-65535> seconds)
+
+
+ ignore_lsa_mospf + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Do not complain upon receiving MOSPFv2 Type 6 LSA
+
+
+ link_down_fast_detect + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable fast or early detection of link-down events
+
+
+ log_adjacency_changes + +
+ dictionary +
+
+ +
Log adjacency state changes
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Log all state changes
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable log adjacency changes
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set log adjacency
+
+
+ loopback_stub_network + +
+ string +
+
+
    Choices: +
  • enable
  • +
  • disable
  • +
+
+
Advertise loopback as a stub network
+
+
+ max_lsa + +
+ dictionary +
+
+ +
Feature to limit the number of non-self-originated LSAs
+
+
+ ignore_count + +
+ integer +
+
+ +
Set count on how many times adjacencies can be suppressed
+
+
+ ignore_time + +
+ integer +
+
+ +
Set number of minutes during which all adjacencies are suppressed
+
+
+ reset_time + +
+ integer +
+
+ +
Set number of minutes after which ignore-count is reset to zero
+
+
+ threshold + +
+ integer +
+
+ +
Threshold value (%) at which to generate a warning message
+
+
+ warning_only + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Log a warning message when limit is exceeded
+
+
+ max_metric + +
+ dictionary +
+
+ +
Set maximum metric
+
+
+ router_lsa + +
+ dictionary +
+
+ +
Maximum metric in self-originated router-LSAs
+
+
+ external_lsa + +
+ dictionary +
+
+ +
External LSA configuration
+
+
+ max_metric_value + +
+ integer +
+
+ +
Set max metric value for external LSAs
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set external-lsa attribute
+
+
+ include_stub + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Advertise Max metric for Stub links as well
+
+
+ on_startup + +
+ dictionary +
+
+ +
Effective only at startup
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set on-startup attribute
+
+
+ wait_for_bgp_asn + +
+ integer +
+
+ +
ASN of BGP to wait for
+
+
+ wait_period + +
+ integer +
+
+ +
Wait period in seconds after startup
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set router-lsa attribute
+
+
+ summary_lsa + +
+ dictionary +
+
+ +
Summary LSAs configuration
+
+
+ max_metric_value + +
+ integer +
+
+ +
Max metric value for summary LSAs
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set summary-lsa attribute
+
+
+ message_digest_key + +
+ dictionary +
+
+ +
Message digest authentication password (key)
+
+
+ id + +
+ integer + / required +
+
+ +
Key ID
+
+
+ md5 + +
+ dictionary + / required +
+
+ +
Use MD5 Algorithm
+
+
+ clear + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies an UNENCRYPTED password (key) will follow
+
+
+ encrypted + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies an ENCRYPTED password (key) will follow
+
+
+ password + +
+ string +
+
+ +
The OSPFv2 password (key)
+
+
+ microloop_avoidance + +
+ dictionary +
+
+ +
Avoid microloops
+
+
+ protected + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Avoid microloops for protected prefixes only)
+
+
+ rib_update_delay + +
+ integer +
+
+ +
Delay to introduce between SPF and RIB updates
+
+
+ segment_routing + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable segment routing microloop avoidance
+
+
+ monitor_convergence + +
+ dictionary +
+
+ +
Enables OSPFv2 route convergence monitoring
+
+
+ prefix_list + +
+ string +
+
+ +
Enables Individual Prefix Monitoring
+
+
+ track_external_routes + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enables Tracking External(Type-5/7) Prefix monitoring
+
+
+ track_ip_frr + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enables Tracking IP-Frr Convergence
+
+
+ track_summary_routes + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enables Tracking Summary(Inter-Area) Prefix monitoring
+
+
+ mpls + +
+ dictionary +
+
+ +
Configure MPLS routing protocol parameters
+
+
+ ldp + +
+ dictionary +
+
+ +
Configure LDP parameters
+
+
+ auto_config + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable LDP IGP interface auto-configuration
+
+
+ sync + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable LDP IGP synchronization
+
+
+ sync_igp_shortcuts + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
LDP sync for igp-shortcut tunnels
+
+
+ traffic_eng + +
+ dictionary +
+
+ +
Routing protocol commands for MPLS Traffic Engineering
+
+
+ autoroute_exclude + +
+ dictionary +
+
+ +
Exclude IP address destinations from using TE tunnels
+
+
+ parameters + +
+ list + / elements=string +
+
+ +
Specify parameter values for the policy
+
+
+ route_policy + +
+ string +
+
+ +
Policy name
+
+
+ igp_intact + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Retain one or more IPv4 nexthops with tunnel nexthops
+
+
+ ldp_sync_update + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable LDP sync induced metric propagation
+
+
+ multicast_intact + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Publish multicast-intact paths to RIB
+
+
+ router_id + +
+ string +
+
+ +
Traffic Engineering stable IP address for system
+
+
+ mtu_ignore + +
+ string +
+
+
    Choices: +
  • enable
  • +
  • disable
  • +
+
+
Enable/Disable ignoring of MTU in DBD packets
+
+
+ network + +
+ dictionary +
+
+ +
Network type
+
+
+ broadcast + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify OSPFv2 broadcast multi-access network
+
+
+ non_broadcast + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify OSPFv2 NBMA network
+
+
+ point_to_multipoint + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify OSPFv2 point-to-multipoint network
+
+
+ point_to_point + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify OSPFv2 point-to-point network
+
+
+ nsf + +
+ dictionary +
+
+ +
Non-stop forwarding
+
+
+ cisco + +
+ dictionary +
+
+ +
Cisco Non-stop forwarding
+
+
+ enforce_global + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Cancel NSF restart when non-NSF-aware neighbors detected for the whole OSPFv2 process
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable Cisco NSF
+
+
+ flush_delay_time + +
+ integer +
+
+ +
Maximum time allowed for external route learning
+
+
+ ietf + +
+ dictionary +
+
+ +
IETF graceful restart
+
+
+ helper_disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable router's helper support level
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Only enable ietf option
+
+
+ interval + +
+ integer +
+
+ +
Minimum interval between NSF restarts (<90-3600> seconds)
+
+
+ lifetime + +
+ integer +
+
+ +
Maximum route lifetime following restart (<90-1800> seconds)
+
+
+ nsr + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable NSR for all VRFs in this process. 'False' option to disable NSR for all VRFs in this process
+
+
+ packet_size + +
+ integer +
+
+ +
Size of OSPFv2 packets to use. min=576 max=MTU bytes
+
+
+ passive + +
+ string +
+
+
    Choices: +
  • enable
  • +
  • disable
  • +
+
+
Enable/Disable passive
+
+
+ prefix_suppression + +
+ dictionary +
+
+ +
Suppress advertisement of the prefixes
+
+
+ secondary_address + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable secondary address suppression
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set the suppression option
+
+
+ priority + +
+ integer +
+
+ +
Router priority
+
+
+ process_id + +
+ string + / required +
+
+ +
The OSPFv2 Process ID
+
+
+ protocol_shutdown + +
+ dictionary +
+
+ +
Protocol specific configuration
+
+
+ host_mode + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Only traffic destined for this box allowed(cisco-support)
+
+
+ limit + +
+ dictionary +
+
+ +
High watermark for incoming priority events
+
+
+ high + +
+ integer +
+
+ +
Hello events are dropped when incoming event queue exceeds this value
+
+
+ low + +
+ integer +
+
+ +
DBD/LS Update/Req packets are dropped when incoming event queue exceeds this value
+
+
+ medium + +
+ integer +
+
+ +
LSA ACKs are dropped when incoming event queue exceeds this value
+
+
+ on_reload + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Shutdown post reload only
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Shutdown the OSPFv2 Protocol
+
+
+ redistribute + +
+ dictionary +
+
+ +
Redistribute information from another routing Protocol
+
+
+ id + +
+ string +
+
+ +
OnePK application name for application routes (or) AS number for bgp and eigrp (or) instance name for isis and ospf
+
+
+ level + +
+ integer +
+
+
    Choices: +
  • 1
  • +
  • 2
  • +
  • 12
  • +
+
+
ISIS levels
+
+
+ lsa_type_summary + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
LSA type 3 for redistributed routes
+
+
+ match + +
+ string +
+
+ +
Redistribution of routes. For OSPFv2 - external/internal/nssa-external 1/2. For EIGRP - external/internal
+
+
+ metric + +
+ integer +
+
+ +
Metric for redistributed routes
+
+
+ metric_type + +
+ integer +
+
+
    Choices: +
  • 1
  • +
  • 2
  • +
+
+
OSPFv2 exterior metric type for redistributed routes
+
+
+ nssa_only + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Redistribute to NSSA areas only
+
+
+ preserve_med + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Preserve med of BGP routes
+
+
+ route_policy + +
+ dictionary +
+
+ +
Apply route-policy to redistribution
+
+
+ name + +
+ string +
+
+ +
Name of the policy
+
+
+ parameters + +
+ list + / elements=string +
+
+ +
Specify parameter values for the policy
+
+
+ route_type + +
+ string +
+
+
    Choices: +
  • application
  • +
  • bgp
  • +
  • connected
  • +
  • dagr
  • +
  • eigrp
  • +
  • isis
  • +
  • mobile
  • +
  • ospf
  • +
  • rip
  • +
  • static
  • +
  • subscriber
  • +
+
+
Route type to redistribute
+
+
+ tag + +
+ integer +
+
+ +
Set tag for routes redistributed into OSPFv2
+
+
+ retransmit_interval + +
+ integer +
+
+ +
Delay between LSA retransmissions
+
+
+ router_id + +
+ string +
+
+ +
OSPFv2 router-id in IPv4 address format (A.B.C.D)
+
+
+ security_ttl + +
+ dictionary +
+
+ +
Enable security
+
+
+ hops + +
+ integer +
+
+ +
Maximum number of IP hops allowed <1-254>
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable ttl security
+
+
+ summary_in + +
+ string +
+
+
    Choices: +
  • enable
  • +
  • disable
  • +
+
+
Enable/Disable advertisement of external prefixes as inter-area
+
+
+ summary_prefix + +
+ list + / elements=dictionary +
+
+ +
Configure IP address summaries
+
+
+ not_advertise + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Suppress routes that match the specified prefix/mask pair
+
+
+ prefix + +
+ string + / required +
+
+ +
IP summary address/mask (A.B.C.D/prefix)
+
+
+ tag + +
+ integer +
+
+ +
Set tag
+
+
+ timers + +
+ dictionary +
+
+ +
Configure timer related constants
+
+
+ graceful_shutdown + +
+ dictionary +
+
+ +
Timers for graceful shutdown(cisco-support)
+
+
+ initial_delay + +
+ integer +
+
+ +
Delay before starting graceful shutdown
+
+
+ retain_routes + +
+ integer +
+
+ +
Time to keep routes active after graceful shutdown
+
+
+ lsa + +
+ dictionary +
+
+ +
OSPFv2 global LSA timers
+
+
+ group_pacing + +
+ integer +
+
+ +
OSPFv2 LSA group pacing timer. Interval between group of LSA being refreshed or maxaged
+
+
+ min_arrival + +
+ integer +
+
+ +
OSPFv2 MinLSArrival timer. The minimum interval in millisec between accepting the same LSA
+
+
+ refresh + +
+ integer +
+
+ +
OSPFv2 LSA refresh interval. How often self-originated LSAs should be refreshed, in seconds
+
+
+ pacing_flood + +
+ integer +
+
+ +
OSPFv2 flood pacing timer. Interval in msec to pace flooding on all interfaces
+
+
+ throttle + +
+ dictionary +
+
+ +
OSPFv2 throttle timers
+
+
+ fast_reroute + +
+ integer +
+
+ +
Fast-reroute throttle timer. Delay between end of SPF and start of the fast-reroute computation in milliseconds
+
+
+ lsa_all + +
+ dictionary +
+
+ +
LSA throttle timers for all types of OSPFv2 LSAs
+
+
+ initial_delay + +
+ integer +
+
+ +
Delay to generate first occurance of LSA in milliseconds
+
+
+ max_delay + +
+ integer +
+
+ +
Maximum delay between originating the same LSA in milliseconds
+
+
+ min_delay + +
+ integer +
+
+ +
Minimum delay between originating the same LSA in milliseconds
+
+
+ spf + +
+ dictionary +
+
+ +
OSPFv2 SPF throttle timers
+
+
+ change_delay + +
+ integer +
+
+ +
Delay between receiving a change to SPF calculation in milliseconds
+
+
+ max_wait + +
+ integer +
+
+ +
Maximum wait time in milliseconds for SPF calculations
+
+
+ second_delay + +
+ integer +
+
+ +
Delay between first and second SPF calculation in milliseconds
+
+
+ transmit_delay + +
+ integer +
+
+ +
Estimated time needed to send link-state update packet
+
+
+ weight + +
+ integer +
+
+ +
Interface weight
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the IOS-XR device by executing the command show running-config router ospf.
+
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • merged ←
  • +
  • replaced
  • +
  • deleted
  • +
  • parsed
  • +
  • gathered
  • +
  • rendered
  • +
  • overridden
  • +
+
+
The state the configuration should be left in.
+
+
+ + +Notes +----- + +.. note:: + - Tested against IOS-XR 6.1.3 + - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_ + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + + # Before state: + # ------------- + # + # RP/0/RP0/CPU0:anton#show running-config router ospf + # Thu Jun 11 15:54:44.569 UTC + # % No such configuration item(s) + # + + - name: Merge provided OSPFv2 configuration with the existing configuration + cisco.iosxr.iosxr_ospfv2: + config: + processes: + - process_id: '27' + areas: + - area_id: '10' + hello_interval: 2 + authentication: + keychain: ansi11393 + - process_id: '26' + adjacency_stagger: + max_adjacency: 20 + min_adjacency: 10 + - process_id: '10' + authentication: + keychain: ansible_test1102 + areas: + - area_id: '11' + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: '30' + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + weight: 2 + packet_size: 577 + priority: 1 + router_id: 2.2.2.2 + demand_circuit: enable + passive: disable + summary_in: enable + flood_reduction: disable + mtu_ignore: enable + external_out: disable + state: merged + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "before": {} + # + # "commands": [ + # "router ospf 30", + # "cost 2", + # "weight 2", + # "passive disable", + # "priority 1", + # "flood-reduction disable", + # "default-metric 10", + # "router-id 2.2.2.2", + # "demand-circuit enable", + # "packet-size 577", + # "transmit-delay 2", + # "summary-in enable", + # "external-out disable", + # "dead-interval 2", + # "hello-interval 1", + # "retransmit-interval 2", + # "mtu-ignore enable", + # "area 11 default-cost 5", + # "area 22 default-cost 6", + # "router ospf 26", + # "adjacency stagger 10 20", + # "authentication message-digest keychain ansible1101pass", + # "router ospf 27", + # "area 10 authentication keychain ansi11393", + # "area 10 hello-interval 2", + # "router ospf 10", + # "authentication keychain ansible_test1102", + # "area 11 default-cost 5", + # "area 11 cost 11", + # "area 22 default-cost 6" + # ] + # + # "after": { + # "processes": [ + # { + # "areas": [ + # { + # "area_id": "11", + # "cost": 11, + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "authentication": { + # "keychain": "ansible_test1102" + # }, + # "process_id": "10" + # }, + # { + # "adjacency_stagger": { + # "max_adjacency": 20, + # "min_adjacency": 10 + # }, + # "authentication": { + # "message_digest": { + # "keychain": "ansible1101pass" + # } + # }, + # "process_id": "26" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "authentication": { + # "keychain": "ansi11393" + # }, + # "hello_interval": 2 + # } + # ], + # "process_id": "27" + # }, + # { + # "areas": [ + # { + # "area_id": "11", + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "cost": 2, + # "dead_interval": 2, + # "default_metric": 10, + # "demand_circuit": "enable", + # "external_out": "disable", + # "flood_reduction": "disable", + # "hello_interval": 1, + # "mtu_ignore": "enable", + # "packet_size": 577, + # "passive": "disable", + # "priority": 1, + # "process_id": "30", + # "retransmit_interval": 2, + # "router_id": "2.2.2.2", + # "summary_in": "enable", + # "transmit_delay": 2, + # "weight": 2 + # } + # ] + # } + # + # + # ------------ + # After state + # ------------ + # + # RP/0/RP0/CPU0:anton#show running-config router ospf + # Thu Jun 11 16:06:44.406 UTC + # router ospf 10 + # authentication keychain ansible_test1102 + # area 11 + # cost 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # router ospf 26 + # authentication message-digest keychain ansible1101pass + # adjacency stagger 10 20 + # ! + # router ospf 27 + # area 10 + # authentication keychain ansi11393 + # hello-interval 2 + # ! + # ! + # router ospf 30 + # router-id 2.2.2.2 + # summary-in enable + # external-out disable + # cost 2 + # packet-size 577 + # weight 2 + # passive disable + # priority 1 + # mtu-ignore enable + # flood-reduction disable + # dead-interval 2 + # retransmit-interval 2 + # demand-circuit enable + # hello-interval 1 + # transmit-delay 2 + # default-metric 10 + # area 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # + + + # Using replaced + # + # ------------ + # Before state + # ------------ + # + # + # RP/0/RP0/CPU0:anton#show running-config router ospf + # Thu Jun 11 16:06:44.406 UTC + # router ospf 10 + # authentication keychain ansible_test1102 + # area 11 + # cost 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # router ospf 26 + # authentication message-digest keychain ansible1101pass + # adjacency stagger 10 20 + # ! + # router ospf 27 + # area 10 + # authentication keychain ansi11393 + # hello-interval 2 + # ! + # ! + # router ospf 30 + # router-id 2.2.2.2 + # summary-in enable + # external-out disable + # cost 2 + # packet-size 577 + # weight 2 + # passive disable + # priority 1 + # mtu-ignore enable + # flood-reduction disable + # dead-interval 2 + # retransmit-interval 2 + # demand-circuit enable + # hello-interval 1 + # transmit-delay 2 + # default-metric 10 + # area 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # + + - name: Replace OSPFv2 routes configurations from the device + cisco.iosxr.iosxr_ospfv2: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - area_id: 20 + cost: 2 + default_cost: 2 + authentication: + keychain: ansi11393 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 + state: replaced + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "before": { + # "processes": [ + # { + # "areas": [ + # { + # "area_id": "11", + # "cost": 11, + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "authentication": { + # "keychain": "ansible_test1102" + # }, + # "process_id": "10" + # }, + # { + # "adjacency_stagger": { + # "max_adjacency": 20, + # "min_adjacency": 10 + # }, + # "authentication": { + # "message_digest": { + # "keychain": "ansible1101pass" + # } + # }, + # "process_id": "26" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "authentication": { + # "keychain": "ansi11393" + # }, + # "hello_interval": 2 + # } + # ], + # "process_id": "27" + # }, + # { + # "areas": [ + # { + # "area_id": "11", + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "cost": 2, + # "dead_interval": 2, + # "default_metric": 10, + # "demand_circuit": "enable", + # "external_out": "disable", + # "flood_reduction": "disable", + # "hello_interval": 1, + # "mtu_ignore": "enable", + # "packet_size": 577, + # "passive": "disable", + # "priority": 1, + # "process_id": "30", + # "retransmit_interval": 2, + # "router_id": "2.2.2.2", + # "summary_in": "enable", + # "transmit_delay": 2, + # "weight": 2 + # } + # ] + # } + # + # "commands": [ + # "router ospf 27", + # "no area 10 authentication keychain ansi11393", + # "area 20 authentication keychain ansi11393", + # "area 20 default-cost 2", + # "area 20 cost 2" + # ] + # + # "after": { + # "processes": [ + # { + # "areas": [ + # { + # "area_id": "11", + # "cost": 11, + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "authentication": { + # "keychain": "ansible_test1102" + # }, + # "process_id": "10" + # }, + # { + # "adjacency_stagger": { + # "max_adjacency": 20, + # "min_adjacency": 10 + # }, + # "authentication": { + # "message_digest": { + # "keychain": "ansible1101pass" + # } + # }, + # "process_id": "26" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "hello_interval": 2 + # }, + # { + # "area_id": "20", + # "authentication": { + # "keychain": "ansi11393" + # }, + # "cost": 2, + # "default_cost": 2 + # } + # ], + # "process_id": "27" + # }, + # { + # "areas": [ + # { + # "area_id": "11", + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "cost": 2, + # "dead_interval": 2, + # "default_metric": 10, + # "demand_circuit": "enable", + # "external_out": "disable", + # "flood_reduction": "disable", + # "hello_interval": 1, + # "mtu_ignore": "enable", + # "packet_size": 577, + # "passive": "disable", + # "priority": 1, + # "process_id": "30", + # "retransmit_interval": 2, + # "router_id": "2.2.2.2", + # "summary_in": "enable", + # "transmit_delay": 2, + # "weight": 2 + # } + # ] + # } + # + # + # ----------- + # After state + # ----------- + # + # RP/0/RP0/CPU0:anton(config)#do show running-config router ospf + # Thu Jun 11 16:40:31.038 UTC + # router ospf 10 + # authentication keychain ansible_test1102 + # area 11 + # cost 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # router ospf 26 + # authentication message-digest keychain ansible1101pass + # adjacency stagger 10 20 + # ! + # router ospf 27 + # area 10 + # hello-interval 2 + # ! + # area 20 + # cost 2 + # authentication keychain ansi11393 + # default-cost 2 + # ! + # ! + # router ospf 30 + # router-id 2.2.2.2 + # summary-in enable + # external-out disable + # cost 2 + # packet-size 577 + # weight 2 + # passive disable + # priority 1 + # mtu-ignore enable + # flood-reduction disable + # dead-interval 2 + # retransmit-interval 2 + # demand-circuit enable + # hello-interval 1 + # transmit-delay 2 + # default-metric 10 + # area 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # + + + # Using overridden + # + # ------------ + # Before state + # ------------ + # + # + # RP/0/RP0/CPU0:anton#show running-config router ospf + # Thu Jun 11 16:06:44.406 UTC + # router ospf 10 + # authentication keychain ansible_test1102 + # area 11 + # cost 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # router ospf 26 + # authentication message-digest keychain ansible1101pass + # adjacency stagger 10 20 + # ! + # router ospf 27 + # area 10 + # authentication keychain ansi11393 + # hello-interval 2 + # ! + # ! + # router ospf 30 + # router-id 2.2.2.2 + # summary-in enable + # external-out disable + # cost 2 + # packet-size 577 + # weight 2 + # passive disable + # priority 1 + # mtu-ignore enable + # flood-reduction disable + # dead-interval 2 + # retransmit-interval 2 + # demand-circuit enable + # hello-interval 1 + # transmit-delay 2 + # default-metric 10 + # area 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # + + - name: Override existing OSPFv2 configurations from the device + cisco.iosxr.iosxr_ospfv2: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + authentication: + keychain: ansi11393 + - area_id: 20 + cost: 2 + default_cost: 2 + authentication: + keychain: ansi11393 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 + state: overridden + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "before": { + # "processes": [ + # { + # "areas": [ + # { + # "area_id": "11", + # "cost": 11, + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "authentication": { + # "keychain": "ansible_test1102" + # }, + # "process_id": "10" + # }, + # { + # "adjacency_stagger": { + # "max_adjacency": 20, + # "min_adjacency": 10 + # }, + # "authentication": { + # "message_digest": { + # "keychain": "ansible1101pass" + # } + # }, + # "process_id": "26" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "authentication": { + # "keychain": "ansi11393" + # }, + # "hello_interval": 2 + # } + # ], + # "process_id": "27" + # }, + # { + # "areas": [ + # { + # "area_id": "11", + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "cost": 2, + # "dead_interval": 2, + # "default_metric": 10, + # "demand_circuit": "enable", + # "external_out": "disable", + # "flood_reduction": "disable", + # "hello_interval": 1, + # "mtu_ignore": "enable", + # "packet_size": 577, + # "passive": "disable", + # "priority": 1, + # "process_id": "30", + # "retransmit_interval": 2, + # "router_id": "2.2.2.2", + # "summary_in": "enable", + # "transmit_delay": 2, + # "weight": 2 + # } + # ] + # } + # + # "commands": [ + # "router ospf 10", + # "no authentication keychain ansible_test1102", + # "no area 11 default-cost 5", + # "no area 11 cost 11", + # "no area 22 default-cost 6", + # "router ospf 30", + # "no cost 2", + # "no weight 2", + # "no passive disable", + # "no priority 1", + # "no flood-reduction disable", + # "no default-metric 10", + # "no router-id 2.2.2.2", + # "no demand-circuit enable", + # "no packet-size 577", + # "no transmit-delay 2", + # "no summary-in enable", + # "no external-out disable", + # "no dead-interval 2", + # "no hello-interval 1", + # "no retransmit-interval 2", + # "no mtu-ignore enable", + # "no area 11 default-cost 5", + # "no area 22 default-cost 6", + # "router ospf 27", + # "area 20 authentication keychain ansi11393", + # "area 20 default-cost 2", + # "area 20 cost 2" + # ] + # + # "after": { + # "processes": [ + # { + # "process_id": "10" + # }, + # { + # "adjacency_stagger": { + # "max_adjacency": 20, + # "min_adjacency": 10 + # }, + # "authentication": { + # "message_digest": { + # "keychain": "ansible1101pass" + # } + # }, + # "process_id": "26" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "authentication": { + # "keychain": "ansi11393" + # }, + # "hello_interval": 2 + # }, + # { + # "area_id": "20", + # "authentication": { + # "keychain": "ansi11393" + # }, + # "cost": 2, + # "default_cost": 2 + # } + # ], + # "process_id": "27" + # }, + # { + # "process_id": "30" + # } + # ] + # } + # + # + # ----------- + # After state + # ----------- + # + # RP/0/RP0/CPU0:anton#show running-config router ospf + # Thu Jun 11 16:50:36.332 UTC + # router ospf 10 + # ! + # router ospf 26 + # authentication message-digest keychain ansible1101pass + # adjacency stagger 10 20 + # ! + # router ospf 27 + # area 10 + # authentication keychain ansi11393 + # hello-interval 2 + # ! + # area 20 + # cost 2 + # authentication keychain ansi11393 + # default-cost 2 + # ! + # ! + # router ospf 30 + # ! + # + + + # Using deleted + # + # ------------ + # Before state + # ------------ + # + # + # RP/0/RP0/CPU0:anton#show running-config router ospf + # Thu Jun 11 16:06:44.406 UTC + # router ospf 10 + # authentication keychain ansible_test1102 + # area 11 + # cost 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # router ospf 26 + # authentication message-digest keychain ansible1101pass + # adjacency stagger 10 20 + # ! + # router ospf 27 + # area 10 + # authentication keychain ansi11393 + # hello-interval 2 + # ! + # ! + # router ospf 30 + # router-id 2.2.2.2 + # summary-in enable + # external-out disable + # cost 2 + # packet-size 577 + # weight 2 + # passive disable + # priority 1 + # mtu-ignore enable + # flood-reduction disable + # dead-interval 2 + # retransmit-interval 2 + # demand-circuit enable + # hello-interval 1 + # transmit-delay 2 + # default-metric 10 + # area 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # + + - name: Deleted existing OSPFv2 configurations from the device + cisco.iosxr.iosxr_ospfv2: + config: + processes: + - process_id: '10' + - process_id: '26' + - process_id: '27' + - process_id: '30' + state: deleted + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "before": { + # "processes": [ + # { + # "areas": [ + # { + # "area_id": "11", + # "cost": 11, + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "authentication": { + # "keychain": "ansible_test1102" + # }, + # "process_id": "10" + # }, + # { + # "adjacency_stagger": { + # "max_adjacency": 20, + # "min_adjacency": 10 + # }, + # "authentication": { + # "message_digest": { + # "keychain": "ansible1101pass" + # } + # }, + # "process_id": "26" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "authentication": { + # "keychain": "ansi11393" + # }, + # "hello_interval": 2 + # } + # ], + # "process_id": "27" + # }, + # { + # "areas": [ + # { + # "area_id": "11", + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "cost": 2, + # "dead_interval": 2, + # "default_metric": 10, + # "demand_circuit": "enable", + # "external_out": "disable", + # "flood_reduction": "disable", + # "hello_interval": 1, + # "mtu_ignore": "enable", + # "packet_size": 577, + # "passive": "disable", + # "priority": 1, + # "process_id": "30", + # "retransmit_interval": 2, + # "router_id": "2.2.2.2", + # "summary_in": "enable", + # "transmit_delay": 2, + # "weight": 2 + # } + # ] + # }, + # + # "commands": [ + # "router ospf 10", + # "no authentication keychain ansible_test1102", + # "no area 11 default-cost 5", + # "no area 11 cost 11", + # "no area 22 default-cost 6", + # "router ospf 26", + # "no adjacency stagger 10 20", + # "no authentication message-digest keychain ansible1101pass", + # "router ospf 27", + # "no area 10 authentication keychain ansi11393", + # "no area 10 hello-interval 2", + # "router ospf 30", + # "no cost 2", + # "no weight 2", + # "no passive disable", + # "no priority 1", + # "no flood-reduction disable", + # "no default-metric 10", + # "no router-id 2.2.2.2", + # "no demand-circuit enable", + # "no packet-size 577", + # "no transmit-delay 2", + # "no summary-in enable", + # "no external-out disable", + # "no dead-interval 2", + # "no hello-interval 1", + # "no retransmit-interval 2", + # "no mtu-ignore enable", + # "no area 11 default-cost 5", + # "no area 22 default-cost 6" + # ] + # + # "after": { + # "processes": [ + # { + # "process_id": "10" + # }, + # { + # "process_id": "26" + # }, + # { + # "process_id": "27" + # }, + # { + # "process_id": "30" + # } + # ] + # } + # + # + # ----------- + # After state + # ----------- + # + # RP/0/RP0/CPU0:anton(config)#show running-config router ospf + # Thu Jun 11 17:07:34.218 UTC + # router ospf 10 + # ! + # router ospf 26 + # ! + # router ospf 27 + # ! + # router ospf 30 + # ! + + + # Using parsed + # parsed.cfg + # ------------ + # Thu Jun 11 17:28:51.918 UTC + # router ospf 10 + # authentication keychain ansible_test1102 + # area 11 + # cost 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # router ospf 26 + # authentication message-digest keychain ansible1101pass + # adjacency stagger 10 20 + # ! + # router ospf 27 + # area 10 + # authentication keychain ansi11393 + # hello-interval 2 + # ! + # ! + # router ospf 30 + # router-id 2.2.2.2 + # summary-in enable + # external-out disable + # cost 2 + # packet-size 577 + # weight 2 + # passive disable + # priority 1 + # mtu-ignore enable + # flood-reduction disable + # dead-interval 2 + # retransmit-interval 2 + # demand-circuit enable + # hello-interval 1 + # transmit-delay 2 + # default-metric 10 + # area 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + - name: Parsed the device configuration to get output commands + cisco.iosxr.iosxr_ospfv2: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # + # "parsed": { + # "processes": [ + # { + # "areas": [ + # { + # "area_id": "11", + # "cost": 11, + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "authentication": { + # "keychain": "ansible_test1102" + # }, + # "process_id": "10" + # }, + # { + # "adjacency_stagger": { + # "max_adjacency": 20, + # "min_adjacency": 10 + # }, + # "authentication": { + # "message_digest": { + # "keychain": "ansible1101pass" + # } + # }, + # "process_id": "26" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "authentication": { + # "keychain": "ansi11393" + # }, + # "hello_interval": 2 + # } + # ], + # "process_id": "27" + # }, + # { + # "areas": [ + # { + # "area_id": "11", + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "cost": 2, + # "dead_interval": 2, + # "default_metric": 10, + # "demand_circuit": "enable", + # "external_out": "disable", + # "flood_reduction": "disable", + # "hello_interval": 1, + # "mtu_ignore": "enable", + # "packet_size": 577, + # "passive": "disable", + # "priority": 1, + # "process_id": "30", + # "retransmit_interval": 2, + # "router_id": "2.2.2.2", + # "summary_in": "enable", + # "transmit_delay": 2, + # "weight": 2 + # } + # ] + # } + + + + # Using rendered + # + # + - name: Render the commands for provided configuration + cisco.iosxr.iosxr_ospfv2: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + authentication: + keychain: ansi11393 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 + - process_id: 10 + authentication: + keychain: ansible_test1102 + areas: + - area_id: 11 + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: 30 + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + weight: 2 + packet_size: 577 + priority: 1 + router_id: 2.2.2.2 + demand_circuit: enable + passive: disable + summary_in: enable + flood_reduction: disable + mtu_ignore: enable + external_out: disable + state: rendered + + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # + # "rendered": [ + # "router ospf 27", + # "area 10 authentication keychain ansi11393", + # "area 10 hello-interval 2", + # "router ospf 26", + # "adjacency stagger 10 20", + # "authentication message-digest keychain ansible1101pass", + # "router ospf 10", + # "authentication keychain ansible_test1102", + # "area 11 default-cost 5", + # "area 11 cost 11", + # "area 22 default-cost 6", + # "router ospf 30", + # "cost 2", + # "weight 2", + # "passive disable", + # "priority 1", + # "flood-reduction disable", + # "default-metric 10", + # "router-id 2.2.2.2", + # "demand-circuit enable", + # "packet-size 577", + # "transmit-delay 2", + # "summary-in enable", + # "external-out disable", + # "dead-interval 2", + # "hello-interval 1", + # "retransmit-interval 2", + # "mtu-ignore enable", + # "area 11 default-cost 5", + # "area 22 default-cost 6" + # ] + + + # Using gathered + # + # Before state: + # ------------- + # + # RP/0/RP0/CPU0:anton#show running-config router ospf + # Thu Jun 11 16:06:44.406 UTC + # router ospf 10 + # authentication keychain ansible_test1102 + # area 11 + # cost 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # router ospf 26 + # authentication message-digest keychain ansible1101pass + # adjacency stagger 10 20 + # ! + # router ospf 27 + # area 10 + # authentication keychain ansi11393 + # hello-interval 2 + # ! + # ! + # router ospf 30 + # router-id 2.2.2.2 + # summary-in enable + # external-out disable + # cost 2 + # packet-size 577 + # weight 2 + # passive disable + # priority 1 + # mtu-ignore enable + # flood-reduction disable + # dead-interval 2 + # retransmit-interval 2 + # demand-circuit enable + # hello-interval 1 + # transmit-delay 2 + # default-metric 10 + # area 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # + - name: Gather ospfv2 routes configuration + cisco.iosxr.iosxr_ospfv2: + state: gathered + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # "gathered": { + # "processes": [ + # { + # "areas": [ + # { + # "area_id": "11", + # "cost": 11, + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "authentication": { + # "keychain": "ansible_test1102" + # }, + # "process_id": "10" + # }, + # { + # "adjacency_stagger": { + # "max_adjacency": 20, + # "min_adjacency": 10 + # }, + # "authentication": { + # "message_digest": { + # "keychain": "ansible1101pass" + # } + # }, + # "process_id": "26" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "authentication": { + # "keychain": "ansi11393" + # }, + # "hello_interval": 2 + # } + # ], + # "process_id": "27" + # }, + # { + # "areas": [ + # { + # "area_id": "11", + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "cost": 2, + # "dead_interval": 2, + # "default_metric": 10, + # "demand_circuit": "enable", + # "external_out": "disable", + # "flood_reduction": "disable", + # "hello_interval": 1, + # "mtu_ignore": "enable", + # "packet_size": 577, + # "passive": "disable", + # "priority": 1, + # "process_id": "30", + # "retransmit_interval": 2, + # "router_id": "2.2.2.2", + # "summary_in": "enable", + # "transmit_delay": 2, + # "weight": 2 + # } + # ] + # } + # + # After state: + # ------------- + # + # RP/0/RP0/CPU0:anton#show running-config router ospf + # Thu Jun 11 16:06:44.406 UTC + # router ospf 10 + # authentication keychain ansible_test1102 + # area 11 + # cost 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # router ospf 26 + # authentication message-digest keychain ansible1101pass + # adjacency stagger 10 20 + # ! + # router ospf 27 + # area 10 + # authentication keychain ansi11393 + # hello-interval 2 + # ! + # ! + # router ospf 30 + # router-id 2.2.2.2 + # summary-in enable + # external-out disable + # cost 2 + # packet-size 577 + # weight 2 + # passive disable + # priority 1 + # mtu-ignore enable + # flood-reduction disable + # dead-interval 2 + # retransmit-interval 2 + # demand-circuit enable + # hello-interval 1 + # transmit-delay 2 + # default-metric 10 + # area 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # + # + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ after + +
+ dictionary +
+
when changed +
The resulting configuration model invocation.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ before + +
+ dictionary +
+
always +
The configuration prior to the model invocation.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ commands + +
+ list +
+
always +
The set of commands pushed to the remote device.
+
+
Sample:
+
['router ospf 30', "authentication message-digest keychain 'ansible1101pass'"]
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Rohit Thakur (@rohitthakur2590) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_ospfv3_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_ospfv3_module.rst new file mode 100644 index 00000000..f9fa3d0c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_ospfv3_module.rst @@ -0,0 +1,10348 @@ +.. _cisco.iosxr.iosxr_ospfv3_module: + + +************************ +cisco.iosxr.iosxr_ospfv3 +************************ + +**ospfv3 resource module** + + +Version added: 1.1.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages global ospfv3 configuration on devices running Cisco IOS-XR + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ dictionary +
+
+ +
A list of ospfv3 process configuration
+
+
+ processes + +
+ list + / elements=dictionary +
+
+ +
A list of ospfv3 instances configuration
+
+
+ address_family_unicast + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable unicast topology for ipv4 address family
+
+
+ areas + +
+ list + / elements=dictionary +
+
+ +
Configure ospfv3 areas' properties
+
+
+ area_id + +
+ string + / required +
+
+ +
Area ID as IP address or integer
+
+
+ authentication + +
+ dictionary +
+
+ +
Enable authentication
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Do not authenticate OSPFv3 packets
+
+
+ ipsec + +
+ dictionary +
+
+ +
Specify IPSec AH authentication attributes
+
+
+ algorithim_type + +
+ string +
+
+
    Choices: +
  • md5
  • +
  • sha1
  • +
+
+
Specify the type of algorithim
+
+
+ clear_key + +
+ string +
+
+ +
Specify key in cleartext form
+
+
+ key + +
+ string +
+
+ +
Specify key
+
+
+ password_key + +
+ string +
+
+ +
Specify key in encrypted form
+
+
+ spi + +
+ integer +
+
+ +
Specify the Security Parameter Index value
+
+
+ bfd + +
+ dictionary +
+
+ +
Configure BFD parameters
+
+
+ fast_detect + +
+ dictionary +
+
+ +
Configure fast detection
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable fast detection only
+
+
+ strict_mode + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Hold down neighbor session until BFD session is up
+
+
+ minimum_interval + +
+ integer +
+
+ +
Hello interval in milli-seconds
+
+
+ multiplier + +
+ integer +
+
+ +
Detect multiplier
+
+
+ cost + +
+ integer +
+
+ +
Interface cost
+
+
+ database_filter + +
+ dictionary +
+
+ +
Filter LSAs during synchronization and flooding
+
+
+ all_outgoing_lsa + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Filter all outgoing LSA
+
+
+ dead_interval + +
+ integer +
+
+ +
Interval after which a neighbor is declared dead
+
+
+ default_cost + +
+ integer +
+
+ +
Set the summary default-cost of a NSSA/stub area. Stub's advertised external route metric
+
+
+ demand_circuit + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable ospfv3 demand circuit
+
+
+ distrinbute_rib_prefix_list_name + +
+ string +
+
+ +
Filter LSAs during synchronization and flooding
+
+
+ encryption + +
+ dictionary +
+
+ +
Encrypt and authenticate OSPFv3 packets
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Do not encrypt OSPFv3 packets
+
+
+ ipsec + +
+ dictionary +
+
+ +
Specify IPSec ESP encryption and authentication
+
+
+ esp + +
+ dictionary +
+
+ +
Specify encryption parameters
+
+
+ aes + +
+ dictionary +
+
+ +
This specify the aes algorithim
+
+
+ algorithim_type + +
+ string +
+
+
    Choices: +
  • 192
  • +
  • 256
  • +
+
+
Specify the bit encryption for aes algorithim
+
+
+ clear_key + +
+ string +
+
+ +
Specify AES key in cleartext form
+
+
+ key + +
+ string +
+
+ +
Cleartext AES key
+
+
+ password_key + +
+ string +
+
+ +
Specify AES key in encrypted form
+
+
+ des + +
+ dictionary +
+
+ +
This specify the des algorithim
+
+
+ clear_key + +
+ string +
+
+ +
Specify AES key in cleartext form
+
+
+ key + +
+ string +
+
+ +
Cleartext AES key
+
+
+ password_key + +
+ string +
+
+ +
Specify AES key in encrypted form
+
+
+ null_encryption + +
+ dictionary +
+
+ +
Specify null encryption attributes
+
+
+ authentication + +
+ dictionary +
+
+ +
Specify authentication parameters
+
+
+ algorithim_type + +
+ string +
+
+
    Choices: +
  • md5
  • +
  • sha1
  • +
+
+
Specify the type of algorithim
+
+
+ clear_key + +
+ string +
+
+ +
Specify key in cleartext form
+
+
+ key + +
+ string +
+
+ +
Specify key
+
+
+ password_key + +
+ string +
+
+ +
Specify key in encrypted form
+
+
+ triple_des + +
+ dictionary +
+
+ +
This specify the triple DES algorithim
+
+
+ clear_key + +
+ string +
+
+ +
Specify 3DES key in cleartext form
+
+
+ key + +
+ string +
+
+ +
Cleartext 3DES key
+
+
+ password_key + +
+ string +
+
+ +
Specify 3DES key in encrypted form
+
+
+ spi + +
+ integer +
+
+ +
Specify the Security Parameter Index value
+
+
+ fast_reroute + +
+ dictionary +
+
+ +
Specify IP Fast Reroute
+
+
+ disabled + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable IP fast reroute
+
+
+ per_link + +
+ dictionary +
+
+ +
Specify per-prefix computation
+
+
+ information_type + +
+ string +
+
+
    Choices: +
  • exclude
  • +
  • lfa_candidate
  • +
+
+
Specify per-link LFA exclusion or FRR LFA candidate information
+
+
+ interface + +
+ dictionary +
+
+ +
Specify Per-link LFA exclusion information
+
+
+ bundle_ether + +
+ list + / elements=integer +
+
+ +
Specify Aggregated Ethernet interface(s)
+
+
+ bvi + +
+ list + / elements=integer +
+
+ +
Specify Bridge-Group Virtual Interface
+
+
+ fast_ethernet + +
+ list + / elements=string +
+
+ +
Specify FastEthernet/IEEE 802.3 interface(s)
+
+
+ fiftygige + +
+ list + / elements=string +
+
+ +
Specify FiftyGigE/IEEE 802.3 interface(s)
+
+
+ fortygige + +
+ list + / elements=string +
+
+ +
Specify FortyGigE/IEEE 802.3 interface(s)
+
+
+ fourhundredgige + +
+ list + / elements=string +
+
+ +
Specify FourHundredGigE/IEEE 802.3 interface(s)
+
+
+ gigabitethernet + +
+ list + / elements=string +
+
+ +
Specify GigabitEthernet/IEEE 802.3 interface(s)
+
+
+ hundredgige + +
+ list + / elements=string +
+
+ +
Specify HundredGigE/IEEE 802.3 interface(s)
+
+
+ mgmteth + +
+ list + / elements=string +
+
+ +
Specify MgmtEth/IEEE 802.3 interface(s)
+
+
+ multilink + +
+ list + / elements=string +
+
+ +
Specify Multilink network interface(s)
+
+
+ nve + +
+ list + / elements=integer +
+
+ +
Specify Network Virtualization Endpoint Interface(s)
+
+
+ pos_int + +
+ list + / elements=integer +
+
+ +
Specify Aggregated pos interface(s)
+
+
+ pw_ether + +
+ list + / elements=integer +
+
+ +
Specify PWHE Ethernet Interface
+
+
+ pw_iw + +
+ list + / elements=integer +
+
+ +
Specify PWHE VC11 IP Interworking Interface
+
+
+ serial + +
+ list + / elements=string +
+
+ +
Specify Serial network interface(s)
+
+
+ srp + +
+ list + / elements=string +
+
+ +
Specify SRP interface(s)
+
+
+ tengige + +
+ list + / elements=string +
+
+ +
Specify TenGigabitEthernet/IEEE 802.3 interface(s)
+
+
+ tunnel_ip + +
+ list + / elements=integer +
+
+ +
Specify GRE/IPinIP Tunnel Interface(s)
+
+
+ tunnel_ipsec + +
+ list + / elements=integer +
+
+ +
Specify IPSec Tunnel interface(s)
+
+
+ tunnel_mpls + +
+ integer +
+
+ +
MPLS Transport Protocol Tunnel interface
+
+
+ tunnel_mte + +
+ list + / elements=integer +
+
+ +
Specify MPLS Traffic Engineering P2MP Tunnel interface(s)
+
+
+ twentyfivegige + +
+ list + / elements=string +
+
+ +
Specify TwentyFiveGigabitEthernet/IEEE 802.3 interface(s)
+
+
+ twohundredgige + +
+ list + / elements=string +
+
+ +
Specify TwoHundredGigE/IEEE 802.3 interface(s)
+
+
+ use_candidate_only + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable backup selection from candidate-list only
+
+
+ per_prefix + +
+ dictionary +
+
+ +
Specify per-prefix computation
+
+
+ information_type + +
+ string +
+
+
    Choices: +
  • exclude
  • +
  • lfa_candidate
  • +
+
+
Specify per_prefix LFA exclusion or FRR LFA candidate information
+
+
+ interface + +
+ dictionary +
+
+ +
Specify Per-link LFA exclusion information
+
+
+ bundle_ether + +
+ list + / elements=integer +
+
+ +
Specify Aggregated Ethernet interface(s)
+
+
+ bvi + +
+ list + / elements=integer +
+
+ +
Specify Bridge-Group Virtual Interface
+
+
+ fast_ethernet + +
+ list + / elements=string +
+
+ +
Specify FastEthernet/IEEE 802.3 interface(s)
+
+
+ fiftygige + +
+ list + / elements=string +
+
+ +
Specify FiftyGigE/IEEE 802.3 interface(s)
+
+
+ fortygige + +
+ list + / elements=string +
+
+ +
Specify FortyGigE/IEEE 802.3 interface(s)
+
+
+ fourhundredgige + +
+ list + / elements=string +
+
+ +
Specify FourHundredGigE/IEEE 802.3 interface(s)
+
+
+ gigabitethernet + +
+ list + / elements=string +
+
+ +
Specify GigabitEthernet/IEEE 802.3 interface(s)
+
+
+ hundredgige + +
+ list + / elements=string +
+
+ +
Specify HundredGigE/IEEE 802.3 interface(s)
+
+
+ mgmteth + +
+ list + / elements=string +
+
+ +
Specify MgmtEth/IEEE 802.3 interface(s)
+
+
+ multilink + +
+ list + / elements=string +
+
+ +
Specify Multilink network interface(s)
+
+
+ nve + +
+ list + / elements=integer +
+
+ +
Specify Network Virtualization Endpoint Interface(s)
+
+
+ pos_int + +
+ list + / elements=integer +
+
+ +
Specify Aggregated pos interface(s)
+
+
+ pw_ether + +
+ list + / elements=integer +
+
+ +
Specify PWHE Ethernet Interface
+
+
+ pw_iw + +
+ list + / elements=integer +
+
+ +
Specify PWHE VC11 IP Interworking Interface
+
+
+ serial + +
+ list + / elements=string +
+
+ +
Specify Serial network interface(s)
+
+
+ srp + +
+ list + / elements=string +
+
+ +
Specify SRP interface(s)
+
+
+ tengige + +
+ list + / elements=string +
+
+ +
Specify TenGigabitEthernet/IEEE 802.3 interface(s)
+
+
+ tunnel_ip + +
+ list + / elements=integer +
+
+ +
Specify GRE/IPinIP Tunnel Interface(s)
+
+
+ tunnel_ipsec + +
+ list + / elements=integer +
+
+ +
Specify IPSec Tunnel interface(s)
+
+
+ tunnel_mpls + +
+ integer +
+
+ +
MPLS Transport Protocol Tunnel interface
+
+
+ tunnel_mte + +
+ list + / elements=integer +
+
+ +
Specify MPLS Traffic Engineering P2MP Tunnel interface(s)
+
+
+ twentyfivegige + +
+ list + / elements=string +
+
+ +
Specify TwentyFiveGigabitEthernet/IEEE 802.3 interface(s)
+
+
+ twohundredgige + +
+ list + / elements=string +
+
+ +
Specify TwoHundredGigE/IEEE 802.3 interface(s)
+
+
+ use_candidate_only + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable backup selection from candidate-list only
+
+
+ flood_reduction + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable flood reduction
+
+
+ hello_interval + +
+ integer +
+
+ +
Specify Time between HELLO packets
+
+
+ instance_id + +
+ integer +
+
+ +
Specify instance ID
+
+
+ mpls_ldp_sync + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable MPLS LDP Sync
+
+
+ mtu_ignore + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable ignoring of MTU in DBD packets
+
+
+ network + +
+ string +
+
+
    Choices: +
  • broadcast
  • +
  • non-broadcast
  • +
  • point-to-multipoint
  • +
  • point-to-point
  • +
+
+
Specify Network type
+
+
+ nssa + +
+ dictionary +
+
+ +
NSSA settings for the area
+
+
+ default_information_originate + +
+ dictionary +
+
+ +
Originate default Type 7 LSA
+
+
+ metric + +
+ integer +
+
+ +
ospfv3 default metric
+
+
+ metric_type + +
+ integer +
+
+ +
Metric type for default routes
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set nssa to default information originate
+
+
+ no_redistribution + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Do not send redistributed LSAs into NSSA area
+
+
+ no_summary + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Do not send summary LSAs into NSSA area
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure area as NSSA
+
+
+ translate + +
+ dictionary +
+
+ +
Translate LSA
+
+
+ type7 + +
+ dictionary +
+
+ +
Translate from Type 7 to Type 5
+
+
+ always + +
+ boolean + / required +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Always translate LSAs
+
+
+ packet_size + +
+ integer +
+
+ +
Specify limit size of OSPFv3 packets
+
+
+ passive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable routing updates on an interface
+
+
+ prefix_suppression + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Hide all transit addresses on this interface
+
+
+ priority + +
+ integer +
+
+ +
Specify Router priority
+
+
+ ranges + +
+ list + / elements=dictionary +
+
+ +
Summarize routes matching address/mask (border routers only)
+
+
+ address + +
+ string + / required +
+
+ +
IP in Prefix format (X:X::X/length)
+
+
+ advertise + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Advertise this range (default)
+
+
+ cost + +
+ integer +
+
+ +
Specify user specified metric for this range
+
+
+ not_advertise + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
DoNotAdvertise this range
+
+
+ retransmit_interval + +
+ integer +
+
+ +
Specify Delay between LSA retransmissions
+
+
+ stub + +
+ dictionary +
+
+ +
Settings for configuring the area as a stub
+
+
+ no_summary + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Do not send summary LSA into stub area
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure the area as a stub
+
+
+ transmit_delay + +
+ integer +
+
+ +
Specify estimated time needed to send link-state update packet
+
+
+ virtual_link + +
+ list + / elements=dictionary +
+
+ +
Define a virtual link
+
+
+ authentication + +
+ dictionary +
+
+ +
Enable authentication
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Do not authenticate OSPFv3 packets
+
+
+ ipsec + +
+ dictionary +
+
+ +
Specify IPSec AH authentication attributes
+
+
+ algorithim_type + +
+ string +
+
+
    Choices: +
  • md5
  • +
  • sha1
  • +
+
+
Specify the type of algorithim
+
+
+ clear_key + +
+ string +
+
+ +
Specify key in cleartext form
+
+
+ key + +
+ string +
+
+ +
Specify key
+
+
+ password_key + +
+ string +
+
+ +
Specify key in encrypted form
+
+
+ spi + +
+ integer +
+
+ +
Specify the Security Parameter Index value
+
+
+ dead_interval + +
+ integer +
+
+ +
Interval after which a neighbor is declared dead
+
+
+ encryption + +
+ dictionary +
+
+ +
Encrypt and authenticate OSPFv3 packets
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Do not encrypt OSPFv3 packets
+
+
+ ipsec + +
+ dictionary +
+
+ +
Specify IPSec ESP encryption and authentication
+
+
+ esp + +
+ dictionary +
+
+ +
Specify encryption parameters
+
+
+ aes + +
+ dictionary +
+
+ +
This specify the aes algorithim
+
+
+ algorithim_type + +
+ string +
+
+
    Choices: +
  • 192
  • +
  • 256
  • +
+
+
Specify the bit encryption for aes algorithim
+
+
+ clear_key + +
+ string +
+
+ +
Specify AES key in cleartext form
+
+
+ key + +
+ string +
+
+ +
Cleartext AES key
+
+
+ password_key + +
+ string +
+
+ +
Specify AES key in encrypted form
+
+
+ des + +
+ dictionary +
+
+ +
This specify the des algorithim
+
+
+ clear_key + +
+ string +
+
+ +
Specify AES key in cleartext form
+
+
+ key + +
+ string +
+
+ +
Cleartext AES key
+
+
+ password_key + +
+ string +
+
+ +
Specify AES key in encrypted form
+
+
+ null_encryption + +
+ dictionary +
+
+ +
Specify null encryption attributes
+
+
+ authentication + +
+ dictionary +
+
+ +
Specify authentication parameters
+
+
+ algorithim_type + +
+ string +
+
+
    Choices: +
  • md5
  • +
  • sha1
  • +
+
+
Specify the type of algorithim
+
+
+ clear_key + +
+ string +
+
+ +
Specify key in cleartext form
+
+
+ key + +
+ string +
+
+ +
Specify key
+
+
+ password_key + +
+ string +
+
+ +
Specify key in encrypted form
+
+
+ triple_des + +
+ dictionary +
+
+ +
This specify the triple DES algorithim
+
+
+ clear_key + +
+ string +
+
+ +
Specify 3DES key in cleartext form
+
+
+ key + +
+ string +
+
+ +
Cleartext 3DES key
+
+
+ password_key + +
+ string +
+
+ +
Specify 3DES key in encrypted form
+
+
+ spi + +
+ integer +
+
+ +
Specify the Security Parameter Index value
+
+
+ hello_interval + +
+ integer +
+
+ +
Time between HELLO packets
+
+
+ id + +
+ string + / required +
+
+ +
Router-ID of virtual link neighbor (A.B.C.D)
+
+
+ retransmit_interval + +
+ integer +
+
+ +
Delay between LSA retransmissions
+
+
+ transmit_delay + +
+ integer +
+
+ +
Link state transmit delay
+
+
+ authentication + +
+ dictionary +
+
+ +
Enable authentication
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Do not authenticate OSPFv3 packets
+
+
+ ipsec + +
+ dictionary +
+
+ +
Specify IPSec AH authentication attributes
+
+
+ algorithim_type + +
+ string +
+
+
    Choices: +
  • md5
  • +
  • sha1
  • +
+
+
Specify the type of algorithim
+
+
+ clear_key + +
+ string +
+
+ +
Specify key in cleartext form
+
+
+ key + +
+ string +
+
+ +
Specify key
+
+
+ password_key + +
+ string +
+
+ +
Specify key in encrypted form
+
+
+ spi + +
+ integer +
+
+ +
Specify the Security Parameter Index value
+
+
+ auto_cost + +
+ dictionary +
+
+ +
Calculate ospfv3 interface cost according to bandwidth
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Assign ospfv3 cost based on interface type
+
+
+ reference_bandwidth + +
+ integer +
+
+ +
Specify reference bandwidth in megabits per sec
+
+
+ bfd + +
+ dictionary +
+
+ +
Configure BFD parameters
+
+
+ fast_detect + +
+ dictionary +
+
+ +
Configure fast detection
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable fast detection only
+
+
+ strict_mode + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Hold down neighbor session until BFD session is up
+
+
+ minimum_interval + +
+ integer +
+
+ +
Hello interval in milli-seconds
+
+
+ multiplier + +
+ integer +
+
+ +
Detect multiplier
+
+
+ capability + +
+ dictionary +
+
+ +
Enable specific OSPFv3 feature
+
+
+ type7 + +
+ dictionary +
+
+ +
Specify type7 nssa capability
+
+
+ prefer + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Prefer type7 externals over type5
+
+
+ translate + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Translate type7 to type5
+
+
+ cost + +
+ integer +
+
+ +
Specify Interface cost
+
+
+ database_filter + +
+ dictionary +
+
+ +
Filter LSAs during synchronization and flooding
+
+
+ all_outgoing_lsa + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Filter all outgoing LSA
+
+
+ dead_interval + +
+ integer +
+
+ +
Interval after which a neighbor is declared dead
+
+
+ default_information_originate + +
+ dictionary +
+
+ +
Control distribution of default information
+
+
+ always + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Always advertise default route
+
+
+ metric + +
+ integer +
+
+ +
ospfv3 default metric
+
+
+ metric_type + +
+ integer +
+
+ +
ospfv3 metric type for default routes
+
+
+ route_policy + +
+ string +
+
+ +
Apply route-policy to default-information origination
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable distribution of default route
+
+
+ tag + +
+ integer +
+
+ +
Set tag for default route
+
+
+ default_metric + +
+ integer +
+
+ +
Set metric of redistributed routes
+
+
+ demand_circuit + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable ospfv3 demand circuit
+
+
+ distance + +
+ dictionary +
+
+ +
Define an administrative distance
+
+
+ admin_distance + +
+ integer +
+
+ +
Administrative distance
+
+
+ ospfv3_distance + +
+ dictionary +
+
+ +
ospfv3 administrative distance
+
+
+ external + +
+ integer +
+
+ +
Distance for external routes
+
+
+ inter_area + +
+ integer +
+
+ +
Distance for inter-area routes
+
+
+ intra_area + +
+ integer +
+
+ +
Distance for intra-area routes
+
+
+ distribute_list + +
+ dictionary +
+
+ +
Filter prefixes to/from RIB
+
+
+ prefix_list + +
+ list + / elements=string +
+
+ +
Filter prefixes based on an IPv6 prefix-list
+
+
+ in + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Filter prefixes installed to RIB
+
+
+ name + +
+ string +
+
+ +
Specify Prefix-list name
+
+
+ out + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Filter prefixes redistributed from RIB
+
+
+ encryption + +
+ dictionary +
+
+ +
Encrypt and authenticate OSPFv3 packets
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Do not encrypt OSPFv3 packets
+
+
+ ipsec + +
+ dictionary +
+
+ +
Specify IPSec ESP encryption and authentication
+
+
+ esp + +
+ dictionary +
+
+ +
Specify encryption parameters
+
+
+ aes + +
+ dictionary +
+
+ +
This specify the aes algorithim
+
+
+ algorithim_type + +
+ string +
+
+
    Choices: +
  • 192
  • +
  • 256
  • +
+
+
Specify the bit encryption for aes algorithim
+
+
+ clear_key + +
+ string +
+
+ +
Specify AES key in cleartext form
+
+
+ key + +
+ string +
+
+ +
Cleartext AES key
+
+
+ password_key + +
+ string +
+
+ +
Specify AES key in encrypted form
+
+
+ des + +
+ dictionary +
+
+ +
This specify the des algorithim
+
+
+ clear_key + +
+ string +
+
+ +
Specify AES key in cleartext form
+
+
+ key + +
+ string +
+
+ +
Cleartext AES key
+
+
+ password_key + +
+ string +
+
+ +
Specify AES key in encrypted form
+
+
+ null_encryption + +
+ dictionary +
+
+ +
Specify null encryption attributes
+
+
+ authentication + +
+ dictionary +
+
+ +
Specify authentication parameters
+
+
+ algorithim_type + +
+ string +
+
+
    Choices: +
  • md5
  • +
  • sha1
  • +
+
+
Specify the type of algorithim
+
+
+ clear_key + +
+ string +
+
+ +
Specify key in cleartext form
+
+
+ key + +
+ string +
+
+ +
Specify key
+
+
+ password_key + +
+ string +
+
+ +
Specify key in encrypted form
+
+
+ triple_des + +
+ dictionary +
+
+ +
This specify the triple DES algorithim
+
+
+ clear_key + +
+ string +
+
+ +
Specify 3DES key in cleartext form
+
+
+ key + +
+ string +
+
+ +
Cleartext 3DES key
+
+
+ password_key + +
+ string +
+
+ +
Specify 3DES key in encrypted form
+
+
+ spi + +
+ integer +
+
+ +
Specify the Security Parameter Index value
+
+
+ fast_reroute + +
+ dictionary +
+
+ +
Specify IP Fast Reroute
+
+
+ disabled + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable IP fast reroute
+
+
+ per_link + +
+ dictionary +
+
+ +
Specify per-prefix computation
+
+
+ information_type + +
+ string +
+
+
    Choices: +
  • exclude
  • +
  • lfa_candidate
  • +
+
+
Specify per-link LFA exclusion or FRR LFA candidate information
+
+
+ interface + +
+ dictionary +
+
+ +
Specify Per-link LFA exclusion information
+
+
+ bundle_ether + +
+ list + / elements=integer +
+
+ +
Specify Aggregated Ethernet interface(s)
+
+
+ bvi + +
+ list + / elements=integer +
+
+ +
Specify Bridge-Group Virtual Interface
+
+
+ fast_ethernet + +
+ list + / elements=string +
+
+ +
Specify FastEthernet/IEEE 802.3 interface(s)
+
+
+ fiftygige + +
+ list + / elements=string +
+
+ +
Specify FiftyGigE/IEEE 802.3 interface(s)
+
+
+ fortygige + +
+ list + / elements=string +
+
+ +
Specify FortyGigE/IEEE 802.3 interface(s)
+
+
+ fourhundredgige + +
+ list + / elements=string +
+
+ +
Specify FourHundredGigE/IEEE 802.3 interface(s)
+
+
+ gigabitethernet + +
+ list + / elements=string +
+
+ +
Specify GigabitEthernet/IEEE 802.3 interface(s)
+
+
+ hundredgige + +
+ list + / elements=string +
+
+ +
Specify HundredGigE/IEEE 802.3 interface(s)
+
+
+ mgmteth + +
+ list + / elements=string +
+
+ +
Specify MgmtEth/IEEE 802.3 interface(s)
+
+
+ multilink + +
+ list + / elements=string +
+
+ +
Specify Multilink network interface(s)
+
+
+ nve + +
+ list + / elements=integer +
+
+ +
Specify Network Virtualization Endpoint Interface(s)
+
+
+ pos_int + +
+ list + / elements=integer +
+
+ +
Specify Aggregated pos interface(s)
+
+
+ pw_ether + +
+ list + / elements=integer +
+
+ +
Specify PWHE Ethernet Interface
+
+
+ pw_iw + +
+ list + / elements=integer +
+
+ +
Specify PWHE VC11 IP Interworking Interface
+
+
+ serial + +
+ list + / elements=string +
+
+ +
Specify Serial network interface(s)
+
+
+ srp + +
+ list + / elements=string +
+
+ +
Specify SRP interface(s)
+
+
+ tengige + +
+ list + / elements=string +
+
+ +
Specify TenGigabitEthernet/IEEE 802.3 interface(s)
+
+
+ tunnel_ip + +
+ list + / elements=integer +
+
+ +
Specify GRE/IPinIP Tunnel Interface(s)
+
+
+ tunnel_ipsec + +
+ list + / elements=integer +
+
+ +
Specify IPSec Tunnel interface(s)
+
+
+ tunnel_mpls + +
+ integer +
+
+ +
MPLS Transport Protocol Tunnel interface
+
+
+ tunnel_mte + +
+ list + / elements=integer +
+
+ +
Specify MPLS Traffic Engineering P2MP Tunnel interface(s)
+
+
+ twentyfivegige + +
+ list + / elements=string +
+
+ +
Specify TwentyFiveGigabitEthernet/IEEE 802.3 interface(s)
+
+
+ twohundredgige + +
+ list + / elements=string +
+
+ +
Specify TwoHundredGigE/IEEE 802.3 interface(s)
+
+
+ use_candidate_only + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable backup selection from candidate-list only
+
+
+ per_prefix + +
+ dictionary +
+
+ +
Specify per-prefix computation
+
+
+ information_type + +
+ string +
+
+
    Choices: +
  • exclude
  • +
  • lfa_candidate
  • +
+
+
Specify per_prefix LFA exclusion or FRR LFA candidate information
+
+
+ interface + +
+ dictionary +
+
+ +
Specify Per-link LFA exclusion information
+
+
+ bundle_ether + +
+ list + / elements=integer +
+
+ +
Specify Aggregated Ethernet interface(s)
+
+
+ bvi + +
+ list + / elements=integer +
+
+ +
Specify Bridge-Group Virtual Interface
+
+
+ fast_ethernet + +
+ list + / elements=string +
+
+ +
Specify FastEthernet/IEEE 802.3 interface(s)
+
+
+ fiftygige + +
+ list + / elements=string +
+
+ +
Specify FiftyGigE/IEEE 802.3 interface(s)
+
+
+ fortygige + +
+ list + / elements=string +
+
+ +
Specify FortyGigE/IEEE 802.3 interface(s)
+
+
+ fourhundredgige + +
+ list + / elements=string +
+
+ +
Specify FourHundredGigE/IEEE 802.3 interface(s)
+
+
+ gigabitethernet + +
+ list + / elements=string +
+
+ +
Specify GigabitEthernet/IEEE 802.3 interface(s)
+
+
+ hundredgige + +
+ list + / elements=string +
+
+ +
Specify HundredGigE/IEEE 802.3 interface(s)
+
+
+ mgmteth + +
+ list + / elements=string +
+
+ +
Specify MgmtEth/IEEE 802.3 interface(s)
+
+
+ multilink + +
+ list + / elements=string +
+
+ +
Specify Multilink network interface(s)
+
+
+ nve + +
+ list + / elements=integer +
+
+ +
Specify Network Virtualization Endpoint Interface(s)
+
+
+ post_int + +
+ list + / elements=integer +
+
+ +
Specify Aggregated pos interface(s)
+
+
+ pw_ether + +
+ list + / elements=integer +
+
+ +
Specify PWHE Ethernet Interface
+
+
+ pw_iw + +
+ list + / elements=integer +
+
+ +
Specify PWHE VC11 IP Interworking Interface
+
+
+ serial + +
+ list + / elements=string +
+
+ +
Specify Serial network interface(s)
+
+
+ srp + +
+ list + / elements=string +
+
+ +
Specify SRP interface(s)
+
+
+ tengige + +
+ list + / elements=string +
+
+ +
Specify TenGigabitEthernet/IEEE 802.3 interface(s)
+
+
+ tunnel_ip + +
+ list + / elements=integer +
+
+ +
Specify GRE/IPinIP Tunnel Interface(s)
+
+
+ tunnel_ipsec + +
+ list + / elements=integer +
+
+ +
Specify IPSec Tunnel interface(s)
+
+
+ tunnel_mpls + +
+ integer +
+
+ +
MPLS Transport Protocol Tunnel interface
+
+
+ tunnel_mte + +
+ list + / elements=integer +
+
+ +
Specify MPLS Traffic Engineering P2MP Tunnel interface(s)
+
+
+ twentyfivegige + +
+ list + / elements=string +
+
+ +
Specify TwentyFiveGigabitEthernet/IEEE 802.3 interface(s)
+
+
+ twohundredgige + +
+ list + / elements=string +
+
+ +
Specify TwoHundredGigE/IEEE 802.3 interface(s)
+
+
+ use_candidate_only + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable backup selection from candidate-list only
+
+
+ flood_reduction + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable flood reduction
+
+
+ graceful_restart + +
+ dictionary +
+
+ +
Enable Graceful-Restart
+
+
+ helper_disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable router's helper support level
+
+
+ max_interval + +
+ integer +
+
+ +
Maximum route lifetime following restart
+
+
+ min_interval + +
+ integer +
+
+ +
Minimum interval between Graceful Restarts
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set graceful restart
+
+
+ hello_interval + +
+ integer +
+
+ +
Specify Time between HELLO packets
+
+
+ ignore_mospf_type6_lsa + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Ignore MOSPF Type 6 LSA
+
+
+ instance_id + +
+ integer +
+
+ +
Specify instance ID
+
+
+ log_adjacency_changes + +
+ dictionary +
+
+ +
Log adjacency state changes
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Log all state changes
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable log adjacency changes
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set log adjacency
+
+
+ maximum + +
+ dictionary +
+
+ +
Set OSPFv3 limits
+
+
+ interfaces + +
+ integer +
+
+ +
Specify limit for number of interfaces
+
+
+ paths + +
+ integer +
+
+ +
Specify limit for number of paths
+
+
+ redistributed_prefixes + +
+ integer +
+
+ +
Specify limit for number of redistributed prefixes
+
+
+ mpls_ldp_sync + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable MPLS LDP Sync
+
+
+ mtu_ignore + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable ignoring of MTU in DBD packets
+
+
+ network + +
+ string +
+
+
    Choices: +
  • broadcast
  • +
  • non-broadcast
  • +
  • point-to-multipoint
  • +
  • point-to-point
  • +
+
+
Specify Network type
+
+
+ nsr + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable NSR for all VRFs in this process
+
+
+ packet_size + +
+ integer +
+
+ +
Specify limit size of OSPFv3 packets
+
+
+ passive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable routing updates on an interface
+
+
+ prefix_suppression + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Hide all transit addresses on this interface
+
+
+ priority + +
+ integer +
+
+ +
Specify Router priority
+
+
+ process_id + +
+ string + / required +
+
+ +
The OSPFv3 Process ID
+
+
+ protocol_shutdown + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Gracefully shutdown the OSPFv3 protocol
+
+
+ redistribute + +
+ dictionary +
+
+ +
Redistribute information from another routing Protocol
+
+
+ application + +
+ list + / elements=dictionary +
+
+ +
Specify application routes
+
+
+ id + +
+ string + / required +
+
+ +
OnePK Application name
+
+
+ metric + +
+ integer +
+
+ +
Specify metric for redistributed routes
+
+
+ metric_type + +
+ integer +
+
+ +
Specify OSPFv3 exterior metric type for redistributed routes
+
+
+ route_policy + +
+ string +
+
+ +
Apply route policy to redistribution
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set application route
+
+
+ tag + +
+ integer +
+
+ +
Set tag for routes redistributed into OSPFv3
+
+
+ bgp + +
+ list + / elements=dictionary +
+
+ +
Specify bgp routes
+
+
+ id + +
+ integer + / required +
+
+ +
BGP process name
+
+
+ metric + +
+ integer +
+
+ +
Specify metric for redistributed routes
+
+
+ metric_type + +
+ integer +
+
+ +
Specify OSPFv3 exterior metric type for redistributed routes
+
+
+ preserved_med + +
+ string +
+
+ +
Specify preserve med of BGP routes
+
+
+ route_policy + +
+ string +
+
+ +
Apply route policy to redistribution
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set bgp route number
+
+
+ tag + +
+ integer +
+
+ +
Set tag for routes redistributed into OSPFv3
+
+
+ connected + +
+ dictionary +
+
+ +
Specify connected routes
+
+
+ metric + +
+ integer +
+
+ +
Specify metric for redistributed routes
+
+
+ metric_type + +
+ integer +
+
+ +
Specify OSPFv3 exterior metric type for redistributed routes
+
+
+ route_policy + +
+ string +
+
+ +
Apply route policy to redistribution
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set connected route
+
+
+ tag + +
+ integer +
+
+ +
Set tag for routes redistributed into OSPFv3
+
+
+ eigrp + +
+ list + / elements=dictionary +
+
+ +
Specify eigrp routes
+
+
+ id + +
+ integer + / required +
+
+ +
EIGRP process name
+
+
+ match + +
+ string +
+
+
    Choices: +
  • external
  • +
  • internal
  • +
+
+
Redistribution of EIGRP routes
+
+
+ metric + +
+ integer +
+
+ +
Specify metric for redistributed routes
+
+
+ metric_type + +
+ integer +
+
+ +
Specify OSPFv3 exterior metric type for redistributed routes
+
+
+ route_policy + +
+ string +
+
+ +
Apply route policy to redistribution
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set bgp route number
+
+
+ tag + +
+ integer +
+
+ +
Set tag for routes redistributed into OSPFv3
+
+
+ isis + +
+ list + / elements=dictionary +
+
+ +
Specify IS-IS routes
+
+
+ id + +
+ string + / required +
+
+ +
IS-IS name
+
+
+ level + +
+ string +
+
+
    Choices: +
  • level-1
  • +
  • level-1-2
  • +
  • level-2
  • +
+
+
Specify IS-IS level routes
+
+
+ metric + +
+ integer +
+
+ +
Specify metric for redistributed routes
+
+
+ metric_type + +
+ integer +
+
+ +
Specify OSPFv3 exterior metric type for redistributed routes
+
+
+ route_policy + +
+ string +
+
+ +
Apply route policy to redistribution
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set IS-IS route number
+
+
+ tag + +
+ integer +
+
+ +
Set tag for routes redistributed into OSPFv3
+
+
+ mobile + +
+ dictionary +
+
+ +
Specify mobile routes
+
+
+ metric + +
+ integer +
+
+ +
Specify metric for redistributed routes
+
+
+ metric_type + +
+ integer +
+
+ +
Specify OSPFv3 exterior metric type for redistributed routes
+
+
+ route_policy + +
+ string +
+
+ +
Apply route policy to redistribution
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set mobile route number
+
+
+ tag + +
+ integer +
+
+ +
Set tag for routes redistributed into OSPFv3
+
+
+ ospfv3 + +
+ list + / elements=dictionary +
+
+ +
Specify ospfv3 routes
+
+
+ id + +
+ string + / required +
+
+ +
OSPFv3 process name
+
+
+ match + +
+ dictionary +
+
+ +
Redistribution of OSPFv3 routes
+
+
+ external + +
+ integer +
+
+
    Choices: +
  • 1
  • +
  • 2
  • +
+
+
Redistribute OSPFv3 external routes
+
+
+ internal + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Redistribute OSPFv3 internal routes
+
+
+ nssa_external + +
+ integer +
+
+
    Choices: +
  • 1
  • +
  • 2
  • +
+
+
Redistribute NSSA OSPFv3 external routes
+
+
+ metric + +
+ integer +
+
+ +
Specify metric for redistributed routes
+
+
+ metric_type + +
+ integer +
+
+ +
Specify OSPFv3 exterior metric type for redistributed routes
+
+
+ route_policy + +
+ string +
+
+ +
Apply route policy to redistribution
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set ospfv3 route number
+
+
+ tag + +
+ integer +
+
+ +
Set tag for routes redistributed into OSPFv3
+
+
+ static + +
+ dictionary +
+
+ +
Specify static routes
+
+
+ metric + +
+ integer +
+
+ +
Specify metric for redistributed routes
+
+
+ metric_type + +
+ integer +
+
+ +
Specify OSPFv3 exterior metric type for redistributed routes
+
+
+ route_policy + +
+ string +
+
+ +
Apply route policy to redistribution
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set static route
+
+
+ tag + +
+ integer +
+
+ +
Set tag for routes redistributed into OSPFv3
+
+
+ subscriber + +
+ dictionary +
+
+ +
Specify subscriber routes
+
+
+ metric + +
+ integer +
+
+ +
Specify metric for redistributed routes
+
+
+ metric_type + +
+ integer +
+
+ +
Specify OSPFv3 exterior metric type for redistributed routes
+
+
+ route_policy + +
+ string +
+
+ +
Apply route policy to redistribution
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set static route
+
+
+ tag + +
+ integer +
+
+ +
Set tag for routes redistributed into OSPFv3
+
+
+ retransmit_interval + +
+ integer +
+
+ +
Delay between LSA retransmissions
+
+
+ router_id + +
+ string +
+
+ +
ospfv3 router-id in IPv4 address format (A.B.C.D)
+
+
+ spf_prefix_priority + +
+ dictionary +
+
+ +
Specify SPF configuration
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable SPF prefix priority
+
+
+ route_policy + +
+ list + / elements=dictionary +
+
+ +
Specify the route-policy to prioritize route install
+
+
+ name + +
+ string +
+
+ +
Specify name of the policy
+
+
+ value + +
+ string +
+
+ +
Specify parameter values for the policy ()
+
+
+ stub_router + +
+ dictionary +
+
+ +
Enter stub router configuration submode
+
+
+ router_lsa + +
+ dictionary +
+
+ +
Modify self originated router LSAs
+
+
+ advertise_with + +
+ string +
+
+
    Choices: +
  • max-metric
  • +
  • r-bit
  • +
  • v6-bit
  • +
+
+
Advertise LSAs with specified type
+
+
+ always + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Force ospfv3 stub router mode unconditionally
+
+
+ external_lsa + +
+ dictionary +
+
+ +
Override External LSA metric in stub router mode
+
+
+ metric + +
+ integer +
+
+ +
Metric to use while in stub router mode
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set external lsa
+
+
+ include_stub + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set maximum metric for stub links in stub router mode
+
+
+ on_proc_migration + +
+ integer +
+
+ +
Enter stub router mode on ospfv3 process migration
+
+
+ on_proc_restart + +
+ integer +
+
+ +
Enter stub router mode on ospfv3 process restart
+
+
+ on_startup + +
+ dictionary +
+
+ +
Enter stub router mode on startup
+
+
+ time + +
+ integer +
+
+ +
Time in seconds to stay in stub router mode
+
+
+ wait_for_bgp + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Exit stub router mode when BGP converges
+
+
+ on_switchover + +
+ integer +
+
+ +
Enter stub router mode on RP switchover
+
+
+ summary_lsa + +
+ dictionary +
+
+ +
Override Summary LSA metric in stub router mode
+
+
+ metric + +
+ integer +
+
+ +
Metric to use while in stub router mode
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable summary LSA
+
+
+ summary_prefix + +
+ list + / elements=dictionary +
+
+ +
Configure IP address summaries
+
+
+ not_advertise + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Suppress routes that match the specified prefix/mask pair
+
+
+ prefix + +
+ string + / required +
+
+ +
IP summary address/mask (A.B.C.D/prefix)
+
+
+ tag + +
+ integer +
+
+ +
Set tag
+
+
+ timers + +
+ dictionary +
+
+ +
Adjust routing timers
+
+
+ lsa_arrival + +
+ integer +
+
+ +
Specify LSA arrival timers
+
+
+ pacing + +
+ dictionary +
+
+ +
Specify pacing timers
+
+
+ flood + +
+ integer +
+
+ +
Flood pacing timer
+
+
+ lsa_group + +
+ integer +
+
+ +
LSA group pacing timer
+
+
+ retransmission + +
+ integer +
+
+ +
LSA group pacing timer
+
+
+ throttle + +
+ dictionary +
+
+ +
Adjust throttle timers
+
+
+ lsa + +
+ dictionary +
+
+ +
Specify LSA throttle timers
+
+
+ all_lsa_initial + +
+ integer +
+
+ +
Delay to generate first occurrence of LSA in milliseconds
+
+
+ all_lsa_minimum + +
+ integer +
+
+ +
Minimum delay between originating the same LSA in milliseconds
+
+
+ spf + +
+ dictionary +
+
+ +
Specify SPF throttle timers
+
+
+ spf_initial + +
+ integer +
+
+ +
Delay to generate first occurrence of SPF in ms
+
+
+ spf_minimum + +
+ integer +
+
+ +
Minimum delay between originating the same SPF in ms
+
+
+ trace + +
+ dictionary +
+
+ +
Specify OSPF tracing options
+
+
+ size + +
+ string +
+
+ +
Delete existing buffer and create one with N entries
+
+
+ value + +
+ integer +
+
+ +
Specify trace entry
+
+
+ transmit_delay + +
+ integer +
+
+ +
Estimated time needed to send link-state update packet
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the IOS-XR device by executing the command show running-config router ospfv3.
+
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • merged ←
  • +
  • replaced
  • +
  • overridden
  • +
  • deleted
  • +
  • gathered
  • +
  • rendered
  • +
  • parsed
  • +
+
+
The state the configuration should be left in
+
+
+ + +Notes +----- + +.. note:: + - Tested against IOS-XR 6.1.3 + - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_ + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + + # Before state: + # ------------- + # + # RP/0/RP0/CPU0:anton#show running-config router ospfv3 + # Thu Jun 11 15:54:44.569 UTC + # % No such configuration item(s) + # + + - name: Merge provided OSPFv3 configuration with the existing configuration + cisco.iosxr.iosxr_ospfv3: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - process_id: 26 + authentication: + disable: true + - process_id: 10 + areas: + - area_id: 11 + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: 30 + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + packet_size: 577 + priority: 1 + router_id: '2.2.2.2' + demand_circuit: true + mtu_ignore: true + state: merged + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "before": {} + # + # "commands": [ + # "router ospfv3 10", + # "area 11 default-cost 5", + # "area 11 cost 11", + # "area 22 default-cost 6", + # "router ospfv3 26", + # "authentication disable", + # "router ospfv3 27", + # "area 10 hello-interval 2", + # "router ospfv3 30", + # "cost 2", + # "priority 1", + # "default-metric 10", + # "router-id 2.2.2.2", + # "demand-circuit", + # "packet-size 577", + # "transmit-delay 2", + # "dead-interval 2", + # "hello-interval 1", + # "retransmit-interval 2", + # "mtu-ignore", + # "area 11 default-cost 5", + # "area 22 default-cost 6" + # ] + # + # "after": { + # "processes": [ + # { + # "areas": [ + # { + # "area_id": "11", + # "cost": 11, + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "process_id": "10" + # }, + # { + # "authentication": { + # "disable": true + # }, + # "process_id": "26" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "hello_interval": 2 + # } + # ], + # "process_id": "27" + # }, + # { + # "areas": [ + # { + # "area_id": "11", + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "cost": 2, + # "dead_interval": 2, + # "default_metric": 10, + # "demand_circuit": true, + # "hello_interval": 1, + # "mtu_ignore": true, + # "packet_size": 577, + # "priority": 1, + # "process_id": "30", + # "retransmit_interval": 2, + # "router_id": "2.2.2.2", + # "transmit_delay": 2 + # } + # ] + # } + # + # + # ------------ + # After state + # ------------ + # + # RP/0/RP0/CPU0:anton#show running-config router ospfv3 + # router ospfv3 10 + # area 11 + # cost 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # router ospfv3 26 + # authentication disable + # ! + # router ospfv3 27 + # area 10 + # hello-interval 2 + # ! + # area 20 + # ! + # area 30 + # ! + # ! + # router ospfv3 30 + # cost 2 + # priority 1 + # mtu-ignore + # packet-size 577 + # dead-interval 2 + # retransmit-interval 2 + # demand-circuit + # hello-interval 1 + # transmit-delay 2 + # router-id 2.2.2.2 + # default-metric 10 + # area 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # router ospfv3 10 + # area 11 + # cost 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # router ospfv3 26 + # authentication disable + # ! + # router ospfv3 27 + # area 10 + # hello-interval 2 + # ! + # area 20 + # ! + # area 30 + # ! + # ! + # router ospfv3 30 + # cost 2 + # priority 1 + # mtu-ignore + # packet-size 577 + # dead-interval 2 + # retransmit-interval 2 + # demand-circuit + # hello-interval 1 + # transmit-delay 2 + # router-id 2.2.2.2 + # default-metric 10 + # area 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + + + + # Using replaced + # + # ------------ + # Before state + # ------------ + # + # + # RP/0/RP0/CPU0:anton#show running-config router ospf + # router ospfv3 10 + # area 11 + # cost 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # router ospfv3 26 + # authentication disable + # ! + # router ospfv3 27 + # area 10 + # hello-interval 2 + # ! + # area 20 + # ! + # area 30 + # ! + # ! + # router ospfv3 30 + # cost 2 + # priority 1 + # mtu-ignore + # packet-size 577 + # dead-interval 2 + # retransmit-interval 2 + # demand-circuit + # hello-interval 1 + # transmit-delay 2 + # router-id 2.2.2.2 + # default-metric 10 + # area 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # router ospfv3 10 + # area 11 + # cost 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # router ospfv3 26 + # authentication disable + # ! + # router ospfv3 27 + # area 10 + # hello-interval 2 + # ! + # area 20 + # ! + # area 30 + # ! + # ! + # router ospfv3 30 + # cost 2 + # priority 1 + # mtu-ignore + # packet-size 577 + # dead-interval 2 + # retransmit-interval 2 + # demand-circuit + # hello-interval 1 + # transmit-delay 2 + # router-id 2.2.2.2 + # default-metric 10 + # area 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + + - name: Replace OSPFv3 routes configurations from the device + cisco.iosxr.iosxr_ospfv3: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - area_id: 20 + cost: 2 + default_cost: 2 + - process_id: 26 + authentication: + disable: true + state: replaced + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "before": { + # "processes": [ + # { + # "areas": [ + # { + # "area_id": "11", + # "cost": 11, + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "process_id": "10" + # }, + # { + # "authentication": { + # "disable": true + # }, + # "process_id": "26" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "hello_interval": 2 + # } + # ], + # "process_id": "27" + # }, + # { + # "areas": [ + # { + # "area_id": "11", + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "cost": 2, + # "dead_interval": 2, + # "default_metric": 10, + # "demand_circuit": true, + # "hello_interval": 1, + # "mtu_ignore": true, + # "packet_size": 577, + # "priority": 1, + # "process_id": "30", + # "retransmit_interval": 2, + # "router_id": "2.2.2.2", + # "transmit_delay": 2 + # } + # ] + # } + # + # "commands": [ + # "router ospfv3 27", + # "area 20 default-cost 2", + # "area 20 cost 2" + # ] + # + # "after": { + # "processes": [ + # { + # "areas": [ + # { + # "area_id": "11", + # "cost": 11, + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "process_id": "10" + # }, + # { + # "authentication": { + # "disable": true + # }, + # "process_id": "26" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "hello_interval": 2 + # }, + # { + # "area_id": "20", + # "cost": 2, + # "default_cost": 2 + # } + # ], + # "process_id": "27" + # }, + # { + # "areas": [ + # { + # "area_id": "11", + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "cost": 2, + # "dead_interval": 2, + # "default_metric": 10, + # "demand_circuit": true, + # "hello_interval": 1, + # "mtu_ignore": true, + # "packet_size": 577, + # "priority": 1, + # "process_id": "30", + # "retransmit_interval": 2, + # "router_id": "2.2.2.2", + # "transmit_delay": 2 + # } + # ] + # } + # + # + # ----------- + # After state + # ----------- + # + # RP/0/RP0/CPU0:anton(config)#do show running-config router ospfv3 + # router ospfv3 10 + # area 11 + # cost 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # router ospfv3 26 + # authentication disable + # ! + # router ospfv3 27 + # area 10 + # hello-interval 2 + # ! + # area 20 + # cost 2 + # default-cost 2 + # ! + # area 30 + # ! + # ! + # router ospfv3 30 + # cost 2 + # priority 1 + # mtu-ignore + # packet-size 577 + # dead-interval 2 + # retransmit-interval 2 + # demand-circuit + # hello-interval 1 + # transmit-delay 2 + # router-id 2.2.2.2 + # default-metric 10 + # area 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + + + - name: Override existing OSPFv3 configurations from the device + cisco.iosxr.iosxr_ospfv3: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + authentication: + disable: true + - area_id: 20 + cost: 2 + default_cost: 2 + authentication: + disable: true + - process_id: 26 + areas: + - area_id: 10 + hello_interval: 2 + authentication: + disable: true + state: overridden + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "before": { + # "processes": [ + # { + # "areas": [ + # { + # "area_id": "11", + # "cost": 11, + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "process_id": "10" + # }, + # { + # "authentication": { + # "disable": true + # }, + # "process_id": "26" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "hello_interval": 2 + # }, + # { + # "area_id": "20", + # "cost": 2, + # "default_cost": 2 + # } + # ], + # "process_id": "27" + # }, + # { + # "areas": [ + # { + # "area_id": "11", + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "cost": 2, + # "dead_interval": 2, + # "default_metric": 10, + # "demand_circuit": true, + # "hello_interval": 1, + # "mtu_ignore": true, + # "packet_size": 577, + # "priority": 1, + # "process_id": "30", + # "retransmit_interval": 2, + # "router_id": "2.2.2.2", + # "transmit_delay": 2 + # } + # ] + # } + # + # "commands": [ + # "router ospfv3 10", + # "no area 11 default-cost 5", + # "no area 11 cost 11", + # "no area 22 default-cost 6", + # "router ospfv3 30", + # "no cost 2", + # "no priority 1", + # "no default-metric 10", + # "no router-id 2.2.2.2", + # "no demand-circuit", + # "no packet-size 577", + # "no transmit-delay 2", + # "no dead-interval 2", + # "no hello-interval 1", + # "no retransmit-interval 2", + # "no mtu-ignore", + # "no area 11 default-cost 5", + # "no area 22 default-cost 6", + # "router ospfv3 26", + # "area 10 hello-interval 4" + # ] + # + # "after": { + # "processes": [ + # { + # "process_id": "10" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "hello_interval": 4 + # } + # ], + # "authentication": { + # "disable": true + # }, + # "process_id": "26" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "hello_interval": 2 + # }, + # { + # "area_id": "20", + # "cost": 2, + # "default_cost": 2 + # } + # ], + # "process_id": "27" + # }, + # { + # "process_id": "30" + # } + # ] + # } + # + # + # ----------- + # After state + # ----------- + # + # RP/0/RP0/CPU0:anton#show running-config router ospfv3 + # router ospfv3 10 + # area 11 + # ! + # area 22 + # ! + # ! + # router ospfv3 26 + # authentication disable + # area 10 + # hello-interval 4 + # ! + # ! + # router ospfv3 27 + # area 10 + # hello-interval 2 + # ! + # area 20 + # cost 2 + # default-cost 2 + # ! + # area 30 + # ! + # ! + # router ospfv3 30 + # area 11 + # ! + # area 22 + # ! + # ! + + + + # Using deleted + # + # ------------ + # Before state + # ------------ + # + # + # RP/0/RP0/CPU0:anton#show running-config router ospfv3 + # router ospfv3 10 + # area 11 + # ! + # area 22 + # ! + # ! + # router ospfv3 26 + # authentication disable + # area 10 + # hello-interval 4 + # ! + # ! + # router ospfv3 27 + # area 10 + # hello-interval 2 + # ! + # area 20 + # cost 2 + # default-cost 2 + # ! + # area 30 + # ! + # ! + # router ospfv3 30 + # area 11 + # ! + # area 22 + # ! + # ! + + - name: Deleted existing OSPFv3 configurations from the device + cisco.iosxr.iosxr_ospfv3: + config: + processes: + - process_id: '10' + - process_id: '26' + - process_id: '27' + - process_id: '30' + state: deleted + + # + # + # ------------------------ + # Module Execution Result + # ------------------------ + # + # "before": { + # "processes": [ + # { + # "process_id": "10" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "hello_interval": 4 + # } + # ], + # "authentication": { + # "disable": true + # }, + # "process_id": "26" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "hello_interval": 2 + # }, + # { + # "area_id": "20", + # "cost": 2, + # "default_cost": 2 + # } + # ], + # "process_id": "27" + # }, + # { + # "process_id": "30" + # } + # ] + # }, + # + # "commands": [ + # "router ospfv3 26", + # "no authentication disable", + # "no area 10 hello-interval 4", + # "router ospfv3 27", + # "no area 10 hello-interval 2", + # "no area 20 default-cost 2", + # "no area 20 cost 2" + # ] + # + # "after": { + # "processes": [ + # { + # "process_id": "10" + # }, + # { + # "process_id": "26" + # }, + # { + # "process_id": "27" + # }, + # { + # "process_id": "30" + # } + # ] + # } + # + # + # ----------- + # After state + # ----------- + # + # RP/0/RP0/CPU0:anton(config)#show running-config router ospfv3 + # router ospfv3 10 + # ! + # router ospfv3 26 + # ! + # router ospfv3 27 + # ! + # router ospfv3 30 + # ! + + + # Using parsed + # parsed.cfg + # ------------ + # router ospfv3 10 + # area 11 + # cost 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # router ospfv3 26 + # authentication disable + # ! + # router ospfv3 27 + # area 10 + # hello-interval 2 + # ! + # ! + # router ospfv3 30 + # router-id 2.2.2.2 + # cost 2 + # packet-size 577 + # priority 1 + # mtu-ignore + # dead-interval 2 + # retransmit-interval 2 + # demand-circuit + # hello-interval 1 + # transmit-delay 2 + # default-metric 10 + # area 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + - name: Parsed the device configuration to get output commands + cisco.iosxr.iosxr_ospfv3: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # + # "parsed": { + # "processes": [ + # { + # "areas": [ + # { + # "area_id": "11", + # "cost": 11, + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "process_id": "10" + # }, + # { + # "authentication": { + # "disable": true + # }, + # "process_id": "26" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "hello_interval": 2 + # } + # ], + # "process_id": "27" + # }, + # { + # "areas": [ + # { + # "area_id": "11", + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "cost": 2, + # "dead_interval": 2, + # "default_metric": 10, + # "demand_circuit": true, + # "hello_interval": 1, + # "mtu_ignore": true, + # "packet_size": 577, + # "priority": 1, + # "process_id": "30", + # "retransmit_interval": 2, + # "router_id": "2.2.2.2", + # "transmit_delay": 2 + # } + # ] + # } + # + # Using rendered + # + # + - name: Render the commands for provided configuration + cisco.iosxr.iosxr_ospfv3: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - process_id: 26 + authentication: + disable: true + - process_id: 10 + areas: + - area_id: 11 + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: 30 + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + packet_size: 577 + priority: 1 + router_id: '2.2.2.2' + demand_circuit: true + mtu_ignore: true + state: rendered + + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # + # "rendered": [ + # "router ospfv3 27", + # "area 10 hello-interval 2", + # "router ospfv3 26", + # "authentication disable", + # "router ospfv3 10", + # "area 11 default-cost 5", + # "area 11 cost 11", + # "area 22 default-cost 6", + # "router ospfv3 30", + # "cost 2", + # "priority 1", + # "default-metric 10", + # "router-id 2.2.2.2", + # "demand-circuit", + # "packet-size 577", + # "transmit-delay 2", + # "dead-interval 2", + # "hello-interval 1", + # "retransmit-interval 2", + # "mtu-ignore", + # "area 11 default-cost 5", + # "area 22 default-cost 6" + # ] + + + # Using gathered + # + # Before state: + # ------------- + # + # RP/0/RP0/CPU0:anton#show running-config router ospf + # router ospfv3 10 + # area 11 + # cost 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + # router ospfv3 26 + # authentication disable + # area 10 + # ! + # ! + # router ospfv3 27 + # area 10 + # hello-interval 2 + # ! + # area 20 + # ! + # area 30 + # ! + # ! + # router ospfv3 30 + # cost 2 + # priority 1 + # mtu-ignore + # packet-size 577 + # dead-interval 2 + # retransmit-interval 2 + # demand-circuit + # hello-interval 1 + # transmit-delay 2 + # router-id 2.2.2.2 + # default-metric 10 + # area 11 + # default-cost 5 + # ! + # area 22 + # default-cost 6 + # ! + # ! + + - name: Gather ospfv3 routes configuration + cisco.iosxr.iosxr_ospfv3: + state: gathered + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # "gathered": { + # "processes": [ + # { + # "areas": [ + # { + # "area_id": "11", + # "cost": 11, + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "process_id": "10" + # }, + # { + # "authentication": { + # "disable": true + # }, + # "process_id": "26" + # }, + # { + # "areas": [ + # { + # "area_id": "10", + # "hello_interval": 2 + # } + # ], + # "process_id": "27" + # }, + # { + # "areas": [ + # { + # "area_id": "11", + # "default_cost": 5 + # }, + # { + # "area_id": "22", + # "default_cost": 6 + # } + # ], + # "cost": 2, + # "dead_interval": 2, + # "default_metric": 10, + # "demand_circuit": true, + # "hello_interval": 1, + # "mtu_ignore": true, + # "packet_size": 577, + # "priority": 1, + # "process_id": "30", + # "retransmit_interval": 2, + # "router_id": "2.2.2.2", + # "transmit_delay": 2 + # } + # ] + # } + # + + + + +Status +------ + + +Authors +~~~~~~~ + +- Rohit Thakur (@rohitthakur2590) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_static_routes_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_static_routes_module.rst new file mode 100644 index 00000000..266e6fcc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_static_routes_module.rst @@ -0,0 +1,1141 @@ +.. _cisco.iosxr.iosxr_static_routes_module: + + +******************************* +cisco.iosxr.iosxr_static_routes +******************************* + +**Static routes resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages static routes on devices running Cisco IOS-XR. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A dictionary of static route options.
+
+
+ address_families + +
+ list + / elements=dictionary +
+
+ +
A dictionary specifying the address family to which the static route(s) belong.
+
+
+ afi + +
+ string + / required +
+
+
    Choices: +
  • ipv4
  • +
  • ipv6
  • +
+
+
Specifies the top level address family indicator.
+
+
+ routes + +
+ list + / elements=dictionary +
+
+ +
A dictionary that specifies the static route configurations.
+
+
+ dest + +
+ string + / required +
+
+ +
An IPv4 or IPv6 address in CIDR notation that specifies the destination network for the static route.
+
+
+ next_hops + +
+ list + / elements=dictionary +
+
+ +
Next hops to the specified destination.
+
+
+ admin_distance + +
+ integer +
+
+ +
The administrative distance for this static route.
+
Refer to vendor documentation for valid values.
+
+
+ description + +
+ string +
+
+ +
Specifies the description for this static route.
+
+
+ dest_vrf + +
+ string +
+
+ +
The destination VRF.
+
+
+ forward_router_address + +
+ string +
+
+ +
The IP address of the next hop that can be used to reach the destination network.
+
+
+ interface + +
+ string +
+
+ +
The interface to use to reach the destination.
+
+
+ metric + +
+ integer +
+
+ +
Specifes the metric for this static route.
+
Refer to vendor documentation for valid values.
+
+
+ tag + +
+ integer +
+
+ +
Specifies a numeric tag for this static route.
+
Refer to vendor documentation for valid values.
+
+
+ track + +
+ string +
+
+ +
Specifies the object to be tracked.
+
This enables object tracking for static routes.
+
+
+ tunnel_id + +
+ integer +
+
+ +
Specifies a tunnel id for the route.
+
Refer to vendor documentation for valid values.
+
+
+ vrflabel + +
+ integer +
+
+ +
Specifies the VRF label for this static route.
+
Refer to vendor documentation for valid values.
+
+
+ safi + +
+ string + / required +
+
+
    Choices: +
  • unicast
  • +
  • multicast
  • +
+
+
Specifies the subsequent address family indicator.
+
+
+ vrf + +
+ string +
+
+ +
The VRF to which the static route(s) belong.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the IOS-XR device by executing the command show running-config router static.
+
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • merged ←
  • +
  • replaced
  • +
  • overridden
  • +
  • deleted
  • +
  • gathered
  • +
  • rendered
  • +
  • parsed
  • +
+
+
The state the configuration should be left in.
+
+
+ + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + + # Before state + # ------------- + # RP/0/RP0/CPU0:ios#show running-config router static + # Sat Feb 22 07:46:30.089 UTC + # % No such configuration item(s) + # + - name: Merge the provided configuration with the exisiting running configuration + cisco.iosxr.iosxr_static_routes: + config: + - address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.16/28 + next_hops: + - forward_router_address: 192.0.2.10 + interface: FastEthernet0/0/0/1 + description: LAB + metric: 120 + tag: 10 + + - interface: FastEthernet0/0/0/5 + track: ip_sla_1 + + - dest: 192.0.2.32/28 + next_hops: + - forward_router_address: 192.0.2.11 + admin_distance: 100 + + - afi: ipv6 + safi: unicast + routes: + - dest: 2001:db8:1000::/36 + next_hops: + - interface: FastEthernet0/0/0/7 + description: DC + + - interface: FastEthernet0/0/0/8 + forward_router_address: 2001:db8:2000:2::1 + + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.12 + description: DEV + dest_vrf: test_1 + + - dest: 192.0.2.80/28 + next_hops: + - interface: FastEthernet0/0/0/2 + forward_router_address: 192.0.2.14 + dest_vrf: test_1 + track: ip_sla_2 + vrflabel: 124 + state: merged + + # After state + # ------------- + # RP/0/RP0/CPU0:ios#show running-config router static + # Sat Feb 22 07:49:11.754 UTC + # router static + # address-family ipv4 unicast + # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 + # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 + # 192.0.2.32/28 192.0.2.11 100 + # ! + # address-family ipv6 unicast + # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC + # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 + # ! + # vrf DEV_SITE + # address-family ipv4 unicast + # 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV + # 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 + # ! + # ! + # ! + + # Using merged to update existing static routes + + # Before state + # ------------- + # RP/0/RP0/CPU0:ios#show running-config router static + # Sat Feb 22 07:49:11.754 UTC + # router static + # address-family ipv4 unicast + # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 + # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 + # 192.0.2.32/28 192.0.2.11 100 + # ! + # address-family ipv6 unicast + # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC + # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 + # ! + # vrf DEV_SITE + # address-family ipv4 unicast + # 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV + # 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 + # ! + # ! + # ! + + - name: Update existing static routes configuration using merged + cisco.iosxr.iosxr_static_routes: + config: + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.12 + vrflabel: 2301 + dest_vrf: test_1 + + - dest: 192.0.2.80/28 + next_hops: + - interface: FastEthernet0/0/0/2 + forward_router_address: 192.0.2.14 + dest_vrf: test_1 + description: rt_test_1 + state: merged + + # After state + # ------------- + # RP/0/RP0/CPU0:ios#show running-config router static + # Sat Feb 22 07:49:11.754 UTC + # router static + # address-family ipv4 unicast + # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 + # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 + # 192.0.2.32/28 192.0.2.11 100 + # ! + # address-family ipv6 unicast + # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC + # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 + # ! + # vrf DEV_SITE + # address-family ipv4 unicast + # 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV vrflabel 2301 + # 192.0.2.80/28 vrf test_1 192.0.2.14 FastEthernet0/0/0/2 description rt_test_1 track ip_sla_2 vrflabel 124 + # ! + # ! + # ! + + # Using replaced to replace all next hop entries for a single destination network + + # Before state + # -------------- + + # RP/0/RP0/CPU0:ios#sh running-config router static + # Sat Feb 22 07:59:08.669 UTC + # router static + # address-family ipv4 unicast + # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 + # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 + # 192.0.2.32/28 192.0.2.11 100 + # ! + # address-family ipv6 unicast + # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC + # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 + # ! + # vrf DEV_SITE + # address-family ipv4 unicast + # 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV + # 192.0.2.48/28 GigabitEthernet0/0/0/1 192.0.3.24 vrflabel 2302 + # 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 + # ! + # ! + # ! + + - name: Replace device configurations of static routes with provided configurations + cisco.iosxr.iosxr_static_routes: + config: + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.15 + interface: FastEthernet0/0/0/3 + description: DEV_NEW + dest_vrf: dev_test_2 + state: replaced + + # After state + # ------------ + # RP/0/RP0/CPU0:ios#sh running-config router static + # Sat Feb 22 08:04:07.085 UTC + # router static + # address-family ipv4 unicast + # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 + # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 + # 192.0.2.32/28 192.0.2.11 100 + # ! + # address-family ipv6 unicast + # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC + # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 + # ! + # vrf DEV_SITE + # address-family ipv4 unicast + # 192.0.2.48/28 vrf dev_test_2 FastEthernet0/0/0/3 192.0.2.15 description DEV_NEW + # 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 + # ! + # ! + # ! + + # Using overridden to override all static route entries on the device + + # Before state + # ------------- + # RP/0/RP0/CPU0:ios#sh running-config router static + # Sat Feb 22 07:59:08.669 UTC + # router static + # address-family ipv4 unicast + # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 + # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 + # 192.0.2.32/28 192.0.2.11 100 + # ! + # address-family ipv6 unicast + # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC + # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 + # ! + # vrf DEV_SITE + # address-family ipv4 unicast + # 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV + # 192.0.2.48/28 GigabitEthernet0/0/0/1 192.0.3.24 vrflabel 2302 + # 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 + # ! + # ! + # ! + + - name: Overridde all static routes configuration with provided configuration + cisco.iosxr.iosxr_static_routes: + config: + - vrf: DEV_NEW + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.15 + interface: FastEthernet0/0/0/3 + description: DEV1 + - afi: ipv6 + safi: unicast + routes: + - dest: 2001:db8:3000::/36 + next_hops: + - interface: FastEthernet0/0/0/4 + forward_router_address: 2001:db8:2000:2::2 + description: PROD1 + track: ip_sla_1 + state: overridden + + # After state + # ------------- + # RP/0/RP0/CPU0:ios#sh running-config router static + # Sat Feb 22 08:07:41.516 UTC + # router static + # vrf DEV_NEW + # address-family ipv4 unicast + # 192.0.2.48/28 FastEthernet0/0/0/3 192.0.2.15 description DEV1 + # ! + # address-family ipv6 unicast + # 2001:db8:3000::/36 FastEthernet0/0/0/4 2001:db8:2000:2::2 description PROD1 track ip_sla_1 + # ! + # ! + # ! + + # Using deleted to delete all destination network entries under a single AFI + + # Before state + # ------------- + # RP/0/RP0/CPU0:ios#sh running-config router static + # Sat Feb 22 07:59:08.669 UTC + # router static + # address-family ipv4 unicast + # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 + # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 + # 192.0.2.32/28 192.0.2.11 100 + # ! + # address-family ipv6 unicast + # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC + # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 + # ! + # vrf DEV_SITE + # address-family ipv4 unicast + # 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV + # 192.0.2.48/28 GigabitEthernet0/0/0/1 192.0.3.24 vrflabel 2302 + # 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 + # ! + # ! + # ! + + - name: Delete all destination network entries under a single AFI + cisco.iosxr.iosxr_static_routes: + config: + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + state: deleted + + # After state + # ------------ + + # RP/0/RP0/CPU0:ios#sh running-config router static + # Sat Feb 22 08:16:41.464 UTC + # router static + # address-family ipv4 unicast + # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 + # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 + # 192.0.2.32/28 192.0.2.11 100 + # ! + # address-family ipv6 unicast + # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC + # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 + # ! + # vrf DEV_SITE + # ! + # ! + + # Using deleted to remove all static route entries from the device + + # Before state + # ------------- + # RP/0/RP0/CPU0:ios#sh running-config router static + # Sat Feb 22 07:59:08.669 UTC + # router static + # address-family ipv4 unicast + # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 + # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 + # 192.0.2.32/28 192.0.2.11 100 + # ! + # address-family ipv6 unicast + # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC + # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 + # ! + # vrf DEV_SITE + # address-family ipv4 unicast + # 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV + # 192.0.2.48/28 GigabitEthernet0/0/0/1 192.0.3.24 vrflabel 2302 + # 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 + # ! + # ! + # ! + + - name: Delete static routes configuration + cisco.iosxr.iosxr_static_routes: + state: deleted + + # After state + # ------------ + # RP/0/RP0/CPU0:ios#sh running-config router static + # Sat Feb 22 08:50:43.038 UTC + # % No such configuration item(s) + + # Using gathered to gather static route facts from the device + + - name: Gather static routes facts from the device using iosxr_static_routes module + cisco.iosxr.iosxr_static_routes: + state: gathered + + # Task output (redacted) + # ----------------------- + # "gathered": [ + # { + # "address_families": [ + # { + # "afi": "ipv4", + # "routes": [ + # { + # "dest": "192.0.2.16/28", + # "next_hops": [ + # { + # "description": "LAB", + # "forward_router_address": "192.0.2.10", + # "interface": "FastEthernet0/0/0/1", + # "metric": 120, + # "tag": 10 + # }, + # { + # "interface": "FastEthernet0/0/0/5", + # "track": "ip_sla_1" + # } + # ] + # }, + # { + # "dest": "192.0.2.32/28", + # "next_hops": [ + # { + # "admin_distance": 100, + # "forward_router_address": "192.0.2.11" + # } + # ] + # } + # ], + # "safi": "unicast" + # }, + # { + # "afi": "ipv6", + # "routes": [ + # { + # "dest": "2001:db8:1000::/36", + # "next_hops": [ + # { + # "description": "DC", + # "interface": "FastEthernet0/0/0/7" + # }, + # { + # "forward_router_address": "2001:db8:2000:2::1", + # "interface": "FastEthernet0/0/0/8" + # } + # ] + # } + # ], + # "safi": "unicast" + # } + # ] + # }, + # { + # "address_families": [ + # { + # "afi": "ipv4", + # "routes": [ + # { + # "dest": "192.0.2.48/28", + # "next_hops": [ + # { + # "description": "DEV", + # "dest_vrf": "test_1", + # "forward_router_address": "192.0.2.12" + # }, + # { + # "forward_router_address": "192.0.3.24", + # "interface": "GigabitEthernet0/0/0/1", + # "vrflabel": 2302 + # } + # ] + # }, + # { + # "dest": "192.0.2.80/28", + # "next_hops": [ + # { + # "dest_vrf": "test_1", + # "forward_router_address": "192.0.2.14", + # "interface": "FastEthernet0/0/0/2", + # "track": "ip_sla_2", + # "vrflabel": 124 + # } + # ] + # } + # ], + # "safi": "unicast" + # } + # ], + # "vrf": "DEV_SITE" + # } + # ] + + # Using rendered + + - name: Render platform specific commands (without connecting to the device) + cisco.iosxr.iosxr_static_routes: + config: + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.12 + description: DEV + dest_vrf: test_1 + + - dest: 192.0.2.80/28 + next_hops: + - interface: FastEthernet0/0/0/2 + forward_router_address: 192.0.2.14 + dest_vrf: test_1 + track: ip_sla_2 + vrflabel: 124 + + # Task Output (redacted) + # ----------------------- + # "rendered": [ + # "router static"s, + # "vrf DEV_SITE", + # "address-family ipv4 unicast", + # "192.0.2.48/28 vrf test_1 192.0.2.12 description DEV", + # "192.0.2.80/28 vrf test_1 192.0.2.14 FastEthernet0/0/0/2 track ip_sla_2 vrflabel 124" + + # Using parsed + + # parsed.cfg + # ------------ + # Fri Nov 29 21:10:41.896 UTC + # router static + # address-family ipv4 unicast + # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 + # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 + # 192.0.2.32/28 192.0.2.11 100 + # ! + # address-family ipv6 unicast + # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC + # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 + # ! + # vrf DEV_SITE + # address-family ipv4 unicast + # 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV + # 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 + # ! + # ! + # ! + + - name: Use parsed state to convert externally supplied device specific static routes + commands to structured format + cisco.iosxr.iosxr_static_routes: + running_config: "{{ lookup('file', '../../fixtures/parsed.cfg') }}" + state: parsed + + # Task output (redacted) + # ----------------------- + # "parsed": [ + # { + # "address_families": [ + # { + # "afi": "ipv4", + # "routes": [ + # { + # "dest": "192.0.2.16/28", + # "next_hops": [ + # { + # "description": "LAB", + # "forward_router_address": "192.0.2.10", + # "interface": "FastEthernet0/0/0/1", + # "metric": 120, + # "tag": 10 + # }, + # { + # "interface": "FastEthernet0/0/0/5", + # "track": "ip_sla_1" + # } + # ] + # }, + # { + # "dest": "192.0.2.32/28", + # "next_hops": [ + # { + # "admin_distance": 100, + # "forward_router_address": "192.0.2.11" + # } + # ] + # } + # ], + # "safi": "unicast" + # }, + # { + # "afi": "ipv6", + # "routes": [ + # { + # "dest": "2001:db8:1000::/36", + # "next_hops": [ + # { + # "description": "DC", + # "interface": "FastEthernet0/0/0/7" + # }, + # { + # "forward_router_address": "2001:db8:2000:2::1", + # "interface": "FastEthernet0/0/0/8" + # } + # ] + # } + # ], + # "safi": "unicast" + # } + # ] + # }, + # { + # "address_families": [ + # { + # "afi": "ipv4", + # "routes": [ + # { + # "dest": "192.0.2.48/28", + # "next_hops": [ + # { + # "description": "DEV", + # "dest_vrf": "test_1", + # "forward_router_address": "192.0.2.12" + # } + # ] + # }, + # { + # "dest": "192.0.2.80/28", + # "next_hops": [ + # { + # "dest_vrf": "test_1", + # "forward_router_address": "192.0.2.14", + # "interface": "FastEthernet0/0/0/2", + # "track": "ip_sla_2", + # "vrflabel": 124 + # } + # ] + # } + # ], + # "safi": "unicast" + # } + # ], + # "vrf": "DEV_SITE" + # } + # ] + # } + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ after + +
+ list +
+
when changed +
The resulting configuration model invocation.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ before + +
+ list +
+
always +
The configuration prior to the model invocation.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ commands + +
+ list +
+
always +
The set of commands pushed to the remote device.
+
+
Sample:
+
['router static', 'vrf dev_site', 'address-family ipv4 unicast', '192.0.2.48/28 192.0.2.12 FastEthernet0/0/0/1 track ip_sla_10 description dev1', 'address-family ipv6 unicast', 'no 2001:db8:1000::/36', '2001:db8:3000::/36 2001:db8:2000:2::2 FastEthernet0/0/0/4 track ip_sla_11 description prod1']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Nilashish Chakraborty (@NilashishC) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_system_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_system_module.rst new file mode 100644 index 00000000..c2c25a78 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_system_module.rst @@ -0,0 +1,427 @@ +.. _cisco.iosxr.iosxr_system_module: + + +************************ +cisco.iosxr.iosxr_system +************************ + +**Manage the system attributes on Cisco IOS XR devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module provides declarative management of node system attributes on Cisco IOS XR devices. It provides an option to configure host system parameters or remove those parameters from the device active configuration. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient >= 0.5.3 when using netconf +- lxml >= 4.1.1 when using netconf + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ domain_name + +
+ string +
+
+ +
Configure the IP domain name on the remote device to the provided value. Value should be in the dotted name form and will be appended to the hostname to create a fully-qualified domain name.
+
+
+ domain_search + +
+ list + / elements=string +
+
+ +
Provides the list of domain suffixes to append to the hostname for the purpose of doing name resolution. This argument accepts a list of names and will be reconciled with the current active configuration on the running node.
+
+
+ hostname + +
+ string +
+
+ +
Configure the device hostname parameter. This option takes an ASCII string value.
+
+
+ lookup_enabled + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Provides administrative control for enabling or disabling DNS lookups. When this argument is set to True, lookups are performed and when it is set to False, lookups are not performed.
+
+
+ lookup_source + +
+ string +
+
+ +
The lookup_source argument provides one or more source interfaces to use for performing DNS lookups. The interface provided in lookup_source must be a valid interface configured on the device.
+
+
+ name_servers + +
+ list + / elements=string +
+
+ +
The name_serves argument accepts a list of DNS name servers by way of either FQDN or IP address to use to perform name resolution lookups. This argument accepts wither a list of DNS servers See examples.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli.
+
For more information please see the Network Guide.
+

+
A dict object containing connection details.
+
+
+ host + +
+ string +
+
+ +
Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.
+
+
+ password + +
+ string +
+
+ +
Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.
+
+
+ port + +
+ integer +
+
+ +
Specifies the port to use when building the connection to the remote device.
+
+
+ ssh_keyfile + +
+ path +
+
+ +
Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_SSH_KEYFILE will be used instead.
+
+
+ timeout + +
+ integer +
+
+ +
Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error.
+
+
+ transport + +
+ string +
+
+
    Choices: +
  • cli ←
  • +
  • netconf
  • +
+
+
Specifies the type of connection based transport.
+
+
+ username + +
+ string +
+
+ +
Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present ←
  • +
  • absent
  • +
+
+
State of the configuration values in the device's current active configuration. When set to present, the values should be configured in the device active configuration and when set to absent the values should not be in the device active configuration
+
+
+ vrf + +
+ string +
+
+ Default:
"default"
+
+
VRF name for domain services
+
+
+ + +Notes +----- + +.. note:: + - This module works with connection ``network_cli`` and ``netconf``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + - Tested against IOS XRv 6.1.3 + - name-servers *state=absent* operation with ``netconf`` transport is a success, but with rpc-error. This is due to XR platform issue. Recommended to use *ignore_errors* option with the task as a workaround. + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Cisco devices see the `Cisco integration page `_. + + + +Examples +-------- + +.. code-block:: yaml + + - name: configure hostname and domain-name (default vrf=default) + cisco.iosxr.iosxr_system: + hostname: iosxr01 + domain_name: test.example.com + domain_search: + - ansible.com + - redhat.com + - cisco.com + - name: remove configuration + cisco.iosxr.iosxr_system: + hostname: iosxr01 + domain_name: test.example.com + domain_search: + - ansible.com + - redhat.com + - cisco.com + state: absent + - name: configure hostname and domain-name with vrf + cisco.iosxr.iosxr_system: + hostname: iosxr01 + vrf: nondefault + domain_name: test.example.com + domain_search: + - ansible.com + - redhat.com + - cisco.com + - name: configure DNS lookup sources + cisco.iosxr.iosxr_system: + lookup_source: MgmtEth0/0/CPU0/0 + lookup_enabled: true + - name: configure name servers + cisco.iosxr.iosxr_system: + name_servers: + - 8.8.8.8 + - 8.8.4.4 + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ commands + +
+ list +
+
always +
The list of configuration mode commands to send to the device
+
+
Sample:
+
['hostname iosxr01', 'ip domain-name test.example.com']
+
+
+ xml + +
+ list +
+
always (empty list when no xml rpc to send) +
NetConf rpc xml sent to device with transport netconf
+
+
Sample:
+
['<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"> <ip-domain xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ip-domain-cfg"> <vrfs> <vrf> <vrf-name>default</vrf-name> <lists> <list xc:operation="merge"> <order>0</order> <list-name>redhat.com</list-name> </list> </lists> </vrf> </vrfs> </ip-domain> </config>']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Peter Sprygada (@privateip) +- Kedar Kekan (@kedarX) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_user_module.rst b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_user_module.rst new file mode 100644 index 00000000..fc8cefb3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_user_module.rst @@ -0,0 +1,651 @@ +.. _cisco.iosxr.iosxr_user_module: + + +********************** +cisco.iosxr.iosxr_user +********************** + +**Manage the aggregate of local users on Cisco IOS XR device** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module provides declarative management of the local usernames configured on network devices. It allows playbooks to manage either individual usernames or the aggregate of usernames in the current running config. It also supports purging usernames from the configuration that are not explicitly defined. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient >= 0.5.3 when using netconf +- lxml >= 4.1.1 when using netconf +- base64 when using *public_key_contents* or *public_key* +- paramiko when using *public_key_contents* or *public_key* + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ admin + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Enters into administration configuration mode for making config changes to the device.
+
Applicable only when using network_cli transport
+
+
+ aggregate + +
+ list + / elements=dictionary +
+
+ +
The set of username objects to be configured on the remote Cisco IOS XR device. The list entries can either be the username or a hash of username and properties. This argument is mutually exclusive with the name argument.
+

aliases: users, collection
+
+
+ admin + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enters into administration configuration mode for making config changes to the device.
+
Applicable only when using network_cli transport
+
+
+ configured_password + +
+ string +
+
+ +
The password to be configured on the Cisco IOS XR device. The password needs to be provided in clear text. Password is encrypted on the device when used with cli and by Ansible when used with netconf using the same MD5 hash technique with salt size of 3. Please note that this option is not same as provider password.
+
+
+ group + +
+ string +
+
+ +
Configures the group for the username in the device running configuration. The argument accepts a string value defining the group name. This argument does not check if the group has been configured on the device.
+

aliases: role
+
+
+ groups + +
+ list + / elements=string +
+
+ +
Configures the groups for the username in the device running configuration. The argument accepts a list of group names. This argument does not check if the group has been configured on the device. It is similar to the aggregate command for usernames, but lets you configure multiple groups for the user(s).
+
+
+ name + +
+ string + / required +
+
+ +
The username to be configured on the Cisco IOS XR device. This argument accepts a string value and is mutually exclusive with the aggregate argument. Please note that this option is not same as provider username.
+
+
+ public_key + +
+ string +
+
+ +
Configures the contents of the public keyfile to upload to the IOS-XR node. This enables users to login using the accompanying private key. IOS-XR only accepts base64 decoded files, so this will be decoded and uploaded to the node. Do note that this requires an OpenSSL public key file, PuTTy generated files will not work! Mutually exclusive with public_key_contents. If used with multiple users in aggregates, then the same key file is used for all users.
+
+
+ public_key_contents + +
+ string +
+
+ +
Configures the contents of the public keyfile to upload to the IOS-XR node. This enables users to login using the accompanying private key. IOS-XR only accepts base64 decoded files, so this will be decoded and uploaded to the node. Do note that this requires an OpenSSL public key file, PuTTy generated files will not work! Mutually exclusive with public_key.If used with multiple users in aggregates, then the same key file is used for all users.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present
  • +
  • absent
  • +
+
+
Configures the state of the username definition as it relates to the device operational configuration. When set to present, the username(s) should be configured in the device active configuration and when set to absent the username(s) should not be in the device active configuration
+
+
+ update_password + +
+ string +
+
+
    Choices: +
  • on_create
  • +
  • always
  • +
+
+
Since passwords are encrypted in the device running config, this argument will instruct the module when to change the password. When set to always, the password will always be updated in the device and when set to on_create the password will be updated only if the username is created.
+
+
+ configured_password + +
+ string +
+
+ +
The password to be configured on the Cisco IOS XR device. The password needs to be provided in clear text. Password is encrypted on the device when used with cli and by Ansible when used with netconf using the same MD5 hash technique with salt size of 3. Please note that this option is not same as provider password.
+
+
+ group + +
+ string +
+
+ +
Configures the group for the username in the device running configuration. The argument accepts a string value defining the group name. This argument does not check if the group has been configured on the device.
+

aliases: role
+
+
+ groups + +
+ list + / elements=string +
+
+ +
Configures the groups for the username in the device running configuration. The argument accepts a list of group names. This argument does not check if the group has been configured on the device. It is similar to the aggregate command for usernames, but lets you configure multiple groups for the user(s).
+
+
+ name + +
+ string +
+
+ +
The username to be configured on the Cisco IOS XR device. This argument accepts a string value and is mutually exclusive with the aggregate argument. Please note that this option is not same as provider username.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli.
+
For more information please see the Network Guide.
+

+
A dict object containing connection details.
+
+
+ host + +
+ string +
+
+ +
Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.
+
+
+ password + +
+ string +
+
+ +
Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.
+
+
+ port + +
+ integer +
+
+ +
Specifies the port to use when building the connection to the remote device.
+
+
+ ssh_keyfile + +
+ path +
+
+ +
Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_SSH_KEYFILE will be used instead.
+
+
+ timeout + +
+ integer +
+
+ +
Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error.
+
+
+ transport + +
+ string +
+
+
    Choices: +
  • cli ←
  • +
  • netconf
  • +
+
+
Specifies the type of connection based transport.
+
+
+ username + +
+ string +
+
+ +
Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.
+
+
+ public_key + +
+ string +
+
+ +
Configures the contents of the public keyfile to upload to the IOS-XR node. This enables users to login using the accompanying private key. IOS-XR only accepts base64 decoded files, so this will be decoded and uploaded to the node. Do note that this requires an OpenSSL public key file, PuTTy generated files will not work! Mutually exclusive with public_key_contents. If used with multiple users in aggregates, then the same key file is used for all users.
+
+
+ public_key_contents + +
+ string +
+
+ +
Configures the contents of the public keyfile to upload to the IOS-XR node. This enables users to login using the accompanying private key. IOS-XR only accepts base64 decoded files, so this will be decoded and uploaded to the node. Do note that this requires an OpenSSL public key file, PuTTy generated files will not work! Mutually exclusive with public_key.If used with multiple users in aggregates, then the same key file is used for all users.
+
+
+ purge + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Instructs the module to consider the resource definition absolute. It will remove any previously configured usernames on the device with the exception of the `admin` user and the current defined set of users.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present ←
  • +
  • absent
  • +
+
+
Configures the state of the username definition as it relates to the device operational configuration. When set to present, the username(s) should be configured in the device active configuration and when set to absent the username(s) should not be in the device active configuration
+
+
+ update_password + +
+ string +
+
+
    Choices: +
  • on_create
  • +
  • always ←
  • +
+
+
Since passwords are encrypted in the device running config, this argument will instruct the module when to change the password. When set to always, the password will always be updated in the device and when set to on_create the password will be updated only if the username is created.
+
+
+ + +Notes +----- + +.. note:: + - This module works with connection ``network_cli`` and ``netconf``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. + - Tested against IOS XRv 6.1.3 + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Cisco devices see the `Cisco integration page `_. + + + +Examples +-------- + +.. code-block:: yaml + + - name: create a new user + cisco.iosxr.iosxr_user: + name: ansible + configured_password: mypassword + state: present + - name: create a new user in admin configuration mode + cisco.iosxr.iosxr_user: + name: ansible + configured_password: mypassword + admin: true + state: present + - name: remove all users except admin + cisco.iosxr.iosxr_user: + purge: true + - name: set multiple users to group sys-admin + cisco.iosxr.iosxr_user: + aggregate: + - name: netop + - name: netend + group: sysadmin + state: present + - name: set multiple users to multiple groups + cisco.iosxr.iosxr_user: + aggregate: + - name: netop + - name: netend + groups: + - sysadmin + - root-system + state: present + - name: Change Password for User netop + cisco.iosxr.iosxr_user: + name: netop + configured_password: '{{ new_password }}' + update_password: always + state: present + - name: Add private key authentication for user netop + cisco.iosxr.iosxr_user: + name: netop + state: present + public_key_contents: "{{ lookup('file', '/home/netop/.ssh/id_rsa.pub' }}" + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ commands + +
+ list +
+
always +
The list of configuration mode commands to send to the device
+
+
Sample:
+
['username ansible secret password group sysadmin', 'username admin secret admin']
+
+
+ xml + +
+ list +
+
always (empty list when no xml rpc to send) +
NetConf rpc xml sent to device with transport netconf
+
+
Sample:
+
['<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"> <aaa xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-aaa-lib-cfg"> <usernames xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-aaa-locald-cfg"> <username xc:operation="merge"> <name>test7</name> <usergroup-under-usernames> <usergroup-under-username> <name>sysadmin</name> </usergroup-under-username> </usergroup-under-usernames> <secret>$1$ZsXC$zZ50wqhDC543ZWQkkAHLW0</secret> </username> </usernames> </aaa> </config>']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Trishna Guha (@trishnaguha) +- Sebastiaan van Doesselaar (@sebasdoes) +- Kedar Kekan (@kedarX) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/meta/runtime.yml b/collections-debian-merged/ansible_collections/cisco/iosxr/meta/runtime.yml new file mode 100644 index 00000000..fd538c9d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/meta/runtime.yml @@ -0,0 +1,156 @@ +--- +requires_ansible: '>=2.9.10,<2.11' +plugin_routing: + action: + iosxr_acl_interfaces: + redirect: cisco.iosxr.iosxr + acl_interfaces: + redirect: cisco.iosxr.iosxr + iosxr_acls: + redirect: cisco.iosxr.iosxr + acls: + redirect: cisco.iosxr.iosxr + iosxr_banner: + redirect: cisco.iosxr.iosxr + banner: + redirect: cisco.iosxr.iosxr + iosxr_bgp: + redirect: cisco.iosxr.iosxr + bgp: + redirect: cisco.iosxr.iosxr + iosxr_command: + redirect: cisco.iosxr.iosxr + command: + redirect: cisco.iosxr.iosxr + iosxr_config: + redirect: cisco.iosxr.iosxr + config: + redirect: cisco.iosxr.iosxr + iosxr_facts: + redirect: cisco.iosxr.iosxr + facts: + redirect: cisco.iosxr.iosxr + iosxr_interface: + redirect: cisco.iosxr.iosxr + interface: + redirect: cisco.iosxr.iosxr + iosxr_interfaces: + redirect: cisco.iosxr.iosxr + interfaces: + redirect: cisco.iosxr.iosxr + iosxr_l2_interfaces: + redirect: cisco.iosxr.iosxr + l2_interfaces: + redirect: cisco.iosxr.iosxr + iosxr_l3_interfaces: + redirect: cisco.iosxr.iosxr + l3_interfaces: + redirect: cisco.iosxr.iosxr + iosxr_lacp: + redirect: cisco.iosxr.iosxr + lacp: + redirect: cisco.iosxr.iosxr + iosxr_lacp_interfaces: + redirect: cisco.iosxr.iosxr + lacp_interfaces: + redirect: cisco.iosxr.iosxr + iosxr_lag_interfaces: + redirect: cisco.iosxr.iosxr + lag_interfaces: + redirect: cisco.iosxr.iosxr + iosxr_lldp_global: + redirect: cisco.iosxr.iosxr + lldp_global: + redirect: cisco.iosxr.iosxr + iosxr_lldp_interfaces: + redirect: cisco.iosxr.iosxr + lldp_interfaces: + redirect: cisco.iosxr.iosxr + iosxr_logging: + redirect: cisco.iosxr.iosxr + logging: + redirect: cisco.iosxr.iosxr + iosxr_netconf: + redirect: cisco.iosxr.iosxr + netconf: + redirect: cisco.iosxr.iosxr + iosxr_ospfv2: + redirect: cisco.iosxr.iosxr + ospfv2: + redirect: cisco.iosxr.iosxr + iosxr_ospfv3: + redirect: cisco.iosxr.iosxr + ospfv3: + redirect: cisco.iosxr.iosxr + iosxr_ospf_interfaces: + redirect: cisco.iosxr.iosxr + ospf_interfaces: + redirect: cisco.iosxr.iosxr + iosxr_static_routes: + redirect: cisco.iosxr.iosxr + static_routes: + redirect: cisco.iosxr.iosxr + iosxr_system: + redirect: cisco.iosxr.iosxr + system: + redirect: cisco.iosxr.iosxr + iosxr_user: + redirect: cisco.iosxr.iosxr + user: + redirect: cisco.iosxr.iosxr + modules: + acl_interfaces: + redirect: cisco.iosxr.iosxr_acl_interfaces + acls: + redirect: cisco.iosxr.iosxr_acls + banner: + redirect: cisco.iosxr.iosxr_banner + bgp: + redirect: cisco.iosxr.iosxr_bgp + command: + redirect: cisco.iosxr.iosxr_command + config: + redirect: cisco.iosxr.iosxr_config + facts: + redirect: cisco.iosxr.iosxr_facts + interface: + redirect: cisco.iosxr.iosxr_interface + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + iosxr_interface: + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + interfaces: + redirect: cisco.iosxr.iosxr_interfaces + l2_interfaces: + redirect: cisco.iosxr.iosxr_l2_interfaces + l3_interfaces: + redirect: cisco.iosxr.iosxr_l3_interfaces + lacp: + redirect: cisco.iosxr.iosxr_lacp + lacp_interfaces: + redirect: cisco.iosxr.iosxr_lacp_interfaces + lag_interfaces: + redirect: cisco.iosxr.iosxr_lag_interfaces + lldp_global: + redirect: cisco.iosxr.iosxr_lldp_global + lldp_interfaces: + redirect: cisco.iosxr.iosxr_lldp_interfaces + logging: + redirect: cisco.iosxr.iosxr_logging + netconf: + redirect: cisco.iosxr.iosxr_netconf + ospfv2: + redirect: cisco.iosxr.iosxr_ospfv2 + ospfv3: + redirect: cisco.iosxr.iosxr_ospfv3 + ospf_interfaces: + redirect: cisco.iosxr.iosxr_ospf_interfaces + static_routes: + redirect: cisco.iosxr.iosxr_static_routes + system: + redirect: cisco.iosxr.iosxr_system + user: + redirect: cisco.iosxr.iosxr_user diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/action/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/action/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/action/iosxr.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/action/iosxr.py new file mode 100644 index 00000000..2d5819bc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/action/iosxr.py @@ -0,0 +1,162 @@ +# +# (c) 2016 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . +# +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import sys +import copy + +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + iosxr_provider_spec, +) +from ansible_collections.ansible.netcommon.plugins.action.network import ( + ActionModule as ActionNetworkModule, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + load_provider, +) +from ansible.utils.display import Display + +display = Display() + + +class ActionModule(ActionNetworkModule): + def run(self, tmp=None, task_vars=None): + del tmp # tmp no longer has any effect + + module_name = self._task.action.split(".")[-1] + self._config_module = ( + True if module_name in ["iosxr_config", "config"] else False + ) + force_cli = module_name in ( + "iosxr_netconf", + "iosxr_config", + "iosxr_command", + "iosxr_facts", + ) + persistent_connection = self._play_context.connection.split(".")[-1] + warnings = [] + + if self._play_context.connection == "local": + provider = load_provider(iosxr_provider_spec, self._task.args) + pc = copy.deepcopy(self._play_context) + pc.network_os = "cisco.iosxr.iosxr" + if force_cli or provider["transport"] == "cli": + pc.connection = "ansible.netcommon.network_cli" + pc.port = int( + provider["port"] or self._play_context.port or 22 + ) + elif provider["transport"] == "netconf": + pc.connection = "ansible.netcommon.netconf" + pc.port = int( + provider["port"] or self._play_context.port or 830 + ) + else: + return { + "failed": True, + "msg": "Transport type %s is not valid for this module" + % provider["transport"], + } + + pc.remote_addr = provider["host"] or self._play_context.remote_addr + pc.port = int(provider["port"] or self._play_context.port or 22) + pc.remote_user = ( + provider["username"] or self._play_context.connection_user + ) + pc.password = provider["password"] or self._play_context.password + + connection = self._shared_loader_obj.connection_loader.get( + "ansible.netcommon.persistent", + pc, + sys.stdin, + task_uuid=self._task._uuid, + ) + + # TODO: Remove below code after ansible minimal is cut out + if connection is None: + pc.network_os = "iosxr" + if pc.connection.split(".")[-1] == "netconf": + pc.connection = "netconf" + else: + pc.connection = "network_cli" + + connection = self._shared_loader_obj.connection_loader.get( + "persistent", pc, sys.stdin, task_uuid=self._task._uuid + ) + + display.vvv( + "using connection plugin %s (was local)" % pc.connection, + pc.remote_addr, + ) + + command_timeout = ( + int(provider["timeout"]) + if provider["timeout"] + else connection.get_option("persistent_command_timeout") + ) + connection.set_options( + direct={"persistent_command_timeout": command_timeout} + ) + + socket_path = connection.run() + display.vvvv("socket_path: %s" % socket_path, pc.remote_addr) + if not socket_path: + return { + "failed": True, + "msg": "unable to open shell. Please see: " + + "https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell", + } + + task_vars["ansible_socket"] = socket_path + warnings.append( + [ + "connection local support for this module is deprecated and will be removed in version 2.14, use connection %s" + % pc.connection + ] + ) + elif persistent_connection in ("netconf", "network_cli"): + if force_cli and persistent_connection != "network_cli": + return { + "failed": True, + "msg": "Connection type %s is not valid for module %s" + % (self._play_context.connection, module_name), + } + provider = self._task.args.get("provider", {}) + if any(provider.values()): + display.warning( + "provider is unnecessary when using {0} and will be ignored".format( + self._play_context.connection + ) + ) + del self._task.args["provider"] + else: + return { + "failed": True, + "msg": "Connection type %s is not valid for this module" + % self._play_context.connection, + } + + result = super(ActionModule, self).run(task_vars=task_vars) + if warnings: + if "warnings" in result: + result["warnings"].extend(warnings) + else: + result["warnings"] = warnings + return result diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/cliconf/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/cliconf/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/cliconf/iosxr.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/cliconf/iosxr.py new file mode 100644 index 00000000..0a2d81c9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/cliconf/iosxr.py @@ -0,0 +1,366 @@ +# +# (c) 2017 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . +# +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +author: Ansible Networking Team +cliconf: iosxr +short_description: Use iosxr cliconf to run command on Cisco IOS XR platform +description: +- This iosxr plugin provides low level abstraction apis for sending and receiving + CLI commands from Cisco IOS XR network devices. +version_added: 1.0.0 +""" + +import re +import json + +from ansible.errors import AnsibleConnectionFailure +from ansible.module_utils._text import to_text +from ansible.module_utils.common._collections_compat import Mapping +from ansible.module_utils.connection import ConnectionError +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config import ( + NetworkConfig, + dumps, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + sanitize_config, + mask_config_blocks_from_diff, +) +from ansible.plugins.cliconf import CliconfBase + + +class Cliconf(CliconfBase): + def get_device_info(self): + device_info = {} + + device_info["network_os"] = "iosxr" + reply = self.get("show version | utility head -n 20") + data = to_text(reply, errors="surrogate_or_strict").strip() + + match = re.search(r"Version (\S+)$", data, re.M) + if match: + device_info["network_os_version"] = match.group(1) + + match = re.search(r'image file is "(.+)"', data) + if match: + device_info["network_os_image"] = match.group(1) + + model_search_strs = [ + r"^[Cc]isco (.+) \(revision", + r"^[Cc]isco (\S+ \S+).+bytes of .*memory", + ] + for item in model_search_strs: + match = re.search(item, data, re.M) + if match: + device_info["network_os_model"] = match.group(1) + break + + match = re.search(r"^(.+) uptime", data, re.M) + if match: + device_info["network_os_hostname"] = match.group(1) + + return device_info + + def configure(self, admin=False, exclusive=False): + prompt = to_text( + self._connection.get_prompt(), errors="surrogate_or_strict" + ).strip() + if not prompt.endswith(")#"): + if admin and "admin-" not in prompt: + self.send_command("admin") + if exclusive: + self.send_command("configure exclusive") + return + self.send_command("configure terminal") + + def abort(self, admin=False): + prompt = to_text( + self._connection.get_prompt(), errors="surrogate_or_strict" + ).strip() + if prompt.endswith(")#"): + self.send_command("abort") + if admin and "admin-" in prompt: + self.send_command("exit") + + def get_config(self, source="running", format="text", flags=None): + if source not in ["running"]: + raise ValueError( + "fetching configuration from %s is not supported" % source + ) + + lookup = {"running": "running-config"} + + cmd = "show {0} ".format(lookup[source]) + cmd += " ".join(to_list(flags)) + cmd = cmd.strip() + + return self.send_command(cmd) + + def edit_config( + self, + candidate=None, + commit=True, + admin=False, + exclusive=False, + replace=None, + comment=None, + label=None, + ): + operations = self.get_device_operations() + self.check_edit_config_capability( + operations, candidate, commit, replace, comment + ) + + resp = {} + results = [] + requests = [] + + self.configure(admin=admin, exclusive=exclusive) + + if replace: + candidate = "load {0}".format(replace) + + for line in to_list(candidate): + if not isinstance(line, Mapping): + line = {"command": line} + cmd = line["command"] + results.append(self.send_command(**line)) + requests.append(cmd) + + # Before any commit happend, we can get a real configuration + # diff from the device and make it available by the iosxr_config module. + # This information can be usefull either in check mode or normal mode. + resp["show_commit_config_diff"] = self.get("show commit changes diff") + + if commit: + self.commit(comment=comment, label=label, replace=replace) + else: + self.discard_changes() + + self.abort(admin=admin) + + resp["request"] = requests + resp["response"] = results + return resp + + def get_diff( + self, + candidate=None, + running=None, + diff_match="line", + diff_ignore_lines=None, + path=None, + diff_replace="line", + ): + diff = {} + device_operations = self.get_device_operations() + option_values = self.get_option_values() + + if candidate is None and device_operations["supports_generate_diff"]: + raise ValueError( + "candidate configuration is required to generate diff" + ) + + if diff_match not in option_values["diff_match"]: + raise ValueError( + "'match' value %s in invalid, valid values are %s" + % (diff_match, ", ".join(option_values["diff_match"])) + ) + + if diff_replace not in option_values["diff_replace"]: + raise ValueError( + "'replace' value %s in invalid, valid values are %s" + % (diff_replace, ", ".join(option_values["diff_replace"])) + ) + + # prepare candidate configuration + sanitized_candidate = sanitize_config(candidate) + candidate_obj = NetworkConfig(indent=1, comment_tokens=["!"]) + candidate_obj.load(sanitized_candidate) + + if running and diff_match != "none": + # running configuration + running = mask_config_blocks_from_diff( + running, candidate, "ansible" + ) + running = sanitize_config(running) + + running_obj = NetworkConfig( + indent=1, + contents=running, + ignore_lines=diff_ignore_lines, + comment_tokens=["!"], + ) + configdiffobjs = candidate_obj.difference( + running_obj, path=path, match=diff_match, replace=diff_replace + ) + + else: + configdiffobjs = candidate_obj.items + + diff["config_diff"] = ( + dumps(configdiffobjs, "commands") if configdiffobjs else "" + ) + return diff + + def get( + self, + command=None, + prompt=None, + answer=None, + sendonly=False, + newline=True, + output=None, + check_all=False, + ): + if output: + raise ValueError( + "'output' value %s is not supported for get" % output + ) + return self.send_command( + command=command, + prompt=prompt, + answer=answer, + sendonly=sendonly, + newline=newline, + check_all=check_all, + ) + + def commit(self, comment=None, label=None, replace=None): + cmd_obj = {} + if replace: + cmd_obj["command"] = "commit replace" + cmd_obj[ + "prompt" + ] = "This commit will replace or remove the entire running configuration" + cmd_obj["answer"] = "yes" + else: + if comment and label: + cmd_obj["command"] = "commit label {0} comment {1}".format( + label, comment + ) + elif comment: + cmd_obj["command"] = "commit comment {0}".format(comment) + elif label: + cmd_obj["command"] = "commit label {0}".format(label) + else: + cmd_obj["command"] = "commit show-error" + # In some cases even a normal commit, i.e., !replace, + # throws a prompt and we need to handle it before + # proceeding further + cmd_obj["prompt"] = "(C|c)onfirm" + cmd_obj["answer"] = "y" + + self.send_command(**cmd_obj) + + def run_commands(self, commands=None, check_rc=True): + if commands is None: + raise ValueError("'commands' value is required") + responses = list() + for cmd in to_list(commands): + if not isinstance(cmd, Mapping): + cmd = {"command": cmd} + + output = cmd.pop("output", None) + if output: + raise ValueError( + "'output' value %s is not supported for run_commands" + % output + ) + + try: + out = self.send_command(**cmd) + except AnsibleConnectionFailure as e: + if check_rc: + raise + out = getattr(e, "err", e) + + if out is not None: + try: + out = to_text(out, errors="surrogate_or_strict").strip() + except UnicodeError: + raise ConnectionError( + message=u"Failed to decode output from %s: %s" + % (cmd, to_text(out)) + ) + + try: + out = json.loads(out) + except ValueError: + pass + + responses.append(out) + return responses + + def discard_changes(self): + self.send_command("abort") + + def get_device_operations(self): + return { + "supports_diff_replace": True, + "supports_commit": True, + "supports_rollback": False, + "supports_defaults": False, + "supports_onbox_diff": False, + "supports_commit_comment": True, + "supports_multiline_delimiter": False, + "supports_diff_match": True, + "supports_diff_ignore_lines": True, + "supports_generate_diff": True, + "supports_replace": True, + "supports_admin": True, + "supports_commit_label": True, + } + + def get_option_values(self): + return { + "format": ["text"], + "diff_match": ["line", "strict", "exact", "none"], + "diff_replace": ["line", "block", "config"], + "output": [], + } + + def get_capabilities(self): + result = super(Cliconf, self).get_capabilities() + result["rpc"] += [ + "commit", + "discard_changes", + "get_diff", + "configure", + "exit", + ] + result["device_operations"] = self.get_device_operations() + result.update(self.get_option_values()) + return json.dumps(result) + + def set_cli_prompt_context(self): + """ + Make sure we are in the operational cli mode + :return: None + """ + if self._connection.connected: + self._update_cli_prompt_context( + config_context=")#", exit_command="abort" + ) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/doc_fragments/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/doc_fragments/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/doc_fragments/iosxr.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/doc_fragments/iosxr.py new file mode 100644 index 00000000..9e552ded --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/doc_fragments/iosxr.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +# Copyright: (c) 2015, Peter Sprygada +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + + +class ModuleDocFragment(object): + + # Standard files documentation fragment + DOCUMENTATION = r"""options: + provider: + description: + - B(Deprecated) + - 'Starting with Ansible 2.5 we recommend using C(connection: network_cli).' + - For more information please see the L(Network Guide, ../network/getting_started/network_differences.html#multiple-communication-protocols). + - HORIZONTALLINE + - A dict object containing connection details. + type: dict + suboptions: + host: + description: + - Specifies the DNS host name or address for connecting to the remote device + over the specified transport. The value of host is used as the destination + address for the transport. + type: str + port: + description: + - Specifies the port to use when building the connection to the remote device. + type: int + username: + description: + - Configures the username to use to authenticate the connection to the remote + device. This value is used to authenticate the SSH session. If the value + is not specified in the task, the value of environment variable C(ANSIBLE_NET_USERNAME) + will be used instead. + type: str + password: + description: + - Specifies the password to use to authenticate the connection to the remote + device. This value is used to authenticate the SSH session. If the value + is not specified in the task, the value of environment variable C(ANSIBLE_NET_PASSWORD) + will be used instead. + type: str + timeout: + description: + - Specifies the timeout in seconds for communicating with the network device + for either connecting or sending commands. If the timeout is exceeded before + the operation is completed, the module will error. + type: int + ssh_keyfile: + description: + - Specifies the SSH key to use to authenticate the connection to the remote + device. This value is the path to the key used to authenticate the SSH + session. If the value is not specified in the task, the value of environment + variable C(ANSIBLE_NET_SSH_KEYFILE) will be used instead. + type: path + transport: + description: + - Specifies the type of connection based transport. + type: str + default: cli + choices: + - cli + - netconf +notes: +- For more information on using Ansible to manage network devices see the :ref:`Ansible + Network Guide ` +- For more information on using Ansible to manage Cisco devices see the `Cisco integration + page `_. +""" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/filter/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/filter/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/acl_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/acl_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/acl_interfaces/acl_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/acl_interfaces/acl_interfaces.py new file mode 100644 index 00000000..9e847a16 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/acl_interfaces/acl_interfaces.py @@ -0,0 +1,85 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# +""" +The arg spec for the iosxr_acl_interfaces module +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class Acl_interfacesArgs(object): # pylint: disable=R0903 + """The arg spec for the iosxr_acl_interfaces module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "running_config": {"type": "str"}, + "config": { + "elements": "dict", + "options": { + "access_groups": { + "elements": "dict", + "options": { + "acls": { + "elements": "dict", + "options": { + "direction": { + "choices": ["in", "out"], + "type": "str", + "required": True, + }, + "name": {"type": "str", "required": True}, + }, + "type": "list", + }, + "afi": { + "choices": ["ipv4", "ipv6"], + "type": "str", + "required": True, + }, + }, + "type": "list", + }, + "name": {"type": "str", "required": True}, + }, + "type": "list", + }, + "state": { + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "parsed", + "rendered", + ], + "default": "merged", + "type": "str", + }, + } # pylint: disable=C0301 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/acls/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/acls/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/acls/acls.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/acls/acls.py new file mode 100644 index 00000000..0b3a7afc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/acls/acls.py @@ -0,0 +1,538 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# +""" +The arg spec for the iosxr_acls module +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class AclsArgs(object): # pylint: disable=R0903 + """The arg spec for the iosxr_acls module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "running_config": {"type": "str"}, + "config": { + "elements": "dict", + "options": { + "acls": { + "elements": "dict", + "options": { + "name": {"type": "str"}, + "aces": { + "elements": "dict", + "mutually_exclusive": [ + ["grant", "remark", "line"] + ], + "options": { + "destination": { + "mutually_exclusive": [ + ["address", "any", "host", "prefix"], + [ + "wildcard_bits", + "any", + "host", + "prefix", + ], + ], + "options": { + "host": {"type": "str"}, + "address": {"type": "str"}, + "any": {"type": "bool"}, + "prefix": {"type": "str"}, + "port_protocol": { + "mutually_exclusive": [ + [ + "eq", + "gt", + "lt", + "neq", + "range", + ] + ], + "options": { + "eq": {"type": "str"}, + "gt": {"type": "str"}, + "lt": {"type": "str"}, + "neq": {"type": "str"}, + "range": { + "options": { + "end": {"type": "str"}, + "start": { + "type": "str" + }, + }, + "required_together": [ + ["start", "end"] + ], + "type": "dict", + }, + }, + "type": "dict", + }, + "wildcard_bits": {"type": "str"}, + }, + "required_together": [ + ["address", "wildcard_bits"] + ], + "type": "dict", + }, + "dscp": { + "mutually_exclusive": [ + ["eq", "gt", "lt", "neq", "range"] + ], + "type": "dict", + "options": { + "eq": {"type": "str"}, + "gt": {"type": "str"}, + "lt": {"type": "str"}, + "neq": {"type": "str"}, + "range": { + "options": { + "end": {"type": "str"}, + "start": {"type": "str"}, + }, + "required_together": [ + ["start", "end"] + ], + "type": "dict", + }, + }, + }, + "fragments": {"type": "bool"}, + "capture": {"type": "bool"}, + "destopts": {"type": "bool"}, + "authen": {"type": "bool"}, + "routing": {"type": "bool"}, + "hop_by_hop": {"type": "bool"}, + "grant": { + "type": "str", + "choices": ["permit", "deny"], + }, + "icmp_off": {"type": "bool"}, + "log": {"type": "bool"}, + "log_input": {"type": "bool"}, + "line": {"type": "str", "aliases": ["ace"]}, + "packet_length": { + "mutually_exclusive": [ + ["eq", "lt", "neq", "range"], + ["eq", "gt", "neq", "range"], + ], + "options": { + "eq": {"type": "int"}, + "gt": {"type": "int"}, + "lt": {"type": "int"}, + "neq": {"type": "int"}, + "range": { + "options": { + "end": {"type": "int"}, + "start": {"type": "int"}, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "precedence": {"type": "str"}, + "protocol": {"type": "str"}, + "protocol_options": { + "mutually_exclusive": [ + ["icmp", "tcp", "igmp", "icmpv6"] + ], + "options": { + "icmpv6": { + "type": "dict", + "options": { + "address_unreachable": { + "type": "bool" + }, + "administratively_prohibited": { + "type": "bool" + }, + "beyond_scope_of_source_address": { + "type": "bool" + }, + "destination_unreachable": { + "type": "bool" + }, + "echo": {"type": "bool"}, + "echo_reply": {"type": "bool"}, + "erroneous_header_field": { + "type": "bool" + }, + "group_membership_query": { + "type": "bool" + }, + "group_membership_report": { + "type": "bool" + }, + "group_membership_termination": { + "type": "bool" + }, + "host_unreachable": { + "type": "bool" + }, + "nd_na": {"type": "bool"}, + "nd_ns": {"type": "bool"}, + "neighbor_redirect": { + "type": "bool" + }, + "no_route_to_destination": { + "type": "bool" + }, + "node_information_request_is_refused": { + "type": "bool" + }, + "node_information_successful_reply": { + "type": "bool" + }, + "packet_too_big": { + "type": "bool" + }, + "parameter_problem": { + "type": "bool" + }, + "port_unreachable": { + "type": "bool" + }, + "query_subject_is_IPv4address": { + "type": "bool" + }, + "query_subject_is_IPv6address": { + "type": "bool" + }, + "query_subject_is_domainname": { + "type": "bool" + }, + "reassembly_timeout": { + "type": "bool" + }, + "redirect": {"type": "bool"}, + "router_advertisement": { + "type": "bool" + }, + "router_renumbering": { + "type": "bool" + }, + "router_solicitation": { + "type": "bool" + }, + "rr_command": {"type": "bool"}, + "rr_result": {"type": "bool"}, + "rr_seqnum_reset": { + "type": "bool" + }, + "time_exceeded": { + "type": "bool" + }, + "ttl_exceeded": { + "type": "bool" + }, + "unknown_query_type": { + "type": "bool" + }, + "unreachable": { + "type": "bool" + }, + "unrecognized_next_header": { + "type": "bool" + }, + "unrecognized_option": { + "type": "bool" + }, + "whoareyou_reply": { + "type": "bool" + }, + "whoareyou_request": { + "type": "bool" + }, + }, + }, + "icmp": { + "options": { + "administratively_prohibited": { + "type": "bool" + }, + "alternate_address": { + "type": "bool" + }, + "conversion_error": { + "type": "bool" + }, + "dod_host_prohibited": { + "type": "bool" + }, + "dod_net_prohibited": { + "type": "bool" + }, + "echo": {"type": "bool"}, + "echo_reply": {"type": "bool"}, + "general_parameter_problem": { + "type": "bool" + }, + "host_isolated": { + "type": "bool" + }, + "host_precedence_unreachable": { + "type": "bool" + }, + "host_redirect": { + "type": "bool" + }, + "host_tos_redirect": { + "type": "bool" + }, + "host_tos_unreachable": { + "type": "bool" + }, + "host_unknown": { + "type": "bool" + }, + "host_unreachable": { + "type": "bool" + }, + "information_reply": { + "type": "bool" + }, + "information_request": { + "type": "bool" + }, + "mask_reply": {"type": "bool"}, + "mask_request": { + "type": "bool" + }, + "mobile_redirect": { + "type": "bool" + }, + "net_redirect": { + "type": "bool" + }, + "net_tos_redirect": { + "type": "bool" + }, + "net_tos_unreachable": { + "type": "bool" + }, + "net_unreachable": { + "type": "bool" + }, + "network_unknown": { + "type": "bool" + }, + "no_room_for_option": { + "type": "bool" + }, + "option_missing": { + "type": "bool" + }, + "packet_too_big": { + "type": "bool" + }, + "parameter_problem": { + "type": "bool" + }, + "port_unreachable": { + "type": "bool" + }, + "precedence_unreachable": { + "type": "bool" + }, + "protocol_unreachable": { + "type": "bool" + }, + "reassembly_timeout": { + "type": "bool" + }, + "redirect": {"type": "bool"}, + "router_advertisement": { + "type": "bool" + }, + "router_solicitation": { + "type": "bool" + }, + "source_quench": { + "type": "bool" + }, + "source_route_failed": { + "type": "bool" + }, + "time_exceeded": { + "type": "bool" + }, + "timestamp_reply": { + "type": "bool" + }, + "timestamp_request": { + "type": "bool" + }, + "traceroute": {"type": "bool"}, + "ttl_exceeded": { + "type": "bool" + }, + "unreachable": { + "type": "bool" + }, + }, + "type": "dict", + }, + "igmp": { + "options": { + "dvmrp": {"type": "bool"}, + "host_query": {"type": "bool"}, + "host_report": { + "type": "bool" + }, + "mtrace": {"type": "bool"}, + "mtrace_response": { + "type": "bool" + }, + "pim": {"type": "bool"}, + "trace": {"type": "bool"}, + }, + "type": "dict", + }, + "tcp": { + "options": { + "ack": {"type": "bool"}, + "established": { + "type": "bool" + }, + "fin": {"type": "bool"}, + "psh": {"type": "bool"}, + "rst": {"type": "bool"}, + "syn": {"type": "bool"}, + "urg": {"type": "bool"}, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "remark": {"type": "str"}, + "sequence": {"type": "int"}, + "source": { + "mutually_exclusive": [ + ["address", "any", "host", "prefix"], + [ + "wildcard_bits", + "any", + "host", + "prefix", + ], + ], + "options": { + "host": {"type": "str"}, + "address": {"type": "str"}, + "any": {"type": "bool"}, + "prefix": {"type": "str"}, + "port_protocol": { + "mutually_exclusive": [ + [ + "eq", + "gt", + "lt", + "neq", + "range", + ] + ], + "options": { + "eq": {"type": "str"}, + "gt": {"type": "str"}, + "lt": {"type": "str"}, + "neq": {"type": "str"}, + "range": { + "options": { + "end": {"type": "str"}, + "start": { + "type": "str" + }, + }, + "required_together": [ + ["start", "end"] + ], + "type": "dict", + }, + }, + "type": "dict", + }, + "wildcard_bits": {"type": "str"}, + }, + "required_together": [ + ["address", "wildcard_bits"] + ], + "type": "dict", + }, + "ttl": { + "mutually_exclusive": [ + ["eq", "gt", "lt", "neq", "range"] + ], + "options": { + "eq": {"type": "int"}, + "gt": {"type": "int"}, + "lt": {"type": "int"}, + "neq": {"type": "int"}, + "range": { + "options": { + "end": {"type": "int"}, + "start": {"type": "int"}, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + }, + "type": "list", + }, + }, + "type": "list", + }, + "afi": { + "choices": ["ipv4", "ipv6"], + "required": True, + "type": "str", + }, + }, + "type": "list", + }, + "state": { + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "rendered", + "parsed", + ], + "default": "merged", + "type": "str", + }, + } # pylint: disable=C0301 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/facts/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/facts/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/facts/facts.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/facts/facts.py new file mode 100644 index 00000000..af84f8be --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/facts/facts.py @@ -0,0 +1,27 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The arg spec for the iosxr facts module. +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class FactsArgs(object): # pylint: disable=R0903 + """ The arg spec for the iosxr facts module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "gather_subset": dict( + default=["!config"], type="list", elements="str" + ), + "gather_network_resources": dict(type="list", elements="str"), + } diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/interfaces/interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/interfaces/interfaces.py new file mode 100644 index 00000000..e119c159 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/interfaces/interfaces.py @@ -0,0 +1,64 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# +""" +The arg spec for the ios_interfaces module +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class InterfacesArgs(object): + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "name": {"type": "str", "required": True}, + "description": {"type": "str"}, + "enabled": {"default": True, "type": "bool"}, + "speed": {"type": "int"}, + "mtu": {"type": "int"}, + "duplex": {"type": "str", "choices": ["full", "half"]}, + }, + "type": "list", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "parsed", + "rendered", + ], + "default": "merged", + "type": "str", + }, + } diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/l2_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/l2_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/l2_interfaces/l2_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/l2_interfaces/l2_interfaces.py new file mode 100644 index 00000000..fbe5e870 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/l2_interfaces/l2_interfaces.py @@ -0,0 +1,85 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# +""" +The arg spec for the iosxr_l2_interfaces module +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class L2_InterfacesArgs(object): + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "name": {"type": "str", "required": True}, + "native_vlan": {"type": "int"}, + "l2transport": {"type": "bool"}, + "l2protocol": { + "elements": "dict", + "options": { + "cdp": { + "type": "str", + "choices": ["drop", "forward", "tunnel"], + }, + "pvst": { + "type": "str", + "choices": ["drop", "forward", "tunnel"], + }, + "stp": { + "type": "str", + "choices": ["drop", "forward", "tunnel"], + }, + "vtp": { + "type": "str", + "choices": ["drop", "forward", "tunnel"], + }, + }, + "type": "list", + }, + "q_vlan": {"type": "list", "elements": "int"}, + "propagate": {"type": "bool"}, + }, + "type": "list", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "parsed", + "rendered", + ], + "default": "merged", + "type": "str", + }, + } diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/l3_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/l3_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/l3_interfaces/l3_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/l3_interfaces/l3_interfaces.py new file mode 100644 index 00000000..2e63dae9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/l3_interfaces/l3_interfaces.py @@ -0,0 +1,72 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# +""" +The arg spec for the ios_l3_interfaces module +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class L3_InterfacesArgs(object): + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "name": {"type": "str", "required": True}, + "ipv4": { + "elements": "dict", + "type": "list", + "options": { + "address": {"type": "str"}, + "secondary": {"type": "bool"}, + }, + }, + "ipv6": { + "elements": "dict", + "type": "list", + "options": {"address": {"type": "str"}}, + }, + }, + "type": "list", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "parsed", + "rendered", + ], + "default": "merged", + "type": "str", + }, + } diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lacp/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lacp/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lacp/lacp.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lacp/lacp.py new file mode 100644 index 00000000..9b09053f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lacp/lacp.py @@ -0,0 +1,69 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# +""" +The arg spec for the iosxr_lacp module +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class LacpArgs(object): # pylint: disable=R0903 + """The arg spec for the iosxr_lacp module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "options": { + "system": { + "options": { + "mac": { + "type": "dict", + "options": {"address": {"type": "str"}}, + }, + "priority": {"type": "int"}, + }, + "type": "dict", + } + }, + "type": "dict", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "deleted", + "parsed", + "rendered", + "gathered", + ], + "default": "merged", + "type": "str", + }, + } # pylint: disable=C0301 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lacp_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lacp_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lacp_interfaces/lacp_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lacp_interfaces/lacp_interfaces.py new file mode 100644 index 00000000..8dfab9ff --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lacp_interfaces/lacp_interfaces.py @@ -0,0 +1,77 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# +""" +The arg spec for the iosxr_lacp_interfaces module +""" + + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class Lacp_interfacesArgs(object): # pylint: disable=R0903 + """The arg spec for the iosxr_lacp_interfaces module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "churn_logging": { + "choices": ["actor", "partner", "both"], + "type": "str", + }, + "collector_max_delay": {"type": "int"}, + "name": {"type": "str"}, + "period": {"type": "int"}, + "switchover_suppress_flaps": {"type": "int"}, + "system": { + "options": { + "mac": {"type": "str"}, + "priority": {"type": "int"}, + }, + "type": "dict", + }, + }, + "type": "list", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "deleted", + "overridden", + "parsed", + "rendered", + "gathered", + ], + "default": "merged", + "type": "str", + }, + } # pylint: disable=C0301 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lag_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lag_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lag_interfaces/lag_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lag_interfaces/lag_interfaces.py new file mode 100644 index 00000000..cf076046 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lag_interfaces/lag_interfaces.py @@ -0,0 +1,88 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# +""" +The arg spec for the iosxr_lag_interfaces module +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class Lag_interfacesArgs(object): # pylint: disable=R0903 + """The arg spec for the iosxr_lag_interfaces module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "links": { + "options": { + "max_active": {"type": "int"}, + "min_active": {"type": "int"}, + }, + "type": "dict", + }, + "load_balancing_hash": { + "choices": ["dst-ip", "src-ip"], + "type": "str", + }, + "members": { + "elements": "dict", + "options": { + "member": {"type": "str"}, + "mode": { + "choices": ["on", "active", "passive", "inherit"], + "type": "str", + }, + }, + "type": "list", + }, + "mode": { + "choices": ["on", "active", "passive"], + "type": "str", + }, + "name": {"required": True, "type": "str"}, + }, + "type": "list", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "parsed", + "rendered", + "gathered", + ], + "default": "merged", + "type": "str", + }, + } diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lldp_global/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lldp_global/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lldp_global/lldp_global.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lldp_global/lldp_global.py new file mode 100644 index 00000000..97efae08 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lldp_global/lldp_global.py @@ -0,0 +1,73 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# +""" +The arg spec for the iosxr_lldp_global module +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class Lldp_globalArgs(object): # pylint: disable=R0903 + """The arg spec for the iosxr_lldp module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "options": { + "holdtime": {"type": "int"}, + "reinit": {"type": "int"}, + "subinterfaces": {"type": "bool"}, + "timer": {"type": "int"}, + "tlv_select": { + "options": { + "management_address": {"type": "bool"}, + "port_description": {"type": "bool"}, + "system_capabilities": {"type": "bool"}, + "system_description": {"type": "bool"}, + "system_name": {"type": "bool"}, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "deleted", + "parsed", + "rendered", + "gathered", + ], + "default": "merged", + "type": "str", + }, + } # pylint: disable=C0301 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lldp_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lldp_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lldp_interfaces/lldp_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lldp_interfaces/lldp_interfaces.py new file mode 100644 index 00000000..0dca5800 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/lldp_interfaces/lldp_interfaces.py @@ -0,0 +1,77 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# +""" +The arg spec for the iosxr_lldp_interfaces module +""" + + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class Lldp_interfacesArgs(object): # pylint: disable=R0903 + """The arg spec for the iosxr_lldp_interfaces module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "destination": { + "type": "dict", + "options": { + "mac_address": { + "type": "str", + "choices": [ + "ieee-nearest-bridge", + "ieee-nearest-non-tmpr-bridge", + ], + } + }, + }, + "name": {"type": "str"}, + "receive": {"type": "bool"}, + "transmit": {"type": "bool"}, + }, + "type": "list", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "deleted", + "overridden", + "parsed", + "rendered", + "gathered", + ], + "default": "merged", + "type": "str", + }, + } # pylint: disable=C0301 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospf_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospf_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospf_interfaces/ospf_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospf_interfaces/ospf_interfaces.py new file mode 100644 index 00000000..8bf33fd0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospf_interfaces/ospf_interfaces.py @@ -0,0 +1,379 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the +# cli_rm_builder. +# +# Manually editing this file is not advised. +# +# To update the argspec make the desired changes +# in the module docstring and re-run +# cli_rm_builder. +# +############################################# + +""" +The arg spec for the iosxr_ospf_interfaces module +""" + + +class Ospf_interfacesArgs(object): # pylint: disable=R0903 + """The arg spec for the iosxr_ospf_interfaces module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "running_config": {"type": "str"}, + "config": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "str", "required": True}, + "type": {"type": "str", "required": True}, + "address_family": { + "type": "list", + "elements": "dict", + "options": { + "afi": { + "type": "str", + "choices": ["ipv4", "ipv6"], + "required": True, + }, + "processes": { + "type": "list", + "elements": "dict", + "options": { + "process_id": { + "type": "str", + "required": True, + }, + "area": { + "type": "dict", + "options": {"area_id": {"type": "str"}}, + }, + }, + }, + "apply_group_option": { + "type": "dict", + "options": { + "group_name": {"type": "str"}, + "operation": { + "type": "str", + "choices": ["add", "remove", "append"], + }, + }, + }, + "authentication": { + "type": "dict", + "options": { + "message_digest": { + "type": "dict", + "options": {"keychain": {"type": "str"}}, + }, + "null_auth": {"type": "bool"}, + }, + }, + "authentication_key": { + "type": "dict", + "options": { + "password": {"type": "str"}, + "clear": {"type": "str"}, + "encrypted": {"type": "str"}, + }, + }, + "bfd": { + "type": "dict", + "options": { + "fast_detect": { + "type": "dict", + "options": { + "set": {"type": "bool"}, + "strict_mode": {"type": "bool"}, + }, + }, + "minimum_interval": {"type": "int"}, + "multiplier": {"type": "int"}, + }, + }, + "cost": {"type": "int"}, + "cost_fallback": { + "type": "dict", + "options": { + "cost": {"type": "int"}, + "threshold": {"type": "int"}, + }, + }, + "database_filter": { + "type": "dict", + "options": {"all_outgoing_lsa": {"type": "bool"}}, + }, + "dead_interval": {"type": "int"}, + "demand_circuit": {"type": "bool"}, + "fast_reroute": { + "type": "dict", + "options": { + "disabled": {"type": "bool"}, + "per_link": { + "type": "dict", + "options": { + "information_type": { + "type": "str", + "choices": [ + "exclude", + "lfa_candidate", + ], + }, + "use_candidate_only": {"type": "bool"}, + "interface": { + "type": "dict", + "options": { + "bvi": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "int"} + }, + }, + "bundle_ether": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "int"} + }, + }, + "pos_int": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "int"} + }, + }, + "fast_ethernet": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "str"} + }, + }, + "fiftygige": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "str"} + }, + }, + "fortygige": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "str"} + }, + }, + "fourhundredgige": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "str"} + }, + }, + "gigabitethernet": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "str"} + }, + }, + "hundredgige": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "str"} + }, + }, + "mgmteth": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "str"} + }, + }, + "multilink": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "str"} + }, + }, + "pw_ether": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "int"} + }, + }, + "pw_iw": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "int"} + }, + }, + "srp": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "str"} + }, + }, + "serial": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "str"} + }, + }, + "tengige": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "str"} + }, + }, + "twentyfivegige": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "str"} + }, + }, + "twohundredgige": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "str"} + }, + }, + "nve": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "int"} + }, + }, + "tunnel_ip": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "int"} + }, + }, + "tunnel_ipsec": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "int"} + }, + }, + "tunnel_mte": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "int"} + }, + }, + "tunnel_mpls": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "str"} + }, + }, + }, + }, + }, + }, + }, + }, + "flood_reduction": {"type": "bool"}, + "hello_interval": {"type": "int"}, + "link_down_fast_detect": {"type": "bool"}, + "message_digest_key": { + "type": "dict", + "options": { + "id": {"type": "int", "required": True}, + "md5": { + "type": "dict", + "required": True, + "options": { + "password": {"type": "str"}, + "clear": {"type": "bool"}, + "encrypted": {"type": "bool"}, + }, + }, + }, + }, + "mpls_ldp_sync": {"type": "bool"}, + "mtu_ignore": {"type": "bool"}, + "network": { + "type": "str", + "choices": [ + "broadcast", + "non-broadcast", + "point-to-multipoint", + "point-to-point", + ], + }, + "neighbors": { + "type": "list", + "elements": "dict", + "options": { + "neighbor_id": {"type": "str"}, + "cost": {"type": "int"}, + "db_filter_all_out": {"type": "bool"}, + "poll_interval": {"type": "int"}, + "priority": {"type": "int"}, + }, + }, + "packet_size": {"type": "int"}, + "passive": {"type": "bool"}, + "prefix_suppression": {"type": "bool"}, + "priority": {"type": "int"}, + "retransmit_interval": {"type": "int"}, + "security_ttl": { + "type": "dict", + "options": { + "set": {"type": "bool"}, + "hops": {"type": "int"}, + }, + }, + "transmit_delay": {"type": "int"}, + }, + }, + }, + }, + "state": { + "type": "str", + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "parsed", + "rendered", + ], + "default": "merged", + }, + } # pylint: disable=C0301 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospfv2/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospfv2/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospfv2/ospfv2.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospfv2/ospfv2.py new file mode 100644 index 00000000..fb41a1e3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospfv2/ospfv2.py @@ -0,0 +1,795 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2020 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# +""" +The arg spec for the iosxr_ospfv2 module +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class Ospfv2Args(object): # pylint: disable=R0903 + """The arg spec for the iosxr_ospfv2 module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "options": { + "processes": { + "elements": "dict", + "options": { + "address_family_unicast": {"type": "bool"}, + "adjacency_stagger": { + "options": { + "disable": {"type": "bool"}, + "max_adjacency": {"type": "int"}, + "min_adjacency": {"type": "int"}, + }, + "required_together": [ + ["min_adjacency", "max_adjacency"] + ], + "type": "dict", + }, + "apply_weight": { + "mutually_exclusive": [ + ["bandwidth", "default_weight"] + ], + "options": { + "bandwidth": {"type": "int"}, + "default_weight": {"type": "int"}, + }, + "type": "dict", + }, + "areas": { + "elements": "dict", + "options": { + "area_id": {"required": True, "type": "str"}, + "authentication": { + "mutually_exclusive": [ + [ + "keychain", + "message_digest", + "no_auth", + ] + ], + "options": { + "keychain": {"type": "str"}, + "message_digest": { + "options": { + "keychain": {"type": "str"} + }, + "type": "dict", + }, + "no_auth": {"type": "bool"}, + }, + "type": "dict", + }, + "authentication_key": { + "mutually_exclusive": [ + ["clear", "encrypted"] + ], + "options": { + "clear": {"type": "str"}, + "encrypted": {"type": "str"}, + "password": {"type": "str"}, + }, + "type": "dict", + }, + "bfd": { + "options": { + "fast_detect": { + "options": { + "set": {"type": "bool"}, + "strict_mode": { + "type": "bool" + }, + }, + "type": "dict", + }, + "minimum_interval": {"type": "int"}, + "multiplier": {"type": "int"}, + }, + "type": "dict", + }, + "cost": {"type": "int"}, + "dead_interval": {"type": "int"}, + "default_cost": {"type": "int"}, + "hello_interval": {"type": "int"}, + "mpls": { + "options": { + "ldp": { + "options": { + "auto_config": { + "type": "bool" + }, + "sync": {"type": "bool"}, + "sync_igp_shortcuts": { + "type": "bool" + }, + }, + "type": "dict", + }, + "traffic_eng": {"type": "bool"}, + }, + "type": "dict", + }, + "mtu_ignore": { + "choices": ["enable", "disable"], + "type": "str", + }, + "nssa": { + "options": { + "default_information_originate": { + "options": { + "metric": {"type": "int"}, + "metric_type": {"type": "int"}, + }, + "type": "dict", + }, + "no_redistribution": {"type": "bool"}, + "no_summary": {"type": "bool"}, + "set": {"type": "bool"}, + "translate": { + "options": { + "type7": { + "options": { + "always": { + "type": "bool" + } + }, + "type": "dict", + } + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "ranges": { + "elements": "dict", + "mutually_exclusive": [ + ["advertise", "not_advertise"] + ], + "options": { + "address": { + "required": True, + "type": "str", + }, + "advertise": {"type": "bool"}, + "not_advertise": {"type": "bool"}, + }, + "type": "list", + }, + "route_policy": { + "elements": "dict", + "options": { + "direction": { + "choices": ["in", "out"], + "type": "str", + }, + "parameters": { + "elements": "str", + "type": "list", + }, + }, + "type": "list", + }, + "stub": { + "options": { + "no_summary": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "transmit_delay": {"type": "int"}, + "virtual_link": { + "elements": "dict", + "options": { + "authentication": { + "mutually_exclusive": [ + [ + "keychain", + "message_digest", + "no_auth", + ] + ], + "options": { + "keychain": {"type": "str"}, + "message_digest": { + "options": { + "keychain": { + "type": "str" + } + }, + "type": "dict", + }, + "no_auth": {"type": "bool"}, + }, + "type": "dict", + }, + "authentication_key": { + "mutually_exclusive": [ + ["clear", "encrypted"] + ], + "options": { + "clear": {"type": "str"}, + "encrypted": {"type": "str"}, + "password": {"type": "str"}, + }, + "type": "dict", + }, + "dead_interval": {"type": "int"}, + "hello_interval": {"type": "int"}, + "id": { + "required": True, + "type": "str", + }, + "message_digest_key": { + "options": { + "id": { + "required": True, + "type": "int", + }, + "md5": { + "mutually_exclusive": [ + ["clear", "encrypted"] + ], + "options": { + "clear": { + "type": "bool" + }, + "encrypted": { + "type": "bool" + }, + "password": { + "type": "str" + }, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "retransmit_interval": {"type": "int"}, + "transmit_delay": {"type": "int"}, + }, + "type": "list", + }, + }, + "type": "list", + }, + "authentication": { + "mutually_exclusive": [ + ["keychain", "message_digest", "no_auth"] + ], + "options": { + "keychain": {"type": "str"}, + "message_digest": { + "options": { + "keychain": {"type": "str"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "no_auth": {"type": "bool"}, + }, + "type": "dict", + }, + "authentication_key": { + "mutually_exclusive": [["clear", "encrypted"]], + "options": { + "clear": {"type": "bool"}, + "encrypted": {"type": "bool"}, + "password": {"type": "str"}, + }, + "type": "dict", + }, + "auto_cost": { + "mutually_exclusive": [ + ["reference_bandwidth", "disable"] + ], + "options": { + "disable": {"type": "bool"}, + "reference_bandwidth": {"type": "int"}, + }, + "type": "dict", + }, + "bfd": { + "options": { + "fast_detect": { + "options": { + "set": {"type": "bool"}, + "strict_mode": {"type": "bool"}, + }, + "type": "dict", + }, + "minimum_interval": {"type": "int"}, + "multiplier": {"type": "int"}, + }, + "type": "dict", + }, + "capability": { + "options": { + "opaque": { + "mutually_exclusive": [["set", "disable"]], + "options": { + "disable": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "type7": {"type": "str"}, + }, + "type": "dict", + }, + "cost": {"type": "int"}, + "database_filter": { + "choices": ["enable", "disable"], + "type": "str", + }, + "dead_interval": {"type": "int"}, + "default_information_originate": { + "options": { + "always": {"type": "bool"}, + "metric": {"type": "int"}, + "metric_type": {"type": "int"}, + "route_policy": {"type": "str"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "default_metric": {"type": "int"}, + "demand_circuit": { + "choices": ["enable", "disable"], + "type": "str", + }, + "distance": { + "options": { + "admin_distance": { + "elements": "dict", + "options": { + "access_list": {"type": "str"}, + "source": {"type": "str"}, + "value": {"type": "int"}, + "wildcard": {"type": "str"}, + }, + "required_together": [ + ["value", "source", "wildcard"] + ], + "type": "list", + }, + "ospf_distance": { + "options": { + "external": {"type": "int"}, + "inter_area": {"type": "int"}, + "intra_area": {"type": "int"}, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "distribute_bgp_ls": { + "options": { + "instance_id": {"type": "int"}, + "throttle": {"type": "int"}, + }, + "type": "dict", + }, + "distribute_link_state": { + "options": { + "instance_id": {"type": "int"}, + "throttle": {"type": "int"}, + }, + "type": "dict", + }, + "distribute_list": { + "elements": "dict", + "mutually_exclusive": [ + ["access_list", "route_policy"] + ], + "options": { + "access_list": {"type": "str"}, + "direction": { + "choices": ["in", "out"], + "type": "str", + }, + "outgoing_params": { + "options": { + "id": {"type": "str"}, + "route_type": { + "choices": [ + "bgp", + "connected", + "dagr", + "ospf", + "static", + ], + "type": "str", + }, + }, + "type": "dict", + }, + "route_policy": {"type": "str"}, + }, + "type": "list", + }, + "external_out": { + "choices": ["enable", "disable"], + "type": "str", + }, + "flood_reduction": { + "choices": ["enable", "disable"], + "type": "str", + }, + "hello_interval": {"type": "int"}, + "ignore_lsa_mospf": {"type": "bool"}, + "link_down_fast_detect": {"type": "bool"}, + "log_adjacency_changes": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "loopback_stub_network": { + "choices": ["enable", "disable"], + "type": "str", + }, + "max_lsa": { + "options": { + "ignore_count": {"type": "int"}, + "ignore_time": {"type": "int"}, + "reset_time": {"type": "int"}, + "threshold": {"type": "int"}, + "warning_only": {"type": "bool"}, + }, + "type": "dict", + }, + "max_metric": { + "options": { + "router_lsa": { + "options": { + "external_lsa": { + "options": { + "max_metric_value": { + "type": "int" + }, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "include_stub": {"type": "bool"}, + "on_startup": { + "options": { + "set": {"type": "bool"}, + "wait_for_bgp_asn": { + "type": "int" + }, + "wait_period": {"type": "int"}, + }, + "type": "dict", + }, + "set": {"type": "bool"}, + "summary_lsa": { + "options": { + "max_metric_value": { + "type": "int" + }, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + }, + "type": "dict", + } + }, + "type": "dict", + }, + "message_digest_key": { + "options": { + "id": {"required": True, "type": "int"}, + "md5": { + "mutually_exclusive": [ + ["clear", "encrypted"] + ], + "options": { + "clear": {"type": "bool"}, + "encrypted": {"type": "bool"}, + "password": {"type": "str"}, + }, + "required": True, + "type": "dict", + }, + }, + "type": "dict", + }, + "microloop_avoidance": { + "mutually_exclusive": [ + [ + "protected", + "rib_update_delay", + "segment_routing", + ] + ], + "options": { + "protected": {"type": "bool"}, + "rib_update_delay": {"type": "int"}, + "segment_routing": {"type": "bool"}, + }, + "type": "dict", + }, + "monitor_convergence": { + "options": { + "prefix_list": {"type": "str"}, + "track_external_routes": {"type": "bool"}, + "track_ip_frr": {"type": "bool"}, + "track_summary_routes": {"type": "bool"}, + }, + "type": "dict", + }, + "mpls": { + "options": { + "ldp": { + "options": { + "auto_config": {"type": "bool"}, + "sync": {"type": "bool"}, + "sync_igp_shortcuts": {"type": "bool"}, + }, + "type": "dict", + }, + "traffic_eng": { + "options": { + "autoroute_exclude": { + "options": { + "parameters": { + "elements": "str", + "type": "list", + }, + "route_policy": { + "type": "str" + }, + }, + "type": "dict", + }, + "igp_intact": {"type": "bool"}, + "ldp_sync_update": {"type": "bool"}, + "multicast_intact": {"type": "bool"}, + "router_id": {"type": "str"}, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "mtu_ignore": { + "choices": ["enable", "disable"], + "type": "str", + }, + "network": { + "options": { + "broadcast": {"type": "bool"}, + "non_broadcast": {"type": "bool"}, + "point_to_multipoint": {"type": "bool"}, + "point_to_point": {"type": "bool"}, + }, + "type": "dict", + }, + "nsf": { + "options": { + "cisco": { + "options": { + "enforce_global": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "flush_delay_time": {"type": "int"}, + "ietf": { + "options": { + "helper_disable": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "interval": {"type": "int"}, + "lifetime": {"type": "int"}, + }, + "type": "dict", + }, + "nsr": {"type": "bool"}, + "packet_size": {"type": "int"}, + "passive": { + "choices": ["enable", "disable"], + "type": "str", + }, + "prefix_suppression": { + "options": { + "secondary_address": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "priority": {"type": "int"}, + "process_id": {"required": True, "type": "str"}, + "protocol_shutdown": { + "options": { + "host_mode": {"type": "bool"}, + "limit": { + "options": { + "high": {"type": "int"}, + "low": {"type": "int"}, + "medium": {"type": "int"}, + }, + "type": "dict", + }, + "on_reload": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "redistribute": { + "options": { + "id": {"type": "str"}, + "level": { + "choices": [1, 2, 12], + "type": "int", + }, + "lsa_type_summary": {"type": "bool"}, + "match": {"type": "str"}, + "metric": {"type": "int"}, + "metric_type": { + "choices": [1, 2], + "type": "int", + }, + "nssa_only": {"type": "bool"}, + "preserve_med": {"type": "bool"}, + "route_policy": { + "options": { + "name": {"type": "str"}, + "parameters": { + "elements": "str", + "type": "list", + }, + }, + "type": "dict", + }, + "route_type": { + "choices": [ + "application", + "bgp", + "connected", + "dagr", + "eigrp", + "isis", + "mobile", + "ospf", + "rip", + "static", + "subscriber", + ], + "type": "str", + }, + "tag": {"type": "int"}, + }, + "type": "dict", + }, + "retransmit_interval": {"type": "int"}, + "router_id": {"type": "str"}, + "security_ttl": { + "options": { + "hops": {"type": "int"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "summary_in": { + "choices": ["enable", "disable"], + "type": "str", + }, + "summary_prefix": { + "elements": "dict", + "options": { + "not_advertise": {"type": "bool"}, + "prefix": {"required": True, "type": "str"}, + "tag": {"type": "int"}, + }, + "type": "list", + }, + "timers": { + "options": { + "graceful_shutdown": { + "options": { + "initial_delay": {"type": "int"}, + "retain_routes": {"type": "int"}, + }, + "type": "dict", + }, + "lsa": { + "options": { + "group_pacing": {"type": "int"}, + "min_arrival": {"type": "int"}, + "refresh": {"type": "int"}, + }, + "type": "dict", + }, + "pacing_flood": {"type": "int"}, + "throttle": { + "options": { + "fast_reroute": {"type": "int"}, + "lsa_all": { + "options": { + "initial_delay": { + "type": "int" + }, + "max_delay": {"type": "int"}, + "min_delay": {"type": "int"}, + }, + "type": "dict", + }, + "spf": { + "options": { + "change_delay": { + "type": "int" + }, + "max_wait": {"type": "int"}, + "second_delay": { + "type": "int" + }, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "transmit_delay": {"type": "int"}, + "weight": {"type": "int"}, + }, + "type": "list", + } + }, + "type": "dict", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "rendered", + "parsed", + ], + "default": "merged", + "type": "str", + }, + } # pylint: disable=C0301 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospfv3/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospfv3/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospfv3/ospfv3.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospfv3/ospfv3.py new file mode 100644 index 00000000..e9d82720 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/ospfv3/ospfv3.py @@ -0,0 +1,1376 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# + +""" +The arg spec for the iosxr_ospfv3 module +""" + + +class Ospfv3Args(object): # pylint: disable=R0903 + """The arg spec for the iosxr_ospfv3 module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "running_config": {"type": "str"}, + "config": { + "type": "dict", + "options": { + "processes": { + "type": "list", + "elements": "dict", + "options": { + "process_id": {"type": "str", "required": True}, + "address_family_unicast": {"type": "bool"}, + "authentication": { + "type": "dict", + "options": { + "disable": {"type": "bool", "default": False}, + "ipsec": { + "type": "dict", + "options": { + "spi": {"type": "int"}, + "algorithim_type": { + "type": "str", + "choices": ["md5", "sha1"], + }, + "key": {"type": "str"}, + "clear_key": {"type": "str"}, + "password_key": {"type": "str"}, + }, + }, + }, + }, + "auto_cost": { + "type": "dict", + "options": { + "reference_bandwidth": {"type": "int"}, + "disable": {"type": "bool"}, + }, + }, + "bfd": { + "type": "dict", + "options": { + "fast_detect": { + "type": "dict", + "options": { + "set": {"type": "bool"}, + "strict_mode": {"type": "bool"}, + }, + }, + "minimum_interval": {"type": "int"}, + "multiplier": {"type": "int"}, + }, + }, + "areas": { + "type": "list", + "elements": "dict", + "options": { + "area_id": {"type": "str", "required": True}, + "authentication": { + "type": "dict", + "options": { + "disable": { + "type": "bool", + "default": False, + }, + "ipsec": { + "type": "dict", + "options": { + "spi": {"type": "int"}, + "algorithim_type": { + "type": "str", + "choices": ["md5", "sha1"], + }, + "key": {"type": "str"}, + "clear_key": {"type": "str"}, + "password_key": { + "type": "str" + }, + }, + }, + }, + }, + "bfd": { + "type": "dict", + "options": { + "fast_detect": { + "type": "dict", + "options": { + "set": {"type": "bool"}, + "strict_mode": { + "type": "bool" + }, + }, + }, + "minimum_interval": {"type": "int"}, + "multiplier": {"type": "int"}, + }, + }, + "cost": {"type": "int"}, + "database_filter": { + "type": "dict", + "options": { + "all_outgoing_lsa": {"type": "bool"} + }, + }, + "dead_interval": {"type": "int"}, + "default_cost": {"type": "int"}, + "demand_circuit": {"type": "bool"}, + "distrinbute_rib_prefix_list_name": { + "type": "str" + }, + "fast_reroute": { + "type": "dict", + "options": { + "disabled": {"type": "bool"}, + "per_link": { + "type": "dict", + "options": { + "information_type": { + "type": "str", + "choices": [ + "exclude", + "lfa_candidate", + ], + }, + "use_candidate_only": { + "type": "bool" + }, + "interface": { + "type": "dict", + "options": { + "bvi": { + "type": "list", + "elements": "int", + }, + "bundle_ether": { + "type": "list", + "elements": "int", + }, + "pos_int": { + "type": "list", + "elements": "int", + }, + "fast_ethernet": { + "type": "list", + "elements": "str", + }, + "fiftygige": { + "type": "list", + "elements": "str", + }, + "fortygige": { + "type": "list", + "elements": "str", + }, + "fourhundredgige": { + "type": "list", + "elements": "str", + }, + "gigabitethernet": { + "type": "list", + "elements": "str", + }, + "hundredgige": { + "type": "list", + "elements": "str", + }, + "mgmteth": { + "type": "list", + "elements": "str", + }, + "multilink": { + "type": "list", + "elements": "str", + }, + "pw_ether": { + "type": "list", + "elements": "int", + }, + "pw_iw": { + "type": "list", + "elements": "int", + }, + "srp": { + "type": "list", + "elements": "str", + }, + "serial": { + "type": "list", + "elements": "str", + }, + "tengige": { + "type": "list", + "elements": "str", + }, + "twentyfivegige": { + "type": "list", + "elements": "str", + }, + "twohundredgige": { + "type": "list", + "elements": "str", + }, + "nve": { + "type": "list", + "elements": "int", + }, + "tunnel_ip": { + "type": "list", + "elements": "int", + }, + "tunnel_ipsec": { + "type": "list", + "elements": "int", + }, + "tunnel_mte": { + "type": "list", + "elements": "int", + }, + "tunnel_mpls": { + "type": "int" + }, + }, + }, + }, + }, + "per_prefix": { + "type": "dict", + "options": { + "information_type": { + "type": "str", + "choices": [ + "exclude", + "lfa_candidate", + ], + }, + "use_candidate_only": { + "type": "bool" + }, + "interface": { + "type": "dict", + "options": { + "bvi": { + "type": "list", + "elements": "int", + }, + "bundle_ether": { + "type": "list", + "elements": "int", + }, + "pos_int": { + "type": "list", + "elements": "int", + }, + "fast_ethernet": { + "type": "list", + "elements": "str", + }, + "fiftygige": { + "type": "list", + "elements": "str", + }, + "fortygige": { + "type": "list", + "elements": "str", + }, + "fourhundredgige": { + "type": "list", + "elements": "str", + }, + "gigabitethernet": { + "type": "list", + "elements": "str", + }, + "hundredgige": { + "type": "list", + "elements": "str", + }, + "mgmteth": { + "type": "list", + "elements": "str", + }, + "multilink": { + "type": "list", + "elements": "str", + }, + "pw_ether": { + "type": "list", + "elements": "int", + }, + "pw_iw": { + "type": "list", + "elements": "int", + }, + "srp": { + "type": "list", + "elements": "str", + }, + "serial": { + "type": "list", + "elements": "str", + }, + "tengige": { + "type": "list", + "elements": "str", + }, + "twentyfivegige": { + "type": "list", + "elements": "str", + }, + "twohundredgige": { + "type": "list", + "elements": "str", + }, + "nve": { + "type": "list", + "elements": "int", + }, + "tunnel_ip": { + "type": "list", + "elements": "int", + }, + "tunnel_ipsec": { + "type": "list", + "elements": "int", + }, + "tunnel_mte": { + "type": "list", + "elements": "int", + }, + "tunnel_mpls": { + "type": "int" + }, + }, + }, + }, + }, + }, + }, + "flood_reduction": {"type": "bool"}, + "hello_interval": {"type": "int"}, + "instance_id": {"type": "int"}, + "mtu_ignore": {"type": "bool"}, + "mpls_ldp_sync": {"type": "bool"}, + "network": { + "type": "str", + "choices": [ + "broadcast", + "non-broadcast", + "point-to-multipoint", + "point-to-point", + ], + }, + "nssa": { + "type": "dict", + "options": { + "set": {"type": "bool"}, + "default_information_originate": { + "type": "dict", + "options": { + "set": {"type": "bool"}, + "metric": {"type": "int"}, + "metric_type": {"type": "int"}, + }, + }, + "no_redistribution": {"type": "bool"}, + "no_summary": {"type": "bool"}, + "translate": { + "type": "dict", + "options": { + "type7": { + "type": "dict", + "options": { + "always": { + "type": "bool", + "required": True, + } + }, + } + }, + }, + }, + }, + "packet_size": {"type": "int"}, + "passive": {"type": "bool"}, + "prefix_suppression": {"type": "bool"}, + "priority": {"type": "int"}, + "ranges": { + "type": "list", + "elements": "dict", + "options": { + "address": { + "type": "str", + "required": True, + }, + "cost": {"type": "int"}, + "advertise": {"type": "bool"}, + "not_advertise": {"type": "bool"}, + }, + }, + "retransmit_interval": {"type": "int"}, + "stub": { + "type": "dict", + "options": { + "set": {"type": "bool"}, + "no_summary": {"type": "bool"}, + }, + }, + "transmit_delay": {"type": "int"}, + "virtual_link": { + "type": "list", + "elements": "dict", + "options": { + "id": { + "type": "str", + "required": True, + }, + "authentication": { + "type": "dict", + "options": { + "disable": { + "type": "bool", + "default": False, + }, + "ipsec": { + "type": "dict", + "options": { + "spi": {"type": "int"}, + "algorithim_type": { + "type": "str", + "choices": [ + "md5", + "sha1", + ], + }, + "key": {"type": "str"}, + "clear_key": { + "type": "str" + }, + "password_key": { + "type": "str" + }, + }, + }, + }, + }, + "dead_interval": {"type": "int"}, + "hello_interval": {"type": "int"}, + "retransmit_interval": {"type": "int"}, + "transmit_delay": {"type": "int"}, + "encryption": { + "type": "dict", + "options": { + "disable": { + "type": "bool", + "default": False, + }, + "ipsec": { + "type": "dict", + "options": { + "spi": {"type": "int"}, + "esp": { + "type": "dict", + "options": { + "triple_des": { + "type": "dict", + "options": { + "key": { + "type": "str" + }, + "clear_key": { + "type": "str" + }, + "password_key": { + "type": "str" + }, + }, + }, + "aes": { + "type": "dict", + "options": { + "algorithim_type": { + "type": "str", + "choices": [ + "192", + "256", + ], + }, + "key": { + "type": "str" + }, + "clear_key": { + "type": "str" + }, + "password_key": { + "type": "str" + }, + }, + }, + "des": { + "type": "dict", + "options": { + "key": { + "type": "str" + }, + "clear_key": { + "type": "str" + }, + "password_key": { + "type": "str" + }, + }, + }, + "null_encryption": { + "type": "dict", + "options": { + "authentication": { + "type": "dict", + "options": { + "algorithim_type": { + "type": "str", + "choices": [ + "md5", + "sha1", + ], + }, + "key": { + "type": "str" + }, + "clear_key": { + "type": "str" + }, + "password_key": { + "type": "str" + }, + }, + } + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "encryption": { + "type": "dict", + "options": { + "disable": { + "type": "bool", + "default": False, + }, + "ipsec": { + "type": "dict", + "options": { + "spi": {"type": "int"}, + "esp": { + "type": "dict", + "options": { + "triple_des": { + "type": "dict", + "options": { + "key": { + "type": "str" + }, + "clear_key": { + "type": "str" + }, + "password_key": { + "type": "str" + }, + }, + }, + "aes": { + "type": "dict", + "options": { + "algorithim_type": { + "type": "str", + "choices": [ + "192", + "256", + ], + }, + "key": { + "type": "str" + }, + "clear_key": { + "type": "str" + }, + "password_key": { + "type": "str" + }, + }, + }, + "des": { + "type": "dict", + "options": { + "key": { + "type": "str" + }, + "clear_key": { + "type": "str" + }, + "password_key": { + "type": "str" + }, + }, + }, + "null_encryption": { + "type": "dict", + "options": { + "authentication": { + "type": "dict", + "options": { + "algorithim_type": { + "type": "str", + "choices": [ + "md5", + "sha1", + ], + }, + "key": { + "type": "str" + }, + "clear_key": { + "type": "str" + }, + "password_key": { + "type": "str" + }, + }, + } + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "capability": { + "type": "dict", + "options": { + "type7": { + "type": "dict", + "options": { + "prefer": {"type": "bool"}, + "translate": {"type": "bool"}, + }, + } + }, + }, + "cost": {"type": "int"}, + "database_filter": { + "type": "dict", + "options": {"all_outgoing_lsa": {"type": "bool"}}, + }, + "dead_interval": {"type": "int"}, + "default_information_originate": { + "type": "dict", + "options": { + "always": {"type": "bool"}, + "metric": {"type": "int"}, + "metric_type": {"type": "int"}, + "route_policy": {"type": "str"}, + "tag": {"type": "int"}, + "set": {"type": "bool"}, + }, + }, + "default_metric": {"type": "int"}, + "demand_circuit": {"type": "bool"}, + "distance": { + "type": "dict", + "options": { + "admin_distance": {"type": "int"}, + "ospfv3_distance": { + "type": "dict", + "options": { + "external": {"type": "int"}, + "inter_area": {"type": "int"}, + "intra_area": {"type": "int"}, + }, + }, + }, + }, + "distribute_list": { + "type": "dict", + "options": { + "prefix_list": { + "type": "list", + "elements": "str", + "options": { + "name": {"type": "str"}, + "in": {"type": "bool"}, + "out": {"type": "bool"}, + }, + } + }, + }, + "encryption": { + "type": "dict", + "options": { + "disable": {"type": "bool", "default": False}, + "ipsec": { + "type": "dict", + "options": { + "spi": {"type": "int"}, + "esp": { + "type": "dict", + "options": { + "triple_des": { + "type": "dict", + "options": { + "key": {"type": "str"}, + "clear_key": { + "type": "str" + }, + "password_key": { + "type": "str" + }, + }, + }, + "aes": { + "type": "dict", + "options": { + "algorithim_type": { + "type": "str", + "choices": [ + "192", + "256", + ], + }, + "key": {"type": "str"}, + "clear_key": { + "type": "str" + }, + "password_key": { + "type": "str" + }, + }, + }, + "des": { + "type": "dict", + "options": { + "key": {"type": "str"}, + "clear_key": { + "type": "str" + }, + "password_key": { + "type": "str" + }, + }, + }, + "null_encryption": { + "type": "dict", + "options": { + "authentication": { + "type": "dict", + "options": { + "algorithim_type": { + "type": "str", + "choices": [ + "md5", + "sha1", + ], + }, + "key": { + "type": "str" + }, + "clear_key": { + "type": "str" + }, + "password_key": { + "type": "str" + }, + }, + } + }, + }, + }, + }, + }, + }, + }, + }, + "fast_reroute": { + "type": "dict", + "options": { + "disabled": {"type": "bool"}, + "per_link": { + "type": "dict", + "options": { + "information_type": { + "type": "str", + "choices": [ + "exclude", + "lfa_candidate", + ], + }, + "use_candidate_only": {"type": "bool"}, + "interface": { + "type": "dict", + "options": { + "bvi": { + "type": "list", + "elements": "int", + }, + "bundle_ether": { + "type": "list", + "elements": "int", + }, + "pos_int": { + "type": "list", + "elements": "int", + }, + "fast_ethernet": { + "type": "list", + "elements": "str", + }, + "fiftygige": { + "type": "list", + "elements": "str", + }, + "fortygige": { + "type": "list", + "elements": "str", + }, + "fourhundredgige": { + "type": "list", + "elements": "str", + }, + "gigabitethernet": { + "type": "list", + "elements": "str", + }, + "hundredgige": { + "type": "list", + "elements": "str", + }, + "mgmteth": { + "type": "list", + "elements": "str", + }, + "multilink": { + "type": "list", + "elements": "str", + }, + "pw_ether": { + "type": "list", + "elements": "int", + }, + "pw_iw": { + "type": "list", + "elements": "int", + }, + "srp": { + "type": "list", + "elements": "str", + }, + "serial": { + "type": "list", + "elements": "str", + }, + "tengige": { + "type": "list", + "elements": "str", + }, + "twentyfivegige": { + "type": "list", + "elements": "str", + }, + "twohundredgige": { + "type": "list", + "elements": "str", + }, + "nve": { + "type": "list", + "elements": "int", + }, + "tunnel_ip": { + "type": "list", + "elements": "int", + }, + "tunnel_ipsec": { + "type": "list", + "elements": "int", + }, + "tunnel_mte": { + "type": "list", + "elements": "int", + }, + "tunnel_mpls": {"type": "int"}, + }, + }, + }, + }, + "per_prefix": { + "type": "dict", + "options": { + "information_type": { + "type": "str", + "choices": [ + "exclude", + "lfa_candidate", + ], + }, + "use_candidate_only": {"type": "bool"}, + "interface": { + "type": "dict", + "options": { + "bvi": { + "type": "list", + "elements": "int", + }, + "bundle_ether": { + "type": "list", + "elements": "int", + }, + "post_int": { + "type": "list", + "elements": "int", + }, + "fast_ethernet": { + "type": "list", + "elements": "str", + }, + "fiftygige": { + "type": "list", + "elements": "str", + }, + "fortygige": { + "type": "list", + "elements": "str", + }, + "fourhundredgige": { + "type": "list", + "elements": "str", + }, + "gigabitethernet": { + "type": "list", + "elements": "str", + }, + "hundredgige": { + "type": "list", + "elements": "str", + }, + "mgmteth": { + "type": "list", + "elements": "str", + }, + "multilink": { + "type": "list", + "elements": "str", + }, + "pw_ether": { + "type": "list", + "elements": "int", + }, + "pw_iw": { + "type": "list", + "elements": "int", + }, + "srp": { + "type": "list", + "elements": "str", + }, + "serial": { + "type": "list", + "elements": "str", + }, + "tengige": { + "type": "list", + "elements": "str", + }, + "twentyfivegige": { + "type": "list", + "elements": "str", + }, + "twohundredgige": { + "type": "list", + "elements": "str", + }, + "nve": { + "type": "list", + "elements": "int", + }, + "tunnel_ip": { + "type": "list", + "elements": "int", + }, + "tunnel_ipsec": { + "type": "list", + "elements": "int", + }, + "tunnel_mte": { + "type": "list", + "elements": "int", + }, + "tunnel_mpls": {"type": "int"}, + }, + }, + }, + }, + }, + }, + "flood_reduction": {"type": "bool"}, + "graceful_restart": { + "type": "dict", + "options": { + "set": {"type": "bool"}, + "helper_disable": {"type": "bool"}, + "min_interval": {"type": "int"}, + "max_interval": {"type": "int"}, + }, + }, + "hello_interval": {"type": "int"}, + "ignore_mospf_type6_lsa": {"type": "bool"}, + "instance_id": {"type": "int"}, + "log_adjacency_changes": { + "type": "dict", + "options": { + "set": {"type": "bool"}, + "disable": {"type": "bool"}, + "detail": {"type": "bool"}, + }, + }, + "maximum": { + "type": "dict", + "options": { + "interfaces": {"type": "int"}, + "paths": {"type": "int"}, + "redistributed_prefixes": {"type": "int"}, + }, + }, + "mpls_ldp_sync": {"type": "bool"}, + "mtu_ignore": {"type": "bool"}, + "network": { + "type": "str", + "choices": [ + "broadcast", + "non-broadcast", + "point-to-multipoint", + "point-to-point", + ], + }, + "nsr": {"type": "bool"}, + "packet_size": {"type": "int"}, + "passive": {"type": "bool"}, + "prefix_suppression": {"type": "bool"}, + "priority": {"type": "int"}, + "protocol_shutdown": {"type": "bool"}, + "redistribute": { + "type": "dict", + "options": { + "application": { + "type": "list", + "elements": "dict", + "options": { + "id": { + "type": "str", + "required": True, + }, + "set": {"type": "bool"}, + "metric": {"type": "int"}, + "metric_type": {"type": "int"}, + "route_policy": {"type": "str"}, + "tag": {"type": "int"}, + }, + }, + "bgp": { + "type": "list", + "elements": "dict", + "options": { + "id": { + "type": "int", + "required": True, + }, + "set": {"type": "bool"}, + "metric": {"type": "int"}, + "metric_type": {"type": "int"}, + "preserved_med": {"type": "str"}, + "route_policy": {"type": "str"}, + "tag": {"type": "int"}, + }, + }, + "connected": { + "type": "dict", + "options": { + "set": {"type": "bool"}, + "metric": {"type": "int"}, + "metric_type": {"type": "int"}, + "route_policy": {"type": "str"}, + "tag": {"type": "int"}, + }, + }, + "eigrp": { + "type": "list", + "elements": "dict", + "options": { + "id": { + "type": "int", + "required": True, + }, + "set": {"type": "bool"}, + "match": { + "type": "str", + "choices": [ + "external", + "internal", + ], + }, + "metric": {"type": "int"}, + "metric_type": {"type": "int"}, + "route_policy": {"type": "str"}, + "tag": {"type": "int"}, + }, + }, + "isis": { + "type": "list", + "elements": "dict", + "options": { + "id": { + "type": "str", + "required": True, + }, + "set": {"type": "bool"}, + "level": { + "type": "str", + "choices": [ + "level-1", + "level-1-2", + "level-2", + ], + }, + "metric": {"type": "int"}, + "metric_type": {"type": "int"}, + "route_policy": {"type": "str"}, + "tag": {"type": "int"}, + }, + }, + "mobile": { + "type": "dict", + "options": { + "set": {"type": "bool"}, + "metric": {"type": "int"}, + "metric_type": {"type": "int"}, + "route_policy": {"type": "str"}, + "tag": {"type": "int"}, + }, + }, + "ospfv3": { + "type": "list", + "elements": "dict", + "options": { + "id": { + "type": "str", + "required": True, + }, + "set": {"type": "bool"}, + "match": { + "type": "dict", + "options": { + "external": { + "type": "int", + "choices": ["1", "2"], + }, + "nssa_external": { + "type": "int", + "choices": ["1", "2"], + }, + "internal": {"type": "bool"}, + }, + }, + "metric": {"type": "int"}, + "metric_type": {"type": "int"}, + "route_policy": {"type": "str"}, + "tag": {"type": "int"}, + }, + }, + "static": { + "type": "dict", + "options": { + "set": {"type": "bool"}, + "metric": {"type": "int"}, + "metric_type": {"type": "int"}, + "route_policy": {"type": "str"}, + "tag": {"type": "int"}, + }, + }, + "subscriber": { + "type": "dict", + "options": { + "set": {"type": "bool"}, + "metric": {"type": "int"}, + "metric_type": {"type": "int"}, + "route_policy": {"type": "str"}, + "tag": {"type": "int"}, + }, + }, + }, + }, + "retransmit_interval": {"type": "int"}, + "router_id": {"type": "str"}, + "spf_prefix_priority": { + "type": "dict", + "options": { + "disable": {"type": "bool"}, + "route_policy": { + "type": "list", + "elements": "dict", + "options": { + "name": {"type": "str"}, + "value": {"type": "str"}, + }, + }, + }, + }, + "stub_router": { + "type": "dict", + "options": { + "router_lsa": { + "type": "dict", + "options": { + "advertise_with": { + "type": "str", + "choices": [ + "max-metric", + "r-bit", + "v6-bit", + ], + }, + "always": {"type": "bool"}, + "external_lsa": { + "type": "dict", + "options": { + "set": {"type": "bool"}, + "metric": {"type": "int"}, + }, + }, + "include_stub": {"type": "bool"}, + "on_proc_migration": {"type": "int"}, + "on_proc_restart": {"type": "int"}, + "on_startup": { + "type": "dict", + "options": { + "time": {"type": "int"}, + "wait_for_bgp": { + "type": "bool" + }, + }, + }, + "on_switchover": {"type": "int"}, + "summary_lsa": { + "type": "dict", + "options": { + "set": {"type": "bool"}, + "metric": {"type": "int"}, + }, + }, + }, + } + }, + }, + "summary_prefix": { + "type": "list", + "elements": "dict", + "options": { + "prefix": {"type": "str", "required": True}, + "not_advertise": {"type": "bool"}, + "tag": {"type": "int"}, + }, + }, + "timers": { + "type": "dict", + "options": { + "lsa_arrival": {"type": "int"}, + "pacing": { + "type": "dict", + "options": { + "flood": {"type": "int"}, + "lsa_group": {"type": "int"}, + "retransmission": {"type": "int"}, + }, + }, + "throttle": { + "type": "dict", + "options": { + "lsa": { + "type": "dict", + "options": { + "all_lsa_initial": { + "type": "int" + }, + "all_lsa_minimum": { + "type": "int" + }, + }, + }, + "spf": { + "type": "dict", + "options": { + "spf_initial": {"type": "int"}, + "spf_minimum": {"type": "int"}, + }, + }, + }, + }, + }, + }, + "trace": { + "type": "dict", + "options": { + "size": {"type": "str"}, + "value": {"type": "int"}, + }, + }, + "transmit_delay": {"type": "int"}, + }, + } + }, + }, + "state": { + "type": "str", + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "rendered", + "parsed", + ], + "default": "merged", + }, + } # pylint: disable=C0301 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/static_routes/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/static_routes/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/static_routes/static_routes.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/static_routes/static_routes.py new file mode 100644 index 00000000..362477b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/argspec/static_routes/static_routes.py @@ -0,0 +1,103 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# +""" +The arg spec for the iosxr_static_routes module +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class Static_routesArgs(object): # pylint: disable=R0903 + """The arg spec for the iosxr_static_routes module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "vrf": {"type": "str"}, + "address_families": { + "elements": "dict", + "options": { + "afi": { + "choices": ["ipv4", "ipv6"], + "required": True, + "type": "str", + }, + "safi": { + "choices": ["unicast", "multicast"], + "required": True, + "type": "str", + }, + "routes": { + "elements": "dict", + "options": { + "dest": {"required": True, "type": "str"}, + "next_hops": { + "elements": "dict", + "options": { + "admin_distance": {"type": "int"}, + "description": {"type": "str"}, + "dest_vrf": {"type": "str"}, + "forward_router_address": { + "type": "str" + }, + "interface": {"type": "str"}, + "metric": {"type": "int"}, + "tag": {"type": "int"}, + "track": {"type": "str"}, + "tunnel_id": {"type": "int"}, + "vrflabel": {"type": "int"}, + }, + "type": "list", + }, + }, + "type": "list", + }, + }, + "type": "list", + }, + }, + "type": "list", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "rendered", + "parsed", + ], + "default": "merged", + "type": "str", + }, + } # pylint: disable=C0301 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/acl_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/acl_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py new file mode 100644 index 00000000..924abba2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py @@ -0,0 +1,126 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr_acl_interfaces class +It is in this file where the current configuration (as dict) +is compared to the provided configuration (as dict) and the command set +necessary to bring the current configuration to it's desired end-state is +created +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.rm_templates.acl_interfaces import ( + Acl_interfacesTemplate, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + dict_merge, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.facts import ( + Facts, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.resource_module import ( + ResourceModule, +) + + +class Acl_interfaces(ResourceModule): + """ + The iosxr_acl_interfaces class + """ + + def __init__(self, module): + super(Acl_interfaces, self).__init__( + empty_fact_val={}, + facts_module=Facts(module), + module=module, + resource="acl_interfaces", + tmplt=Acl_interfacesTemplate(), + ) + + def execute_module(self): + """ Execute the module + + :rtype: A dictionary + :returns: The result from module execution + """ + if self.state not in ["parsed", "gathered"]: + self.gen_config() + self.run_commands() + return self.result + + def gen_config(self): + """ Select the appropriate function based on the state provided + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + # convert list of dicts to dicts of dicts + wantd = {entry["name"]: entry for entry in self.want} + haved = {entry["name"]: entry for entry in self.have} + + # turn all lists of dicts into dicts prior to merge + for entry in wantd, haved: + self._list_to_dict(entry) + + # if state is merged, merge want onto have and then compare + if self.state == "merged": + wantd = dict_merge(haved, wantd) + + # if state is deleted, empty out wantd and set haved to wantd + if self.state == "deleted": + haved = {k: v for k, v in haved.items() if k in wantd or not wantd} + wantd = {} + + # remove superfluous config + if self.state in ["overridden", "deleted"]: + for k, have in haved.items(): + if k not in wantd: + self._compare(want={}, have=have) + + for k, want in wantd.items(): + self._compare(want=want, have=haved.pop(k, {})) + + def _compare(self, want, have): + begin = len(self.commands) + self._compare_lists(want=want, have=have) + if len(self.commands) != begin: + self.commands.insert( + begin, self._tmplt.render(want or have, "interface", False) + ) + + def _compare_lists(self, want, have): + wdict = want.get("access_groups", {}) + hdict = have.get("access_groups", {}) + + for afi in ("ipv4", "ipv6"): + wacls = wdict.pop(afi, {}).pop("acls", {}) + hacls = hdict.pop(afi, {}).pop("acls", {}) + + for key, entry in wacls.items(): + if entry != hacls.pop(key, {}): + entry["afi"] = afi + self.addcmd(entry, "access_groups", False) + # remove remaining items in have for replaced + for entry in hacls.values(): + entry["afi"] = afi + self.addcmd(entry, "access_groups", True) + + def _list_to_dict(self, entry): + for item in entry.values(): + for ag in item.get("access_groups", []): + ag["acls"] = { + subentry["direction"]: subentry + for subentry in ag.get("acls", []) + } + item["access_groups"] = { + subentry["afi"]: subentry + for subentry in item.get("access_groups", []) + } diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/acls/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/acls/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/acls/acls.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/acls/acls.py new file mode 100644 index 00000000..c07b3b3e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/acls/acls.py @@ -0,0 +1,518 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr_acls class +It is in this file where the current configuration (as dict) +is compared to the provided configuration (as dict) and the command set +necessary to bring the current configuration to it's desired end-state is +created +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( + ConfigBase, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + flatten_dict, + prefix_to_address_wildcard, + is_ipv4_address, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, + search_obj_in_list, + dict_diff, + remove_empties, +) +from ansible.module_utils.six import iteritems +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.facts import ( + Facts, +) + + +class Acls(ConfigBase): + """ + The iosxr_acls class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["acls"] + + def __init__(self, module): + super(Acls, self).__init__(module) + + def get_acls_facts(self, data=None): + """ Get the 'facts' (the current configuration) + + :rtype: A dictionary + :returns: The current configuration as a dictionary + """ + facts, _warnings = Facts(self._module).get_facts( + self.gather_subset, self.gather_network_resources, data=data + ) + acls_facts = facts["ansible_network_resources"].get("acls") + if not acls_facts: + return [] + return acls_facts + + def execute_module(self): + """ Execute the module + + :rtype: A dictionary + :returns: The result from module execution + """ + result = {"changed": False} + warnings = list() + commands = list() + + if self.state in self.ACTION_STATES: + existing_acls_facts = self.get_acls_facts() + else: + existing_acls_facts = [] + + if self.state in self.ACTION_STATES or self.state == "rendered": + commands.extend(self.set_config(existing_acls_facts)) + + if commands and self.state in self.ACTION_STATES: + if not self._module.check_mode: + self._connection.edit_config(commands) + result["changed"] = True + + if self.state in self.ACTION_STATES: + result["commands"] = commands + + if self.state in self.ACTION_STATES or self.state == "gathered": + changed_acls_facts = self.get_acls_facts() + + elif self.state == "rendered": + result["rendered"] = commands + + elif self.state == "parsed": + running_config = self._module.params["running_config"] + if not running_config: + self._module.fail_json( + msg="value of running_config parameter must not be empty for state parsed" + ) + result["parsed"] = self.get_acls_facts(data=running_config) + + if self.state in self.ACTION_STATES: + result["before"] = existing_acls_facts + if result["changed"]: + result["after"] = changed_acls_facts + + elif self.state == "gathered": + result["gathered"] = changed_acls_facts + + result["warnings"] = warnings + return result + + def set_config(self, existing_acls_facts): + """ Collect the configuration from the args passed to the module, + collect the current configuration (as a dict from facts) + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + want = self._module.params["config"] + have = existing_acls_facts + resp = self.set_state(want, have) + return to_list(resp) + + def set_state(self, want, have): + """ Select the appropriate function based on the state provided + + :param want: the desired configuration as a dictionary + :param have: the current configuration as a dictionary + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + state = self._module.params["state"] + commands = [] + + if ( + state in ("overridden", "merged", "replaced", "rendered") + and not want + ): + self._module.fail_json( + msg="value of config parameter must not be empty for state {0}".format( + state + ) + ) + + if state == "overridden": + commands.extend(self._state_overridden(want, have)) + + elif state == "deleted": + commands.extend(self._state_deleted(want, have)) + + else: + # Instead of passing entire want and have + # list of dictionaries to the respective + # _state_* methods we are passing the want + # and have dictionaries per AFI + for item in want: + afi = item["afi"] + obj_in_have = search_obj_in_list(afi, have, key="afi") or {} + + if state == "merged" or self.state == "rendered": + commands.extend( + self._state_merged(remove_empties(item), obj_in_have) + ) + + elif state == "replaced": + commands.extend( + self._state_replaced(remove_empties(item), obj_in_have) + ) + + return commands + + def _state_replaced(self, want, have): + """ The command generator when state is replaced + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + + for want_acl in want["acls"]: + have_acl = ( + search_obj_in_list(want_acl["name"], have.get("acls", [])) + or {} + ) + acl_updates = [] + + for have_ace in have_acl.get("aces", []): + want_ace = ( + search_obj_in_list( + have_ace["sequence"], want_acl["aces"], key="sequence" + ) + or {} + ) + if not want_ace: + acl_updates.append("no {0}".format(have_ace["sequence"])) + + for want_ace in want_acl.get("aces", []): + have_ace = ( + search_obj_in_list( + want_ace.get("sequence"), + have_acl.get("aces", []), + key="sequence", + ) + or {} + ) + set_cmd = self._set_commands(want_ace, have_ace) + if set_cmd: + acl_updates.append(set_cmd) + + if acl_updates: + acl_updates.insert( + 0, + "{0} access-list {1}".format( + want["afi"], want_acl["name"] + ), + ) + commands.extend(acl_updates) + + return commands + + def _state_overridden(self, want, have): + """ The command generator when state is overridden + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + + # Remove extraneous AFI that are present in config but not + # specified in `want` + for have_afi in have: + want_afi = ( + search_obj_in_list(have_afi["afi"], want, key="afi") or {} + ) + if not want_afi: + for acl in have_afi.get("acls", []): + commands.append( + "no {0} access-list {1}".format( + have_afi["afi"], acl["name"] + ) + ) + + # First we remove the extraneous ACLs from the AFIs that + # are present both in `want` and in `have` and then + # we call `_state_replaced` to update the ACEs within those ACLs + for want_afi in want: + want_afi = remove_empties(want_afi) + have_afi = ( + search_obj_in_list(want_afi["afi"], have, key="afi") or {} + ) + if have_afi: + for have_acl in have_afi.get("acls", []): + want_acl = ( + search_obj_in_list( + have_acl["name"], want_afi.get("acls", []) + ) + or {} + ) + if not want_acl: + commands.append( + "no {0} access-list {1}".format( + have_afi["afi"], have_acl["name"] + ) + ) + + commands.extend(self._state_replaced(want_afi, have_afi)) + + return commands + + def _state_merged(self, want, have): + """ The command generator when state is merged + + :rtype: A list + :returns: the commands necessary to merge the provided into + the current configuration + """ + commands = [] + if not have: + have = {} + + for want_acl in want["acls"]: + have_acl = ( + search_obj_in_list(want_acl["name"], have.get("acls", {})) + or {} + ) + + acl_updates = [] + for want_ace in want_acl["aces"]: + have_ace = ( + search_obj_in_list( + want_ace.get("sequence"), + have_acl.get("aces", []), + key="sequence", + ) + or {} + ) + set_cmd = self._set_commands(want_ace, have_ace) + if set_cmd: + acl_updates.append(set_cmd) + + if acl_updates: + acl_updates.insert( + 0, + "{0} access-list {1}".format( + want["afi"], want_acl["name"] + ), + ) + commands.extend(acl_updates) + + return commands + + def _state_deleted(self, want, have): + """ The command generator when state is deleted + + :rtype: A list + :returns: the commands necessary to remove the current configuration + of the provided objects + """ + commands = [] + + if not want: + want = [{"afi": "ipv4"}, {"afi": "ipv6"}] + + for item in want: + item = remove_empties(item) + have_item = search_obj_in_list(item["afi"], have, key="afi") or {} + if "acls" not in item: + if have_item: + for acl in have_item["acls"]: + commands.append( + "no {0} access-list {1}".format( + have_item["afi"], acl["name"] + ) + ) + else: + for want_acl in item["acls"]: + have_acl = ( + search_obj_in_list( + want_acl["name"], have_item.get("acls", []) + ) + or {} + ) + if have_acl: + commands.append( + "no {0} access-list {1}".format( + have_item["afi"], have_acl["name"] + ) + ) + + return commands + + def _compute_commands(self, want_ace): + """This command creates an ACE line from an ACE dictionary + + :rtype: A string + :returns: An ACE generated from a structured ACE dictionary + """ + + def __compute_src_dest(dir_dict): + cmd = "" + if "any" in dir_dict: + cmd += "any " + elif "host" in dir_dict: + cmd += "host {0} ".format(dir_dict["host"]) + elif "prefix" in dir_dict: + cmd += "{0} ".format(dir_dict["prefix"]) + else: + cmd += "{0} {1} ".format( + dir_dict["address"], dir_dict["wildcard_bits"] + ) + + if "port_protocol" in dir_dict: + protocol_range = dir_dict["port_protocol"].get("range") + if protocol_range: + cmd += "range {0} {1} ".format( + protocol_range["start"], protocol_range["end"] + ) + else: + for key, value in iteritems(dir_dict["port_protocol"]): + cmd += "{0} {1} ".format(key, value) + + return cmd + + def __compute_protocol_options(protocol_dict): + cmd = "" + for value in protocol_options.values(): + for subkey, subvalue in iteritems(value): + if subvalue: + cmd += "{0} ".format(subkey.replace("_", "-")) + return cmd + + def __compute_match_options(want_ace): + cmd = "" + + if "precedence" in want_ace: + cmd += "precedence {0} ".format(want_ace["precedence"]) + + for x in ["dscp", "packet_length", "ttl"]: + if x in want_ace: + opt_range = want_ace[x].get("range") + if opt_range: + cmd += "{0} range {1} {2} ".format( + x.replace("_", "-"), + opt_range["start"], + opt_range["end"], + ) + else: + for key, value in iteritems(want_ace[x]): + cmd += "{0} {1} {2} ".format( + x.replace("_", "-"), key, value + ) + + for x in ( + "authen", + "capture", + "fragments", + "routing", + "log", + "log_input", + "icmp_off", + "destopts", + "hop_by_hop", + ): + if x in want_ace: + cmd += "{0} ".format(x.replace("_", "-")) + + return cmd + + cmd = "" + if "sequence" in want_ace: + cmd += "{0} ".format(want_ace["sequence"]) + + if "remark" in want_ace: + cmd += "remark {0}".format(want_ace["remark"]) + + elif "line" in want_ace: + cmd += want_ace["line"] + + else: + cmd += "{0} ".format(want_ace["grant"]) + if "protocol" in want_ace: + cmd += "{0} ".format(want_ace["protocol"]) + + cmd += __compute_src_dest(want_ace["source"]) + cmd += __compute_src_dest(want_ace["destination"]) + + protocol_options = want_ace.get("protocol_options", {}) + if protocol_options: + cmd += __compute_protocol_options(protocol_options) + + cmd += __compute_match_options(want_ace) + + return cmd.strip() + + def _set_commands(self, want_ace, have_ace): + """A helped method that checks if there is + a delta between the `have_ace` and `want_ace`. + If there is a delta then it calls `_compute_commands` + to create the ACE line. + + :rtype: A string + :returns: An ACE generated from a structured ACE dictionary + via a call to `_compute_commands` + """ + + if "line" in want_ace: + if want_ace["line"] != have_ace.get("line"): + return self._compute_commands(want_ace) + + else: + if ("prefix" in want_ace.get("source", {})) or ( + "prefix" in want_ace.get("destination", {}) + ): + self._prepare_for_diff(want_ace) + + protocol_opt_delta = {} + delta = dict_diff(have_ace, want_ace) + + # `dict_diff` doesn't work properly for `protocol_options` diff, + # so we need to handle it separately + if want_ace.get("protocol_options", {}): + protocol_opt_delta = set( + flatten_dict(have_ace.get("protocol_options", {})) + ) ^ set(flatten_dict(want_ace.get("protocol_options", {}))) + + if delta or protocol_opt_delta: + want_ace = self._dict_merge(have_ace, want_ace) + return self._compute_commands(want_ace) + + def _prepare_for_diff(self, ace): + """This method prepares the want ace dict + for diff calculation against the have ace dict. + + :param ace: The want ace to prepare for diff calculation + """ + # Convert prefixes to "address wildcard bits" format for IPv4 addresses + # Not valid for IPv6 addresses because those can only be specified as prefixes + # and are always rendered in running-config as prefixes too + for x in ["source", "destination"]: + prefix = ace.get(x, {}).get("prefix") + if prefix and is_ipv4_address(prefix): + del ace[x]["prefix"] + ace[x]["address"], ace[x][ + "wildcard_bits" + ] = prefix_to_address_wildcard(prefix) + + def _dict_merge(self, have_ace, want_ace): + for x in want_ace: + have_ace[x] = want_ace[x] + return have_ace diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/interfaces/interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/interfaces/interfaces.py new file mode 100644 index 00000000..ce3534b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/interfaces/interfaces.py @@ -0,0 +1,327 @@ +# -*- 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 iosxr_interfaces class +It is in this file where the current configuration (as dict) +is compared to the provided configuration (as dict) and the command set +necessary to bring the current configuration to it's desired end-state is +created +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( + ConfigBase, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.facts import ( + Facts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + get_interface_type, + dict_to_set, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + remove_command_from_config_list, + add_command_to_config_list, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + filter_dict_having_none_value, + remove_duplicate_interface, +) + + +class Interfaces(ConfigBase): + """ + The iosxr_interfaces class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["interfaces"] + + params = ("description", "mtu", "speed", "duplex") + + def __init__(self, module): + super(Interfaces, self).__init__(module) + + def get_interfaces_facts(self, data=None): + """ Get the 'facts' (the current configuration) + :rtype: A dictionary + :returns: The current configuration as a dictionary + """ + facts, _warnings = Facts(self._module).get_facts( + self.gather_subset, self.gather_network_resources, data=data + ) + interfaces_facts = facts["ansible_network_resources"].get("interfaces") + if not interfaces_facts: + return [] + return interfaces_facts + + def execute_module(self): + """ Execute the module + :rtype: A dictionary + :returns: The result from module execution + """ + result = {"changed": False} + warnings = list() + commands = list() + + if self.state in self.ACTION_STATES: + existing_interfaces_facts = self.get_interfaces_facts() + else: + existing_interfaces_facts = [] + + if self.state in self.ACTION_STATES or self.state == "rendered": + commands.extend(self.set_config(existing_interfaces_facts)) + + if commands and self.state in self.ACTION_STATES: + if not self._module.check_mode: + self._connection.edit_config(commands) + result["changed"] = True + + if self.state in self.ACTION_STATES: + result["commands"] = commands + + if self.state in self.ACTION_STATES or self.state == "gathered": + changed_interfaces_facts = self.get_interfaces_facts() + + elif self.state == "rendered": + result["rendered"] = commands + + elif self.state == "parsed": + running_config = self._module.params["running_config"] + if not running_config: + self._module.fail_json( + msg="value of running_config parameter must not be empty for state parsed" + ) + result["parsed"] = self.get_interfaces_facts(data=running_config) + + if self.state in self.ACTION_STATES: + result["before"] = existing_interfaces_facts + if result["changed"]: + result["after"] = changed_interfaces_facts + + elif self.state == "gathered": + result["gathered"] = changed_interfaces_facts + + result["warnings"] = warnings + return result + + def set_config(self, existing_interfaces_facts): + """ Collect the configuration from the args passed to the module, + collect the current configuration (as a dict from facts) + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + want = self._module.params["config"] + have = existing_interfaces_facts + resp = self.set_state(want, have) + + return to_list(resp) + + def set_state(self, want, have): + """ Select the appropriate function based on the state provided + :param want: the desired configuration as a dictionary + :param have: the current configuration as a dictionary + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + if ( + self.state in ("overridden", "merged", "replaced", "rendered") + and not want + ): + self._module.fail_json( + msg="value of config parameter must not be empty for state {0}".format( + self.state + ) + ) + + if self.state == "overridden": + commands = self._state_overridden(want, have) + elif self.state == "deleted": + commands = self._state_deleted(want, have) + elif self.state in ("merged", "rendered"): + commands = self._state_merged(want, have) + elif self.state == "replaced": + commands = self._state_replaced(want, have) + + return commands + + def _state_replaced(self, want, have): + """ The command generator when state is replaced + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + + for interface in want: + for each in have: + if ( + each["name"] == interface["name"] + or interface["name"] in each["name"] + ): + break + else: + continue + have_dict = filter_dict_having_none_value(interface, each) + want = dict() + commands.extend(self._clear_config(want, have_dict)) + commands.extend(self._set_config(interface, each)) + # Remove the duplicate interface call + commands = remove_duplicate_interface(commands) + + return commands + + def _state_overridden(self, want, have): + """ The command generator when state is overridden + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + + for each in have: + for interface in want: + if ( + each["name"] == interface["name"] + or interface["name"] in each["name"] + ): + break + else: + # We didn't find a matching desired state, which means we can + # pretend we received an empty desired state. + interface = dict(name=each["name"]) + commands.extend(self._clear_config(interface, each)) + continue + have_dict = filter_dict_having_none_value(interface, each) + want = dict() + commands.extend(self._clear_config(want, have_dict)) + commands.extend(self._set_config(interface, each)) + # Remove the duplicate interface call + commands = remove_duplicate_interface(commands) + + return commands + + def _state_merged(self, want, have): + """ The command generator when state is merged + :rtype: A list + :returns: the commands necessary to merge the provided into + the current configuration + """ + commands = [] + + for interface in want: + if self.state == "rendered": + commands.extend(self._set_config(interface, dict())) + else: + for each in have: + if ( + each["name"] == interface["name"] + or interface["name"] in each["name"] + ): + break + else: + continue + commands.extend(self._set_config(interface, each)) + + return commands + + def _state_deleted(self, want, have): + """ The command generator when state is deleted + :rtype: A list + :returns: the commands necessary to remove the current configuration + of the provided objects + """ + commands = [] + + if want: + for interface in want: + for each in have: + if ( + each["name"] == interface["name"] + or interface["name"] in each["name"] + ): + break + else: + continue + interface = dict(name=interface["name"]) + commands.extend(self._clear_config(interface, each)) + else: + for each in have: + want = dict() + commands.extend(self._clear_config(want, each)) + + return commands + + def _set_config(self, want, have): + # Set the interface config based on the want and have config + commands = [] + interface = "interface " + want["name"] + + # Get the diff b/w want and have + want_dict = dict_to_set(want) + have_dict = dict_to_set(have) + diff = want_dict - have_dict + + if diff: + diff = dict(diff) + for item in self.params: + if diff.get(item): + cmd = item + " " + str(want.get(item)) + add_command_to_config_list(interface, cmd, commands) + if diff.get("enabled"): + add_command_to_config_list(interface, "no shutdown", commands) + elif diff.get("enabled") is False: + add_command_to_config_list(interface, "shutdown", commands) + + return commands + + def _clear_config(self, want, have): + # Delete the interface config based on the want and have config + commands = [] + + if want.get("name"): + interface_type = get_interface_type(want["name"]) + interface = "interface " + want["name"] + else: + interface_type = get_interface_type(have["name"]) + interface = "interface " + have["name"] + + if have.get("description") and want.get("description") != have.get( + "description" + ): + remove_command_from_config_list(interface, "description", commands) + if not have.get("enabled") and want.get("enabled") != have.get( + "enabled" + ): + # if enable is False set enable as True which is the default behavior + remove_command_from_config_list(interface, "shutdown", commands) + + if interface_type.lower() == "gigabitethernet": + if ( + have.get("speed") + and have.get("speed") != "auto" + and want.get("speed") != have.get("speed") + ): + remove_command_from_config_list(interface, "speed", commands) + if ( + have.get("duplex") + and have.get("duplex") != "auto" + and want.get("duplex") != have.get("duplex") + ): + remove_command_from_config_list(interface, "duplex", commands) + if have.get("mtu") and want.get("mtu") != have.get("mtu"): + remove_command_from_config_list(interface, "mtu", commands) + + return commands diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/l2_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/l2_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/l2_interfaces/l2_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/l2_interfaces/l2_interfaces.py new file mode 100644 index 00000000..a5596d18 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/l2_interfaces/l2_interfaces.py @@ -0,0 +1,373 @@ +# -*- 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 iosxr_l2_interfaces class +It is in this file where the current configuration (as dict) +is compared to the provided configuration (as dict) and the command set +necessary to bring the current configuration to it's desired end-state is +created +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( + ConfigBase, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, + remove_empties, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.facts import ( + Facts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + normalize_interface, + dict_to_set, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + remove_command_from_config_list, + add_command_to_config_list, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + filter_dict_having_none_value, + remove_duplicate_interface, +) + + +class L2_Interfaces(ConfigBase): + """ + The iosxr_interfaces class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["l2_interfaces"] + + def get_l2_interfaces_facts(self, data=None): + """ Get the 'facts' (the current configuration) + :rtype: A dictionary + :returns: The current configuration as a dictionary + """ + facts, _warnings = Facts(self._module).get_facts( + self.gather_subset, self.gather_network_resources, data=data + ) + l2_interfaces_facts = facts["ansible_network_resources"].get( + "l2_interfaces" + ) + if not l2_interfaces_facts: + return [] + return l2_interfaces_facts + + def execute_module(self): + """ Execute the module + :rtype: A dictionary + :returns: The result from module execution + """ + result = {"changed": False} + warnings = list() + commands = list() + + if self.state in self.ACTION_STATES: + existing_l2_interfaces_facts = self.get_l2_interfaces_facts() + else: + existing_l2_interfaces_facts = [] + + if self.state in self.ACTION_STATES or self.state == "rendered": + commands.extend(self.set_config(existing_l2_interfaces_facts)) + + if commands and self.state in self.ACTION_STATES: + if not self._module.check_mode: + self._connection.edit_config(commands) + result["changed"] = True + + if self.state in self.ACTION_STATES: + result["commands"] = commands + + if self.state in self.ACTION_STATES or self.state == "gathered": + changed_l2_interfaces_facts = self.get_l2_interfaces_facts() + + elif self.state == "rendered": + result["rendered"] = commands + + elif self.state == "parsed": + running_config = self._module.params["running_config"] + if not running_config: + self._module.fail_json( + msg="value of running_config parameter must not be empty for state parsed" + ) + result["parsed"] = self.get_l2_interfaces_facts( + data=running_config + ) + + if self.state in self.ACTION_STATES: + result["before"] = existing_l2_interfaces_facts + if result["changed"]: + result["after"] = changed_l2_interfaces_facts + + elif self.state == "gathered": + result["gathered"] = changed_l2_interfaces_facts + + result["warnings"] = warnings + return result + + def set_config(self, existing_l2_interfaces_facts): + """ Collect the configuration from the args passed to the module, + collect the current configuration (as a dict from facts) + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + want = self._module.params["config"] + have = existing_l2_interfaces_facts + resp = self.set_state(want, have) + return to_list(resp) + + def set_state(self, want, have): + """ Select the appropriate function based on the state provided + :param want: the desired configuration as a dictionary + :param have: the current configuration as a dictionary + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + + if ( + self.state in ("overridden", "merged", "replaced", "rendered") + and not want + ): + self._module.fail_json( + msg="value of config parameter must not be empty for state {0}".format( + self.state + ) + ) + + if self.state == "overridden": + commands = self._state_overridden(want, have, self._module) + elif self.state == "deleted": + commands = self._state_deleted(want, have) + elif self.state in ("merged", "rendered"): + commands = self._state_merged(want, have, self._module) + elif self.state == "replaced": + commands = self._state_replaced(want, have, self._module) + + return commands + + def _state_replaced(self, want, have, module): + """ The command generator when state is replaced + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + for interface in want: + interface["name"] = normalize_interface(interface["name"]) + for each in have: + if ( + each["name"] == interface["name"] + or interface["name"] in each["name"] + ): + break + else: + commands.extend(self._set_config(interface, {}, module)) + continue + interface = remove_empties(interface) + have_dict = filter_dict_having_none_value(interface, each) + commands.extend(self._clear_config(dict(), have_dict)) + commands.extend(self._set_config(interface, each, module)) + # Remove the duplicate interface call + commands = remove_duplicate_interface(commands) + + return commands + + def _state_overridden(self, want, have, module): + """ The command generator when state is overridden + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + not_in_have = set() + in_have = set() + for each in have: + for interface in want: + interface["name"] = normalize_interface(interface["name"]) + if each["name"] == interface["name"]: + in_have.add(interface["name"]) + break + if interface["name"] != each["name"]: + not_in_have.add(interface["name"]) + else: + # We didn't find a matching desired state, which means we can + # pretend we received an empty desired state. + interface = dict(name=each["name"]) + commands.extend(self._clear_config(interface, each)) + continue + interface = remove_empties(interface) + have_dict = filter_dict_having_none_value(interface, each) + commands.extend(self._clear_config(dict(), have_dict)) + commands.extend(self._set_config(interface, each, module)) + # Add the want interface that's not already configured in have interface + for each in not_in_have - in_have: + for every in want: + interface = "interface {0}".format(every["name"]) + if each and interface not in commands: + commands.extend(self._set_config(every, {}, module)) + + # Remove the duplicate interface call + commands = remove_duplicate_interface(commands) + + return commands + + def _state_merged(self, want, have, module): + """ The command generator when state is merged + :rtype: A list + :returns: the commands necessary to merge the provided into + the current configuration + """ + commands = [] + + for interface in want: + interface["name"] = normalize_interface(interface["name"]) + interface = remove_empties(interface) + for each in have: + if ( + each["name"] == interface["name"] + or interface["name"] in each["name"] + ): + break + else: + commands.extend(self._set_config(interface, {}, module)) + continue + commands.extend(self._set_config(interface, each, module)) + + return commands + + def _state_deleted(self, want, have): + """ The command generator when state is deleted + :rtype: A list + :returns: the commands necessary to remove the current configuration + of the provided objects + """ + commands = [] + + if want: + for interface in want: + interface["name"] = normalize_interface(interface["name"]) + for each in have: + if ( + each["name"] == interface["name"] + or interface["name"] in each["name"] + ): + break + else: + continue + interface = dict(name=interface["name"]) + commands.extend(self._clear_config(interface, each)) + else: + for each in have: + want = dict() + commands.extend(self._clear_config(want, each)) + + return commands + + def _set_config(self, want, have, module): + # Set the interface config based on the want and have config + commands = [] + interface = "interface " + want["name"] + l2_protocol_bool = False + # Get the diff b/w want and have + want_dict = dict_to_set(want) + have_dict = dict_to_set(have) + diff = want_dict - have_dict + + if diff: + # For merging with already configured l2protocol + if have.get("l2protocol") and len(have.get("l2protocol")) > 1: + l2_protocol_diff = [] + for each in want.get("l2protocol"): + for every in have.get("l2protocol"): + if every == each: + break + if each not in have.get("l2protocol"): + l2_protocol_diff.append(each) + l2_protocol_bool = True + l2protocol = tuple(l2_protocol_diff) + else: + l2protocol = {} + + diff = dict(diff) + wants_native = diff.get("native_vlan") + l2transport = diff.get("l2transport") + q_vlan = diff.get("q_vlan") + propagate = diff.get("propagate") + if l2_protocol_bool is False: + l2protocol = diff.get("l2protocol") + + if wants_native: + cmd = "dot1q native vlan {0}".format(wants_native) + add_command_to_config_list(interface, cmd, commands) + + if l2transport or l2protocol: + for each in l2protocol: + each = dict(each) + if isinstance(each, dict): + cmd = "l2transport l2protocol {0} {1}".format( + list(each.keys())[0], list(each.values())[0] + ) + add_command_to_config_list(interface, cmd, commands) + if propagate and not have.get("propagate"): + cmd = "l2transport propagate remote-status" + add_command_to_config_list(interface, cmd, commands) + elif want.get("l2transport") is False and ( + want.get("l2protocol") or want.get("propagate") + ): + module.fail_json( + msg="L2transport L2protocol or Propagate can only be configured when " + "L2transport set to True!" + ) + + if q_vlan and "." in interface: + q_vlans = " ".join(map(str, want.get("q_vlan"))) + if q_vlans != have.get("q_vlan"): + cmd = "dot1q vlan {0}".format(q_vlans) + add_command_to_config_list(interface, cmd, commands) + + return commands + + def _clear_config(self, want, have): + # Delete the interface config based on the want and have config + commands = [] + + if want.get("name"): + interface = "interface " + want["name"] + else: + interface = "interface " + have["name"] + if have.get("native_vlan"): + remove_command_from_config_list( + interface, "dot1q native vlan", commands + ) + + if have.get("q_vlan"): + remove_command_from_config_list( + interface, "encapsulation dot1q", commands + ) + + if have.get("l2protocol") and ( + want.get("l2protocol") is None or want.get("propagate") is None + ): + if "no l2transport" not in commands: + remove_command_from_config_list( + interface, "l2transport", commands + ) + elif have.get("l2transport") and have.get("l2transport") != want.get( + "l2transport" + ): + if "no l2transport" not in commands: + remove_command_from_config_list( + interface, "l2transport", commands + ) + return commands diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/l3_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/l3_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/l3_interfaces/l3_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/l3_interfaces/l3_interfaces.py new file mode 100644 index 00000000..47949a77 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/l3_interfaces/l3_interfaces.py @@ -0,0 +1,397 @@ +# -*- 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 iosxr_l3_interfaces class +It is in this file where the current configuration (as dict) +is compared to the provided configuration (as dict) and the command set +necessary to bring the current configuration to it's desired end-state is +created +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( + ConfigBase, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.facts import ( + Facts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + normalize_interface, + dict_to_set, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + remove_command_from_config_list, + add_command_to_config_list, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + filter_dict_having_none_value, + remove_duplicate_interface, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + validate_n_expand_ipv4, + validate_ipv6, +) + + +class L3_Interfaces(ConfigBase): + """ + The iosxr_l3_interfaces class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["l3_interfaces"] + + def get_l3_interfaces_facts(self, data=None): + """ Get the 'facts' (the current configuration) + :rtype: A dictionary + :returns: The current configuration as a dictionary + """ + facts, _warnings = Facts(self._module).get_facts( + self.gather_subset, self.gather_network_resources, data=data + ) + l3_interfaces_facts = facts["ansible_network_resources"].get( + "l3_interfaces" + ) + if not l3_interfaces_facts: + return [] + return l3_interfaces_facts + + def execute_module(self): + """ Execute the module + :rtype: A dictionary + :returns: The result from module execution + """ + result = {"changed": False} + warnings = list() + commands = list() + + if self.state in self.ACTION_STATES: + existing_l3_interfaces_facts = self.get_l3_interfaces_facts() + else: + existing_l3_interfaces_facts = [] + + if self.state in self.ACTION_STATES or self.state == "rendered": + commands.extend(self.set_config(existing_l3_interfaces_facts)) + + if commands and self.state in self.ACTION_STATES: + if not self._module.check_mode: + self._connection.edit_config(commands) + result["changed"] = True + + if self.state in self.ACTION_STATES: + result["commands"] = commands + + if self.state in self.ACTION_STATES or self.state == "gathered": + changed_l3_interfaces_facts = self.get_l3_interfaces_facts() + + elif self.state == "rendered": + result["rendered"] = commands + + elif self.state == "parsed": + running_config = self._module.params["running_config"] + if not running_config: + self._module.fail_json( + msg="value of running_config parameter must not be empty for state parsed" + ) + result["parsed"] = self.get_l3_interfaces_facts( + data=running_config + ) + + if self.state in self.ACTION_STATES: + result["before"] = existing_l3_interfaces_facts + if result["changed"]: + result["after"] = changed_l3_interfaces_facts + + elif self.state == "gathered": + result["gathered"] = changed_l3_interfaces_facts + + result["warnings"] = warnings + return result + + def set_config(self, existing_l3_interfaces_facts): + """ Collect the configuration from the args passed to the module, + collect the current configuration (as a dict from facts) + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + want = self._module.params["config"] + have = existing_l3_interfaces_facts + resp = self.set_state(want, have) + return to_list(resp) + + def set_state(self, want, have): + """ Select the appropriate function based on the state provided + :param want: the desired configuration as a dictionary + :param have: the current configuration as a dictionary + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + + if ( + self.state in ("overridden", "merged", "replaced", "rendered") + and not want + ): + self._module.fail_json( + msg="value of config parameter must not be empty for state {0}".format( + self.state + ) + ) + + if self.state == "overridden": + commands = self._state_overridden(want, have, self._module) + elif self.state == "deleted": + commands = self._state_deleted(want, have) + elif self.state in ("merged", "rendered"): + commands = self._state_merged(want, have, self._module) + elif self.state == "replaced": + commands = self._state_replaced(want, have, self._module) + + return commands + + def _state_replaced(self, want, have, module): + """ The command generator when state is replaced + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + + for interface in want: + interface["name"] = normalize_interface(interface["name"]) + for each in have: + if each["name"] == interface["name"]: + break + else: + commands.extend(self._set_config(interface, dict(), module)) + continue + have_dict = filter_dict_having_none_value(interface, each) + commands.extend(self._clear_config(dict(), have_dict)) + commands.extend(self._set_config(interface, each, module)) + # Remove the duplicate interface call + commands = remove_duplicate_interface(commands) + + return commands + + def _state_overridden(self, want, have, module): + """ The command generator when state is overridden + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + not_in_have = set() + in_have = set() + + for each in have: + for interface in want: + interface["name"] = normalize_interface(interface["name"]) + if each["name"] == interface["name"]: + in_have.add(interface["name"]) + break + if interface["name"] != each["name"]: + not_in_have.add(interface["name"]) + else: + # We didn't find a matching desired state, which means we can + # pretend we received an empty desired state. + interface = dict(name=each["name"]) + kwargs = {"want": interface, "have": each} + commands.extend(self._clear_config(**kwargs)) + continue + have_dict = filter_dict_having_none_value(interface, each) + commands.extend(self._clear_config(dict(), have_dict)) + commands.extend(self._set_config(interface, each, module)) + # Add the want interface that's not already configured in have interface + for each in not_in_have - in_have: + for every in want: + interface = "interface {0}".format(every["name"]) + if each and interface not in commands: + commands.extend(self._set_config(every, {}, module)) + # Remove the duplicate interface call + commands = remove_duplicate_interface(commands) + + return commands + + def _state_merged(self, want, have, module): + """ The command generator when state is merged + :rtype: A list + :returns: the commands necessary to merge the provided into + the current configuration + """ + commands = [] + + for interface in want: + interface["name"] = normalize_interface(interface["name"]) + if self.state == "rendered": + commands.extend(self._set_config(interface, dict(), module)) + else: + for each in have: + if each["name"] == interface["name"]: + break + else: + commands.extend( + self._set_config(interface, dict(), module) + ) + continue + commands.extend(self._set_config(interface, each, module)) + + return commands + + def _state_deleted(self, want, have): + """ The command generator when state is deleted + :rtype: A list + :returns: the commands necessary to remove the current configuration + of the provided objects + """ + commands = [] + + if want: + for interface in want: + interface["name"] = normalize_interface(interface["name"]) + for each in have: + if ( + each["name"] == interface["name"] + or interface["name"] in each["name"] + ): + break + else: + continue + interface = dict(name=interface["name"]) + commands.extend(self._clear_config(interface, each)) + else: + for each in have: + want = dict() + commands.extend(self._clear_config(want, each)) + + return commands + + def verify_diff_again(self, want, have): + """ + Verify the IPV4 difference again as sometimes due to + change in order of set, set difference may result into change, + when there's actually no difference between want and have + :param want: want_dict IPV4 + :param have: have_dict IPV4 + :return: diff + """ + diff = False + for each in want: + each_want = dict(each) + for every in have: + every_have = dict(every) + + if each_want.get("address") == every_have.get("address"): + if len(each_want.keys()) == len(every_have.keys()) and ( + each_want.get("secondary") + == every_have.get("secondary") + ): + diff = False + break + if not each_want.get("secondary") and not every_have.get( + "secondary" + ): + diff = False + break + + diff = True + else: + diff = True + if diff: + break + + return diff + + def _set_config(self, want, have, module): + # Set the interface config based on the want and have config + commands = [] + interface = "interface " + want["name"] + + # To handle L3 IPV4 configuration + if want.get("ipv4"): + for each in want.get("ipv4"): + if each.get("address") != "dhcp": + ip_addr_want = validate_n_expand_ipv4(module, each) + each["address"] = ip_addr_want + + # Get the diff b/w want and have + want_dict = dict_to_set(want) + have_dict = dict_to_set(have) + + # To handle L3 IPV4 configuration + want_ipv4 = dict(want_dict).get("ipv4") + have_ipv4 = dict(have_dict).get("ipv4") + if want_ipv4: + if have_ipv4: + diff_ipv4 = set(want_ipv4) - set(dict(have_dict).get("ipv4")) + if diff_ipv4: + diff_ipv4 = ( + diff_ipv4 + if self.verify_diff_again(want_ipv4, have_ipv4) + else () + ) + else: + diff_ipv4 = set(want_ipv4) + for each in diff_ipv4: + ipv4_dict = dict(each) + if ipv4_dict.get("address") != "dhcp": + cmd = "ipv4 address {0}".format(ipv4_dict["address"]) + if ipv4_dict.get("secondary"): + cmd += " secondary" + add_command_to_config_list(interface, cmd, commands) + + # To handle L3 IPV6 configuration + want_ipv6 = dict(want_dict).get("ipv6") + have_ipv6 = dict(have_dict).get("ipv6") + if want_ipv6: + if have_ipv6: + diff_ipv6 = set(want_ipv6) - set(have_ipv6) + else: + diff_ipv6 = set(want_ipv6) + for each in diff_ipv6: + ipv6_dict = dict(each) + validate_ipv6(ipv6_dict.get("address"), module) + cmd = "ipv6 address {0}".format(ipv6_dict.get("address")) + add_command_to_config_list(interface, cmd, commands) + + return commands + + def _clear_config(self, want, have): + # Delete the interface config based on the want and have config + count = 0 + commands = [] + if want.get("name"): + interface = "interface " + want["name"] + else: + interface = "interface " + have["name"] + + if have.get("ipv4") and want.get("ipv4"): + for each in have.get("ipv4"): + if each.get("secondary") and not ( + want.get("ipv4")[count].get("secondary") + ): + cmd = "ipv4 address {0} secondary".format( + each.get("address") + ) + remove_command_from_config_list(interface, cmd, commands) + count += 1 + if have.get("ipv4") and not (want.get("ipv4")): + remove_command_from_config_list( + interface, "ipv4 address", commands + ) + if have.get("ipv6") and not (want.get("ipv6")): + remove_command_from_config_list( + interface, "ipv6 address", commands + ) + + return commands diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lacp/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lacp/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lacp/lacp.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lacp/lacp.py new file mode 100644 index 00000000..1c5d53f2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lacp/lacp.py @@ -0,0 +1,213 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr_lacp class +It is in this file where the current configuration (as dict) +is compared to the provided configuration (as dict) and the command set +necessary to bring the current configuration to it's desired end-state is +created +""" + + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( + ConfigBase, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.facts import ( + Facts, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + dict_diff, +) +from ansible.module_utils.six import iteritems +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + remove_empties, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + flatten_dict, +) + + +class Lacp(ConfigBase): + """ + The iosxr_lacp class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["lacp"] + + def __init__(self, module): + super(Lacp, self).__init__(module) + + def get_lacp_facts(self, data=None): + """ Get the 'facts' (the current configuration) + + :rtype: A dictionary + :returns: The current configuration as a dictionary + """ + facts, _warnings = Facts(self._module).get_facts( + self.gather_subset, self.gather_network_resources, data=data + ) + lacp_facts = facts["ansible_network_resources"].get("lacp") + if not lacp_facts: + return {} + return lacp_facts + + def execute_module(self): + """ Execute the module + + :rtype: A dictionary + :returns: The result from module execution + """ + result = {"changed": False} + warnings = list() + commands = list() + + if self.state in self.ACTION_STATES: + existing_lacp_facts = self.get_lacp_facts() + else: + existing_lacp_facts = {} + + if self.state in self.ACTION_STATES or self.state == "rendered": + commands.extend(self.set_config(existing_lacp_facts)) + + if commands and self.state in self.ACTION_STATES: + if not self._module.check_mode: + self._connection.edit_config(commands) + result["changed"] = True + + if self.state in self.ACTION_STATES: + result["commands"] = commands + + if self.state in self.ACTION_STATES or self.state == "gathered": + changed_lacp_facts = self.get_lacp_facts() + + elif self.state == "rendered": + result["rendered"] = commands + + elif self.state == "parsed": + running_config = self._module.params["running_config"] + if not running_config: + self._module.fail_json( + msg="value of running_config parameter must not be empty for state parsed" + ) + result["parsed"] = self.get_lacp_facts(data=running_config) + + if self.state in self.ACTION_STATES: + result["before"] = existing_lacp_facts + if result["changed"]: + result["after"] = changed_lacp_facts + + elif self.state == "gathered": + result["gathered"] = changed_lacp_facts + + result["warnings"] = warnings + return result + + def set_config(self, existing_lacp_facts): + """ Collect the configuration from the args passed to the module, + collect the current configuration (as a dict from facts) + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + want = self._module.params.get("config") + if not want: + want = {} + have = existing_lacp_facts + resp = self.set_state(want, have) + return to_list(resp) + + def set_state(self, want, have): + """ Select the appropriate function based on the state provided + + :param want: the desired configuration as a dictionary + :param have: the current configuration as a dictionary + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + if self.state in ("merged", "replaced", "rendered") and not want: + self._module.fail_json( + msg="value of config parameter must not be empty for state {0}".format( + self.state + ) + ) + + if self.state == "deleted": + commands = self._state_deleted(want, have) + elif self.state in ("merged", "rendered"): + commands = self._state_merged(want, have) + elif self.state == "replaced": + commands = self._state_replaced(want, have) + + return commands + + def _state_replaced(self, want, have): + """ The command generator when state is replaced + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + + commands.extend(self._state_deleted(want, have)) + + commands.extend(self._state_merged(want, have)) + + return commands + + def _state_merged(self, want, have): + """ The command generator when state is merged + + :rtype: A list + :returns: the commands necessary to merge the provided into + the current configuration + """ + commands = [] + + updates = dict_diff(have, want) + if self.state == "rendered": + updates = want + if updates: + for key, value in iteritems( + flatten_dict(remove_empties(updates["system"])) + ): + commands.append( + "lacp system {0} {1}".format( + key.replace("address", "mac"), value + ) + ) + + return commands + + def _state_deleted(self, want, have): + """ The command generator when state is deleted + + :rtype: A list + :returns: the commands necessary to remove the current configuration + of the provided objects + """ + commands = [] + + for x in [ + k + for k in have.get("system", {}) + if k not in remove_empties(want.get("system", {})) + ]: + commands.append("no lacp system {0}".format(x)) + + return commands diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lacp_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lacp_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lacp_interfaces/lacp_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lacp_interfaces/lacp_interfaces.py new file mode 100644 index 00000000..83c1ee9d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lacp_interfaces/lacp_interfaces.py @@ -0,0 +1,312 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr_lacp_interfaces class +It is in this file where the current configuration (as dict) +is compared to the provided configuration (as dict) and the command set +necessary to bring the current configuration to it's desired end-state is +created +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( + ConfigBase, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.facts import ( + Facts, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + dict_diff, + remove_empties, +) +from ansible.module_utils.six import iteritems +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + search_obj_in_list, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + dict_delete, + pad_commands, + flatten_dict, +) + + +class Lacp_interfaces(ConfigBase): + """ + The iosxr_lacp_interfaces class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["lacp_interfaces"] + + def __init__(self, module): + super(Lacp_interfaces, self).__init__(module) + + def get_lacp_interfaces_facts(self, data=None): + """ Get the 'facts' (the current configuration) + + :rtype: A dictionary + :returns: The current configuration as a dictionary + """ + facts, _warnings = Facts(self._module).get_facts( + self.gather_subset, self.gather_network_resources, data=data + ) + lacp_interfaces_facts = facts["ansible_network_resources"].get( + "lacp_interfaces" + ) + if not lacp_interfaces_facts: + return [] + return lacp_interfaces_facts + + def execute_module(self): + """ Execute the module + + :rtype: A dictionary + :returns: The result from module execution + """ + result = {"changed": False} + commands = list() + warnings = list() + + if self.state in self.ACTION_STATES: + existing_lacp_interfaces_facts = self.get_lacp_interfaces_facts() + else: + existing_lacp_interfaces_facts = [] + + if self.state in self.ACTION_STATES or self.state == "rendered": + commands.extend(self.set_config(existing_lacp_interfaces_facts)) + + if commands and self.state in self.ACTION_STATES: + if not self._module.check_mode: + self._connection.edit_config(commands) + result["changed"] = True + + if self.state in self.ACTION_STATES: + result["commands"] = commands + + if self.state in self.ACTION_STATES or self.state == "gathered": + changed_lacp_interfaces_facts = self.get_lacp_interfaces_facts() + + elif self.state == "rendered": + result["rendered"] = commands + + elif self.state == "parsed": + running_config = self._module.params["running_config"] + if not running_config: + self._module.fail_json( + msg="value of running_config parameter must not be empty for state parsed" + ) + result["parsed"] = self.get_lacp_interfaces_facts( + data=running_config + ) + + if self.state in self.ACTION_STATES: + result["before"] = existing_lacp_interfaces_facts + if result["changed"]: + result["after"] = changed_lacp_interfaces_facts + elif self.state == "gathered": + result["gathered"] = changed_lacp_interfaces_facts + + result["warnings"] = warnings + return result + + def set_config(self, existing_lacp_interfaces_facts): + """ Collect the configuration from the args passed to the module, + collect the current configuration (as a dict from facts) + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + want = self._module.params["config"] + have = existing_lacp_interfaces_facts + resp = self.set_state(want, have) + return to_list(resp) + + def set_state(self, want, have): + """ Select the appropriate function based on the state provided + + :param want: the desired configuration as a dictionary + :param have: the current configuration as a dictionary + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + state = self._module.params["state"] + + if ( + state in ("overridden", "merged", "replaced", "rendered") + and not want + ): + self._module.fail_json( + msg="value of config parameter must not be empty for state {0}".format( + state + ) + ) + + if state == "overridden": + commands.extend(Lacp_interfaces._state_overridden(want, have)) + + elif state == "deleted": + if not want: + for intf in have: + commands.extend( + Lacp_interfaces._state_deleted( + {"name": intf["name"]}, intf + ) + ) + else: + for item in want: + obj_in_have = search_obj_in_list(item["name"], have) + commands.extend( + Lacp_interfaces._state_deleted(item, obj_in_have) + ) + + else: + for item in want: + name = item["name"] + obj_in_have = search_obj_in_list(name, have) + + if state in ("merged", "rendered"): + commands.extend( + Lacp_interfaces._state_merged(item, obj_in_have) + ) + + elif state == "replaced": + commands.extend( + Lacp_interfaces._state_replaced(item, obj_in_have) + ) + + return commands + + @staticmethod + def _state_replaced(want, have): + """ The command generator when state is replaced + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + replaced_commands = [] + merged_commands = [] + + if have: + replaced_commands = Lacp_interfaces._state_deleted(want, have) + + merged_commands = Lacp_interfaces._state_merged(want, have) + + if merged_commands and replaced_commands: + del merged_commands[0] + + commands.extend(replaced_commands) + commands.extend(merged_commands) + + return commands + + @staticmethod + def _state_overridden(want, have): + """ The command generator when state is overridden + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + for intf in have: + intf_in_want = search_obj_in_list(intf["name"], want) + if not intf_in_want: + commands.extend( + Lacp_interfaces._state_deleted( + {"name": intf["name"]}, intf + ) + ) + + for intf in want: + intf_in_have = search_obj_in_list(intf["name"], have) + commands.extend( + Lacp_interfaces._state_replaced(intf, intf_in_have) + ) + + return commands + + @staticmethod + def _state_merged(want, have): + """ The command generator when state is merged + + :rtype: A list + :returns: the commands necessary to merge the provided into + the current configuration + """ + commands = [] + + if not have: + have = {"name": want["name"]} + + for key, value in iteritems( + flatten_dict(remove_empties(dict_diff(have, want))) + ): + commands.append(Lacp_interfaces._compute_commands(key, value)) + + if commands: + pad_commands(commands, want["name"]) + + return commands + + @staticmethod + def _state_deleted(want, have): + """ The command generator when state is deleted + + :rtype: A list + :returns: the commands necessary to remove the current configuration + of the provided objects + """ + commands = [] + + for key, value in iteritems( + flatten_dict(dict_delete(have, remove_empties(want))) + ): + commands.append( + Lacp_interfaces._compute_commands(key, value, remove=True) + ) + + if commands: + pad_commands(commands, have["name"]) + + return commands + + @staticmethod + def _compute_commands(key, value, remove=False): + if key == "churn_logging": + cmd = "lacp churn logging {0}".format(value) + + elif key == "collector_max_delay": + cmd = "lacp collector-max-delay {0}".format(value) + + elif key == "period": + cmd = "lacp period {0}".format(value) + + elif key == "switchover_suppress_flaps": + cmd = "lacp switchover suppress-flaps {0}".format(value) + + elif key == "mac": + cmd = "lacp system mac {0}".format(value) + + elif key == "priority": + cmd = "lacp system priority {0}".format(value) + + if remove: + cmd = "no " + cmd + + return cmd diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lag_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lag_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lag_interfaces/lag_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lag_interfaces/lag_interfaces.py new file mode 100644 index 00000000..a877341b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lag_interfaces/lag_interfaces.py @@ -0,0 +1,439 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr_lag_interfaces class +It is in this file where the current configuration (as dict) +is compared to the provided configuration (as dict) and the command set +necessary to bring the current configuration to it's desired end-state is +created +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from copy import deepcopy +from ansible.module_utils.six import iteritems +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( + ConfigBase, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.facts import ( + Facts, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, + dict_diff, + remove_empties, + search_obj_in_list, + param_list_to_dict, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + diff_list_of_dicts, + pad_commands, + flatten_dict, + dict_delete, + normalize_interface, +) + + +class Lag_interfaces(ConfigBase): + """ + The iosxr_lag_interfaces class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["lag_interfaces"] + + def __init__(self, module): + super(Lag_interfaces, self).__init__(module) + + def get_lag_interfaces_facts(self, data=None): + """ Get the 'facts' (the current configuration) + + :rtype: A dictionary + :returns: The current configuration as a dictionary + """ + facts, _warnings = Facts(self._module).get_facts( + self.gather_subset, self.gather_network_resources, data=data + ) + lag_interfaces_facts = facts["ansible_network_resources"].get( + "lag_interfaces" + ) + if not lag_interfaces_facts: + return [] + return lag_interfaces_facts + + def execute_module(self): + """ Execute the module + + :rtype: A dictionary + :returns: The result from module execution + """ + result = {"changed": False} + warnings = list() + commands = list() + + if self.state in self.ACTION_STATES: + existing_lag_interfaces_facts = self.get_lag_interfaces_facts() + else: + existing_lag_interfaces_facts = {} + + if self.state in self.ACTION_STATES or self.state == "rendered": + commands.extend(self.set_config(existing_lag_interfaces_facts)) + + if commands and self.state in self.ACTION_STATES: + if not self._module.check_mode: + self._connection.edit_config(commands) + result["changed"] = True + + if self.state in self.ACTION_STATES: + result["commands"] = commands + + if self.state in self.ACTION_STATES or self.state == "gathered": + changed_lag_interfaces_facts = self.get_lag_interfaces_facts() + + elif self.state == "rendered": + result["rendered"] = commands + + elif self.state == "parsed": + running_config = self._module.params["running_config"] + if not running_config: + self._module.fail_json( + msg="value of running_config parameter must not be empty for state parsed" + ) + result["parsed"] = self.get_lag_interfaces_facts( + data=running_config + ) + + if self.state in self.ACTION_STATES: + result["before"] = existing_lag_interfaces_facts + if result["changed"]: + result["after"] = changed_lag_interfaces_facts + + elif self.state == "gathered": + result["gathered"] = changed_lag_interfaces_facts + + result["warnings"] = warnings + return result + + def set_config(self, existing_lag_interfaces_facts): + """ Collect the configuration from the args passed to the module, + collect the current configuration (as a dict from facts) + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + want = self._module.params["config"] + if want: + for item in want: + item["name"] = normalize_interface(item["name"]) + if "members" in want and want["members"]: + for item in want["members"]: + item.update( + { + "member": normalize_interface(item["member"]), + "mode": item["mode"], + } + ) + have = existing_lag_interfaces_facts + resp = self.set_state(want, have) + return to_list(resp) + + def set_state(self, want, have): + """ Select the appropriate function based on the state provided + + :param want: the desired configuration as a dictionary + :param have: the current configuration as a dictionary + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + state = self._module.params["state"] + commands = [] + + if ( + self.state in ("merged", "replaced", "overridden", "rendered") + and not want + ): + self._module.fail_json( + msg="value of config parameter must not be empty for state {0}".format( + state + ) + ) + + if state == "overridden": + commands.extend(self._state_overridden(want, have)) + + elif state == "deleted": + commands.extend(self._state_deleted(want, have)) + + else: + # Instead of passing entire want and have + # list of dictionaries to the respective + # _state_* methods we are passing the want + # and have dictionaries per interface + for item in want: + name = item["name"] + obj_in_have = search_obj_in_list(name, have) + + if state in ("merged", "rendered"): + commands.extend(self._state_merged(item, obj_in_have)) + + elif state == "replaced": + commands.extend(self._state_replaced(item, obj_in_have)) + + return commands + + def _state_replaced(self, want, have): + """ The command generator when state is replaced + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + if have: + commands.extend(self._render_bundle_del_commands(want, have)) + commands.extend(self._render_bundle_updates(want, have)) + + if commands or have == {}: + pad_commands(commands, want["name"]) + + if have: + commands.extend(self._render_interface_del_commands(want, have)) + commands.extend(self._render_interface_updates(want, have)) + + return commands + + def _state_overridden(self, want, have): + """ The command generator when state is overridden + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + for have_intf in have: + intf_in_want = search_obj_in_list(have_intf["name"], want) + if not intf_in_want: + commands.extend(self._purge_attribs(have_intf)) + + for intf in want: + intf_in_have = search_obj_in_list(intf["name"], have) + commands.extend(self._state_replaced(intf, intf_in_have)) + + return commands + + def _state_merged(self, want, have): + """ The command generator when state is merged + + :rtype: A list + :returns: the commands necessary to merge the provided into + the current configuration + """ + commands = [] + commands.extend(self._render_bundle_updates(want, have)) + + if commands or have == {}: + pad_commands(commands, want["name"]) + + commands.extend(self._render_interface_updates(want, have)) + + return commands + + def _state_deleted(self, want, have): + """ The command generator when state is deleted + + :rtype: A list + :returns: the commands necessary to remove the current configuration + of the provided objects + """ + commands = [] + + if not want: + for item in have: + commands.extend(self._purge_attribs(intf=item)) + else: + for item in want: + name = item["name"] + obj_in_have = search_obj_in_list(name, have) + if not obj_in_have: + self._module.fail_json( + msg=("interface {0} does not exist".format(name)) + ) + commands.extend(self._purge_attribs(intf=obj_in_have)) + + return commands + + def _render_bundle_updates(self, want, have): + """ The command generator for updates to bundles + :rtype: A list + :returns: the commands necessary to update bundles + """ + commands = [] + if not have: + have = {"name": want["name"]} + + want_copy = deepcopy(want) + have_copy = deepcopy(have) + + want_copy.pop("members", []) + have_copy.pop("members", []) + + bundle_updates = dict_diff(have_copy, want_copy) + + if bundle_updates: + for key, value in iteritems( + flatten_dict(remove_empties(bundle_updates)) + ): + commands.append(self._compute_commands(key=key, value=value)) + + return commands + + def _render_interface_updates(self, want, have): + """ The command generator for updates to member + interfaces + :rtype: A list + :returns: the commands necessary to update member + interfaces + """ + commands = [] + + if not have: + have = {"name": want["name"]} + + member_diff = diff_list_of_dicts( + want["members"], have.get("members", []) + ) + + for diff in member_diff: + diff_cmd = [] + bundle_cmd = "bundle id {0}".format( + want["name"].split("Bundle-Ether")[1] + ) + if diff.get("mode"): + bundle_cmd += " mode {0}".format(diff.get("mode")) + diff_cmd.append(bundle_cmd) + pad_commands(diff_cmd, diff["member"]) + commands.extend(diff_cmd) + + return commands + + def _render_bundle_del_commands(self, want, have): + """ The command generator for delete commands + w.r.t bundles + :rtype: A list + :returns: the commands necessary to update member + interfaces + """ + commands = [] + if not want: + want = {"name": have["name"]} + + want_copy = deepcopy(want) + have_copy = deepcopy(have) + want_copy.pop("members", []) + have_copy.pop("members", []) + + to_delete = dict_delete(have_copy, remove_empties(want_copy)) + if to_delete: + for key, value in iteritems( + flatten_dict(remove_empties(to_delete)) + ): + commands.append( + self._compute_commands(key=key, value=value, remove=True) + ) + + return commands + + def _render_interface_del_commands(self, want, have): + """ The command generator for delete commands + w.r.t member interfaces + :rtype: A list + :returns: the commands necessary to update member + interfaces + """ + commands = [] + if not want: + want = {} + have_members = have.get("members") + + if have_members: + have_members = param_list_to_dict( + deepcopy(have_members), unique_key="member" + ) + want_members = param_list_to_dict( + deepcopy(want).get("members", []), unique_key="member" + ) + + for key in have_members: + if key not in want_members: + member_cmd = ["no bundle id"] + pad_commands(member_cmd, key) + commands.extend(member_cmd) + + return commands + + def _purge_attribs(self, intf): + """ The command generator for purging attributes + :rtype: A list + :returns: the commands necessary to purge attributes + """ + commands = [] + have_copy = deepcopy(intf) + members = have_copy.pop("members", []) + + to_delete = dict_delete( + have_copy, remove_empties({"name": have_copy["name"]}) + ) + if to_delete: + for key, value in iteritems( + flatten_dict(remove_empties(to_delete)) + ): + commands.append( + self._compute_commands(key=key, value=value, remove=True) + ) + + if commands: + pad_commands(commands, intf["name"]) + + if members: + members = param_list_to_dict( + deepcopy(members), unique_key="member" + ) + for key in members: + member_cmd = ["no bundle id"] + pad_commands(member_cmd, key) + commands.extend(member_cmd) + + return commands + + def _compute_commands(self, key, value, remove=False): + """ The method generates LAG commands based on the + key, value passed. When remove is set to True, + the command is negated. + :rtype: str + :returns: a command based on the `key`, `value` pair + passed and the value of `remove` + """ + if key == "mode": + cmd = "lacp mode {0}".format(value) + + elif key == "load_balancing_hash": + cmd = "bundle load-balancing hash {0}".format(value) + + elif key == "max_active": + cmd = "bundle maximum-active links {0}".format(value) + + elif key == "min_active": + cmd = "bundle minimum-active links {0}".format(value) + + if remove: + cmd = "no {0}".format(cmd) + + return cmd diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lldp_global/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lldp_global/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lldp_global/lldp_global.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lldp_global/lldp_global.py new file mode 100644 index 00000000..af15f791 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lldp_global/lldp_global.py @@ -0,0 +1,221 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr_lldp_global class +It is in this file where the current configuration (as dict) +is compared to the provided configuration (as dict) and the command set +necessary to bring the current configuration to it's desired end-state is +created +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( + ConfigBase, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, + dict_diff, + remove_empties, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.facts import ( + Facts, +) +from ansible.module_utils.six import iteritems +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + flatten_dict, + dict_delete, +) + + +class Lldp_global(ConfigBase): + """ + The iosxr_lldp class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["lldp_global"] + + def __init__(self, module): + super(Lldp_global, self).__init__(module) + + def get_lldp_global_facts(self, data=None): + """ Get the 'facts' (the current configuration) + + :rtype: A dictionary + :returns: The current configuration as a dictionary + """ + facts, _warnings = Facts(self._module).get_facts( + self.gather_subset, self.gather_network_resources, data=data + ) + lldp_facts = facts["ansible_network_resources"].get("lldp_global") + if not lldp_facts: + return {} + return lldp_facts + + def execute_module(self): + """ Execute the module + + :rtype: A dictionary + :returns: The result from module execution + """ + result = {"changed": False} + warnings = list() + commands = list() + if self.state in self.ACTION_STATES: + existing_lldp_global_facts = self.get_lldp_global_facts() + else: + existing_lldp_global_facts = {} + + if self.state in self.ACTION_STATES or self.state == "rendered": + commands.extend(self.set_config(existing_lldp_global_facts)) + + if commands and self.state in self.ACTION_STATES: + + if not self._module.check_mode: + self._connection.edit_config(commands) + result["changed"] = True + + if self.state in self.ACTION_STATES: + result["commands"] = commands + + if self.state in self.ACTION_STATES or self.state == "gathered": + changed_lldp_global_facts = self.get_lldp_global_facts() + + elif self.state == "rendered": + result["rendered"] = commands + + elif self.state == "parsed": + running_config = self._module.params["running_config"] + if not running_config: + self._module.fail_json( + msg="value of running_config parameter must not be empty for state parsed" + ) + result["parsed"] = self.get_lldp_global_facts(data=running_config) + + if self.state in self.ACTION_STATES: + result["before"] = existing_lldp_global_facts + if result["changed"]: + result["after"] = changed_lldp_global_facts + elif self.state == "gathered": + result["gathered"] = changed_lldp_global_facts + + result["warnings"] = warnings + return result + + def set_config(self, existing_lldp_global_facts): + """ Collect the configuration from the args passed to the module, + collect the current configuration (as a dict from facts) + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + want = self._module.params["config"] + if not want and self._module.params["state"] == "deleted": + want = {} + have = existing_lldp_global_facts + resp = self.set_state(want, have) + return to_list(resp) + + def set_state(self, want, have): + """ Select the appropriate function based on the state provided + + :param want: the desired configuration as a dictionary + :param have: the current configuration as a dictionary + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + state = self._module.params["state"] + if state in ("merged", "replaced", "rendered") and not want: + self._module.fail_json( + msg="value of config parameter must not be empty for state {0}".format( + state + ) + ) + + if state == "deleted": + commands = self._state_deleted(want, have) + elif state in ("merged", "rendered"): + commands = self._state_merged(want, have) + elif state == "replaced": + commands = self._state_replaced(want, have) + + return commands + + def _state_replaced(self, want, have): + """ The command generator when state is replaced + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + + commands.extend(self._state_deleted(want, have)) + + commands.extend(self._state_merged(want, have)) + + return commands + + def _state_merged(self, want, have): + """ The command generator when state is merged + + :rtype: A list + :returns: the commands necessary to merge the provided into + the current configuration + """ + commands = [] + updates = dict_diff(have, want) + if updates: + for key, value in iteritems(flatten_dict(remove_empties(updates))): + commands.append(self._compute_commands(key, value)) + + return commands + + def _state_deleted(self, want, have): + """ The command generator when state is deleted + + :rtype: A list + :returns: the commands necessary to remove the current configuration + of the provided objects + """ + commands = [] + for key, value in iteritems( + flatten_dict(dict_delete(have, remove_empties(want))) + ): + cmd = self._compute_commands(key, value, remove=True) + if cmd: + commands.append(cmd) + + return commands + + def _compute_commands(self, key, value=None, remove=False): + if key in ["holdtime", "reinit", "timer"]: + cmd = "lldp {0} {1}".format(key, value) + if remove: + return "no {0}".format(cmd) + else: + return cmd + + elif key == "subinterfaces": + cmd = "lldp subinterfaces enable" + if value and not remove: + return cmd + elif (not value and not remove) or (value and remove): + return "no {0}".format(cmd) + + else: + cmd = "lldp tlv-select {0} disable".format(key.replace("_", "-")) + if not value and not remove: + return cmd + elif (value and not remove) or (not value and remove): + return "no {0}".format(cmd) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lldp_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lldp_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lldp_interfaces/lldp_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lldp_interfaces/lldp_interfaces.py new file mode 100644 index 00000000..70394f10 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/lldp_interfaces/lldp_interfaces.py @@ -0,0 +1,278 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr_lldp_interfaces class +It is in this file where the current configuration (as dict) +is compared to the provided configuration (as dict) and the command set +necessary to bring the current configuration to it's desired end-state is +created +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( + ConfigBase, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, + search_obj_in_list, + dict_diff, + remove_empties, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.facts import ( + Facts, +) +from ansible.module_utils.six import iteritems +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + dict_delete, + pad_commands, + flatten_dict, +) + + +class Lldp_interfaces(ConfigBase): + """ + The iosxr_lldp_interfaces class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["lldp_interfaces"] + + def __init__(self, module): + super(Lldp_interfaces, self).__init__(module) + + def get_lldp_interfaces_facts(self, data=None): + """ Get the 'facts' (the current configuration) + + :rtype: A dictionary + :returns: The current configuration as a dictionary + """ + facts, _warnings = Facts(self._module).get_facts( + self.gather_subset, self.gather_network_resources, data=data + ) + lldp_interfaces_facts = facts["ansible_network_resources"].get( + "lldp_interfaces" + ) + if not lldp_interfaces_facts: + return [] + return lldp_interfaces_facts + + def execute_module(self): + """ Execute the module + + :rtype: A dictionary + :returns: The result from module execution + """ + result = {"changed": False} + warnings = list() + commands = list() + + if self.state in self.ACTION_STATES: + existing_lldp_interfaces_facts = self.get_lldp_interfaces_facts() + else: + existing_lldp_interfaces_facts = [] + + if self.state in self.ACTION_STATES or self.state == "rendered": + commands.extend(self.set_config(existing_lldp_interfaces_facts)) + + if commands and self.state in self.ACTION_STATES: + if not self._module.check_mode: + self._connection.edit_config(commands) + result["changed"] = True + + if self.state in self.ACTION_STATES: + result["commands"] = commands + + if self.state in self.ACTION_STATES or self.state == "gathered": + changed_lldp_interfaces_facts = self.get_lldp_interfaces_facts() + elif self.state == "rendered": + result["rendered"] = commands + + elif self.state == "parsed": + running_config = self._module.params["running_config"] + if not running_config: + self._module.fail_json( + msg="value of running_config parameter must not be empty for state parsed" + ) + result["parsed"] = self.get_lldp_interfaces_facts( + data=running_config + ) + + if self.state in self.ACTION_STATES: + result["before"] = existing_lldp_interfaces_facts + if result["changed"]: + result["after"] = changed_lldp_interfaces_facts + elif self.state == "gathered": + result["gathered"] = changed_lldp_interfaces_facts + + result["warnings"] = warnings + return result + + def set_config(self, existing_lldp_interfaces_facts): + """ Collect the configuration from the args passed to the module, + collect the current configuration (as a dict from facts) + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + want = self._module.params["config"] + have = existing_lldp_interfaces_facts + resp = self.set_state(want, have) + return to_list(resp) + + def set_state(self, want, have): + """ Select the appropriate function based on the state provided + + :param want: the desired configuration as a dictionary + :param have: the current configuration as a dictionary + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + state = self._module.params["state"] + commands = [] + if ( + state in ("overridden", "merged", "replaced", "rendered") + and not want + ): + self._module.fail_json( + msg="value of config parameter must not be empty for state {0}".format( + state + ) + ) + + if state == "overridden": + commands.extend(self._state_overridden(want, have)) + + elif state == "deleted": + if not want: + for intf in have: + commands.extend( + self._state_deleted({"name": intf["name"]}, intf) + ) + else: + for item in want: + obj_in_have = search_obj_in_list(item["name"], have) + commands.extend(self._state_deleted(item, obj_in_have)) + + else: + for item in want: + name = item["name"] + obj_in_have = search_obj_in_list(name, have) + + if state in ("merged", "rendered"): + commands.extend(self._state_merged(item, obj_in_have)) + + elif state == "replaced": + commands.extend(self._state_replaced(item, obj_in_have)) + + return commands + + def _state_replaced(self, want, have): + """ The command generator when state is replaced + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + replaced_commands = [] + merged_commands = [] + + if have: + replaced_commands = self._state_deleted(want, have) + + merged_commands = self._state_merged(want, have) + + if merged_commands and replaced_commands: + del merged_commands[0] + + commands.extend(replaced_commands) + commands.extend(merged_commands) + + return commands + + def _state_overridden(self, want, have): + """ The command generator when state is overridden + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + + for intf in have: + intf_in_want = search_obj_in_list(intf["name"], want) + if not intf_in_want: + commands.extend( + self._state_deleted({"name": intf["name"]}, intf) + ) + + for intf in want: + intf_in_have = search_obj_in_list(intf["name"], have) + commands.extend(self._state_replaced(intf, intf_in_have)) + + return commands + + def _state_merged(self, want, have): + """ The command generator when state is merged + + :rtype: A list + :returns: the commands necessary to merge the provided into + the current configuration + """ + commands = [] + if not have: + have = {"name": want["name"]} + + for key, value in iteritems( + flatten_dict(remove_empties(dict_diff(have, want))) + ): + commands.append(self._compute_commands(key, value)) + + if commands: + pad_commands(commands, want["name"]) + + return commands + + def _state_deleted(self, want, have): + """ The command generator when state is deleted + + :rtype: A list + :returns: the commands necessary to remove the current configuration + of the provided objects + """ + commands = [] + + for key, value in iteritems( + flatten_dict(dict_delete(have, remove_empties(want))) + ): + commands.append(self._compute_commands(key, value, remove=True)) + + if commands: + pad_commands(commands, have["name"]) + + return commands + + def _compute_commands(self, key, value=None, remove=False): + if key == "mac_address": + cmd = "lldp destination mac-address {0}".format(value) + if remove: + return "no {0}".format(cmd) + else: + return cmd + + else: + cmd = "lldp {0} disable".format(key) + if not value and not remove: + return cmd + elif (value and not remove) or (not value and remove): + return "no {0}".format(cmd) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospf_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospf_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py new file mode 100644 index 00000000..343124b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py @@ -0,0 +1,240 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2020 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +""" +The iosxr_ospf_interfaces config file. +It is in this file where the current configuration (as dict) +is compared to the provided configuration (as dict) and the command set +necessary to bring the current configuration to its desired end-state is +created. +""" + + +from ansible.module_utils.six import iteritems +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + dict_merge, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.resource_module import ( + ResourceModule, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.facts import ( + Facts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.rm_templates.ospf_interfaces import ( + Ospf_interfacesTemplate, +) + + +class Ospf_interfaces(ResourceModule): + """ + The iosxr_ospf_interfaces config class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["ospf_interfaces"] + + def __init__(self, module): + super(Ospf_interfaces, self).__init__( + empty_fact_val=[], + facts_module=Facts(module), + module=module, + resource="ospf_interfaces", + tmplt=Ospf_interfacesTemplate(), + ) + self.parsers = [ + "authentication.message_digest", + "authentication.null_auth", + "authentication.message_digest.keychain", + "authentication_key", + "bfd.minimum_interval", + "bfd.multiplier", + "bfd.fast_detect.set", + "bfd.fast_detect.disable", + "bfd.fast_detect.strict_mode", + "cost", + "cost_fallback", + "dead_interval", + "demand_circuit", + "flood_reduction", + "hello_interval", + "link_down.set", + "link_down.disable", + "message_digest_key", + "mpls.set_ldp", + "mpls.ldp_sync", + "mpls.ldp_sync_disable", + "mtu_ignore", + "network", + "packet_size", + "passive", + "prefix_suppression.disable", + "prefix_suppression.secondary_address", + "priority", + "retransmit_interval", + "security.ttl_hops", + "security.ttl", + "transmit_delay", + ] + + def execute_module(self): + """ Execute the module + :rtype: A dictionary + :returns: The result from module execution + """ + if self.state not in ["parsed", "gathered"]: + self.generate_commands() + self.run_commands() + return self.result + + def generate_commands(self): + """ Generate configuration commands to send based on + want, have and desired state. + """ + wantd = {entry["name"]: entry for entry in self.want} + haved = {entry["name"]: entry for entry in self.have} + + # turn all lists of dicts into dicts prior to merge + for entry in wantd, haved: + self._ospf_int_list_to_dict(entry) + + # if state is merged, merge want onto have and then compare + if self.state == "merged": + wantd = dict_merge(haved, wantd) + + # if state is deleted, empty out wantd and set haved to wantd + if self.state == "deleted": + haved = { + k: v for k, v in iteritems(haved) if k in wantd or not wantd + } + have_int = [] + if wantd == {}: + for k, have in iteritems(haved): + self._remove_ospf_int(have) + + for k, have in iteritems(haved): + if k in wantd: + have_int.append(k) + self._remove_ospf_int(have) + wantd = {} + + # remove superfluous config for overridden and deleted + if self.state == "overridden": + for k, have in iteritems(haved): + if k not in wantd: + self._remove_ospf_int(have) + if self.state != "deleted": + for k, want in iteritems(wantd): + self._compare(want=want, have=haved.pop(k, {})) + + def _remove_ospf_int(self, entry): + int_name = entry.get("name", {}) + int_addr = entry.get("address_family", {}) + for k, addr in iteritems(int_addr): + for key, value in addr["processes"].items(): + rem_entry = { + "name": int_name, + "afi": addr["afi"], + "process": value["process_id"], + "area": value["area"], + } + self.addcmd(rem_entry, "name", True) + + def _compare(self, want, have): + """Leverages the base class `compare()` method and + populates the list of commands to be run by comparing + the `want` and `have` data with the `parsers` defined + for the Ospf_interfaces network resource. + """ + self._compare_interface(want=want, have=have) + + self._compare_addr_family(want=want, have=have) + + def _compare_interface(self, want, have): + wdict = want.get("address_family", {}) + hdict = have.get("address_family", {}) + wname = want.get("name") + hname = have.get("name") + h_value = {} + + for key, w_value in iteritems(wdict): + if hdict and hdict.get(key): + h_value = hdict[key] + else: + h_value = None + w = { + "name": wname, + "type": w_value["afi"], + "address_family": w_value, + } + if h_value is not None: + h = { + "name": hname, + "type": h_value["afi"], + "address_family": h_value, + } + else: + h = {} + self.compare(parsers="name", want=w, have=h) + + def _compare_addr_family(self, want, have): + wdict = want.get("address_family", {}) + hdict = have.get("address_family", {}) + wname = want.get("name") + hname = have.get("name") + # Fetch the area info as that would be common to all the attributes per interface + for name, entry in iteritems(wdict): + w_process = {} + h_process = {} + for key, value in iteritems(entry): + if key == "processes": + for pname, pentry in iteritems(value): + w_process = pentry + for key, param in iteritems(entry): + w_addr = {"afi": name, key: param, "processes": w_process} + h_addr = {} + if hdict.get(name): + hdict_entry = hdict.get(name) + for item, value in iteritems(hdict_entry): + if item == "processes": + for pname, pentry in iteritems(value): + h_process = pentry + h_addr = { + "afi": name, + key: hdict[name].pop(key, {}), + "processes": h_process, + } + w = {"name": wname, "address_family": w_addr} + h = {"name": hname, "address_family": h_addr} + self.compare(parsers=self.parsers, want=w, have=h) + for name, entry in iteritems(hdict): + for key, param in iteritems(entry): + h_addr = {"afi": name, key: param} + w_addr = {} + w = {"name": wname, "address_family": w_addr} + h = {"name": hname, "address_family": h_addr} + self.compare(parsers=self.parsers, want=w, have=h) + + def _ospf_int_list_to_dict(self, entry): + for name, family in iteritems(entry): + if "address_family" in family: + family["address_family"] = { + entry["afi"]: entry + for entry in family.get("address_family", []) + } + self._ospf_int_list_to_dict(family["address_family"]) + for name, ospf_processes in iteritems(entry): + if "processes" in ospf_processes: + ospf_processes["processes"] = { + entry["process_id"]: entry + for entry in ospf_processes.get("processes", []) + } + self._ospf_int_list_to_dict(ospf_processes["processes"]) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospfv2/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospfv2/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py new file mode 100644 index 00000000..d593c7ac --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py @@ -0,0 +1,262 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr_ospfv2 class +It is in this file where the current configuration (as dict) +is compared to the provided configuration (as dict) and the command set +necessary to bring the current configuration to it's desired end-state is +created +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from copy import deepcopy +from ansible.module_utils.six import iteritems +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.facts import ( + Facts, +) + +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.rm_templates.ospfv2 import ( + Ospfv2Template, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.resource_module import ( + ResourceModule, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + dict_merge, +) + + +class Ospfv2(ResourceModule): + """ + The ios_ospfv2 class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["ospfv2"] + + def __init__(self, module): + super(Ospfv2, self).__init__( + empty_fact_val={}, + facts_module=Facts(module), + module=module, + resource="ospfv2", + tmplt=Ospfv2Template(), + ) + + def execute_module(self): + """ Execute the module + :rtype: A dictionary + :returns: The result from module execution + """ + self.gen_config() + self.run_commands() + + return self.result + + def gen_config(self): + """ Select the appropriate function based on the state provided + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + if self.want: + wantd = { + (entry["process_id"], entry.get("vrf")): entry + for entry in self.want.get("processes", []) + } + else: + wantd = {} + if self.have: + haved = { + (entry["process_id"], entry.get("vrf")): entry + for entry in self.have.get("processes", []) + } + else: + haved = {} + + # turn all lists of dicts into dicts prior to merge + for thing in wantd, haved: + for _pid, proc in iteritems(thing): + for area in proc.get("areas", []): + virtual_link = { + entry["id"]: entry + for entry in area.get("virtual_link", []) + } + if bool(virtual_link): + area["virtual_link"] = virtual_link + ranges = { + entry["address"]: entry + for entry in area.get("ranges", []) + } + if bool(ranges): + area["ranges"] = ranges + + proc["areas"] = { + entry["area_id"]: entry for entry in proc.get("areas", []) + } + if proc.get("distribute_list"): + if "acls" in proc.get("distribute_list"): + proc["distribute_list"]["acls"] = { + entry["name"]: entry + for entry in proc["distribute_list"].get( + "acls", [] + ) + } + + # if state is merged, merge want onto have + if self.state == "merged": + wantd = dict_merge(haved, wantd) + + # if state is deleted, limit the have to anything in want + # set want to nothing + if self.state == "deleted": + haved = { + k: v for k, v in iteritems(haved) if k in wantd or not wantd + } + wantd = {} + + # delete processes first so we do run into "more than one" errors + if self.state == "deleted": + haved_del = deepcopy(haved) + want_process = {} + for k, t_want in iteritems(haved_del): + want_process["process_id"] = t_want.get("process_id") + if not (len(t_want) == 2 and not t_want.get("areas")): + self._compare(want=want_process, have=haved_del.get(k, {})) + if self.state == "overridden": + haved_del = deepcopy(haved) + want = {} + for k, t_want in iteritems(haved_del): + if k not in wantd: + want["process_id"] = t_want.get("process_id") + if not (len(t_want) == 2 and not t_want.get("areas")): + self._compare(want=want, have=haved_del.get(k, {})) + + for k, want in iteritems(wantd): + self._compare(want=want, have=haved.pop(k, {})) + + def _compare(self, want, have): + parsers = [ + "bfd", + "cost", + "weight", + "passive", + "priority", + "protocol", + "auto_cost", + "bandwidth", + "flood_reduction", + "default_metric", + "default_weight", + "router_id", + "demand_circuit", + "packet_size", + "transmit_delay", + "summary_in", + "external_out", + "dead_interval", + "hello_interval", + "authentication", + "adjacency_stagger", + "retransmit_interval", + "mtu_ignore", + "bfd.fast_detect", + "capability", + "capability.opaque", + "admin_distance", + "ospf_distance", + "address_family_unicast", + "loopback_stub_network", + "authentication.message_digest", + "default_information_originate", + "link_down_fast_detect", + "nsr", + "database_filter", + "log_adjacency", + "distribute_bgp_ls", + "distribute_link_state", + "max_lsa", + "max_metric", + "mpls_ldp", + "mpls_traffic_eng", + "microloop_avoidance", + "prefix_suppression", + "protocol_shutdown", + "timers.lsa", + "timers.graceful_shutdown", + "throttle.lsa_all", + "throttle.spf", + "throttle.fast_reroute", + "timers.pacing_flood", + ] + + if want != have: + self.addcmd(want or have, "pid", False) + self.compare(parsers, want, have) + self._areas_compare(want, have) + + def _areas_compare(self, want, have): + wareas = want.get("areas", {}) + hareas = have.get("areas", {}) + for name, entry in iteritems(wareas): + self._area_compare(want=entry, have=hareas.pop(name, {})) + for name, entry in iteritems(hareas): + self._area_compare(want={}, have=entry) + + def _area_compare(self, want, have): + parsers = [ + "area.authentication", + "area.authentication_key", + "area.authentication.message_digest", + "area.mpls_traffic_eng", + "area.mpls_ldp", + "area.bfd", + "area.bfd.fast_detect", + "area.nssa", + "area.nssa.default_information_originate", + "area.nssa.translate", + "area.default_cost", + "area.stub", + "area.ranges", + "area.cost", + "area.dead_interval", + "area.hello_interval", + "area.transmit_delay", + "area.mtu_ignore", + "area.packet_size", + "area.priority", + "area.weight", + "area.external_out", + "area.summary_in", + "area.demand_circuit", + "area.passive", + ] + self.compare(parsers=parsers, want=want, have=have) + self._areas_compare_virtual_link(want, have) + + def _areas_compare_virtual_link(self, want, have): + wvlinks = want.get("virtual_link", {}) + hvlinks = have.get("virtual_link", {}) + for name, entry in iteritems(wvlinks): + self._area_compare_virtual_link( + want=entry, have=hvlinks.pop(name, {}) + ) + for name, entry in iteritems(hvlinks): + self._area_compare_virtual_link(want={}, have=entry) + + def _area_compare_virtual_link(self, want, have): + parsers = [ + "virtual_link.authentication", + "virtual_link.authentication_key", + "virtual_link.authentication.message_digest", + "virtual_link.hello_interval", + "virtual_link.dead_interval", + "virtual_link.retransmit_interval", + ] + self.compare(parsers=parsers, want=want, have=have) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospfv3/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospfv3/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py new file mode 100644 index 00000000..f68b1292 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py @@ -0,0 +1,255 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2020 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from copy import deepcopy +from ansible.module_utils.six import iteritems +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.facts import ( + Facts, +) + +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.rm_templates.ospfv3 import ( + Ospfv3Template, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.resource_module import ( + ResourceModule, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + dict_merge, +) + + +class Ospfv3(ResourceModule): + """ + The ios_ospfv3 class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["ospfv3"] + + def __init__(self, module): + super(Ospfv3, self).__init__( + empty_fact_val={}, + facts_module=Facts(module), + module=module, + resource="ospfv3", + tmplt=Ospfv3Template(), + ) + + def execute_module(self): + """ Execute the module + :rtype: A dictionary + :returns: The result from module execution + """ + self.gen_config() + self.run_commands() + + return self.result + + def gen_config(self): + """ Select the appropriate function based on the state provided + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + if self.want: + wantd = { + (entry["process_id"], entry.get("vrf")): entry + for entry in self.want.get("processes", []) + } + else: + wantd = {} + if self.have: + haved = { + (entry["process_id"], entry.get("vrf")): entry + for entry in self.have.get("processes", []) + } + else: + haved = {} + + # turn all lists of dicts into dicts prior to merge + for thing in wantd, haved: + for _pid, proc in iteritems(thing): + for area in proc.get("areas", []): + virtual_link = { + entry["id"]: entry + for entry in area.get("virtual_link", []) + } + if bool(virtual_link): + area["virtual_link"] = virtual_link + ranges = { + entry["address"]: entry + for entry in area.get("ranges", []) + } + if bool(ranges): + area["ranges"] = ranges + + proc["areas"] = { + entry["area_id"]: entry for entry in proc.get("areas", []) + } + if proc.get("distribute_list"): + if "acls" in proc.get("distribute_list"): + proc["distribute_list"]["acls"] = { + entry["name"]: entry + for entry in proc["distribute_list"].get( + "acls", [] + ) + } + + # if state is merged, merge want onto have + if self.state == "merged": + wantd = dict_merge(haved, wantd) + + # if state is deleted, limit the have to anything in want + # set want to nothing + if self.state == "deleted": + haved = { + k: v for k, v in iteritems(haved) if k in wantd or not wantd + } + wantd = {} + + # delete processes first so we do run into "more than one" errors + if self.state == "deleted": + haved_del = deepcopy(haved) + want_process = {} + for k, t_want in iteritems(haved_del): + want_process["process_id"] = t_want.get("process_id") + if not (len(t_want) == 2 and not t_want.get("areas")): + self._compare(want=want_process, have=haved_del.get(k, {})) + if self.state == "overridden": + haved_del = deepcopy(haved) + want = {} + for k, t_want in iteritems(haved_del): + if k not in wantd: + want["process_id"] = t_want.get("process_id") + if not (len(t_want) == 2 and not t_want.get("areas")): + self._compare(want=want, have=haved_del.get(k, {})) + + for k, want in iteritems(wantd): + self._compare(want=want, have=haved.pop(k, {})) + + def _compare(self, want, have): + parsers = [ + "bfd.minimum_interval", + "bfd.multiplier", + "cost", + "weight", + "passive", + "priority", + "protocol", + "auto_cost", + "bandwidth", + "flood_reduction", + "default_metric", + "default_weight", + "router_id", + "demand_circuit", + "packet_size", + "transmit_delay", + "dead_interval", + "hello_interval", + "authentication", + "retransmit_interval", + "mtu_ignore", + "bfd.fast_detect", + "capability", + "capability.opaque", + "admin_distance", + "ospf_distance", + "address_family_unicast", + "loopback_stub_network", + "authentication.ipsec", + "default_information_originate", + "link_down_fast_detect", + "nsr", + "database_filter", + "log_adjacency", + "distribute_bgp_ls", + "distribute_link_state", + "max_lsa", + "max_metric", + "mpls_ldp", + "mpls_traffic_eng", + "microloop_avoidance", + "prefix_suppression", + "protocol_shutdown", + "timers.lsa", + "timers.graceful_shutdown", + "throttle.lsa_all", + "throttle.spf", + "throttle.fast_reroute", + "timers.pacing_flood", + ] + + if want != have: + self.addcmd(want or have, "pid", False) + self.compare(parsers, want, have) + self._areas_compare(want, have) + + def _areas_compare(self, want, have): + wareas = want.get("areas", {}) + hareas = have.get("areas", {}) + for name, entry in iteritems(wareas): + self._area_compare(want=entry, have=hareas.pop(name, {})) + for name, entry in iteritems(hareas): + self._area_compare(want={}, have=entry) + + def _area_compare(self, want, have): + parsers = [ + "area.authentication", + "area.authentication.ipsec", + "area.mpls_traffic_eng", + "area.mpls_ldp", + "area.bfd.minimum_interval", + "area.bfd.multiplier", + "area.bfd.fast_detect", + "area.nssa", + "area.nssa.default_information_originate", + "area.nssa.translate", + "area.default_cost", + "area.stub", + "area.ranges", + "area.cost", + "area.dead_interval", + "area.hello_interval", + "area.transmit_delay", + "area.mtu_ignore", + "area.packet_size", + "area.priority", + "area.weight", + "area.external_out", + "area.summary_in", + "area.demand_circuit", + "area.passive", + ] + self.compare(parsers=parsers, want=want, have=have) + self._areas_compare_virtual_link(want, have) + + def _areas_compare_virtual_link(self, want, have): + wvlinks = want.get("virtual_link", {}) + hvlinks = have.get("virtual_link", {}) + for name, entry in iteritems(wvlinks): + self._area_compare_virtual_link( + want=entry, have=hvlinks.pop(name, {}) + ) + for name, entry in iteritems(hvlinks): + self._area_compare_virtual_link(want={}, have=entry) + + def _area_compare_virtual_link(self, want, have): + parsers = [ + "virtual_link.authentication", + "virtual_link.authentication_key", + "virtual_link.authentication.message_digest", + "virtual_link.hello_interval", + "virtual_link.dead_interval", + "virtual_link.retransmit_interval", + ] + self.compare(parsers=parsers, want=want, have=have) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/static_routes/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/static_routes/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/static_routes/static_routes.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/static_routes/static_routes.py new file mode 100644 index 00000000..246966e4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/config/static_routes/static_routes.py @@ -0,0 +1,549 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr_static_routes class +It is in this file where the current configuration (as dict) +is compared to the provided configuration (as dict) and the command set +necessary to bring the current configuration to it's desired end-state is +created +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( + ConfigBase, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.facts import ( + Facts, +) +from ansible.module_utils.six import iteritems +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + search_obj_in_list, + remove_empties, + dict_diff, + dict_merge, +) + + +class Static_routes(ConfigBase): + """ + The iosxr_static_routes class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["static_routes"] + + def __init__(self, module): + super(Static_routes, self).__init__(module) + + def get_static_routes_facts(self, data=None): + """ Get the 'facts' (the current configuration) + + :rtype: A dictionary + :returns: The current configuration as a dictionary + """ + facts, _warnings = Facts(self._module).get_facts( + self.gather_subset, self.gather_network_resources, data=data + ) + static_routes_facts = facts["ansible_network_resources"].get( + "static_routes" + ) + if not static_routes_facts: + return [] + return static_routes_facts + + def execute_module(self): + """ Execute the module + + :rtype: A dictionary + :returns: The result from module execution + """ + result = {"changed": False} + warnings = list() + commands = list() + + if self.state in self.ACTION_STATES: + existing_static_routes_facts = self.get_static_routes_facts() + else: + existing_static_routes_facts = [] + + if self.state in self.ACTION_STATES or self.state == "rendered": + commands.extend(self.set_config(existing_static_routes_facts)) + + if commands and self.state in self.ACTION_STATES: + if not self._module.check_mode: + self._connection.edit_config(commands) + result["changed"] = True + + if self.state in self.ACTION_STATES: + result["commands"] = commands + + if self.state in self.ACTION_STATES or self.state == "gathered": + changed_static_routes_facts = self.get_static_routes_facts() + + elif self.state == "rendered": + result["rendered"] = commands + + elif self.state == "parsed": + running_config = self._module.params["running_config"] + if not running_config: + self._module.fail_json( + msg="value of running_config parameter must not be empty for state parsed" + ) + result["parsed"] = self.get_static_routes_facts( + data=running_config + ) + + if self.state in self.ACTION_STATES: + result["before"] = existing_static_routes_facts + if result["changed"]: + result["after"] = changed_static_routes_facts + + elif self.state == "gathered": + result["gathered"] = changed_static_routes_facts + + result["warnings"] = warnings + return result + + def set_config(self, existing_static_routes_facts): + """ Collect the configuration from the args passed to the module, + collect the current configuration (as a dict from facts) + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + want = self._module.params["config"] + have = existing_static_routes_facts + resp = self.set_state(want, have) + return to_list(resp) + + def set_state(self, want, have): + """ Select the appropriate function based on the state provided + + :param want: the desired configuration as a dictionary + :param have: the current configuration as a dictionary + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + state = self._module.params["state"] + commands = [] + + if ( + state in ("overridden", "merged", "replaced", "rendered") + and not want + ): + self._module.fail_json( + msg="value of config parameter must not be empty for state {0}".format( + state + ) + ) + + if state == "overridden": + commands.extend(self._state_overridden(want, have)) + + elif state == "deleted": + if not want: + if len(have) >= 1: + return "no router static" + + else: + for w_item in want: + obj_in_have = self._find_vrf(w_item, have) + if obj_in_have: + commands.extend( + self._state_deleted( + remove_empties(w_item), obj_in_have + ) + ) + + else: + for w_item in want: + obj_in_have = self._find_vrf(w_item, have) + if state == "merged" or self.state == "rendered": + commands.extend( + self._state_merged(remove_empties(w_item), obj_in_have) + ) + + elif state == "replaced": + commands.extend( + self._state_replaced( + remove_empties(w_item), obj_in_have + ) + ) + + if commands: + commands.insert(0, "router static") + + return commands + + def _state_replaced(self, want, have): + """ The command generator when state is replaced + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + + for want_afi in want.get("address_families", []): + have_afi = ( + self.find_af_context( + want_afi, have.get("address_families", []) + ) + or {} + ) + update_commands = [] + for want_route in want_afi.get("routes", []): + have_route = ( + search_obj_in_list( + want_route["dest"], + have_afi.get("routes", []), + key="dest", + ) + or {} + ) + + rotated_have_next_hops = self.rotate_next_hops( + have_route.get("next_hops", {}) + ) + rotated_want_next_hops = self.rotate_next_hops( + want_route.get("next_hops", {}) + ) + + for key in rotated_have_next_hops.keys(): + if key not in rotated_want_next_hops: + cmd = "no {0}".format(want_route["dest"]) + for item in key: + if "." in item or ":" in item or "/" in item: + cmd += " {0}".format(item) + else: + cmd += " vrf {0}".format(item) + update_commands.append(cmd) + + for key, value in iteritems(rotated_want_next_hops): + if key in rotated_have_next_hops: + existing = True + have_exit_point_attribs = rotated_have_next_hops[key] + + else: + existing = False + have_exit_point_attribs = {} + + updates = dict_diff(have_exit_point_attribs, value) + + if updates or not existing: + update_commands.append( + self._compute_commands( + dest=want_route["dest"], + next_hop=key, + updates=updates, + ) + ) + + if update_commands: + update_commands.insert( + 0, + "address-family {0} {1}".format( + want_afi["afi"], want_afi["safi"] + ), + ) + commands.extend(update_commands) + + if "vrf" in want and update_commands: + commands.insert(0, "vrf {0}".format(want["vrf"])) + + return commands + + def _state_overridden(self, want, have): + """ The command generator when state is overridden + + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + commands = [] + + # Iterate through all the entries, i.e., VRFs and Global entry in have + # and fully remove the ones that are not present in want and then call + # replaced + + for h_item in have: + w_item = self._find_vrf(h_item, want) + + # Delete all the top-level keys (VRFs/Global Route Entry) that are + # not specified in want. + if not w_item: + if "vrf" in h_item: + commands.append("no vrf {0}".format(h_item["vrf"])) + else: + for have_afi in h_item.get("address_families", []): + commands.append( + "no address-family {0} {1}".format( + have_afi["afi"], have_afi["safi"] + ) + ) + + # For VRFs/Global Entry present in want, we also need to delete extraneous routes + # from them. We cannot reuse `_state_replaced` for this purpose since its scope is + # limited to replacing a single `dest`. + else: + del_cmds = [] + for have_afi in h_item.get("address_families", []): + want_afi = ( + self.find_af_context( + have_afi, w_item.get("address_families", []) + ) + or {} + ) + update_commands = [] + for h_route in have_afi.get("routes", []): + w_route = ( + search_obj_in_list( + h_route["dest"], + want_afi.get("routes", []), + key="dest", + ) + or {} + ) + if not w_route: + update_commands.append( + "no {0}".format(h_route["dest"]) + ) + + if update_commands: + update_commands.insert( + 0, + "address-family {0} {1}".format( + want_afi["afi"], want_afi["safi"] + ), + ) + del_cmds.extend(update_commands) + + if "vrf" in want and update_commands: + del_cmds.insert(0, "vrf {0}".format(want["vrf"])) + + commands.extend(del_cmds) + + # We finally call `_state_replaced` to replace exiting `dest` entries + # or add new ones as specified in want. + for w_item in want: + h_item = self._find_vrf(w_item, have) + commands.extend( + self._state_replaced(remove_empties(w_item), h_item) + ) + + return commands + + def _state_merged(self, want, have): + """ The command generator when state is merged + + :rtype: A list + :returns: the commands necessary to merge the provided into + the current configuration + """ + commands = [] + + for want_afi in want.get("address_families", []): + have_afi = ( + self.find_af_context( + want_afi, have.get("address_families", []) + ) + or {} + ) + + update_commands = [] + for want_route in want_afi.get("routes", []): + have_route = ( + search_obj_in_list( + want_route["dest"], + have_afi.get("routes", []), + key="dest", + ) + or {} + ) + + # convert the next_hops list of dictionaries to dictionary of + # dictionaries with (`dest_vrf`, `forward_router_address`, `interface`) tuple + # being the key for each dictionary. + # a combination of these 3 attributes uniquely identifies a route entry. + # in case `dest_vrf` is not specified, `forward_router_address` and `interface` + # become the unique identifier + rotated_have_next_hops = self.rotate_next_hops( + have_route.get("next_hops", {}) + ) + rotated_want_next_hops = self.rotate_next_hops( + want_route.get("next_hops", {}) + ) + + # for every dict in the want next_hops dictionaries, if the key + # is present in `rotated_have_next_hops`, we set `existing` to True, + # which means the the given want exit point exists and we run dict_diff + # on `value` which is basically all the other attributes of the exit point + # if the key is not present, it means that this is a new exit point + for key, value in iteritems(rotated_want_next_hops): + if key in rotated_have_next_hops: + existing = True + have_exit_point_attribs = rotated_have_next_hops[key] + + else: + existing = False + have_exit_point_attribs = {} + + updates = dict_diff(have_exit_point_attribs, value) + if updates or not existing: + update_commands.append( + self._compute_commands( + dest=want_route["dest"], + next_hop=key, + # dict_merge() is necessary to make sure that we + # don't end up overridding the entry and also to + # allow incremental updates + updates=dict_merge( + rotated_have_next_hops.get(key, {}), + updates, + ), + ) + ) + + if update_commands: + update_commands.insert( + 0, + "address-family {0} {1}".format( + want_afi["afi"], want_afi["safi"] + ), + ) + commands.extend(update_commands) + + if "vrf" in want and update_commands: + commands.insert(0, "vrf {0}".format(want["vrf"])) + + return commands + + def _state_deleted(self, want, have): + """ The command generator when state is deleted + + :rtype: A list + :returns: the commands necessary to remove the current configuration + of the provided objects + """ + commands = [] + if "address_families" not in want: + return ["no vrf {0}".format(want["vrf"])] + + else: + for want_afi in want.get("address_families", []): + have_afi = ( + self.find_af_context( + want_afi, have.get("address_families", []) + ) + or {} + ) + if have_afi: + commands.append( + "no address-family {0} {1}".format( + have_afi["afi"], have_afi["safi"] + ) + ) + if "vrf" in want and commands: + commands.insert(0, "vrf {0}".format(want["vrf"])) + + return commands + + def _find_vrf(self, item, entries): + """ This method iterates through the items + in `entries` and returns the object that + matches `item`. + + :rtype: A dict + :returns: the obj in `entries` that matches `item` + """ + obj = {} + afi = item.get("vrf") + + if afi: + obj = search_obj_in_list(afi, entries, key="vrf") or {} + else: + for x in entries: + if "vrf" not in remove_empties(x): + obj = x + break + return obj + + def find_af_context(self, want_af_context, have_address_families): + """ This method iterates through the have AFs + and returns the one that matches the want AF + + :rtype: A dict + :returns: the corresponding AF in have AFs + that matches the want AF + """ + for have_af in have_address_families: + if ( + have_af["afi"] == want_af_context["afi"] + and have_af["safi"] == want_af_context["safi"] + ): + return have_af + + def rotate_next_hops(self, next_hops): + """ This method iterates through the list of + next hops for a given destination network + and converts it to a dictionary of dictionaries. + Each dictionary has a primary key indicated by the + tuple of `dest_vrf`, `forward_router_address` and + `interface` and the value of this key is a dictionary + that contains all the other attributes of the next hop. + + :rtype: A dict + :returns: A next_hops list in a dictionary of dictionaries format + """ + next_hops_dict = {} + + for entry in next_hops: + entry = entry.copy() + key_list = [] + + for x in ["dest_vrf", "forward_router_address", "interface"]: + if entry.get(x): + key_list.append(entry.pop(x)) + + key = tuple(key_list) + next_hops_dict[key] = entry + + return next_hops_dict + + def _compute_commands(self, dest, next_hop, updates=None): + """ This method computes a static route entry command + from the specified `dest`, `next_hop` and `updates` + + :rtype: A str + :returns: A platform specific static routes command + """ + if not updates: + updates = {} + + command = dest + + for x in next_hop: + if "." in x or ":" in x or "/" in x: + command += " {0}".format(x) + else: + command += " vrf {0}".format(x) + + for key in sorted(updates): + if key == "admin_distance": + command += " {0}".format(updates[key]) + else: + command += " {0} {1}".format(key, updates[key]) + + return command diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/acl_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/acl_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/acl_interfaces/acl_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/acl_interfaces/acl_interfaces.py new file mode 100644 index 00000000..e9c476a3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/acl_interfaces/acl_interfaces.py @@ -0,0 +1,78 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr acl_interfaces fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from copy import deepcopy +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.rm_templates.acl_interfaces import ( + Acl_interfacesTemplate, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.acl_interfaces.acl_interfaces import ( + Acl_interfacesArgs, +) + + +class Acl_interfacesFacts(object): + """ The iosxr acl_interfaces fact class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = Acl_interfacesArgs.argument_spec + spec = deepcopy(self.argument_spec) + if subspec: + if options: + facts_argument_spec = spec[subspec][options] + else: + facts_argument_spec = spec[subspec] + else: + facts_argument_spec = spec + + self.generated_spec = utils.generate_dict(facts_argument_spec) + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for acl_interfaces + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + + if not data: + data = connection.get_config(flags="interface") + + config_parser = Acl_interfacesTemplate(lines=data.splitlines()) + entry = sorted( + list(config_parser.parse().values()), + key=lambda k, sk="name": k[sk], + ) + if entry: + for item in entry: + item["access_groups"] = sorted( + list(item["access_groups"].values()), + key=lambda k, sk="afi": k[sk], + ) + + ansible_facts["ansible_network_resources"].pop("acl_interfaces", None) + facts = {"acl_interfaces": []} + params = utils.validate_config(self.argument_spec, {"config": entry}) + for cfg in params["config"]: + facts["acl_interfaces"].append(utils.remove_empties(cfg)) + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/acls/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/acls/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/acls/acls.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/acls/acls.py new file mode 100644 index 00000000..32375b7f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/acls/acls.py @@ -0,0 +1,457 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr acls fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from copy import deepcopy + +from collections import deque +from ansible.module_utils.six import iteritems +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.acls.acls import ( + AclsArgs, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + isipaddress, +) + +PROTOCOL_OPTIONS = { + "tcp": ("ack", "fin", "psh", "rst", "syn", "urg", "established"), + "igmp": ( + "dvmrp", + "host_query", + "host_report", + "mtrace", + "mtrace_response", + "pim", + "trace", + "v2_leave", + "v2_report", + "v3_report", + ), + "icmp": ( + "administratively_prohibited", + "alternate_address", + "conversion_error", + "dod_host_prohibited", + "dod_net_prohibited", + "echo", + "echo_reply", + "general_parameter_problem", + "host_isolated", + "host_precedence_unreachable", + "host_redirect", + "host_tos_redirect", + "host_tos_unreachable", + "host_unknown", + "host_unreachable", + "information_reply", + "information_request", + "mask_reply", + "mask_request", + "mobile_redirect", + "net_redirect", + "net_tos_redirect", + "net_tos_unreachable", + "net_unreachable", + "network_unknown", + "no_room_for_option", + "option_missing", + "packet_too_big", + "parameter_problem", + "port_unreachable", + "precedence_unreachable", + "protocol_unreachable", + "reassembly_timeout", + "redirect", + "router_advertisement", + "router_solicitation", + "source_quench", + "source_route_failed", + "time_exceeded", + "timestamp_reply", + "timestamp_request", + "traceroute", + "ttl_exceeded", + "unreachable", + ), + "icmpv6": ( + "address_unreachable", + "administratively_prohibited", + "beyond_scope_of_source_address", + "destination_unreachable", + "echo", + "echo_reply", + "erroneous_header_field", + "group_membership_query", + "group_membership_report", + "group_membership_termination", + "host_unreachable", + "nd_na", + "nd_ns", + "neighbor_redirect", + "no_route_to_destination", + "node_information_request_is_refused", + "node_information_successful_reply", + "packet_too_big", + "parameter_problem", + "port_unreachable", + "query_subject_is_IPv4address", + "query_subject_is_IPv6address", + "query_subject_is_domainname", + "reassembly_timeout", + "redirect", + "router_advertisement", + "router_renumbering", + "router_solicitation", + "rr_command", + "rr_result", + "rr_seqnum_reset", + "time_exceeded", + "ttl_exceeded", + "unknown_query_type", + "unreachable", + "unrecognized_next_header", + "unrecognized_option", + "whoareyou_reply", + "whoareyou_request", + ), +} + + +class AclsFacts(object): + """ The iosxr acls fact class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = AclsArgs.argument_spec + spec = deepcopy(self.argument_spec) + + if subspec: + if options: + facts_argument_spec = spec[subspec][options] + else: + facts_argument_spec = spec[subspec] + else: + facts_argument_spec = spec + + self.generated_spec = utils.generate_dict(facts_argument_spec) + + def get_device_data(self, connection): + return connection.get("show access-lists afi-all") + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for acls + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + if not data: + data = self.get_device_data(connection) + + objs = [] + + acl_lines = data.splitlines() + + # We iterate through the data and create a list of ACLs + # where each ACL is a dictionary in the following format: + # {'afi': 'ipv4', 'name': 'acl_1', 'aces': ['10 permit 172.16.0.0 0.0.255.255', '20 deny 192.168.34.0 0.0.0.255']} + if acl_lines: + acl, acls = {}, [] + for line in acl_lines: + if line.startswith("ip"): + if acl: + acls.append(acl) + acl = {"aces": []} + acl["afi"], acl["name"] = line.split()[0], line.split()[2] + else: + acl["aces"].append(line.strip()) + acls.append(acl) + + # Here we group the ACLs based on AFI + # { + # 'ipv6': [{'aces': ['10 permit ipv6 2000::/12 any'], 'name': 'acl_2'}], + # 'ipv4': [{'aces': ['10 permit 172.16.0.0 0.0.255.255', '20 deny 192.168.34.0 0.0.0.255'], 'name': 'acl_1'}, + # {'aces': ['20 deny 10.0.0.0/8 log'], 'name': 'acl_3'}] + # } + + grouped_acls = {"ipv4": [], "ipv6": []} + for acl in acls: + acl_copy = deepcopy(acl) + del acl_copy["afi"] + grouped_acls[acl["afi"]].append(acl_copy) + + # Now that we have the ACLs in a fairly structured format, + # we pass it on to render_config to convert it to model spec + for key, value in iteritems(grouped_acls): + obj = self.render_config(self.generated_spec, value) + if obj: + obj["afi"] = key + objs.append(obj) + + ansible_facts["ansible_network_resources"].pop("acls", None) + facts = {} + + facts["acls"] = [] + params = utils.validate_config(self.argument_spec, {"config": objs}) + for cfg in params["config"]: + facts["acls"].append(utils.remove_empties(cfg)) + + ansible_facts["ansible_network_resources"].update(facts) + + return ansible_facts + + def render_config(self, spec, conf): + """ + Render config as dictionary structure and delete keys + from spec for null values + + :param spec: The facts tree, generated from the argspec + :param conf: The configuration + :rtype: dictionary + :returns: The generated config + """ + config = deepcopy(spec) + config["acls"] = [] + + for item in conf: + acl = {"name": item["name"]} + aces = item.get("aces", []) + if aces: + acl["aces"] = [] + for ace in aces: + acl["aces"].append(self._render_ace(ace)) + config["acls"].append(acl) + + return utils.remove_empties(config) + + def _render_ace(self, ace): + """ + Parses an Access Control Entry (ACE) and converts it + into model spec + + :param ace: An ACE in device specific format + :rtype: dictionary + :returns: The ACE in structured format + """ + + def __parse_src_dest(rendered_ace, ace_queue, direction): + """ + Parses the ACE queue and populates address, wildcard_bits, + host or any keys in the source/destination dictionary of + ace dictionary, i.e., `rendered_ace`. + + :param rendered_ace: The dictionary containing the ACE in structured format + :param ace_queue: The ACE queue + :param direction: Specifies whether to populate `source` or `destination` + dictionary + """ + element = ace_queue.popleft() + if element == "host": + rendered_ace[direction] = {"host": ace_queue.popleft()} + + elif element == "any": + rendered_ace[direction] = {"any": True} + + elif "/" in element: + rendered_ace[direction] = {"prefix": element} + + elif isipaddress(element): + rendered_ace[direction] = { + "address": element, + "wildcard_bits": ace_queue.popleft(), + } + + def __parse_port_protocol(rendered_ace, ace_queue, direction): + """ + Parses the ACE queue and populates `port_protocol` dictionary in the + ACE dictionary, i.e., `rendered_ace`. + + :param rendered_ace: The dictionary containing the ACE in structured format + :param ace_queue: The ACE queue + :param direction: Specifies whether to populate `source` or `destination` + dictionary + """ + if len(ace_queue) > 0 and ace_queue[0] in ( + "eq", + "gt", + "lt", + "neq", + "range", + ): + element = ace_queue.popleft() + port_protocol = {} + + if element == "range": + port_protocol["range"] = { + "start": ace_queue.popleft(), + "end": ace_queue.popleft(), + } + else: + port_protocol[element] = ace_queue.popleft() + + rendered_ace[direction]["port_protocol"] = port_protocol + + def __parse_protocol_options(rendered_ace, ace_queue, protocol): + """ + Parses the ACE queue and populates protocol specific options + of the required dictionary and updates the ACE dictionary, i.e., + `rendered_ace`. + + :param rendered_ace: The dictionary containing the ACE in structured format + :param ace_queue: The ACE queue + :param protocol: Specifies the protocol that will be populated under + `protocol_options` dictionary + """ + if len(ace_queue) > 0: + protocol_options = {protocol: {}} + + for match_bit in PROTOCOL_OPTIONS.get(protocol, ()): + if match_bit.replace("_", "-") in ace_queue: + protocol_options[protocol][match_bit] = True + ace_queue.remove(match_bit.replace("_", "-")) + + rendered_ace["protocol_options"] = protocol_options + + def __parse_match_options(rendered_ace, ace_queue): + """ + Parses the ACE queue and populates remaining options in the ACE dictionary, + i.e., `rendered_ace` + + :param rendered_ace: The dictionary containing the ACE in structured format + :param ace_queue: The ACE queue + """ + if len(ace_queue) > 0: + # We deepcopy the actual queue and iterate through the + # copied queue. However, we pop off the elements from + # the actual queue. Then, in every pass we update the copied + # queue with the current state of the original queue. + # This is done because a queue cannot be mutated during iteration. + copy_ace_queue = deepcopy(ace_queue) + + for element in copy_ace_queue: + if element == "precedence": + ace_queue.popleft() + rendered_ace["precedence"] = ace_queue.popleft() + + elif element == "dscp": + ace_queue.popleft() + dscp = {} + operation = ace_queue.popleft() + + if operation in ("eq", "gt", "neq", "lt", "range"): + if operation == "range": + dscp["range"] = { + "start": ace_queue.popleft(), + "end": ace_queue.popleft(), + } + else: + dscp[operation] = ace_queue.popleft() + else: + # `dscp` can be followed by either the dscp value itself or + # the same thing can be represented using "dscp eq ". + # In both cases, it would show up as {'dscp': {'eq': "dscp_value"}}. + dscp["eq"] = operation + + rendered_ace["dscp"] = dscp + + elif element in ("packet-length", "ttl"): + ace_queue.popleft() + element_dict = {} + operation = ace_queue.popleft() + + if operation == "range": + element_dict["range"] = { + "start": ace_queue.popleft(), + "end": ace_queue.popleft(), + } + else: + element_dict[operation] = ace_queue.popleft() + + rendered_ace[element.replace("-", "_")] = element_dict + + elif element in ( + "log", + "log-input", + "fragments", + "icmp-off", + "capture", + "destopts", + "authen", + "routing", + "hop-by-hop", + ): + rendered_ace[element.replace("-", "_")] = True + ace_queue.remove(element) + + copy_ace_queue = deepcopy(ace_queue) + + rendered_ace = {} + split_ace = ace.split() + + # Create a queue with each word in the ace + # We parse each element and pop it off the queue + ace_queue = deque(split_ace) + + # An ACE will always have a sequence number, even if + # it is not explicitly provided while configuring + sequence = int(ace_queue.popleft()) + rendered_ace["sequence"] = sequence + operation = ace_queue.popleft() + + if operation == "remark": + rendered_ace["remark"] = " ".join(split_ace[2:]) + + else: + rendered_ace["grant"] = operation + + # If the entry is a non-remark entry, the third element + # will always be the protocol specified. By default, it's + # the AFI. + rendered_ace["protocol"] = ace_queue.popleft() + + # Populate source dictionary + __parse_src_dest(rendered_ace, ace_queue, direction="source") + # Populate port_protocol key in source dictionary + __parse_port_protocol(rendered_ace, ace_queue, direction="source") + # Populate destination dictionary + __parse_src_dest(rendered_ace, ace_queue, direction="destination") + # Populate port_protocol key in destination dictionary + __parse_port_protocol( + rendered_ace, ace_queue, direction="destination" + ) + # Populate protocol_options dictionary + __parse_protocol_options( + rendered_ace, ace_queue, protocol=rendered_ace["protocol"] + ) + # Populate remaining match options' dictionaries + __parse_match_options(rendered_ace, ace_queue) + + # At this stage the queue should be empty + # If the queue is not empty, it means that + # we haven't been able to parse the entire ACE + # In this case, we add the whole unprocessed ACE + # to a key called `line` and send it back + if len(ace_queue) > 0: + rendered_ace = { + "sequence": sequence, + "line": " ".join(split_ace[1:]), + } + + return utils.remove_empties(rendered_ace) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/facts.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/facts.py new file mode 100644 index 00000000..1441ef6d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/facts.py @@ -0,0 +1,122 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The facts class for iosxr +this file validates each subset of facts and selectively +calls the appropriate facts gathering function +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts import ( + FactsBase, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.legacy.base import ( + Default, + Hardware, + Interfaces, + Config, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.lacp.lacp import ( + LacpFacts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.lacp_interfaces.lacp_interfaces import ( + Lacp_interfacesFacts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.lldp_global.lldp_global import ( + Lldp_globalFacts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.lldp_interfaces.lldp_interfaces import ( + Lldp_interfacesFacts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.interfaces.interfaces import ( + InterfacesFacts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.lag_interfaces.lag_interfaces import ( + Lag_interfacesFacts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.l2_interfaces.l2_interfaces import ( + L2_InterfacesFacts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.l3_interfaces.l3_interfaces import ( + L3_InterfacesFacts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.acl_interfaces.acl_interfaces import ( + Acl_interfacesFacts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.acls.acls import ( + AclsFacts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.static_routes.static_routes import ( + Static_routesFacts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.ospfv2.ospfv2 import ( + Ospfv2Facts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.ospfv3.ospfv3 import ( + Ospfv3Facts, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.ospf_interfaces.ospf_interfaces import ( + Ospf_interfacesFacts, +) + + +FACT_LEGACY_SUBSETS = dict( + default=Default, hardware=Hardware, interfaces=Interfaces, config=Config +) +FACT_RESOURCE_SUBSETS = dict( + lacp=LacpFacts, + lacp_interfaces=Lacp_interfacesFacts, + lldp_global=Lldp_globalFacts, + lldp_interfaces=Lldp_interfacesFacts, + interfaces=InterfacesFacts, + l2_interfaces=L2_InterfacesFacts, + lag_interfaces=Lag_interfacesFacts, + l3_interfaces=L3_InterfacesFacts, + acl_interfaces=Acl_interfacesFacts, + acls=AclsFacts, + static_routes=Static_routesFacts, + ospfv2=Ospfv2Facts, + ospfv3=Ospfv3Facts, + ospf_interfaces=Ospf_interfacesFacts, +) + + +class Facts(FactsBase): + """ The fact class for iosxr + """ + + VALID_LEGACY_GATHER_SUBSETS = frozenset(FACT_LEGACY_SUBSETS.keys()) + VALID_RESOURCE_SUBSETS = frozenset(FACT_RESOURCE_SUBSETS.keys()) + + def __init__(self, module): + super(Facts, self).__init__(module) + + def get_facts( + self, legacy_facts_type=None, resource_facts_type=None, data=None + ): + """ Collect the facts for iosxr + + :param legacy_facts_type: List of legacy facts types + :param resource_facts_type: List of resource fact types + :param data: previously collected conf + :rtype: dict + :return: the facts gathered + """ + if self.VALID_RESOURCE_SUBSETS: + self.get_network_resources_facts( + FACT_RESOURCE_SUBSETS, resource_facts_type, data + ) + + if self.VALID_LEGACY_GATHER_SUBSETS: + self.get_network_legacy_facts( + FACT_LEGACY_SUBSETS, legacy_facts_type + ) + + return self.ansible_facts, self._warnings diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/interfaces/interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/interfaces/interfaces.py new file mode 100644 index 00000000..bc4450fc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/interfaces/interfaces.py @@ -0,0 +1,110 @@ +# +# -*- 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 iosxr interfaces fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from copy import deepcopy +import re +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + get_interface_type, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.interfaces.interfaces import ( + InterfacesArgs, +) + + +class InterfacesFacts(object): + """ The iosxr interfaces fact class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = InterfacesArgs.argument_spec + spec = deepcopy(self.argument_spec) + if subspec: + if options: + facts_argument_spec = spec[subspec][options] + else: + facts_argument_spec = spec[subspec] + else: + facts_argument_spec = spec + + self.generated_spec = utils.generate_dict(facts_argument_spec) + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for interfaces + :param module: the module instance + :param connection: the device connection + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + objs = [] + if not data: + data = connection.get("show running-config interface") + + # operate on a collection of resource x + config = ("\n" + data).split("\ninterface ") + for conf in config: + if conf: + obj = self.render_config(self.generated_spec, conf) + if obj: + objs.append(obj) + + facts = {} + if objs: + facts["interfaces"] = [] + params = utils.validate_config( + self.argument_spec, {"config": objs} + ) + for cfg in params["config"]: + facts["interfaces"].append(utils.remove_empties(cfg)) + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts + + def render_config(self, spec, conf): + """ + Render config as dictionary structure and delete keys from spec for null values + :param spec: The facts tree, generated from the argspec + :param conf: The configuration + :rtype: dictionary + :returns: The generated config + """ + + config = deepcopy(spec) + match = re.search(r"^(\S+)", conf) + + intf = match.group(1) + if match.group(1).lower() == "preconfigure": + match = re.search(r"^(\S+) (.*)", conf) + if match: + intf = match.group(2) + + if get_interface_type(intf) == "unknown": + return {} + # populate the facts from the configuration + config["name"] = intf + config["description"] = utils.parse_conf_arg(conf, "description") + if utils.parse_conf_arg(conf, "speed"): + config["speed"] = int(utils.parse_conf_arg(conf, "speed")) + if utils.parse_conf_arg(conf, "mtu"): + config["mtu"] = int(utils.parse_conf_arg(conf, "mtu")) + config["duplex"] = utils.parse_conf_arg(conf, "duplex") + enabled = utils.parse_conf_cmd_arg(conf, "shutdown", False) + config["enabled"] = enabled if enabled is not None else True + + return utils.remove_empties(config) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/l2_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/l2_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/l2_interfaces/l2_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/l2_interfaces/l2_interfaces.py new file mode 100644 index 00000000..82220d89 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/l2_interfaces/l2_interfaces.py @@ -0,0 +1,134 @@ +# +# -*- 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 iosxr l2_interfaces fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from copy import deepcopy +import re +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + get_interface_type, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.l2_interfaces.l2_interfaces import ( + L2_InterfacesArgs, +) + + +class L2_InterfacesFacts(object): + """ The iosxr l2_interfaces fact class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = L2_InterfacesArgs.argument_spec + spec = deepcopy(self.argument_spec) + if subspec: + if options: + facts_argument_spec = spec[subspec][options] + else: + facts_argument_spec = spec[subspec] + else: + facts_argument_spec = spec + + self.generated_spec = utils.generate_dict(facts_argument_spec) + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for l2_interfaces + :param module: the module instance + :param connection: the device connection + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + objs = [] + if not data: + data = connection.get("show running-config interface") + + # operate on a collection of resource x + config = ("\n" + data).split("\ninterface ") + for conf in config: + if conf: + obj = self.render_config(self.generated_spec, conf) + if obj: + objs.append(obj) + facts = {} + if objs: + facts["l2_interfaces"] = [] + params = utils.validate_config( + self.argument_spec, {"config": objs} + ) + for cfg in params["config"]: + facts["l2_interfaces"].append(utils.remove_empties(cfg)) + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts + + def render_config(self, spec, conf): + """ + Render config as dictionary structure and delete keys from spec for null values + :param spec: The facts tree, generated from the argspec + :param conf: The configuration + :rtype: dictionary + :returns: The generated config + """ + config = deepcopy(spec) + match = re.search(r"^(\S+)", conf) + + intf = match.group(1) + + if match.group(1).lower() == "preconfigure": + match = re.search(r"^(\S+) (.*)", conf) + if match: + intf = match.group(2) + + if get_interface_type(intf) == "unknown": + return {} + + if intf.lower().startswith("gi"): + config["name"] = intf + + # populate the facts from the configuration + native_vlan = re.search(r"dot1q native vlan (\d+)", conf) + if native_vlan: + config["native_vlan"] = int(native_vlan.group(1)) + + dot1q = utils.parse_conf_arg(conf, "encapsulation dot1q") + config["q_vlan"] = [] + if dot1q: + config["q_vlan"].append(int(dot1q.split(" ")[0])) + if len(dot1q.split(" ")) > 1: + config["q_vlan"].append(int(dot1q.split(" ")[2])) + + if utils.parse_conf_cmd_arg(conf, "l2transport", True): + config["l2transport"] = True + if utils.parse_conf_arg(conf, "propagate"): + config["propagate"] = True + config["l2protocol"] = [] + + cdp = utils.parse_conf_arg(conf, "l2protocol cdp") + pvst = utils.parse_conf_arg(conf, "l2protocol pvst") + stp = utils.parse_conf_arg(conf, "l2protocol stp") + vtp = utils.parse_conf_arg(conf, "l2protocol vtp") + if cdp: + config["l2protocol"].append({"cdp": cdp}) + if pvst: + config["l2protocol"].append({"pvst": pvst}) + if stp: + config["l2protocol"].append({"stp": stp}) + if vtp: + config["l2protocol"].append({"vtp": vtp}) + + return utils.remove_empties(config) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/l3_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/l3_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/l3_interfaces/l3_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/l3_interfaces/l3_interfaces.py new file mode 100644 index 00000000..5bc589d3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/l3_interfaces/l3_interfaces.py @@ -0,0 +1,126 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr_l3_interfaces fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from copy import deepcopy +import re +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import ( + get_interface_type, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.l3_interfaces.l3_interfaces import ( + L3_InterfacesArgs, +) + + +class L3_InterfacesFacts(object): + """ The iosxr_l3_interfaces fact class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = L3_InterfacesArgs.argument_spec + spec = deepcopy(self.argument_spec) + if subspec: + if options: + facts_argument_spec = spec[subspec][options] + else: + facts_argument_spec = spec[subspec] + else: + facts_argument_spec = spec + + self.generated_spec = utils.generate_dict(facts_argument_spec) + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for interfaces + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + objs = [] + + if not data: + data = connection.get("show running-config interface") + # operate on a collection of resource x + config = ("\n" + data).split("\ninterface ") + for conf in config: + if conf: + obj = self.render_config(self.generated_spec, conf) + if obj: + objs.append(obj) + facts = {} + + if objs: + facts["l3_interfaces"] = [] + params = utils.validate_config( + self.argument_spec, {"config": objs} + ) + for cfg in params["config"]: + facts["l3_interfaces"].append(utils.remove_empties(cfg)) + ansible_facts["ansible_network_resources"].update(facts) + + return ansible_facts + + def render_config(self, spec, conf): + """ + Render config as dictionary structure and delete keys from spec for null values + :param spec: The facts tree, generated from the argspec + :param conf: The configuration + :rtype: dictionary + :returns: The generated config + """ + config = deepcopy(spec) + match = re.search(r"^(\S+)", conf) + + intf = match.group(1) + if match.group(1).lower() == "preconfigure": + match = re.search(r"^(\S+) (.*)", conf) + if match: + intf = match.group(2) + + if get_interface_type(intf) == "unknown": + return {} + + # populate the facts from the configuration + config["name"] = intf + + # Get the configured IPV4 details + ipv4 = [] + ipv4_all = re.findall(r"ipv4 address (\S+.*)", conf) + for each in ipv4_all: + each_ipv4 = dict() + if "secondary" in each: + each_ipv4["address"] = each.split(" secondary")[0] + each_ipv4["secondary"] = True + else: + each_ipv4["address"] = each + ipv4.append(each_ipv4) + config["ipv4"] = ipv4 + + # Get the configured IPV6 details + ipv6 = [] + ipv6_all = re.findall(r"ipv6 address (\S+)", conf) + for each in ipv6_all: + each_ipv6 = dict() + each_ipv6["address"] = each + ipv6.append(each_ipv6) + config["ipv6"] = ipv6 + + return utils.remove_empties(config) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lacp/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lacp/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lacp/lacp.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lacp/lacp.py new file mode 100644 index 00000000..e052f116 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lacp/lacp.py @@ -0,0 +1,89 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr lacp fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from copy import deepcopy +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.lacp.lacp import ( + LacpArgs, +) + + +class LacpFacts(object): + """ The iosxr lacp fact class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = LacpArgs.argument_spec + spec = deepcopy(self.argument_spec) + if subspec: + if options: + facts_argument_spec = spec[subspec][options] + else: + facts_argument_spec = spec[subspec] + else: + facts_argument_spec = spec + + self.generated_spec = utils.generate_dict(facts_argument_spec) + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for lacp + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + if not data: + data = connection.get_config(flags="lacp") + + obj = {} + if data: + lacp_obj = self.render_config(self.generated_spec, data) + if lacp_obj: + obj = lacp_obj + + ansible_facts["ansible_network_resources"].pop("lacp", None) + facts = {} + + params = utils.validate_config(self.argument_spec, {"config": obj}) + facts["lacp"] = utils.remove_empties(params["config"]) + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts + + def render_config(self, spec, conf): + """ + Render config as dictionary structure and delete keys + from spec for null values + + :param spec: The facts tree, generated from the argspec + :param conf: The configuration + :rtype: dictionary + :returns: The generated config + """ + config = deepcopy(spec) + + system_priority = utils.parse_conf_arg(conf, "priority") + config["system"]["priority"] = ( + int(system_priority) if system_priority else system_priority + ) + config["system"]["mac"]["address"] = utils.parse_conf_arg(conf, "mac") + + return config diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lacp_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lacp_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lacp_interfaces/lacp_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lacp_interfaces/lacp_interfaces.py new file mode 100644 index 00000000..8cb5fcda --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lacp_interfaces/lacp_interfaces.py @@ -0,0 +1,115 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr lacp_interfaces fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +import re +from copy import deepcopy + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.lacp_interfaces.lacp_interfaces import ( + Lacp_interfacesArgs, +) +from ansible.module_utils.six import iteritems + + +class Lacp_interfacesFacts(object): + """ The iosxr lacp_interfaces fact class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = Lacp_interfacesArgs.argument_spec + spec = deepcopy(self.argument_spec) + if subspec: + if options: + facts_argument_spec = spec[subspec][options] + else: + facts_argument_spec = spec[subspec] + else: + facts_argument_spec = spec + + self.generated_spec = utils.generate_dict(facts_argument_spec) + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for lacp_interfaces + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + + if not data: + data = connection.get_config(flags="interface") + interfaces = ("\n" + data).split("\ninterface ") + + objs = [] + for interface in interfaces: + obj = self.render_config(self.generated_spec, interface) + if obj: + objs.append(obj) + + ansible_facts["ansible_network_resources"].pop("lacp_interfaces", None) + facts = {} + if objs: + facts["lacp_interfaces"] = [] + params = utils.validate_config( + self.argument_spec, {"config": objs} + ) + for cfg in params["config"]: + facts["lacp_interfaces"].append(utils.remove_empties(cfg)) + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts + + def render_config(self, spec, conf): + """ + Render config as dictionary structure and delete keys + from spec for null values + + :param spec: The facts tree, generated from the argspec + :param conf: The configuration + :rtype: dictionary + :returns: The generated config + """ + config = deepcopy(spec) + + match = re.search( + r"(GigabitEthernet|Bundle-Ether|TenGigE|FortyGigE|HundredGigE)(\S+)", + conf, + re.M, + ) + if match: + config["name"] = match.group(1) + match.group(2) + + temp = { + "churn_logging": "lacp churn logging", + "switchover_suppress_flaps": "lacp switchover suppress-flaps", + "collector_max_delay": "lacp collector-max-delay", + "period": "lacp period", + } + + for key, value in iteritems(temp): + config[key] = utils.parse_conf_arg(conf, value) + + for key in config["system"].keys(): + config["system"][key] = utils.parse_conf_arg( + conf, "lacp system {0}".format(key) + ) + + return utils.remove_empties(config) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lag_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lag_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lag_interfaces/lag_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lag_interfaces/lag_interfaces.py new file mode 100644 index 00000000..2b911398 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lag_interfaces/lag_interfaces.py @@ -0,0 +1,141 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr lag_interfaces fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +import re +from copy import deepcopy + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.lag_interfaces.lag_interfaces import ( + Lag_interfacesArgs, +) + + +class Lag_interfacesFacts(object): + """ The iosxr lag_interfaces fact class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = Lag_interfacesArgs.argument_spec + spec = deepcopy(self.argument_spec) + if subspec: + if options: + facts_argument_spec = spec[subspec][options] + else: + facts_argument_spec = spec[subspec] + else: + facts_argument_spec = spec + + self.generated_spec = utils.generate_dict(facts_argument_spec) + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for lag_interfaces + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + + if not data: + data = connection.get_config(flags="interface") + interfaces = ("\n" + data).split("\ninterface ") + + objs = [] + + for interface in interfaces: + if interface.startswith("Bundle-Ether"): + obj = self.render_config( + self.generated_spec, interface, interfaces + ) + if obj: + objs.append(obj) + + ansible_facts["ansible_network_resources"].pop("lag_interfaces", None) + facts = {} + + facts["lag_interfaces"] = [] + params = utils.validate_config(self.argument_spec, {"config": objs}) + for cfg in params["config"]: + facts["lag_interfaces"].append(utils.remove_empties(cfg)) + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts + + def render_config(self, spec, conf, data): + """ + Render config as dictionary structure and delete keys + from spec for null values + + :param spec: The facts tree, generated from the argspec + :param conf: The configuration + :rtype: dictionary + :returns: The generated config + """ + config = deepcopy(spec) + match = re.search(r"(Bundle-Ether)(\d+)", conf, re.M) + if match: + config["name"] = match.group(1) + match.group(2) + config["load_balancing_hash"] = utils.parse_conf_arg( + conf, "bundle load-balancing hash" + ) + config["mode"] = utils.parse_conf_arg(conf, "lacp mode") + config["links"]["max_active"] = utils.parse_conf_arg( + conf, "bundle maximum-active links" + ) + config["links"]["min_active"] = utils.parse_conf_arg( + conf, "bundle minimum-active links" + ) + config["members"] = self.parse_members(match.group(2), data) + + return utils.remove_empties(config) + + def parse_members(self, bundle_id, interfaces): + """ + Renders a list of member interfaces for every bundle + present in running-config. + + :param bundle_id: The Bundle-Ether ID fetched from running-config + :param interfaces: Data of all interfaces present in running-config + :rtype: list + :returns: A list of member interfaces + """ + + def _parse_interface(name): + if name.startswith("preconfigure"): + return name.split()[1] + else: + return name.split()[0] + + members = [] + for interface in interfaces: + if not interface.startswith("Bu"): + match = re.search( + r"bundle id (\d+) mode (\S+)", interface, re.M + ) + if match: + if bundle_id == match.group(1): + members.append( + { + "member": _parse_interface(interface), + "mode": match.group(2), + } + ) + + return members diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/legacy/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/legacy/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/legacy/base.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/legacy/base.py new file mode 100644 index 00000000..463190cd --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/legacy/base.py @@ -0,0 +1,261 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +""" +The iosxr legacy fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" + + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +import platform +import re + +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + run_commands, + get_capabilities, +) +from ansible.module_utils.six import iteritems +from ansible.module_utils.six.moves import zip + + +class FactsBase(object): + + COMMANDS = frozenset() + + def __init__(self, module): + self.module = module + self.facts = dict() + self.warnings = list() + self.responses = None + + def populate(self): + self.responses = run_commands( + self.module, list(self.COMMANDS), check_rc=False + ) + + +class Default(FactsBase): + def populate(self): + self.facts.update(self.platform_facts()) + + def platform_facts(self): + platform_facts = {} + + resp = get_capabilities(self.module) + device_info = resp["device_info"] + + platform_facts["system"] = device_info["network_os"] + + for item in ("model", "image", "version", "platform", "hostname"): + val = device_info.get("network_os_%s" % item) + if val: + platform_facts[item] = val + + platform_facts["api"] = resp["network_api"] + platform_facts["python_version"] = platform.python_version() + + return platform_facts + + +class Hardware(FactsBase): + + COMMANDS = ["dir /all", "show memory summary"] + + def populate(self): + super(Hardware, self).populate() + data = self.responses[0] + self.facts["filesystems"] = self.parse_filesystems(data) + + data = self.responses[1] + match = re.search(r"Physical Memory: (\d+)M total \((\d+)", data) + if match: + self.facts["memtotal_mb"] = match.group(1) + self.facts["memfree_mb"] = match.group(2) + + def parse_filesystems(self, data): + return re.findall(r"^Directory of (\S+)", data, re.M) + + +class Config(FactsBase): + + COMMANDS = ["show running-config"] + + def populate(self): + super(Config, self).populate() + self.facts["config"] = self.responses[0] + + +class Interfaces(FactsBase): + + COMMANDS = [ + "show interfaces", + "show ipv6 interface", + "show lldp", + "show lldp neighbors detail", + ] + + def populate(self): + super(Interfaces, self).populate() + self.facts["all_ipv4_addresses"] = list() + self.facts["all_ipv6_addresses"] = list() + + interfaces = self.parse_interfaces(self.responses[0]) + self.facts["interfaces"] = self.populate_interfaces(interfaces) + + data = self.responses[1] + if len(data) > 0: + data = self.parse_interfaces(data) + self.populate_ipv6_interfaces(data) + + if "LLDP is not enabled" not in self.responses[2]: + neighbors = self.responses[3] + self.facts["neighbors"] = self.parse_neighbors(neighbors) + + def populate_interfaces(self, interfaces): + facts = dict() + for key, value in iteritems(interfaces): + intf = dict() + intf["description"] = self.parse_description(value) + intf["macaddress"] = self.parse_macaddress(value) + + ipv4 = self.parse_ipv4(value) + intf["ipv4"] = self.parse_ipv4(value) + if ipv4: + self.add_ip_address(ipv4["address"], "ipv4") + + intf["mtu"] = self.parse_mtu(value) + intf["bandwidth"] = self.parse_bandwidth(value) + intf["duplex"] = self.parse_duplex(value) + intf["lineprotocol"] = self.parse_lineprotocol(value) + intf["operstatus"] = self.parse_operstatus(value) + intf["type"] = self.parse_type(value) + + facts[key] = intf + return facts + + def populate_ipv6_interfaces(self, data): + for key, value in iteritems(data): + if key in ["No", "RPF"] or key.startswith("IP"): + continue + self.facts["interfaces"][key]["ipv6"] = list() + addresses = re.findall(r"\s+(.+), subnet", value, re.M) + subnets = re.findall(r", subnet is (.+)$", value, re.M) + for addr, subnet in zip(addresses, subnets): + ipv6 = dict(address=addr.strip(), subnet=subnet.strip()) + self.add_ip_address(addr.strip(), "ipv6") + self.facts["interfaces"][key]["ipv6"].append(ipv6) + + def add_ip_address(self, address, family): + if family == "ipv4": + self.facts["all_ipv4_addresses"].append(address) + else: + self.facts["all_ipv6_addresses"].append(address) + + def parse_neighbors(self, neighbors): + facts = dict() + nbors = neighbors.split( + "------------------------------------------------" + ) + for entry in nbors[1:]: + if entry == "": + continue + intf = self.parse_lldp_intf(entry) + if intf not in facts: + facts[intf] = list() + fact = dict() + fact["host"] = self.parse_lldp_host(entry) + fact["remote_description"] = self.parse_lldp_remote_desc(entry) + fact["port"] = self.parse_lldp_port(entry) + facts[intf].append(fact) + return facts + + def parse_interfaces(self, data): + parsed = dict() + key = "" + for line in data.split("\n"): + if len(line) == 0: + continue + if line[0] == " ": + parsed[key] += "\n%s" % line + else: + match = re.match(r"^(\S+)", line) + if match: + key = match.group(1) + parsed[key] = line + return parsed + + def parse_description(self, data): + match = re.search(r"Description: (.+)$", data, re.M) + if match: + return match.group(1) + + def parse_macaddress(self, data): + match = re.search(r"address is (\S+)", data) + if match: + return match.group(1) + + def parse_ipv4(self, data): + match = re.search(r"Internet address is (\S+)/(\d+)", data) + if match: + addr = match.group(1) + masklen = int(match.group(2)) + return dict(address=addr, masklen=masklen) + + def parse_mtu(self, data): + match = re.search(r"MTU (\d+)", data) + if match: + return int(match.group(1)) + + def parse_bandwidth(self, data): + match = re.search(r"BW (\d+)", data) + if match: + return int(match.group(1)) + + def parse_duplex(self, data): + match = re.search(r"(\w+)(?: D|-d)uplex", data, re.M) + if match: + return match.group(1) + + def parse_type(self, data): + match = re.search(r"Hardware is (.+),", data, re.M) + if match: + return match.group(1) + + def parse_lineprotocol(self, data): + match = re.search(r"line protocol is (.+)\s+?$", data, re.M) + if match: + return match.group(1) + + def parse_operstatus(self, data): + match = re.search(r"^(?:.+) is (.+),", data, re.M) + if match: + return match.group(1) + + def parse_lldp_intf(self, data): + match = re.search(r"^Local Interface: (.+)$", data, re.M) + if match: + return match.group(1) + + def parse_lldp_remote_desc(self, data): + match = re.search(r"Port Description: (.+)$", data, re.M) + if match: + return match.group(1) + + def parse_lldp_host(self, data): + match = re.search(r"System Name: (.+)$", data, re.M) + if match: + return match.group(1) + + def parse_lldp_port(self, data): + match = re.search(r"Port id: (.+)$", data, re.M) + if match: + return match.group(1) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lldp_global/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lldp_global/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lldp_global/lldp_global.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lldp_global/lldp_global.py new file mode 100644 index 00000000..13d7f0cf --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lldp_global/lldp_global.py @@ -0,0 +1,107 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr lldp fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from copy import deepcopy + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.lldp_global.lldp_global import ( + Lldp_globalArgs, +) + + +class Lldp_globalFacts(object): + """ The iosxr lldp fact class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = Lldp_globalArgs.argument_spec + spec = deepcopy(self.argument_spec) + if subspec: + if options: + facts_argument_spec = spec[subspec][options] + else: + facts_argument_spec = spec[subspec] + else: + facts_argument_spec = spec + + self.generated_spec = utils.generate_dict(facts_argument_spec) + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for lldp + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + if not data: + data = connection.get_config(flags="lldp") + + obj = {} + if data: + lldp_obj = self.render_config(self.generated_spec, data) + if lldp_obj: + obj = lldp_obj + + ansible_facts["ansible_network_resources"].pop("lldp_global", None) + facts = {} + + params = utils.validate_config(self.argument_spec, {"config": obj}) + facts["lldp_global"] = utils.remove_empties(params["config"]) + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts + + def render_config(self, spec, conf): + """ + Render config as dictionary structure and delete keys + from spec for null values + + :param spec: The facts tree, generated from the argspec + :param conf: The configuration + :rtype: dictionary + :returns: The generated config + """ + config = deepcopy(spec) + + for key in spec.keys(): + if key == "subinterfaces": + config[key] = True if "subinterfaces enable" in conf else None + + elif key == "tlv_select": + for item in [ + "system_name", + "port_description", + "management_address", + "system_description", + "system_capabilities", + ]: + config[key][item] = ( + False + if ("{0} disable".format(item.replace("_", "-"))) + in conf + else None + ) + + else: + value = utils.parse_conf_arg(conf, key) + config[key] = int(value) if value else value + + return config diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lldp_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lldp_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lldp_interfaces/lldp_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lldp_interfaces/lldp_interfaces.py new file mode 100644 index 00000000..57fbc425 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/lldp_interfaces/lldp_interfaces.py @@ -0,0 +1,109 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr lldp_interfaces fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +import re +from copy import deepcopy + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.lldp_interfaces.lldp_interfaces import ( + Lldp_interfacesArgs, +) + + +class Lldp_interfacesFacts(object): + """ The iosxr lldp_interfaces fact class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = Lldp_interfacesArgs.argument_spec + spec = deepcopy(self.argument_spec) + if subspec: + if options: + facts_argument_spec = spec[subspec][options] + else: + facts_argument_spec = spec[subspec] + else: + facts_argument_spec = spec + + self.generated_spec = utils.generate_dict(facts_argument_spec) + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for lldp_interfaces + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + + if not data: + data = connection.get_config(flags="interface") + interfaces = ("\n" + data).split("\ninterface ") + + objs = [] + for interface in interfaces: + obj = self.render_config(self.generated_spec, interface) + if obj: + objs.append(obj) + + ansible_facts["ansible_network_resources"].pop("lldp_interfaces", None) + facts = {} + + if objs: + facts["lldp_interfaces"] = [] + params = utils.validate_config( + self.argument_spec, {"config": objs} + ) + for cfg in params["config"]: + facts["lldp_interfaces"].append(utils.remove_empties(cfg)) + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts + + def render_config(self, spec, conf): + """ + Render config as dictionary structure and delete keys + from spec for null values + + :param spec: The facts tree, generated from the argspec + :param conf: The configuration + :rtype: dictionary + :returns: The generated config + """ + config = deepcopy(spec) + + match = re.search( + r"(GigabitEthernet|Bundle-Ether|TenGigE|FortyGigE|HundredGigE)(\S+)", + conf, + re.M, + ) + if match: + config["name"] = match.group(1) + match.group(2) + + for key in ["receive", "transmit"]: + config[key] = ( + False if ("{0} disable".format(key)) in conf else None + ) + + for x in ["ieee-nearest-bridge", "ieee-nearest-non-tmpr-bridge"]: + if x in conf: + config["destination"]["mac_address"] = x + + return utils.remove_empties(config) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospf_interfaces/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospf_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospf_interfaces/ospf_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospf_interfaces/ospf_interfaces.py new file mode 100644 index 00000000..c21eaf0d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospf_interfaces/ospf_interfaces.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +""" +The iosxr ospf_interfaces fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" + +from copy import deepcopy +import re +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.rm_templates.ospf_interfaces import ( + Ospf_interfacesTemplate, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.ospf_interfaces.ospf_interfaces import ( + Ospf_interfacesArgs, +) + + +class Ospf_interfacesFacts(object): + """ The iosxr ospf_interfaces facts class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = Ospf_interfacesArgs.argument_spec + spec = deepcopy(self.argument_spec) + if subspec: + if options: + facts_argument_spec = spec[subspec][options] + else: + facts_argument_spec = spec[subspec] + else: + facts_argument_spec = spec + + self.generated_spec = utils.generate_dict(facts_argument_spec) + + def get_ospf_interfaces(self, connection, flag): + cmd = "show running-config router " + flag + return connection.get(cmd) + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for Ospf_interfaces network resource + + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + + :rtype: dictionary + :returns: facts + """ + facts = {} + objs = [] + if not data: + data = self.get_ospf_interfaces(connection, flag="ospf") + data += "\n" + self.get_ospf_interfaces(connection, flag="ospfv3") + end_flag, end_mark, count, v_read = 0, 0, 0, False + areas, config_commands = [], [] + area_str, process, curr_process = "", "", "" + data = data.splitlines() + + for line in data: + if ( + line.startswith("router") + and curr_process != "" + and curr_process != line + ): + end_mark, count, end_flag, area_str = 0, 0, 0, "" + if end_mark == 0 and count == 0 and line.startswith("router ospf"): + curr_process = line + process = re.sub("\n", "", line) + count += 1 + config_commands.append(process) + else: + if line.startswith(" area") or line.startswith(" vrf"): + area_str = process + re.sub("\n", "", line) + config_commands.append(area_str.replace(" ", " ")) + end_flag += 1 + elif line.startswith(" interface"): + ospf_int = area_str + re.sub("\n", "", line) + # default output format has more spaces with default identation + # reset the spaces with replace + config_commands.append(ospf_int.replace(" ", " ")) + v_read = True + elif v_read: + if "!" not in line: + command = ospf_int.replace(" ", " ") + re.sub( + "\n", "", line + ) + config_commands.append(command.replace(" ", " ")) + else: + v_read = False + elif end_flag > 0 and "!" not in line: + command = area_str + re.sub("\n", "", line) + config_commands.append(command.replace(" ", " ")) + elif "!" in line: + end_flag = 0 + end_mark += 1 + if end_mark == 3: + end_mark, count = 0, 0 + area_str = "" + else: + command = process + line + command.replace(" ", " ") + config_commands.append(re.sub("\n", "", command)) + areas.append(re.sub("\n", "", command)) + data = config_commands + + ospf_interfaces_parser = Ospf_interfacesTemplate(lines=data) + objs = list(ospf_interfaces_parser.parse().values()) + if objs: + for item in objs: + item["address_family"] = list(item["address_family"].values()) + for af in item["address_family"]: + if af.get("processes"): + af["processes"] = list(af["processes"].values()) + + ansible_facts["ansible_network_resources"].pop("ospf_interfaces", None) + + params = utils.remove_empties( + utils.validate_config(self.argument_spec, {"config": objs}) + ) + + facts["ospf_interfaces"] = params.get("config", []) + ansible_facts["ansible_network_resources"].update(facts) + + return ansible_facts diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospfv2/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospfv2/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospfv2/ospfv2.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospfv2/ospfv2.py new file mode 100644 index 00000000..1da5ea8e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospfv2/ospfv2.py @@ -0,0 +1,157 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr snmp fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from copy import deepcopy +import re + +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.rm_templates.ospfv2 import ( + Ospfv2Template, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.ospfv2.ospfv2 import ( + Ospfv2Args, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network_template import ( + NetworkTemplate, +) + + +class Ospfv2Facts(object): + """ The iosxr snmp fact class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = Ospfv2Args.argument_spec + + spec = deepcopy(self.argument_spec) + if subspec: + if options: + facts_argument_spec = spec[subspec][options] + else: + facts_argument_spec = spec[subspec] + else: + facts_argument_spec = spec + + self.generated_spec = utils.generate_dict(facts_argument_spec) + + def get_ospfv2_data(self, connection): + return connection.get("show running-config router ospf") + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for interfaces + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + + if not data: + data = self.get_ospfv2_data(connection) + end_flag, end_mark, count, v_read = 0, 0, 0, False + areas, config_commands = [], [] + area_str, process, curr_process = "", "", "" + data = data.splitlines() + for line in data: + if ( + line.startswith("router ospf") + and curr_process != "" + and curr_process != line + ): + end_mark, count, end_flag, area_str = 0, 0, 0, "" + if end_mark == 0 and count == 0 and line.startswith("router ospf"): + curr_process = line + process = re.sub("\n", "", line) + count += 1 + config_commands.append(process) + else: + if line.startswith(" area") or line.startswith(" vrf"): + area_str = process + re.sub("\n", "", line) + config_commands.append(area_str.replace(" ", " ")) + end_flag += 1 + elif line.startswith(" virtual-link"): + virtual_str = area_str + re.sub("\n", "", line) + config_commands.append(virtual_str.replace(" ", " ")) + v_read = True + elif v_read: + if "!" not in line: + command = virtual_str.replace(" ", " ") + re.sub( + "\n", "", line + ) + config_commands.append(command.replace(" ", " ")) + else: + v_read = False + elif end_flag > 0 and "!" not in line: + command = area_str + re.sub("\n", "", line) + config_commands.append(command.replace(" ", " ")) + elif "!" in line: + end_flag = 0 + end_mark += 1 + if end_mark == 3: + end_mark, count = 0, 0 + area_str = "" + else: + command = process + line + command.replace(" ", " ") + config_commands.append(re.sub("\n", "", command)) + areas.append(re.sub("\n", "", command)) + data = config_commands + ipv4 = {"processes": []} + rmmod = NetworkTemplate(lines=data, tmplt=Ospfv2Template()) + current = rmmod.parse() + + # convert some of the dicts to lists + for key, sortv in [("processes", "process_id")]: + if key in current and current[key]: + current[key] = current[key].values() + current[key] = sorted( + current[key], key=lambda k, sk=sortv: k[sk] + ) + + for process in current.get("processes", []): + if "areas" in process: + process["areas"] = list(process["areas"].values()) + process["areas"] = sorted( + process["areas"], key=lambda k, sk="area_id": k[sk] + ) + for area in process["areas"]: + if "ranges" in area: + area["ranges"] = sorted( + area["ranges"], key=lambda k, s="ranges": k[s] + ) + if "virtual_link" in area: + area["virtual_link"] = list( + area["virtual_link"].values() + ) + area["virtual_link"] = sorted( + area["virtual_link"], key=lambda k, sk="id": k[sk] + ) + ipv4["processes"].append(process) + + ansible_facts["ansible_network_resources"].pop("ospfv2", None) + facts = {} + if current: + params = utils.validate_config( + self.argument_spec, {"config": ipv4} + ) + params = utils.remove_empties(params) + + facts["ospfv2"] = params["config"] + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospfv3/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospfv3/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospfv3/ospfv3.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospfv3/ospfv3.py new file mode 100644 index 00000000..8e54e3f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/ospfv3/ospfv3.py @@ -0,0 +1,155 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from copy import deepcopy +import re + +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.rm_templates.ospfv3 import ( + Ospfv3Template, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.ospfv3.ospfv3 import ( + Ospfv3Args, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network_template import ( + NetworkTemplate, +) + + +class Ospfv3Facts(object): + """ The iosxr snmp fact class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = Ospfv3Args.argument_spec + + spec = deepcopy(self.argument_spec) + if subspec: + if options: + facts_argument_spec = spec[subspec][options] + else: + facts_argument_spec = spec[subspec] + else: + facts_argument_spec = spec + + self.generated_spec = utils.generate_dict(facts_argument_spec) + + def get_ospfv3_data(self, connection): + return connection.get("show running-config router ospfv3") + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for interfaces + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + + if not data: + data = self.get_ospfv3_data(connection) + end_flag, end_mark, count, v_read = 0, 0, 0, False + areas, config_commands = [], [] + area_str, process, curr_process = "", "", "" + data = data.splitlines() + for line in data: + if ( + line.startswith("router ospfv3") + and curr_process != "" + and curr_process != line + ): + end_mark, count, end_flag, area_str = 0, 0, 0, "" + if ( + end_mark == 0 + and count == 0 + and line.startswith("router ospfv3") + ): + curr_process = line + process = re.sub("\n", "", line) + count += 1 + config_commands.append(process) + else: + if line.startswith(" area") or line.startswith(" vrf"): + area_str = process + re.sub("\n", "", line) + config_commands.append(area_str.replace(" ", " ")) + end_flag += 1 + elif line.startswith(" virtual-link"): + virtual_str = area_str + re.sub("\n", "", line) + config_commands.append(virtual_str.replace(" ", " ")) + v_read = True + elif v_read: + if "!" not in line: + command = virtual_str.replace(" ", " ") + re.sub( + "\n", "", line + ) + config_commands.append(command.replace(" ", " ")) + else: + v_read = False + elif end_flag > 0 and "!" not in line: + command = area_str + re.sub("\n", "", line) + config_commands.append(command.replace(" ", " ")) + elif "!" in line: + end_flag = 0 + end_mark += 1 + if end_mark == 3: + end_mark, count = 0, 0 + area_str = "" + else: + command = process + line + command.replace(" ", " ") + config_commands.append(re.sub("\n", "", command)) + areas.append(re.sub("\n", "", command)) + data = config_commands + ipv4 = {"processes": []} + rmmod = NetworkTemplate(lines=data, tmplt=Ospfv3Template()) + current = rmmod.parse() + + # convert some of the dicts to lists + for key, sortv in [("processes", "process_id")]: + if key in current and current[key]: + current[key] = current[key].values() + current[key] = sorted( + current[key], key=lambda k, sk=sortv: k[sk] + ) + + for process in current.get("processes", []): + if "areas" in process: + process["areas"] = list(process["areas"].values()) + process["areas"] = sorted( + process["areas"], key=lambda k, sk="area_id": k[sk] + ) + for area in process["areas"]: + if "ranges" in area: + area["ranges"] = sorted( + area["ranges"], key=lambda k, s="ranges": k[s] + ) + if "virtual_link" in area: + area["virtual_link"] = list( + area["virtual_link"].values() + ) + area["virtual_link"] = sorted( + area["virtual_link"], key=lambda k, sk="id": k[sk] + ) + ipv4["processes"].append(process) + + ansible_facts["ansible_network_resources"].pop("ospfv3", None) + facts = {} + if current: + params = utils.validate_config( + self.argument_spec, {"config": ipv4} + ) + params = utils.remove_empties(params) + + facts["ospfv3"] = params["config"] + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/static_routes/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/static_routes/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/static_routes/static_routes.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/static_routes/static_routes.py new file mode 100644 index 00000000..7df0e8bc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/static_routes/static_routes.py @@ -0,0 +1,191 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The iosxr static_routes fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +import re +from copy import deepcopy +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.static_routes.static_routes import ( + Static_routesArgs, +) + + +class Static_routesFacts(object): + """ The iosxr static_routes fact class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = Static_routesArgs.argument_spec + spec = deepcopy(self.argument_spec) + if subspec: + if options: + facts_argument_spec = spec[subspec][options] + else: + facts_argument_spec = spec[subspec] + else: + facts_argument_spec = spec + + self.generated_spec = utils.generate_dict(facts_argument_spec) + + def get_device_data(self, connection): + return connection.get_config(flags="router static") + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for static_routes + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + if not data: + data = self.get_device_data(connection) + + objs = [] + + if "No such configuration" not in data: + for entry in re.compile(r"(\s) vrf").split(data): + obj = self.render_config(self.generated_spec, entry) + if obj: + objs.append(obj) + + ansible_facts["ansible_network_resources"].pop("static_routes", None) + facts = {} + + facts["static_routes"] = [] + params = utils.validate_config(self.argument_spec, {"config": objs}) + for cfg in params["config"]: + facts["static_routes"].append(utils.remove_empties(cfg)) + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts + + def render_config(self, spec, conf): + """ + Render config as dictionary structure and delete keys + from spec for null values + + :param spec: The facts tree, generated from the argspec + :param conf: The configuration + :rtype: dictionary + :returns: The generated config + """ + config = deepcopy(spec) + entry_list = conf.split(" address-family") + config["address_families"] = [] + + if "router static" not in entry_list[0]: + config["vrf"] = entry_list[0].replace("!", "").strip() + + for item in entry_list[1:]: + routes = [] + address_family = {"routes": []} + address_family["afi"], address_family["safi"] = self.parse_af(item) + + destinations = re.findall(r"((?:\S+)/(?:\d+)) (?:.*)", item, re.M) + for dest in set(destinations): + route = {"next_hops": []} + route["dest"] = dest + + regex = r"%s .+$" % dest + cfg = re.findall(regex, item, re.M) + + for route_entry in cfg: + exit_point = {} + exit_point["forward_router_address"] = self.parse_faddr( + route_entry + ) + exit_point["interface"] = self.parse_intf(route_entry) + exit_point["admin_distance"] = self.parse_admin_distance( + route_entry + ) + + for x in [ + "tag", + "tunnel-id", + "metric", + "description", + "track", + "vrflabel", + "dest_vrf", + ]: + exit_point[x.replace("-", "_")] = self.parse_attrib( + route_entry, x.replace("dest_vrf", "vrf") + ) + + route["next_hops"].append(exit_point) + + routes.append(route) + address_family["routes"] = sorted( + routes, key=lambda i: i["dest"] + ) + config["address_families"].append(address_family) + + return utils.remove_empties(config) + + def parse_af(self, item): + match = re.search(r"(?:\s*)(\w+)(?:\s*)(\w+)", item, re.M) + if match: + return match.group(1), match.group(2) + + def parse_faddr(self, item): + for x in item.split(" "): + if (":" in x or "." in x) and "/" not in x: + return x + + def parse_intf(self, item): + match = re.search(r" ((\w+)((?:\d)/(?:\d)/(?:\d)/(?:\d+)))", item) + if match: + return match.group(1) + + def parse_attrib(self, item, attrib): + match = re.search(r" %s (\S+)" % attrib, item) + if match: + val = match.group(1).strip("'") + if attrib in ["tunnel-id", "vrflabel", "tag", "metric"]: + val = int(val) + return val + + def parse_admin_distance(self, item): + split_item = item.split(" ") + for item in [ + "vrf", + "metric", + "tunnel-id", + "vrflabel", + "track", + "tag", + "description", + ]: + try: + del split_item[split_item.index(item) + 1] + del split_item[split_item.index(item)] + except ValueError: + continue + try: + return [ + i + for i in split_item + if "." not in i + and ":" not in i + and ord(i[0]) > 48 + and ord(i[0]) < 57 + ][0] + except IndexError: + return None diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/iosxr.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/iosxr.py new file mode 100644 index 00000000..771aec74 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/iosxr.py @@ -0,0 +1,671 @@ +# This code is part of Ansible, but is an independent component. +# This particular file snippet, and this file snippet only, is BSD licensed. +# Modules you write using this snippet, which is embedded dynamically by Ansible +# still belong to the author of the module, and may assign their own license +# to the complete work. +# +# Copyright (c) 2015 Peter Sprygada, +# Copyright (c) 2017 Red Hat Inc. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +import json +import re +from difflib import Differ + +from ansible.module_utils._text import to_text, to_bytes +from ansible.module_utils.basic import env_fallback +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible.module_utils.connection import Connection, ConnectionError +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + NetconfConnection, +) + +try: + from ncclient.xml_ import to_xml + + HAS_NCCLIENT = True +except ImportError: + HAS_NCCLIENT = False + +try: + from lxml import etree + + HAS_XML = True +except ImportError: + HAS_XML = False + +_EDIT_OPS = frozenset(["merge", "create", "replace", "delete"]) + +BASE_1_0 = "{urn:ietf:params:xml:ns:netconf:base:1.0}" + +NS_DICT = { + "BASE_NSMAP": {"xc": "urn:ietf:params:xml:ns:netconf:base:1.0"}, + "BANNERS_NSMAP": { + None: "http://cisco.com/ns/yang/Cisco-IOS-XR-infra-infra-cfg" + }, + "INTERFACES_NSMAP": {None: "http://openconfig.net/yang/interfaces"}, + "INSTALL_NSMAP": { + None: "http://cisco.com/ns/yang/Cisco-IOS-XR-installmgr-admin-oper" + }, + "HOST-NAMES_NSMAP": { + None: "http://cisco.com/ns/yang/Cisco-IOS-XR-shellutil-cfg" + }, + "M:TYPE_NSMAP": {"idx": "urn:ietf:params:xml:ns:yang:iana-if-type"}, + "ETHERNET_NSMAP": {None: "http://openconfig.net/yang/interfaces/ethernet"}, + "CETHERNET_NSMAP": { + None: "http://cisco.com/ns/yang/Cisco-IOS-XR-drivers-media-eth-cfg" + }, + "INTERFACE-CONFIGURATIONS_NSMAP": { + None: "http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg" + }, + "INFRA-STATISTICS_NSMAP": { + None: "http://cisco.com/ns/yang/Cisco-IOS-XR-infra-statsd-oper" + }, + "INTERFACE-PROPERTIES_NSMAP": { + None: "http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-oper" + }, + "IP-DOMAIN_NSMAP": { + None: "http://cisco.com/ns/yang/Cisco-IOS-XR-ip-domain-cfg" + }, + "SYSLOG_NSMAP": { + None: "http://cisco.com/ns/yang/Cisco-IOS-XR-infra-syslog-cfg" + }, + "AAA_NSMAP": {None: "http://cisco.com/ns/yang/Cisco-IOS-XR-aaa-lib-cfg"}, + "AAA_LOCALD_NSMAP": { + None: "http://cisco.com/ns/yang/Cisco-IOS-XR-aaa-locald-cfg" + }, +} + +iosxr_provider_spec = { + "host": dict(), + "port": dict(type="int"), + "username": dict(fallback=(env_fallback, ["ANSIBLE_NET_USERNAME"])), + "password": dict( + fallback=(env_fallback, ["ANSIBLE_NET_PASSWORD"]), no_log=True + ), + "ssh_keyfile": dict( + fallback=(env_fallback, ["ANSIBLE_NET_SSH_KEYFILE"]), type="path" + ), + "timeout": dict(type="int"), + "transport": dict(type="str", default="cli", choices=["cli", "netconf"]), +} + +iosxr_argument_spec = { + "provider": dict( + type="dict", + options=iosxr_provider_spec, + removed_at_date="2022-06-01", + removed_from_collection="cisco.iosxr", + ) +} + +command_spec = { + "command": dict(), + "prompt": dict(default=None), + "answer": dict(default=None), +} + +CONFIG_MISPLACED_CHILDREN = [re.compile(r"^end-\s*(.+)$")] + +# Objects defined in Route-policy Language guide of IOS_XR. +# Reconfiguring these objects replace existing configurations. +# Hence these objects should be played direcly from candidate +# configurations +CONFIG_BLOCKS_FORCED_IN_DIFF = [ + {"start": re.compile(r"^route-policy"), "end": re.compile(r"end-policy$")}, + {"start": re.compile(r"^prefix-set"), "end": re.compile(r"end-set$")}, + {"start": re.compile(r"^as-path-set"), "end": re.compile(r"end-set$")}, + {"start": re.compile(r"^community-set"), "end": re.compile(r"end-set$")}, + {"start": re.compile(r"^rd-set"), "end": re.compile(r"end-set$")}, + { + "start": re.compile(r"^extcommunity-set"), + "end": re.compile(r"end-set$"), + }, +] + + +def get_provider_argspec(): + return iosxr_provider_spec + + +def get_connection(module): + if hasattr(module, "connection"): + return module.connection + + capabilities = get_capabilities(module) + network_api = capabilities.get("network_api") + if network_api == "cliconf": + module.connection = Connection(module._socket_path) + elif network_api == "netconf": + module.connection = NetconfConnection(module._socket_path) + else: + module.fail_json( + msg="Invalid connection type {0!s}".format(network_api) + ) + + return module.connection + + +def get_capabilities(module): + if hasattr(module, "capabilities"): + return module.capabilities + try: + capabilities = Connection(module._socket_path).get_capabilities() + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + module.capabilities = json.loads(capabilities) + + return module.capabilities + + +def build_xml_subtree(container_ele, xmap, param=None, opcode=None): + sub_root = container_ele + meta_subtree = list() + + for key, meta in xmap.items(): + candidates = meta.get("xpath", "").split("/") + if container_ele.tag == candidates[-2]: + parent = container_ele + elif sub_root.tag == candidates[-2]: + parent = sub_root + else: + parent = sub_root.find( + ".//" + + meta.get("xpath", "") + .split(sub_root.tag + "/", 1)[1] + .rsplit("/", 1)[0] + ) + + if ( + opcode in ("delete", "merge") + and meta.get("operation", "unknown") == "edit" + ) or meta.get("operation", None) is None: + + if meta.get("tag", False) is True: + if parent.tag == container_ele.tag: + if meta.get("ns", False) is True: + child = etree.Element( + candidates[-1], + nsmap=NS_DICT[key.upper() + "_NSMAP"], + ) + else: + child = etree.Element(candidates[-1]) + meta_subtree.append(child) + sub_root = child + else: + if meta.get("ns", False) is True: + child = etree.SubElement( + parent, + candidates[-1], + nsmap=NS_DICT[key.upper() + "_NSMAP"], + ) + else: + child = etree.SubElement(parent, candidates[-1]) + + if meta.get("attrib", None) is not None and opcode in ( + "delete", + "merge", + ): + child.set(BASE_1_0 + meta.get("attrib"), opcode) + + continue + + text = None + param_key = key.split(":") + if param_key[0] == "a": + if ( + param is not None + and param.get(param_key[1], None) is not None + ): + text = param.get(param_key[1]) + elif param_key[0] == "m": + if meta.get("value", None) is not None: + text = meta.get("value") + + if text: + if meta.get("ns", False) is True: + child = etree.SubElement( + parent, + candidates[-1], + nsmap=NS_DICT[key.upper() + "_NSMAP"], + ) + else: + child = etree.SubElement(parent, candidates[-1]) + child.text = text + + if meta.get("attrib", None) is not None and opcode in ( + "delete", + "merge", + ): + child.set(BASE_1_0 + meta.get("attrib"), opcode) + + if len(meta_subtree) > 1: + for item in meta_subtree: + container_ele.append(item) + + if sub_root == container_ele: + return None + else: + return sub_root + + +def build_xml(container, xmap=None, params=None, opcode=None): + """ + Builds netconf xml rpc document from meta-data + + Args: + container: the YANG container within the namespace + xmap: meta-data map to build xml tree + params: Input params that feed xml tree values + opcode: operation to be performed (merge, delete etc.) + + Example: + Module inputs: + banner_params = [{'banner':'motd', 'text':'Ansible banner example', 'state':'present'}] + + Meta-data definition: + bannermap = collections.OrderedDict() + bannermap.update([ + ('banner', {'xpath' : 'banners/banner', 'tag' : True, 'attrib' : "operation"}), + ('a:banner', {'xpath' : 'banner/banner-name'}), + ('a:text', {'xpath' : 'banner/banner-text', 'operation' : 'edit'}) + ]) + + Fields: + key: exact match to the key in arg_spec for a parameter + (prefixes --> a: value fetched from arg_spec, m: value fetched from meta-data) + xpath: xpath of the element (based on YANG model) + tag: True if no text on the element + attrib: attribute to be embedded in the element (e.g. xc:operation="merge") + operation: if edit --> includes the element in edit_config() query else ignores for get() queries + value: if key is prefixed with "m:", value is required in meta-data + + Output: + + + + motd + Ansible banner example + + + + :returns: xml rpc document as a string + """ + if opcode == "filter": + root = etree.Element("filter", type="subtree") + elif opcode in ("delete", "merge"): + root = etree.Element("config", nsmap=NS_DICT["BASE_NSMAP"]) + + container_ele = etree.SubElement( + root, container, nsmap=NS_DICT[container.upper() + "_NSMAP"] + ) + + if xmap is not None: + if params is None: + build_xml_subtree(container_ele, xmap, opcode=opcode) + else: + subtree_list = list() + for param in to_list(params): + subtree_ele = build_xml_subtree( + container_ele, xmap, param=param, opcode=opcode + ) + if subtree_ele is not None: + subtree_list.append(subtree_ele) + + for item in subtree_list: + container_ele.append(item) + + return etree.tostring(root, encoding="unicode") + + +def etree_find(root, node): + try: + root = etree.fromstring(to_bytes(root)) + except (ValueError, etree.XMLSyntaxError): + pass + + return root.find(".//%s" % node.strip()) + + +def etree_findall(root, node): + try: + root = etree.fromstring(to_bytes(root)) + except (ValueError, etree.XMLSyntaxError): + pass + + return root.findall(".//%s" % node.strip()) + + +def is_cliconf(module): + capabilities = get_capabilities(module) + return capabilities.get("network_api") == "cliconf" + + +def is_netconf(module): + capabilities = get_capabilities(module) + network_api = capabilities.get("network_api") + if network_api == "netconf": + if not HAS_NCCLIENT: + module.fail_json(msg="ncclient is not installed") + if not HAS_XML: + module.fail_json(msg="lxml is not installed") + return True + + return False + + +def get_config_diff(module, running=None, candidate=None): + conn = get_connection(module) + + if is_cliconf(module): + try: + response = conn.get("show commit changes diff") + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + return response + elif is_netconf(module): + if running and candidate: + # ignore rpc-reply root node and diff from data element onwards + running_data_ele = etree.fromstring( + to_bytes(running.strip()) + ).getchildren()[0] + candidate_data_ele = etree.fromstring( + to_bytes(candidate.strip()) + ).getchildren()[0] + + running_data = to_text(etree.tostring(running_data_ele)).strip() + candidate_data = to_text( + etree.tostring(candidate_data_ele) + ).strip() + if running_data != candidate_data: + d = Differ() + diff = list( + d.compare( + running_data.splitlines(), candidate_data.splitlines() + ) + ) + return "\n".join(diff).strip() + + return None + + +def discard_config(module): + conn = get_connection(module) + try: + if is_netconf(module): + conn.discard_changes(remove_ns=True) + else: + conn.discard_changes() + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + + +def commit_config( + module, + comment=None, + confirmed=False, + confirm_timeout=None, + persist=False, + check=False, + label=None, +): + conn = get_connection(module) + reply = None + try: + if is_netconf(module): + if check: + reply = conn.validate(remove_ns=True) + else: + reply = conn.commit( + confirmed=confirmed, + timeout=confirm_timeout, + persist=persist, + remove_ns=True, + ) + elif is_cliconf(module): + if check: + module.fail_json( + msg="Validate configuration is not supported with network_cli connection type" + ) + else: + reply = conn.commit(comment=comment, label=label) + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + + return reply + + +def get_oper(module, filter=None): + conn = get_connection(module) + + if filter is not None: + try: + if is_netconf(module): + response = conn.get(filter=filter, remove_ns=True) + else: + response = conn.get(filter) + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + else: + return None + + return to_bytes( + etree.tostring(response), errors="surrogate_then_replace" + ).strip() + + +def get_config(module, config_filter=None, source="running"): + conn = get_connection(module) + + # Note: Does not cache config in favour of latest config on every get operation. + try: + if is_netconf(module): + out = to_xml( + conn.get_config( + source=source, filter=config_filter, remove_ns=True + ) + ) + elif is_cliconf(module): + out = conn.get_config(source=source, flags=config_filter) + cfg = out.strip() + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + return cfg + + +def check_existing_commit_labels(conn, label): + out = conn.get( + command="show configuration history detail | include %s" % label + ) + label_exist = re.search(label, out, re.M) + if label_exist: + return True + else: + return False + + +def load_config( + module, + command_filter, + commit=False, + replace=False, + comment=None, + admin=False, + exclusive=False, + running=None, + nc_get_filter=None, + label=None, +): + + conn = get_connection(module) + + diff = None + if is_netconf(module): + # FIXME: check for platform behaviour and restore this + # conn.lock(target = 'candidate') + # conn.discard_changes() + + try: + for filter in to_list(command_filter): + conn.edit_config(config=filter, remove_ns=True) + + candidate = get_config( + module, source="candidate", config_filter=nc_get_filter + ) + diff = get_config_diff(module, running, candidate) + + if commit and diff: + commit_config(module) + else: + discard_config(module) + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + finally: + # conn.unlock(target = 'candidate') + pass + + elif is_cliconf(module): + try: + if label: + old_label = check_existing_commit_labels(conn, label) + if old_label: + module.fail_json( + msg="commit label {%s} is already used for" + " an earlier commit, please choose a different label" + " and rerun task" % label + ) + + response = conn.edit_config( + candidate=command_filter, + commit=commit, + admin=admin, + exclusive=exclusive, + replace=replace, + comment=comment, + label=label, + ) + if module._diff: + diff = response.get("diff") + + # Overwrite the default diff by the IOS XR commit diff. + # See plugins/cliconf/iosxr.py for this key set: show_commit_config_diff + diff = response.get("show_commit_config_diff") + + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + + return diff + + +def run_commands(module, commands, check_rc=True): + connection = get_connection(module) + try: + return connection.run_commands(commands=commands, check_rc=check_rc) + except ConnectionError as exc: + module.fail_json(msg=to_text(exc)) + + +def copy_file(module, src, dst, proto="scp"): + conn = get_connection(module) + try: + conn.copy_file(source=src, destination=dst, proto=proto) + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + + +def get_file(module, src, dst, proto="scp"): + conn = get_connection(module) + try: + conn.get_file(source=src, destination=dst, proto=proto) + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + + +# A list of commands like {end-set, end-policy, ...} are part of configuration +# block like { prefix-set, as-path-set , ... } but they are not indented properly +# to be included with their parent. sanitize_config will add indentation to +# end-* commands so they are included with their parents +def sanitize_config(config, force_diff_prefix=None): + conf_lines = config.split("\n") + for regex in CONFIG_MISPLACED_CHILDREN: + for index, line in enumerate(conf_lines): + m = regex.search(line) + if m and m.group(0): + if force_diff_prefix: + conf_lines[index] = " " + m.group(0) + force_diff_prefix + else: + conf_lines[index] = " " + m.group(0) + conf = ("\n").join(conf_lines) + return conf + + +def mask_config_blocks_from_diff(config, candidate, force_diff_prefix): + conf_lines = config.split("\n") + candidate_lines = candidate.split("\n") + + for regex in CONFIG_BLOCKS_FORCED_IN_DIFF: + block_index_start_end = [] + for index, line in enumerate(candidate_lines): + startre = regex["start"].search(line) + if startre and startre.group(0): + start_index = index + else: + endre = regex["end"].search(line) + if endre and endre.group(0): + end_index = index + new_block = True + for prev_start, prev_end in block_index_start_end: + if start_index == prev_start: + # This might be end-set of another regex + # otherwise we would be having new start + new_block = False + break + if new_block and start_index: + block_index_start_end.append((start_index, end_index)) + + for start, end in block_index_start_end: + diff = False + if candidate_lines[start] in conf_lines: + run_conf_start_index = conf_lines.index(candidate_lines[start]) + else: + diff = False + continue + for i in range(start, end + 1): + if conf_lines[run_conf_start_index] == candidate_lines[i]: + run_conf_start_index = run_conf_start_index + 1 + else: + diff = True + break + if diff: + run_conf_start_index = conf_lines.index(candidate_lines[start]) + for i in range(start, end + 1): + conf_lines[run_conf_start_index] = ( + conf_lines[run_conf_start_index] + force_diff_prefix + ) + run_conf_start_index = run_conf_start_index + 1 + + conf = ("\n").join(conf_lines) + return conf diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/bgp/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/bgp/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/bgp/address_family.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/bgp/address_family.py new file mode 100644 index 00000000..fd9c9bf2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/bgp/address_family.py @@ -0,0 +1,129 @@ +# +# (c) 2019, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +import re + +from ansible.module_utils.six import iteritems +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.providers.providers import ( + CliProvider, +) + + +class AddressFamily(CliProvider): + def render(self, config=None): + commands = list() + safe_list = list() + + router_context = "router bgp %s" % self.get_value("config.bgp_as") + context_config = None + + for item in self.get_value("config.address_family"): + context = "address-family %s %s" % (item["afi"], item["safi"]) + context_commands = list() + + if config: + context_path = [router_context, context] + context_config = self.get_config_context( + config, context_path, indent=1 + ) + + for key, value in iteritems(item): + if value is not None: + meth = getattr(self, "_render_%s" % key, None) + if meth: + resp = meth(item, context_config) + if resp: + context_commands.extend(to_list(resp)) + + if context_commands: + commands.append(context) + commands.extend(context_commands) + commands.append("exit") + + safe_list.append(context) + + if config: + resp = self._negate_config(config, safe_list) + commands.extend(resp) + + return commands + + def _negate_config(self, config, safe_list=None): + commands = list() + matches = re.findall(r"(address-family .+)$", config, re.M) + for item in set(matches).difference(safe_list): + commands.append("no %s" % item) + return commands + + def _render_networks(self, item, config=None): + commands = list() + safe_list = list() + + for entry in item["networks"]: + network = entry["prefix"] + if entry["masklen"]: + network = "%s/%s" % (entry["prefix"], entry["masklen"]) + safe_list.append(network) + + cmd = "network %s" % network + + if entry["route_map"]: + cmd += " route-policy %s" % entry["route_map"] + + if not config or cmd not in config: + commands.append(cmd) + + if config and self.params["operation"] == "replace": + matches = re.findall(r"network (\S+)", config, re.M) + for entry in set(matches).difference(safe_list): + commands.append("no network %s" % entry) + + return commands + + def _render_redistribute(self, item, config=None): + commands = list() + safe_list = list() + + for entry in item["redistribute"]: + option = entry["protocol"] + + cmd = "redistribute %s" % entry["protocol"] + + if entry["id"] and entry["protocol"] in ( + "ospf", + "eigrp", + "isis", + "ospfv3", + ): + cmd += " %s" % entry["id"] + option += " %s" % entry["id"] + + if entry["metric"]: + cmd += " metric %s" % entry["metric"] + + if entry["route_map"]: + cmd += " route-policy %s" % entry["route_map"] + + if not config or cmd not in config: + commands.append(cmd) + + safe_list.append(option) + + if self.params["operation"] == "replace": + if config: + matches = re.findall( + r"redistribute (\S+)(?:\s*)(\d*)", config, re.M + ) + for i in range(0, len(matches)): + matches[i] = " ".join(matches[i]).strip() + for entry in set(matches).difference(safe_list): + commands.append("no redistribute %s" % entry) + + return commands diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/bgp/neighbors.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/bgp/neighbors.py new file mode 100644 index 00000000..1ea870f7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/bgp/neighbors.py @@ -0,0 +1,135 @@ +# +# (c) 2019, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +import re +import socket + +from ansible.module_utils.six import iteritems +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.providers.providers import ( + CliProvider, +) + + +class Neighbors(CliProvider): + def render(self, config=None): + commands = list() + safe_list = list() + + router_context = "router bgp %s" % self.get_value("config.bgp_as") + context_config = None + + for item in self.get_value("config.neighbors"): + context_commands = list() + + neighbor = item["neighbor"] + + try: + socket.inet_aton(neighbor) + context = "neighbor %s" % neighbor + except socket.error: + context = "neighbor-group %s" % neighbor + + if config: + context_path = [router_context, context] + context_config = self.get_config_context( + config, context_path, indent=1 + ) + + for key, value in iteritems(item): + if value is not None: + meth = getattr(self, "_render_%s" % key, None) + if meth: + resp = meth(item, context_config) + if resp: + context_commands.extend(to_list(resp)) + + if context_commands: + commands.append(context) + commands.extend(context_commands) + commands.append("exit") + + safe_list.append(context) + + if config and safe_list: + commands.extend(self._negate_config(config, safe_list)) + + return commands + + def _negate_config(self, config, safe_list=None): + commands = list() + matches = re.findall(r"(neighbor \S+)", config, re.M) + for item in set(matches).difference(safe_list): + commands.append("no %s" % item) + return commands + + def _render_remote_as(self, item, config=None): + cmd = "remote-as %s" % item["remote_as"] + if not config or cmd not in config: + return cmd + + def _render_description(self, item, config=None): + cmd = "description %s" % item["description"] + if not config or cmd not in config: + return cmd + + def _render_enabled(self, item, config=None): + cmd = "shutdown" + if item["enabled"] is True: + cmd = "no %s" % cmd + if not config or cmd not in config: + return cmd + + def _render_update_source(self, item, config=None): + cmd = "update-source %s" % item["update_source"].replace(" ", "") + if not config or cmd not in config: + return cmd + + def _render_password(self, item, config=None): + cmd = "password %s" % item["password"] + if not config or cmd not in config: + return cmd + + def _render_ebgp_multihop(self, item, config=None): + cmd = "ebgp-multihop %s" % item["ebgp_multihop"] + if not config or cmd not in config: + return cmd + + def _render_tcp_mss(self, item, config=None): + cmd = "tcp mss %s" % item["tcp_mss"] + if not config or cmd not in config: + return cmd + + def _render_advertisement_interval(self, item, config=None): + cmd = "advertisement-interval %s" % item["advertisement_interval"] + if not config or cmd not in config: + return cmd + + def _render_neighbor_group(self, item, config=None): + cmd = "use neighbor-group %s" % item["neighbor_group"] + if not config or cmd not in config: + return cmd + + def _render_timers(self, item, config): + """generate bgp timer related configuration + """ + keepalive = item["timers"]["keepalive"] + holdtime = item["timers"]["holdtime"] + min_neighbor_holdtime = item["timers"]["min_neighbor_holdtime"] + + if keepalive and holdtime: + cmd = "timers %s %s" % (keepalive, holdtime) + if min_neighbor_holdtime: + cmd += " %s" % min_neighbor_holdtime + if not config or cmd not in config: + return cmd + else: + raise ValueError( + "required both options for timers: keepalive and holdtime" + ) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/bgp/process.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/bgp/process.py new file mode 100644 index 00000000..8b0aec3a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/cli/config/bgp/process.py @@ -0,0 +1,126 @@ +# +# (c) 2019, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +import re + +from ansible.module_utils.six import iteritems +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.providers.providers import ( + register_provider, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.providers.providers import ( + CliProvider, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.providers.cli.config.bgp.neighbors import ( + Neighbors, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.providers.cli.config.bgp.address_family import ( + AddressFamily, +) + +REDISTRIBUTE_PROTOCOLS = frozenset( + [ + "ospf", + "ospfv3", + "eigrp", + "isis", + "static", + "connected", + "lisp", + "mobile", + "rip", + "subscriber", + ] +) + + +@register_provider("iosxr", "iosxr_bgp") +class Provider(CliProvider): + def render(self, config=None): + commands = list() + + existing_as = None + if config: + match = re.search(r"router bgp (\d+)", config, re.M) + if match: + existing_as = match.group(1) + + operation = self.params["operation"] + + context = None + + if self.params["config"]: + context = "router bgp %s" % self.get_value("config.bgp_as") + + if operation == "delete": + if existing_as: + commands.append("no router bgp %s" % existing_as) + elif context: + commands.append("no %s" % context) + + else: + if operation == "replace": + if existing_as and int(existing_as) != self.get_value( + "config.bgp_as" + ): + # The negate command has to be committed before new BGP AS is used. + self.connection.edit_config( + "no router bgp %s" % existing_as + ) + config = None + + elif operation == "override": + if existing_as: + # The negate command has to be committed before new BGP AS is used. + self.connection.edit_config( + "no router bgp %s" % existing_as + ) + config = None + + context_commands = list() + + for key, value in iteritems(self.get_value("config")): + if value is not None: + meth = getattr(self, "_render_%s" % key, None) + if meth: + resp = meth(config) + if resp: + context_commands.extend(to_list(resp)) + + if context and context_commands: + commands.append(context) + commands.extend(context_commands) + commands.append("exit") + + return commands + + def _render_router_id(self, config=None): + cmd = "bgp router-id %s" % self.get_value("config.router_id") + if not config or cmd not in config: + return cmd + + def _render_log_neighbor_changes(self, config=None): + cmd = "bgp log neighbor changes" + log_neighbor_changes = self.get_value("config.log_neighbor_changes") + if log_neighbor_changes is True: + if not config or cmd not in config: + return "%s detail" % cmd + elif log_neighbor_changes is False: + if config and cmd in config: + return "%s disable" % cmd + + def _render_neighbors(self, config): + """ generate bgp neighbor configuration + """ + return Neighbors(self.params).render(config) + + def _render_address_family(self, config): + """ generate address-family configuration + """ + return AddressFamily(self.params).render(config) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/module.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/module.py new file mode 100644 index 00000000..4786b80c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/module.py @@ -0,0 +1,72 @@ +# +# (c) 2019, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.connection import Connection +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.providers import ( + providers, +) +from ansible.module_utils._text import to_text + + +class NetworkModule(AnsibleModule): + + fail_on_missing_provider = True + + def __init__(self, connection=None, *args, **kwargs): + super(NetworkModule, self).__init__(*args, **kwargs) + + if connection is None: + connection = Connection(self._socket_path) + + self.connection = connection + + @property + def provider(self): + if not hasattr(self, "_provider"): + capabilities = self.from_json(self.connection.get_capabilities()) + + network_os = capabilities["device_info"]["network_os"] + network_api = capabilities["network_api"] + + if network_api == "cliconf": + connection_type = "network_cli" + + cls = providers.get( + network_os, self._name.split(".")[-1], connection_type + ) + + if not cls: + msg = ( + "unable to find suitable provider for network os %s" + % network_os + ) + if self.fail_on_missing_provider: + self.fail_json(msg=msg) + else: + self.warn(msg) + + obj = cls(self.params, self.connection, self.check_mode) + + setattr(self, "_provider", obj) + + return getattr(self, "_provider") + + def get_facts(self, subset=None): + try: + self.provider.get_facts(subset) + except Exception as exc: + self.fail_json(msg=to_text(exc)) + + def edit_config(self, config_filter=None): + current_config = self.connection.get_config(flags=config_filter) + try: + commands = self.provider.edit_config(current_config) + changed = bool(commands) + return {"commands": commands, "changed": changed} + except Exception as exc: + self.fail_json(msg=to_text(exc)) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/providers.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/providers.py new file mode 100644 index 00000000..485eb383 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/providers/providers.py @@ -0,0 +1,128 @@ +# +# (c) 2019, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +import json + +from threading import RLock + +from ansible.module_utils.six import itervalues +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config import ( + NetworkConfig, +) + + +_registered_providers = {} +_provider_lock = RLock() + + +def register_provider(network_os, module_name): + def wrapper(cls): + _provider_lock.acquire() + try: + if network_os not in _registered_providers: + _registered_providers[network_os] = {} + for ct in cls.supported_connections: + if ct not in _registered_providers[network_os]: + _registered_providers[network_os][ct] = {} + for item in to_list(module_name): + for entry in itervalues(_registered_providers[network_os]): + entry[item] = cls + finally: + _provider_lock.release() + return cls + + return wrapper + + +def get(network_os, module_name, connection_type): + network_os_providers = _registered_providers.get(network_os) + if network_os_providers is None: + raise ValueError("unable to find a suitable provider for this module") + if connection_type not in network_os_providers: + raise ValueError("provider does not support this connection type") + elif module_name not in network_os_providers[connection_type]: + raise ValueError("could not find a suitable provider for this module") + return network_os_providers[connection_type][module_name] + + +class ProviderBase(object): + + supported_connections = () + + def __init__(self, params, connection=None, check_mode=False): + self.params = params + self.connection = connection + self.check_mode = check_mode + + @property + def capabilities(self): + if not hasattr(self, "_capabilities"): + resp = self.from_json(self.connection.get_capabilities()) + setattr(self, "_capabilities", resp) + return getattr(self, "_capabilities") + + def get_value(self, path): + params = self.params.copy() + for key in path.split("."): + params = params[key] + return params + + def get_facts(self, subset=None): + raise NotImplementedError(self.__class__.__name__) + + def edit_config(self): + raise NotImplementedError(self.__class__.__name__) + + +class CliProvider(ProviderBase): + + supported_connections = ("network_cli",) + + @property + def capabilities(self): + if not hasattr(self, "_capabilities"): + resp = self.from_json(self.connection.get_capabilities()) + setattr(self, "_capabilities", resp) + return getattr(self, "_capabilities") + + def get_config_context(self, config, path, indent=1): + if config is not None: + netcfg = NetworkConfig(indent=indent, contents=config) + try: + config = netcfg.get_block_config(to_list(path)) + except ValueError: + config = None + return config + + def render(self, config=None): + raise NotImplementedError(self.__class__.__name__) + + def cli(self, command): + try: + if not hasattr(self, "_command_output"): + setattr(self, "_command_output", {}) + return self._command_output[command] + except KeyError: + out = self.connection.get(command) + try: + out = json.loads(out) + except ValueError: + pass + self._command_output[command] = out + return out + + def get_facts(self, subset=None): + return self.populate() + + def edit_config(self, config=None): + commands = self.render(config) + if commands and self.check_mode is False: + self.connection.edit_config(commands) + return commands diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/acl_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/acl_interfaces.py new file mode 100644 index 00000000..7f07a123 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/acl_interfaces.py @@ -0,0 +1,61 @@ +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import re + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network_template import ( + NetworkTemplate, +) + + +class Acl_interfacesTemplate(NetworkTemplate): + def __init__(self, lines=None): + super(Acl_interfacesTemplate, self).__init__(lines=lines, tmplt=self) + + # fmt: off + PARSERS = [ + { + 'name': 'interface', + 'getval': re.compile(r''' + ^interface + \s(preconfigure)*\s* + (?P\S+)$''', re.VERBOSE), + 'setval': 'interface {{ name }}', + 'result': { + '{{ name }}': { + 'name': '{{ name }}', + 'access_groups': {}, + }, + }, + 'shared': True + }, + { + "name": "access_groups", + "getval": re.compile( + r""" + \s+(?Pipv4|ipv6) + \saccess-group\s(?P\S+) + \s(?P\S+)$ + """, + re.VERBOSE, + ), + "setval": "{{ afi }} access-group {{ name }} {{ 'egress' if direction == 'out' else 'ingress' }}", + "result": { + "{{ name }}": { + "access_groups": { + "{{ afi }}": { + "afi": "{{ afi }}", + "acls": [ + { + "name": "{{ acl_name }}", + "direction": "{{ 'in' if direction == 'ingress' else 'out' }}", + }, + ], + } + } + } + } + }, + ] + # fmt: on diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/ospf_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/ospf_interfaces.py new file mode 100644 index 00000000..3cd153d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/ospf_interfaces.py @@ -0,0 +1,1370 @@ +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +import re +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network_template import ( + NetworkTemplate, +) + + +def get_ospf_type(afi): + return "ospf" if afi == "ipv4" else "ospfv3" + + +def get_interface_type(name): + return ( + "GigabitEthernet" if name.startswith("GigabitEthernet") else "Loopback" + ) + + +def _compute_command(cfg): + ospf_type = get_ospf_type(cfg["address_family"]["afi"]) + type = get_interface_type(cfg["name"]) + area = cfg["address_family"]["processes"]["area"] + pid = cfg["address_family"]["processes"]["process_id"] + cmd = "router {0} {1} area {2} interface {3} {4}".format( + ospf_type, pid, area["area_id"], type, cfg["name"].split(type)[1] + ) + return cmd + + +def _tmplt_ospf_int_delete(config_data): + ospf_type = get_ospf_type(config_data["afi"]) + type = get_interface_type(config_data["name"]) + area = config_data["area"] + command = "router {0} {1} area {2} interface {3} {4}".format( + ospf_type, + config_data["process"], + area["area_id"], + type, + config_data["name"].split(type)[1], + ) + return command + + +def _tmplt_ospf_config(config_data): + command = _compute_command(config_data) + return command + + +def _tmplt_ospf_authentication_md_config(config_data): + command = _compute_command(config_data) + auth = config_data["address_family"]["authentication"] + if auth["message_digest"].get("keychain"): + command += ( + " authentication message-digest keychain " + + auth["message_digest"]["keychain"] + ) + return command + + +def _tmplt_ospf_authentication_md_set(config_data): + command = _compute_command(config_data) + auth = config_data["address_family"]["authentication"] + if auth.get("message_digest") and auth["message_digest"].get("keychain"): + command += " authentication message-digest" + elif auth.get("null_auth"): + command += " authentication null" + return command + + +def _tmplt_ospf_authentication_key(config_data): + command = _compute_command(config_data) + auth = config_data["address_family"]["authentication_key"] + if auth.get("password"): + command += " authentication-key " + auth["password"] + elif auth.get("encrypted"): + command += " authentication-key encrypted " + auth["encrypted"] + elif auth.get("clear"): + command += " authentication-key clear " + auth["clear"] + return command + + +def _tmplt_ospf_int_bfd_min_int(config_data): + command = _compute_command(config_data) + bfd = config_data["address_family"]["bfd"] + if bfd.get("minimum_interval"): + command += " bfd minimum-interval " + str(bfd["minimum_interval"]) + return command + + +def _tmplt_ospf_int_bfd_mult(config_data): + command = _compute_command(config_data) + bfd = config_data["address_family"]["bfd"] + if bfd.get("multiplier"): + command += " bfd multiplier " + str(bfd["multiplier"]) + return command + + +def _tmplt_ospf_int_bfd_fd(config_data): + command = _compute_command(config_data) + bfd = config_data["address_family"]["bfd"] + if bfd.get("fast_detect") and bfd["fast_detect"].get("set"): + command += " bfd fast-detect" + elif bfd.get("fast_detect") and bfd["fast_detect"].get("disable"): + command += " bfd fast-detect disable" + elif bfd.get("fast_detect") and bfd["fast_detect"].get("strict_mode"): + command += " bfd fast-detect strict-mode" + return command + + +def _tmplt_ospf_cost_config(config_data): + command = _compute_command(config_data) + command += " cost " + str(config_data["address_family"]["cost"]) + return command + + +def _tmplt_ospf_cost_fallback_config(config_data): + command = _compute_command(config_data) + fallback = config_data["address_family"]["cost_fallback"] + command += ( + " cost-fallback " + + str(fallback["cost"]) + + " threshold " + + str(fallback["threshold"]) + ) + return command + + +def _tmplt_ospf_dead_int_config(config_data): + command = _compute_command(config_data) + command += " dead-interval " + str( + config_data["address_family"]["dead_interval"] + ) + return command + + +def _tmplt_ospf_demand_config(config_data): + command = _compute_command(config_data) + if config_data["address_family"]["demand_circuit"]: + command += " demand-circuit enable" + else: + command += " demand-circuit disable" + return command + + +class Ospf_interfacesTemplate(NetworkTemplate): + def __init__(self, lines=None): + super(Ospf_interfacesTemplate, self).__init__(lines=lines, tmplt=self) + + # fmt: off + PARSERS = [ + { + "name": "name", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + $''', + re.VERBOSE), + "remval": _tmplt_ospf_int_delete, + "setval": _tmplt_ospf_config, + "compval": "name", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + }, + }, + }, + "shared": True, + }, + { + "name": "authentication.message_digest", + "getval": re.compile( + r""" + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \sauthentication(?P) + \s(?Pmessage-digest) + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_authentication_md_set, + "compval": "address_family.authentication.message_digest", + "result": { + "{{ name }}": { + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "authentication": { + "set": "{{ True if authentication is defined and opt is undefined }}", + "message_digest": { + "set": "{{ True if opt == 'message-digest' else None }}", + }, + } + }, + } + } + } + }, + { + "name": "authentication.message_digest.keychain", + "getval": re.compile( + r""" + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \sauthentication(?P) + \s(?Pmessage-digest) + \skeychain\s(?P\S+)$""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_authentication_md_config, + "compval": "address_family.authentication.message_digest.keychain", + "result": { + "{{ name }}": { + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "authentication": { + "message_digest": { + "keychain": "{{ keychain }}", + }, + } + }, + } + } + } + }, + { + "name": "authentication.null_auth", + "getval": re.compile( + r""" + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \sauthentication(?P) + \s(?Pnull) + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_authentication_md_set, + "compval": "address_family.authentication.null_auth", + "result": { + "{{ name }}": { + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "authentication": { + "set": "{{ True if authentication is defined and opt is undefined }}", + "null_auth": "{{ True if opt == 'null' else None }}", + } + }, + } + } + } + }, + { + "name": "authentication_key", + "getval": re.compile( + r""" + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \sauthentication-key + (\sencrypted\s(?P\S+))? + (\s(?P\S+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_authentication_key, + "compval": "address_family.authentication_key", + "result": { + "{{ name }}": { + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "authentication_key": { + "encrypted": "{{ encrypted }}", + } + }, + } + } + } + }, + { + "name": "bfd.minimum_interval", + "getval": re.compile( + r""" + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \sbfd(?P) + \sminimum-interval\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_int_bfd_min_int, + "compval": "address_family.bfd.minimum_interval", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + + } + }, + "bfd": { + "minimum_interval": "{{ minimum_interval|int }}", + }, + }, + }, + }, + } + }, + { + "name": "bfd.multiplier", + "getval": re.compile( + r""" + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \sbfd(?P) + \smultiplier\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_int_bfd_mult, + "compval": "address_family.bfd.multiplier", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + + } + }, + "bfd": { + "multiplier": "{{ multiplier|int }}", + }, + }, + }, + }, + } + }, + { + "name": "bfd.fast_detect.set", + "getval": re.compile( + r""" + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \sbfd(?P) + \sfast-detect(?P) + (\s(?P(disable|strict-mode)))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_int_bfd_fd, + "compval": "address_family.bfd.fast_detect.set", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + + } + }, + "bfd": { + "fast_detect": { + "set": "{{ True if opt != 'disable' and opt != 'strict-mode' and fast_detect is defined else None }}", + }, + }, + }, + }, + }, + } + }, + { + "name": "bfd.fast_detect.disable", + "getval": re.compile( + r""" + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \sbfd(?P) + \sfast-detect(?P) + (\s(?P(disable|strict-mode)))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_int_bfd_fd, + "compval": "address_family.bfd.fast_detect.disable", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + + } + }, + "bfd": { + "fast_detect": { + "disable": "{{ True if opt == 'disable' else None }}" + }, + }, + }, + }, + }, + }, + }, + { + "name": "bfd.fast_detect.strict_mode", + "getval": re.compile( + r""" + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \sbfd(?P) + \sfast-detect(?P) + \s(?Pstrict-mode) + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_int_bfd_fd, + "compval": "address_family.bfd.fast_detect.strict_mode", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "bfd": { + "fast_detect": { + "strict_mode": "{{ True if opt == 'strict-mode' else None }}", + }, + }, + }, + }, + }, + }, + }, + { + "name": "cost", + "getval": re.compile( + r""" + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \scost\s(?P\S+)$""", + re.VERBOSE), + "setval": _tmplt_ospf_cost_config, + "compval": "address_family.cost", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "cost": "{{ cost }}" + }, + }, + }, + } + }, + { + "name": "cost_fallback", + "getval": re.compile( + r""" + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \scost-fallback\s(?P\S+) + \sthreshold\s(?P\S+) + $""", + re.VERBOSE), + "setval": _tmplt_ospf_cost_fallback_config, + "compval": "address_family.cost_fallback", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "cost_fallback": { + "cost": "{{ cost }}", + "threshold": "{{ threshold }}" + } + }, + }, + }, + } + }, + { + "name": "dead_interval", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \sdead-interval\s(?P\S+) + $''', + re.VERBOSE), + "setval": _tmplt_ospf_dead_int_config, + "compval": "address_family.dead_interval", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "dead_interval": "{{ dead_interval }}" + }, + }, + }, + } + }, + { + "name": "demand_circuit", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \sdemand-circuit\s(?P\S+) + $''', + re.VERBOSE), + "setval": _tmplt_ospf_demand_config, + "compval": "address_family.demand_circuit", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "demand_circuit": "{{ True if demand_circuit == 'enable' else False if demand_circuit == 'disable' else None }}" + }, + }, + }, + } + }, + { + "name": "flood_reduction", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \sflood-reduction\s(?P\S+) + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "flood-reduction {{ 'enable' if flood_reduction == True else 'disable' }}", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "flood_reduction": "{{ True if flood_reduction == 'enable' else False if flood_reduction == 'disable' else None }}" + }, + }, + }, + } + }, + { + "name": "hello_interval", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \shello-interval\s(?P\S+) + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "hello-interval {{ hello_interval }}", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "hello_interval": "{{ hello_interval }}" + }, + }, + }, + } + }, + { + "name": "link_down.set", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \s(?Plink-down) + (\s(?Pdisable))? + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "link-down", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "link_down": { + "set": "{{ True if link_down is defined and disable is undefined else None}}" + } + }, + }, + }, + } + }, + { + "name": "link_down.disable", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \s(?Plink-down) + \s(?Pdisable) + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "link-down disable", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "link_down": { + "disable": "{{ True if disable is defined else None }}" + } + }, + }, + }, + } + }, + { + "name": "message_digest_key", + "getval": re.compile( + r""" + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \smessage-digest-key + \s(?P\d+) + \smd5 + \s(?P\d) + \s(?P\S+)$""", + re.VERBOSE, + ), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface " + "{{ type }} {{ name }} #message-digest-key {{ message_digest_key.id }} " + "md5 encrypted {{ message_digest_key.encrypted}}", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "message_digest_key": { + "id": "{{ id }}", + "encrypted": "{{ encryption }}", + } + }, + } + } + } + }, + { + "name": "mpls.set_ldp", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \s(?Pmpls) + \s(?Pset_ldp) + (\s(?Psync))? + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "mpls ldp", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "mpls": { + "set_ldp": "{{ True if set_ldp is defined and sync is undefined else None}}" + } + }, + }, + }, + } + }, + { + "name": "mpls.ldp_sync", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \s(?Pmpls) + \s(?Pldp) + \s(?Psync) + (\s(?Pdisable))? + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "mpls ldp sync", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "mpls": { + "ldp_sync": "{{ True if sync is defined and disable is undefined else None}}" + } + }, + }, + }, + } + }, + { + "name": "mpls.ldp_sync_disable", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \s(?Pmpls) + \s(?Pldp) + \s(?Psync) + \s(?Pdisable) + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "mpls ldp sync disable", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "mpls": { + "ldp_sync": "{{ False if disable is defined }}" + } + }, + }, + }, + } + }, + { + "name": "mtu_ignore", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \smtu-ignore\s(?P\S+) + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "mtu_ignore {{ 'enable' if mtu_ignore == 'True' else 'disable' if mtu_ignore == 'False' }}", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "mtu_ignore": "{{ True if mtu_ignore == 'enable' else False if mtu_ignore == 'disable' else None }}" + }, + }, + }, + } + }, + { + "name": "network", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \snetwork\s(?P\S+) + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "network {{ network }}", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "network": "{{ network }}" + }, + }, + }, + } + }, + { + "name": "packet_size", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \spacket-size\s(?P\S+) + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "packet-size {{ packet_size }}", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "packet_size": "{{ packet_size }}" + }, + }, + }, + } + }, + { + "name": "passive", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \spassive\s(?P\S+) + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "passive {{ 'enable' if passive == 'True' else 'disable' if passive == 'False' }}", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "passive": "{{ True if passive == 'enable' else False if passive == 'disable' else None }}" + }, + }, + }, + } + }, + { + "name": "prefix_suppression.disable", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \sprefix-suppression\s(?P\S+) + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "prefix-suppression {{ prefix_suppression }}", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "prefix_suppression": { + "disable": "{{ True if prefix_suppression == 'disable' else None }}" + } + }, + }, + }, + } + }, + { + "name": "prefix_suppression.secondary_address", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \s(?Pprefix-suppression) + \s(?Psecondary-address) + (\s(?Pdisable))? + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "prefix-suppression secondary-address {{ disable if secondary_address is False }}", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "prefix_suppression": { + "secondary_address": "{{ True if secondary_address is defined and " + "disable is undefined else False if disable is defined else None }}" + }, + }, + }, + }, + } + }, + { + "name": "priority", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \spriority\s(?P\d+) + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "priority {{ priority }}", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "priority": "{{ priority|int }}" + }, + }, + }, + } + }, + { + "name": "retransmit_interval", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \sretransmit-interval\s(?P\d+) + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "retransmit-interval {{ retransmit_interval }}", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "retransmit_interval": "{{ retransmit_interval|int }}" + }, + }, + }, + } + }, + { + "name": "security.ttl_hops", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \s(?Psecurity) + \s(?Pttl) + \shops\s(?P\d+) + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "security ttl hops {{ hops }}", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "security_ttl": { + "hops": "{{ hops|int }}" + }, + }, + }, + }, + } + }, + { + "name": "security.ttl", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \s(?Psecurity) + \s(?Pttl) + (\s(?Phops))? + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "security ttl", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "security_ttl": { + "set": "{{ True if ttl is defined and hops is undefined }}" + }, + }, + }, + }, + } + }, + { + "name": "transmit_delay", + "getval": re.compile(r''' + ^router + \s(?Pospf|ospfv3) + \s(?P\S+) + \sarea\s(?P\S+) + \sinterface\s(?P\S+) + \stransmit-delay\s(?P\d+) + $''', + re.VERBOSE), + "setval": "router {{ ospf_type }} {{ process_id }} area {{ area_id }} interface {{ type }} {{ name }} " + "transmit-delay {{ transmit_delay }}", + "result": { + "{{ name }}": { + "name": "{{ name }}", + "type": "{{ 'gigabitethernet' if 'GigabitEthernet' in name else 'loopback' if 'Loopback' in name }}", + "address_family": { + "{{ ospf_type }}": { + "afi": "{{ 'ipv4' if ospf_type == 'ospf' else 'ipv6' }}", + "processes": { + "{{ process_id }}": { + "process_id": "{{ process_id }}", + "area": { + "area_id": "{{ area_id }}", + }, + } + }, + "transmit_delay": "{{ transmit_delay|int }}" + }, + }, + }, + } + }, + ] + # fmt: on diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/ospfv2.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/ospfv2.py new file mode 100644 index 00000000..83527d03 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/ospfv2.py @@ -0,0 +1,2876 @@ +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +import re +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network_template import ( + NetworkTemplate, +) +from ansible.module_utils.six import iteritems + + +def _tmplt_ospf_default_information(config_data): + if "default_information_originate" in config_data: + command = "default-information originate" + if "always" in config_data["default_information_originate"]: + command += " always" + if "metric" in config_data["default_information_originate"]: + command += " metric {metric}".format( + **config_data["default_information_originate"] + ) + if "metric_type" in config_data["default_information_originate"]: + command += " metric-type {metric_type}".format( + **config_data["default_information_originate"] + ) + if "route_policy" in config_data["default_information_originate"]: + command += " route-policy {route_policy}".format( + **config_data["default_information_originate"] + ) + return command + + +def _tmplt_ospf_auto_cost(config_data): + if "auto_cost" in config_data: + command = "auto-cost" + if "disable" in config_data["auto_cost"]: + command += " disable" + if "reference_bandwidth" in config_data["auto_cost"]: + command += " reference-bandwidth {reference_bandwidth}".format( + **config_data["auto_cost"] + ) + return command + + +def _tmplt_ospf_bfd(config_data): + if "bfd" in config_data: + command = "bfd" + if "minimum_interval" in config_data["bfd"]: + command += " minimum-interval {minimum_interval}".format( + **config_data["bfd"] + ) + + if "multiplier" in config_data["bfd"]: + command += " multiplier {multiplier}".format(**config_data["bfd"]) + + return command + + +def _tmplt_ospf_security(config_data): + if "security_ttl" in config_data: + command = "security_ttl" + if "set" in config_data["security_ttl"]: + command += " ttl" + elif config_data["security_ttl"].get("hops"): + command += " ttl hops {0}".format( + config_data["security_ttl"].get("hops") + ) + return command + + +def _tmplt_ospf_log_adjacency(config_data): + if "log_adjacency_changes" in config_data: + command = "log adjacency" + if "set" in config_data["log_adjacency_changes"]: + command += " changes" + elif config_data["log_adjacency_changes"].get("disable"): + command += " disable" + elif config_data["log_adjacency_changes"].get("details"): + command += " details" + return command + + +def _tmplt_ospf_log_max_lsa(config_data): + if "max_lsa" in config_data: + command = "max-lsa" + if "threshold" in config_data["max_lsa"]: + command += " {0}".format(config_data["max_lsa"].get("threshold")) + if "warning_only" in config_data["max_lsa"]: + command += " warning-only {0}".format( + config_data["max_lsa"].get("warning_only") + ) + if "ignore_time" in config_data["max_lsa"]: + command += " ignore-time {0}".format( + config_data["max_lsa"].get("ignore_time") + ) + if "ignore_count" in config_data["max_lsa"]: + command += " ignore-count {0}".format( + config_data["max_lsa"].get("ignore_count") + ) + if "reset_time" in config_data["max_lsa"]: + command += " reset-time {0}".format( + config_data["max_lsa"].get("reset_time") + ) + return command + + +def _tmplt_ospf_max_metric(config_data): + if "max_metric" in config_data: + command = "max-metric" + if "router_lsa" in config_data["max_metric"]: + command += " router-lsa" + if "external_lsa" in config_data["max_metric"]: + command += " external-lsa {external_lsa}".format( + **config_data["max_metric"] + ) + if "include_stub" in config_data["max_metric"]: + command += " include-stub" + if "on_startup" in config_data["max_metric"]: + if "time" in config_data["max_metric"]["on_startup"]: + command += " on-startup {time}".format( + **config_data["max_metric"]["on_startup"] + ) + elif "wait_for_bgp" in config_data["max_metric"]["on_startup"]: + command += " on-startup wait-for-bgp" + if "summary_lsa" in config_data["max_metric"]: + command += " summary-lsa {summary_lsa}".format( + **config_data["max_metric"] + ) + return command + + +def _tmplt_ospf_distance_admin(config_data): + if "admin_distance" in config_data: + command = "distance" + if config_data["admin_distance"].get("value"): + command += " {0}".format( + config_data["admin_distance"].get("value") + ) + if config_data["admin_distance"].get("source"): + command += " {0}".format( + config_data["admin_distance"].get("source") + ) + if config_data["admin_distance"].get("wildcard"): + command += " {0}".format( + config_data["admin_distance"].get("wildcard") + ) + if config_data["admin_distance"].get("access_list"): + command += " {0}".format( + config_data["admin_distance"].get("access_list") + ) + return command + + +def _tmplt_ospf_distance_ospf(config_data): + if "ospf_distance" in config_data: + command = "distance ospf" + if config_data["ospf_distance"].get("external"): + command += " external {0}".format( + config_data["ospf_distance"].get("external") + ) + if config_data["ospf_distance"].get("inter_area"): + command += " inter-area {0}".format( + config_data["ospf_distance"].get("inter_area") + ) + if config_data["ospf_distance"].get("intra_area"): + command += " intra-area {0}".format( + config_data["ospf_distance"].get("intra_area") + ) + return command + + +def _tmplt_ospf_nsr(config_data): + if "nsr" in config_data: + command = "nsr" + if "set" in config_data["nsr"]: + command += " nsr" + elif config_data["nsr"].get("disable"): + command += " nsr {0}".format("disable") + return command + + +def _tmplt_ospf_protocol(config_data): + if "protocol_shutdown" in config_data: + command = "protocol" + if "set" in config_data["protocol_shutdown"]: + command += " shutdown" + elif config_data["shutdown"].get("host_mode"): + command += " shutdown host-mode" + elif config_data["shutdown"].get("on_reload"): + command += " shutdown on-reload" + return command + + +def _tmplt_microloop_avoidance(config_data): + if "microloop_avoidance" in config_data: + command = "microloop avoidance" + if "protected" in config_data["microloop_avoidance"]: + command += " protected" + if "segment_routing" in config_data["microloop_avoidance"]: + command += " segment_routing" + if "rib_update_delay" in config_data["microloop_avoidance"]: + command += " rin-update-delay {0}".config_data[ + "microloop_avoidance" + ].get("rib_update_delay") + return command + + +def _tmplt_ospf_bfd_fast_detect(config_data): + if "bfd" in config_data: + command = "bfd" + if "fast_detect" in config_data["bfd"]: + fast_detect = config_data["bfd"].get("fast_detect") + command += " fast-detect" + if "strict_mode" in fast_detect: + command += " strict-mode" + return command + + +def _tmplt_ospf_mpls_traffic_eng(config_data): + if "traffic_eng" in config_data: + command = "mpls traffic-eng" + if "igp_intact" in config_data["traffic_eng"]: + command += " igp-intact" + if "ldp_sync_update" in config_data["traffic_eng"]: + command += " ldp_sync_update" + if "multicast_intact" in config_data["traffic_eng"]: + command += " multicast_intact" + if "auto_route_exclude" in config_data["traffic_eng"]: + policy = config_data["traffic_eng"].get("autoroute_exclude") + command += " autoroute-exlude route-policy {0}".format( + policy.get("route_policy") + ) + return command + + +def _tmplt_ospf_authentication_md(config_data): + command = [] + if "authentication" in config_data: + if config_data["authentication"].get("message_digest"): + command = "authentication message-digest" + md = config_data["authentication"].get("message_digest") + if md.get("keychain"): + command += " keychain " + md.get("keychain") + return command + + +def _tmplt_ospf_authentication(config_data): + command = [] + if "authentication" in config_data: + if config_data["authentication"].get("keychain"): + command = "authentication keychain " + config_data[ + "authentication" + ].get("keychain") + elif config_data["authentication"].get("no_auth"): + command = "authentication null" + return command + + +def _tmplt_ospf_adjacency_stagger(config_data): + if "adjacency_stagger" in config_data: + command = "adjacency stagger".format(**config_data) + if config_data["adjacency_stagger"].get( + "min_adjacency" + ) and config_data["adjacency_stagger"].get("min_adjacency"): + command += " {0} {1}".format( + config_data["adjacency_stagger"].get("min_adjacency"), + config_data["adjacency_stagger"].get("max_adjacency"), + ) + elif config_data["adjacency_stagger"].get("disable"): + command += " disable" + return command + + +def _tmplt_ospf_adjacency_distribute_bgp_state(config_data): + if "distribute_link_list" in config_data: + command = "distribute link-state" + if config_data["distribute_link_list"].get("instance_id"): + command += " instance-id {0}".format( + config_data["distribute_link_list"].get("instance_id") + ) + elif config_data["distribute_link_list"].get("throttle"): + command += " throttle {0}".format( + config_data["distribute_link_list"].get("throttle") + ) + return command + elif "distribute_bgp_ls" in config_data: + command = "distribute bgp-ls" + if config_data["distribute_bgp_ls"].get("instance_id"): + command += " instance-id {0}".format( + config_data["distribute_bgp_ls"].get("instance_id") + ) + elif config_data["distribute_bgp_ls"].get("throttle"): + command += " throttle {0}".format( + config_data["distribute_bgp_ls"].get("throttle") + ) + return command + + +def _tmplt_ospf_capability_opaque(config_data): + if "capability" in config_data: + if "opaque" in config_data["capability"]: + command = "capability opaque" + opaque = config_data["capability"].get("opaque") + if "disable" in opaque: + command += "capability opaque disable" + return command + + +def _tmplt_ospf_authentication_key(config_data): + if "authentication_key" in config_data: + command = "authentication-key".format(**config_data) + if config_data["authentication_key"].get("password"): + command += " {0}".format( + config_data["authentication_key"].get("password") + ) + return command + + +def _tmplt_ospf_area_authentication(config_data): + if "authentication" in config_data: + command = "area {area_id} authentication".format(**config_data) + if config_data["authentication"].get("keychain"): + command += " keychain " + config_data["authentication"].get( + "keychain" + ) + elif config_data["authentication"].get("no_auth"): + command += " null" + return command + + +def _tmplt_ospf_area_authentication_md(config_data): + if "authentication" in config_data: + command = "area {area_id} authentication".format(**config_data) + if "message_digest" in config_data["authentication"]: + command = "authentication message-digest" + md = config_data["authentication"].get("message_digest") + if md.get("keychain"): + command += " keychain " + md.get("keychain") + return command + + +def _tmplt_ospf_area_authentication_key(config_data): + if "authentication_key" in config_data: + command = "area {area_id} authentication-key".format(**config_data) + if config_data["authentication_key"].get("password"): + command += " {0}".format( + config_data["authentication_key"].get("password") + ) + return command + + +def _tmplt_ospf_area_mpls_ldp(config_data): + commands = [] + if "mpls" in config_data: + command = "area {area_id} mpls".format(**config_data) + if config_data["mpls"].get("ldp"): + ldp = config_data["mpls"].get("ldp") + if "auto_config" in ldp: + command += " auto-config" + commands.append(command) + if "sync" in ldp: + command += " sync" + commands.append(command) + if "sync_igp_shortcuts" in ldp: + command += " sync-igp-shortcuts" + commands.append(command) + return commands + + +def _tmplt_ospf_area_bfd(config_data): + if "bfd" in config_data: + command = "area {area_id} bfd".format(**config_data) + if "minimum_interval" in config_data["bfd"]: + command += " minimum-interval {minimum_interval}".format( + **config_data["bfd"] + ) + + if "multiplier" in config_data["bfd"]: + command += " multiplier {multiplier}".format(**config_data["bfd"]) + + return command + + +def _tmplt_ospf_area_bfd_fast_detect(config_data): + if "bfd" in config_data: + command = "area {area_id} bfd".format(**config_data) + if "fast_detect" in config_data["bfd"]: + fast_detect = config_data["bfd"].get("fast_detect") + command += " fast-detect" + if "strict_mode" in fast_detect: + command += " strict-mode" + return command + + +def _tmplt_ospf_mpls_ldp(config_data): + commands = [] + if "mpls" in config_data: + command = "mpls".format(**config_data) + if config_data["mpls"].get("ldp"): + ldp = config_data["mpls"].get("ldp") + if "auto_config" in ldp: + command += " auto-config" + commands.append(command) + if "sync" in ldp: + command += " sync" + commands.append(command) + if "sync_igp_shortcuts" in ldp: + command += " sync-igp-shortcuts" + commands.append(command) + return commands + + +def _tmplt_ospf_area_nssa(config_data): + if "nssa" in config_data: + command = "area {area_id} nssa".format(**config_data) + if config_data["nssa"].get("no_redistribution"): + command += " no-redistribution" + if config_data["nssa"].get("no_summary"): + command += " no-summary" + return command + + +def _tmplt_ospf_area_nssa_def_info_origin(config_data): + if "nssa" in config_data: + command = "area {area_id} nssa".format(**config_data) + if "default_information_originate" in config_data["nssa"]: + command += " default-information-originate" + def_info_origin = config_data["nssa"].get( + "default_information_originate" + ) + if "metric" in def_info_origin: + command += " metric {metric}".format( + **config_data["nssa"]["default_information_originate"] + ) + if "metric_type" in def_info_origin: + command += " metric-type {metric_type}".format( + **config_data["nssa"]["default_information_originate"] + ) + return command + + +def _tmplt_ospf_area_nssa_translate(config_data): + if "nssa" in config_data: + command = "area {area_id} nssa".format(**config_data) + if config_data["nssa"].get("translate"): + command += " translate" + translate = config_data["nssa"].get("translate") + if "type7" in translate: + command += " type7" + if translate["type7"].get("always"): + command += " always" + return command + + +def _tmplt_ospf_area_vlink_authentication(config_data): + if "authentication" in config_data: + command = "area {area_id} virtual-link {id} authentication".format( + **config_data + ) + if config_data["authentication"].get("keychain"): + command += " keychain " + config_data["authentication"].get( + "keychain" + ) + elif config_data["authentication"].get("no_auth"): + command += " null" + return command + + +def _tmplt_ospf_area_vlink_authentication_md(config_data): + if "authentication" in config_data: + command = "area {area_id} virtual-link {id} authentication".format( + **config_data + ) + if config_data["authentication"].get("message_digest"): + command = "authentication message-digest" + md = config_data["authentication"].get("message_digest") + if md.get("keychain"): + command += " keychain " + md.get("keychain") + return command + + +def _tmplt_ospf_area_vlink_authentication_key(config_data): + if "authentication_key" in config_data: + command = "area {area_id} virtual-link {id} authentication-key".format( + **config_data + ) + if config_data["authentication_key"].get("password"): + command += " {0}".format( + config_data["authentication_key"].get("password") + ) + return command + + +def _tmplt_ospf_area_stub(config_data): + if "stub" in config_data: + command = "area {area_id} stub".format(**config_data) + if config_data["stub"].get("no_summary"): + command += " no-summary" + return command + + +def _tmplt_ospf_area_ranges(config_data): + if "ranges" in config_data: + commands = [] + for k, v in iteritems(config_data["ranges"]): + cmd = "area {area_id} range".format(**config_data) + temp_cmd = " {address}".format(**v) + if "advertise" in v: + temp_cmd += " advertise" + elif "not_advertise" in v: + temp_cmd += " not-advertise" + cmd += temp_cmd + commands.append(cmd) + return commands + + +def _tmplt_prefix_suppression(config_data): + if "prefix_suppression" in config_data: + if "set" in config_data["prefix_suppression"]: + command = "prefix-suppression" + if "secondary_address" in config_data["prefix_suppression"]: + command = "prefix-suppression secondary-address" + return command + + +def _tmplt_protocol_shutdown(config_data): + if "protocol_shutdown" in config_data: + if "set" in config_data["protocol_shutdown"]: + command = "protocol-shutdown" + if "host_mode" in config_data["protocol_shutdown"]: + command = "protocol-shutdown host-mode" + if "on_reload" in config_data["protocol_shutdown"]: + command = "protocol-shutdown on-reload" + return command + + +def _tmplt_timers_lsa(config_data): + if "timers" in config_data: + command = "timers lsa" + if "group_pacing" in config_data["timers"]["lsa"]: + command += " group-pacing {group_pacing}".format( + **config_data["timers"]["lsa"] + ) + if "min_arrival" in config_data["timers"]["lsa"]: + command += " min-arrival {min_arrival}".format( + **config_data["timers"]["lsa"] + ) + if "refresh" in config_data["timers"]["lsa"]: + command += " refresh {refresh}".format( + **config_data["timers"]["lsa"] + ) + return command + + +def _tmplt_timers_graceful_shutdown(config_data): + if "timers" in config_data: + command = "timers graceful-shutdown" + if "initial_delay" in config_data["timers"]["graceful-shutdown"]: + command += " initial delay {initial_delay}".format( + **config_data["timers"]["graceful-shutdown"] + ) + if "retain_routes" in config_data["timers"]["graceful-shutdown"]: + command += " retain routes {retain_routes}".format( + **config_data["timers"]["graceful-shutdown"] + ) + return command + + +class Ospfv2Template(NetworkTemplate): + def __init__(self, lines=None): + super(Ospfv2Template, self).__init__(lines=lines, tmplt=self) + + # fmt: off + PARSERS = [ + { + "name": "pid", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + $""", + re.VERBOSE, + ), + "setval": "router ospf {{ process_id }}", + "result": { + "processes": {"{{ pid }}": {"process_id": "{{ pid }}"}} + }, + "shared": True, + }, + { + "name": "cost", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \scost(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "cost {{ cost }}", + "result": { + "processes": { + "{{ pid }}": { + "cost": "{{ cost|int }}", + } + } + }, + }, + { + "name": "default_metric", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sdefault-metric(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "default-metric {{ default_metric }}", + "result": { + "processes": { + "{{ pid }}": { + "default_metric": "{{ default_metric|int }}", + } + } + }, + }, + { + "name": "packet_size", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \spacket-size(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "packet-size {{ packet_size }}", + "result": { + "processes": { + "{{ pid }}": { + "packet_size": "{{ packet_size|int }}", + } + } + }, + }, + { + "name": "dead_interval", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sdead-interval(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "dead-interval {{ dead_interval }}", + "result": { + "processes": { + "{{ pid }}": { + "dead_interval": "{{ dead_interval|int }}", + } + } + }, + }, + { + "name": "hello_interval", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \shello-interval(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "hello-interval {{ hello_interval }}", + "result": { + "processes": { + "{{ pid }}": { + "hello_interval": "{{ hello_interval|int }}", + } + } + }, + }, + { + "name": "priority", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \spriority(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "priority {{ priority }}", + "result": { + "processes": { + "{{ pid }}": { + "priority": "{{ priority|int }}", + } + } + }, + }, + { + "name": "weight", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sweight(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "weight {{ weight }}", + "result": { + "processes": { + "{{ pid }}": { + "weight": "{{ weight|int }}", + } + } + }, + }, + { + "name": "retransmit_interval", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sretransmit-interval(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "retransmit-interval {{ retransmit_interval }}", + "result": { + "processes": { + "{{ pid }}": { + "retransmit_interval": "{{ retransmit_interval|int }}", + } + } + }, + }, + { + "name": "transmit_delay", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \stransmit-delay(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "transmit-delay {{ transmit_delay }}", + "result": { + "processes": { + "{{ pid }}": { + "transmit_delay": "{{ transmit_delay|int }}", + } + } + }, + }, + { + "name": "passive", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \spassive\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "passive {{ passive }}", + "result": { + "processes": { + "{{ pid }}": { + "passive": "{{ passive }}", + } + } + }, + }, + { + "name": "process.database_filter", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sdatabase-filter + \sall + \sout\s(?P\s\S+) + $""", + re.VERBOSE, + ), + + "setval": "process.database_filter", + "result": { + "processes": { + "{{ pid }}": { + "database_filter": "{{ database_filter }}", + } + } + }, + }, + { + "name": "demand_circuit", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sdemand-circuit\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "demand-circuit {{ demand_circuit }}", + "result": { + "processes": { + "{{ pid }}": { + "demand_circuit": "{{ demand_circuit }}", + } + } + }, + }, + { + "name": "external_out", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sexternal-out\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "external-out {{ external_out }}", + "result": { + "processes": { + "{{ pid }}": { + "external_out": "{{ external_out }}", + } + } + }, + }, + { + "name": "router_id", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \srouter-id\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "router-id {{ router_id }}", + "result": { + "processes": { + "{{ pid }}": { + "router_id": "{{ router_id }}", + } + } + }, + }, + { + "name": "summary_in", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \ssummary-in\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "summary-in {{ summary_in }}", + "result": { + "processes": { + "{{ pid }}": { + "summary_in": "{{ summary_in }}", + } + } + }, + }, + + { + "name": "mtu_ignore", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \smtu-ignore\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "mtu-ignore {{ mtu_ignore }}", + "result": { + "processes": { + "{{ pid }}": { + "mtu_ignore": "{{ mtu_ignore }}", + } + } + }, + }, + { + "name": "flood_reduction", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sflood-reduction\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "flood-reduction {{ flood_reduction }}", + "result": { + "processes": { + "{{ pid }}": { + "flood_reduction": "{{ flood_reduction }}", + } + } + }, + }, + { + "name": "loopback_stub_network", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sloopback(?P) + \sstub-network\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "loopback stub-network {{ stub_network }}", + "result": { + "processes": { + "{{ pid }}": { + "loopback_stub_network": "{{ loopback_stub_network }}", + } + } + }, + }, + { + "name": "address_family_unicast", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \saddress-family(?P) + \sipv4(?P) + \sunicast(?P) + $""", + re.VERBOSE, + ), + + "setval": "address_family_unicast", + "result": { + "processes": { + "{{ pid }}": { + "address_family_unicast": "{{ True if unicast is defined }}", + } + } + }, + }, + { + "name": "default_weight", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sapply-weight(?P) + \sdefault-weight(?P\s\d+) + $""", + re.VERBOSE, + ), + "setval": "apply-weight default-weight {{ default_weight }}", + "result": { + "processes": { + "{{ pid }}": { + "apply_weight": { + "default_weight": "{{ default_weight|int }}", + } + } + } + }, + }, + { + "name": "bandwidth", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sapply-weight(?P) + \sbandwidth(?P\s\d+)? + $""", + re.VERBOSE, + ), + "setval": "apply-weight bandwidth {{ bandwidth }}", + "result": { + "processes": { + "{{ pid }}": { + "apply_weight": { + "bandwidth": "{{ bandwidth|int }}", + } + } + } + }, + }, + { + "name": "adjacency_stagger", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sadjacency(?P) + \sstagger(?P) + (\s(?P\d+))? + (\s(?P\d+))? + (\sdisable(?P\S+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_adjacency_stagger, + "result": { + "processes": { + "{{ pid }}": { + "adjacency_stagger": { + "min_adjacency": "{{ min_adjacency|int }}", + "max_adjacency": "{{ max_adjacency }}", + "disable": "{{ True if disable is defined }}", + }, + } + } + }, + }, + { + "name": "authentication", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sauthentication(?P) + (\skeychain\s(?P\S+)*)? + (\snull(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_authentication, + "result": { + "processes": { + "{{ pid }}": { + "authentication": { + "no_auth": "{{ True if no_auth is defined }}", + "keychain": "{{ keychain }}", + }, + } + } + }, + }, + { + "name": "authentication.message_digest", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sauthentication(?P) + \smessage-digest(?P) + \skeychain\s(?P\S+) + *$""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_authentication_md, + "result": { + "processes": { + "{{ pid }}": { + "authentication": { + "message_digest": { + "keychain": "{{ md_key }}", + "set": "{{ True if md is defined and md_key is undefined }}", + } + }, + } + } + }, + }, + { + "name": "default_information_originate", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sdefault-information(?P) + (\soriginate(?P))? + (\salways(?P))? + (\smetric\s(?P\d+))? + (\smetric-type\s(?P\d+))? + (\sroute_policy\s(?P)\S+)? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_default_information, + "result": { + "processes": { + "{{ pid }}": { + "default_information_originate": { + "always": "{{ True if always is defined }}", + "metric": "{{ metric|int }}", + "metric_type": "{{ metric_type|int }}", + "route_policy": "{{ route_policy }}", + "set": "{{ True if default_information is defined and always is undefined and metric " + "is undefined and metric_type is undefined and route_policy is undefined }}" + }, + } + } + }, + }, + { + "name": "auto_cost", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sauto-cost(?P) + (\sreference-bandwidth\s(?P\d+))? + (\sdisable(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_auto_cost, + "result": { + "processes": { + "{{ pid }}": { + "auto_cost": { + "disable": "{{ True if disable is defined }}", + "reference_bandwidth": "{{ reference_bandwidth|int }}", + }, + } + } + }, + }, + { + "name": "bfd", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sbfd(?P) + (\sminimum-interval\s(?P\d+))? + (\smultiplier\s(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_bfd, + "result": { + "processes": { + "{{ pid }}": { + "bfd": { + "minimum_interval": "{{ minimum_interval|int }}", + "multiplier": "{{ multiplier|int }}", + }, + } + } + }, + }, + { + "name": "bfd.fast_detect", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sbfd(?P) + \sfast-detect(?P) + (\s(?Pdisable))? + (\s(?Pstrict-mode))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_bfd_fast_detect, + "result": { + "processes": { + "{{ pid }}": { + "bfd": { + "fast_detect": { + "set": "{{ True if disable is undefined and strict_mode is undefined }}", + "strict_mode": "{{ True if strict_mode is defined }}", + }, + }, + } + }, + }, + }, + { + "name": "security", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \ssecurity(?P) + \sttl(?P)? + (\shops\s(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_security, + "result": { + "processes": { + "{{ pid }}": { + "security_ttl": { + "set": "{{ True if ttl is defined and hops is undefined }}", + "hops": "{{ hops }}", + }, + } + } + }, + }, + { + "name": "nsr", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \snsr(?P) + \sdisable(?P)? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_nsr, + "result": { + "processes": { + "{{ pid }}": { + "nsr": { + "set": "{{ True if nsr is defined and disable is undefined }}", + "disable": "{{ True if disable is defined }}", + }, + } + } + }, + }, + { + "name": "protocol", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sprotocol(?P) + \s(shutdown(?P)) + (\shost-mode(?P))? + (\son-reload\s(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_protocol, + "result": { + "processes": { + "{{ pid }}": { + "protocol_shutdown": { + "set": "{{ True if shutdown is defined and host-mode is undefined and on_reload is undefined }}", + "host_mode": "{{ True if host_mode is defined }}", + "on_reload": "{{ True if on_reload is defined }}", + }, + } + } + }, + }, + { + "name": "capability", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \scapability(?P) + (\stype7\s(?P\S+))? + $""", + re.VERBOSE, + ), + "setval": "capability type7 {{ type7 }}", + "result": { + "processes": { + "{{ pid }}": { + "capability": { + "type7": "{{ type7 }}" + }, + } + } + }, + }, + { + "name": "capability.opaque", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \scapability(?P)? + \sopaque(?P) + (\sdisable(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_capability_opaque, + "result": { + "processes": { + "{{ pid }}": { + "capability": { + "opaque": { + "disable": "{{ True if disable is defined }}", + "set": "{{ True if opaque is defined and disable is undefined }}", + }, + }, + } + } + }, + }, + { + "name": "admin_distance", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sdistance\s(?Pd+) + \s(?P\S+) + \s(?P\S+) + (\s(?P\S+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_distance_admin, + "result": { + "processes": { + "{{ pid }}": { + "distance": { + "admin_distance": { + "value": "{{ value|int }}", + "source": "{{ source }}", + "wildcard": "{{ wildcard }}", + "access_list": "{{ access_list }}", + } + }, + } + } + }, + }, + + { + "name": "ospf_distance", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sdistance(?P) + \sospf(?P) + (\sexternal\s(?P\d+))? + (\sinter-area\s(?P\d+))? + (\sintra-area\s(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_distance_ospf, + "result": { + "processes": { + "{{ pid }}": { + "distance": { + "ospf_distance": { + "external": "{{ external|int }}", + "inter_area": "{{ inter_area|int }}", + "intra_area": "{{ intra_area|int }}", + } + }, + } + } + }, + }, + { + "name": "authentication_key", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sauthentication-key(?P) + (\s(?P\S+))? + (\sclear\s(?P)\S+)? + (\sencrypted(?P\S+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_authentication_key, + "result": { + "processes": { + "{{ pid }}": { + "authentication_key": { + "clear": "{{ clear }}", + "encrypted": "{{ encrypted}}", + "password": "{{ password if clear is undefined and encrypted is undefined }}", + }, + } + } + }, + }, + { + "name": "area.default_cost", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \sdefault-cost\s(?P\d+) + $""", + re.VERBOSE, + ), + + "setval": "area {{ area_id }} default-cost {{ default_cost }}", + "compval": "default_cost", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "default_cost": "{{ default_cost|int }}", + } + } + } + } + }, + }, + { + "name": "area.dead_interval", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \sdead-interval\s(?P\d+) + $""", + re.VERBOSE, + ), + + "setval": "area {{ area_id }} dead-interval {{ dead_interval }}", + "compval": "dead_interval", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "dead_interval": "{{ dead_interval|int }}", + } + } + } + } + }, + }, + { + "name": "area.hello_interval", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \shello-interval\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} hello-interval {{ hello_interval }}", + "compval": "hello_interval", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "hello_interval": "{{ hello_interval|int }}", + } + } + } + } + }, + }, + { + "name": "area.transmit_delay", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \stransmit-delay\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} transmit-delay {{ transmit_delay }}", + "compval": "transmit_delay", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "transmit_delay": "{{ transmit_delay|int }}", + } + } + } + } + }, + }, + { + "name": "area.cost", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \scost\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} cost {{ cost }}", + "compval": "cost", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "cost": "{{ cost|int }}", + } + } + } + } + }, + }, + { + "name": "area.priority", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \spriority\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} priority {{ priority }}", + "compval": "priority", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "priority": "{{ priority|int }}", + } + } + } + } + }, + }, + { + "name": "area.weight", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \sweight\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} weight {{ weight }}", + "compval": "weight", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "weight": "{{ weight|int }}", + } + } + } + } + }, + }, + { + "name": "area.packet_size", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \spacket-size\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} packet-size {{ packet_size }}", + "compval": "packet_size", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "packet_size": "{{ packet_size|int }}", + } + } + } + } + }, + }, + { + "name": "area.summary_in", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \ssummary-in\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "area {{ area_id }} summary-in {{ summary_in }}", + "compval": "summary_in", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "summary_in": "{{ summary_in }}", + } + } + } + } + }, + }, + { + "name": "area.demand_circuit", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \sdemand-circuit\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "area {{ area_id }} demand-circuit {{ demand_circuit }}", + "compval": "demand_circuit", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "demand_circuit": "{{ demand_circuit }}", + } + } + } + } + }, + }, + { + "name": "area.passive", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \spassive\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "area {{ area_id }} passive {{ passive }}", + "compval": "passive", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "passive": "{{ passive }}", + } + } + } + } + }, + }, + { + "name": "area.external_out", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \sexternal-out\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "area {{ area_id }} external-out {{ external_out }}", + "compval": "passive", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "external_out": "{{ external_out }}", + } + } + } + } + }, + }, + { + "name": "area.mtu_ignore", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \smtu-ignore\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "area {{ area_id }} mtu-ignore {{ mtu_ignore }}", + "compval": "mtu_ignore", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "mtu_ignore": "{{ mtu_ignore }}", + } + } + } + } + }, + }, + { + "name": "area.authentication", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \sauthentication(?P) + (\skeychain\s(?P\S+))? + (\snull(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_authentication, + "compval": "authentication", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "authentication": { + "no_auth": "{{ True if no_auth is defined }}", + "keychain": "{{ keychain }}", + }, + } + } + } + } + }, + }, + { + "name": "area.authentication_key", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \sauthentication-key(?P) + (\s(?P\S+))? + (\sclear\s(?P)\S+)? + (\sencrypted(?P\S+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_authentication_key, + "compval": "authentication_key", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "authentication_key": { + "clear": "{{ clear }}", + "encrypted": "{{ encrypted}}", + "password": "{{ password if clear is undefined and encrypted is undefined }}", + }, + } + } + } + } + }, + }, + { + "name": "area.authentication.message_digest", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \sauthentication(?P) + \smessage-digest(?P) + \skeychain(?P\s\S+) + *$""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_authentication_md, + "compval": "authentication.message_digest", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "authentication": { + "message_digest": { + "keychain": "{{ md_key }}", + } + }, + } + } + } + } + }, + }, + { + "name": "area.mpls_traffic_eng", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \smpls(?P) + \straffic-end(?P) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} mpls traffic-eng", + "compval": "mpls_traffic_eng", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "mpls": { + "traffic_eng": "{{ True if traffic_eng is defined }}", + }, + } + } + } + } + }, + }, + { + "name": "area.mpls_ldp", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \smpls(?P) + (\sauto-config(?P))? + (\ssync(?P))? + (\ssync-igp-shortcuts(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_mpls_ldp, + "compval": "mpls_ldp", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "mpls": { + "ldp": { + "auto_config": "{{ True if auto_config is defined }}", + "sync": "{{ True if sync is defined }}", + "sync_igp_shortcuts": "{{ True if sync_igp_shortcuts is defined }}", + + } + }, + } + } + } + } + }, + }, + { + "name": "area.bfd", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \sbfd(?P) + (\sminimum-interval\s(?P\d+))? + (\smultiplier\s(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_bfd, + "compval": "bfd", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "bfd": { + "minimum_interval": "{{ minimum_interval|int }}", + "multiplier": "{{ multiplier|int }}", + }, + } + } + } + } + }, + }, + { + "name": "area.bfd.fast_detect", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sbfd(?P) + \sarea(?P) + \sfast-detect(?P) + (\s(?Pdisable))? + (\s(?Pstrict-mode))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_bfd_fast_detect, + "compval": "bfd.fast_detect", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "bfd": { + "fast_detect": { + "set": "{{ True if disable is undefined and strict_mode is undefined }}", + "strict_mode": "{{ True if strict_mode is defined }}", + }, + }, + } + } + } + }, + }, + }, + { + "name": "area.stub", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \sstub(?P) + (\sno-summary(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_stub, + "compval": "stub", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "area_id": "{{ area_id }}", + "stub": { + "set": "{{ True if stub is defined and no_summary is undefined }}", + "no_summary": "{{ True if no_summary is defined }}", + } + } + } + } + }, + }, + { + "name": "area.nssa", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \snssa(?P) + (\sno-redistribution(?P))? + (\sno-summary(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_nssa, + "compval": "nssa", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "area_id": "{{ area_id }}", + "nssa": { + "set": "{{ True if nssa is defined and no_summary is undefined and no_redis is undefined }}", + "no_summary": "{{ True if no_summary is defined }}", + "no_redistribution": "{{ True if no_redis is defined }}" + } + } + } + } + }, + }, + { + "name": "area.nssa.default_information_originate", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \snssa(?P) + (\sno-redistribution(?P))? + (\sdefault-information-originate(?P))? + (\smetric\s(?P\d+))? + (\smetric-type\s(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_nssa_def_info_origin, + "compval": "nssa.default_information_originate", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "nssa": { + "default_information_originate": { + "metric": "{{ metric|int }}", + "metric_type": "{{ metric_type|int }}", + }, + } + } + } + } + }, + }, + }, + { + "name": "area.ranges", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \srange(?P) + \s(?P
\S+) + (\sadvertise(?P)) + (\snot-advertise(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_ranges, + "compval": "ranges", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "ranges": [ + { + "address": "{{ address }}", + "advertise": "{{ True if advertise is defined }}", + "not_advertise": "{{ True if not_advertise is defined }}", + } + ], + } + } + } + } + }, + }, + { + "name": "area.nssa.translate", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \snssa(?P) + \stranslate(?P) + \stype7(?P) + \salways\s(?P) + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_nssa_translate, + "compval": "nssa.translate", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "area_id": "{{ area_id }}", + "nssa": { + "translate": { + "type7": { + "always": "{{ True if always is defined }}" + } + }, + } + } + } + } + }, + }, + { + "name": "virtual_link.hello_interval", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \svirtual-link\s(?P\S+) + \shello-interval\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} virtual-link {{ id }} hello-interval {{ hello_interval }}", + "compval": "hello_interval", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "virtual_link": { + "{{ id }}": + { + "id": "{{ id }}", + "hello_interval": "{{ hello_interval|int }}" + } + + } + } + } + } + } + }, + }, + { + "name": "virtual_link.dead_interval", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \svirtual-link\s(?P\S+) + \sdead-interval\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} virtual-link {{ id }} dead-interval {{ dead_interval }}", + "compval": "dead_interval", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "virtual_link": { + "{{ id }}": { + "id": "{{ id }}", + "dead_interval": "{{ dead_interval|int }}" + } + + } + } + } + } + } + }, + }, + { + "name": "virtual_link.retransmit_interval", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \svirtual-link\s(?P\S+) + \sretransmit-interval\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} virtual-link {{ id }} retransmit-interval {{ retransmit_interval }}", + "compval": "retransmit_interval", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "virtual_link": { + "{{ id }}": { + "id": "{{ id }}", + "retransmit_interval": "{{ retransmit_interval|int }}" + } + } + + } + } + } + } + } + }, + { + "name": "virtual_link.authentication", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \savirtual-link\s(?P\S+) + \sauthentication(?P) + (\skeychain\s(?P\S+))? + (\snull(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_vlink_authentication, + "compval": "authentication", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "authentication": { + "no_auth": "{{ True if no_auth is defined }}", + "keychain": "{{ keychain }}", + }, + } + } + } + } + }, + }, + { + "name": "virtual_link.authentication_key", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \svirtual-link\s(?P\S+) + \sauthentication-key(?P) + (\s(?P\S+))? + (\sclear\s(?P)\S+)? + (\sencrypted(?P\S+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_vlink_authentication_key, + "compval": "authentication_key", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "virtual_link": { + "{{ id }}": { + "authentication_key": { + "clear": "{{ clear }}", + "encrypted": "{{ encrypted}}", + "password": "{{ password if clear is undefined and encrypted is undefined }}", + }, + } + } + } + } + } + } + }, + }, + { + "name": "virtual_link.authentication.message_digest", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sarea\s(?P\S+) + \svirtual-link\s(?P\S+) + \sauthentication(?P) + \smessage-digest(?P) + \skeychain(?P\s\S+) + *$""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_vlink_authentication_md, + "compval": "authentication.message_digest", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "virtual_link": { + "{{ id }}": { + "authentication": { + "message_digest": { + "keychain": "{{ md_key }}", + } + }, + } + } + } + } + } + } + }, + }, + { + "name": "link_down_fast_detect", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \slink-down + \sfast-detect(?P) + $""", + re.VERBOSE, + ), + "setval": "link-down fast-detect", + "result": { + "processes": { + "{{ pid }}": { + "link_down_fast_detect": "{{ True if fast_detect is defined }}", + } + } + }, + }, + { + "name": "nsr", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \snsr + \sdisable(?P) + $""", + re.VERBOSE, + ), + "setval": "nsr disable", + "result": { + "processes": { + "{{ pid }}": { + "disable": "{{ True if disable is defined }}", + } + } + }, + }, + { + "name": "database_filter", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sdatabase-filter + \sall + \sout\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "database-filter all out {{ outing }}", + "result": { + "processes": { + "{{ pid }}": { + "outing": "{{ outing }}" + } + } + }, + }, + { + "name": "distribute_link_state", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sdistribute(?P) + \slink-state(?P) + (\sinstance-id(?P\d+))? + (\sthrottle(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_adjacency_distribute_bgp_state, + "result": { + "processes": { + "{{ pid }}": { + "distribute_link_list": { + "instance_id": "{{ inst_id|int }}", + "throttle": "{{ throttle }}", + }, + } + } + }, + }, + { + "name": "distribute_bgp_ls", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sdistribute(?P) + \sbgp-ls(?P) + (\sinstance-id(?P\d+))? + (\sthrottle(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_adjacency_distribute_bgp_state, + "result": { + "processes": { + "{{ pid }}": { + "distribute_bgp_ls": { + "instance_id": "{{ inst_id|int }}", + "throttle": "{{ throttle }}", + }, + } + } + }, + }, + { + "name": "log_adjacency", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \slog(?P) + \sadjacency(?P)? + (\schanges(?P))? + (\sdisable(?P))? + (\sdetails(?P
))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_log_adjacency, + "result": { + "processes": { + "{{ pid }}": { + "log_adjacency_changes": { + "set": "{{ True changes id defined and disable is undefined and detail is undefined }}", + "disable": "{{ True if disable is defined }}", + "details": "{{ True if details is defined }}", + }, + } + } + }, + }, + { + "name": "max_lsa", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + (\smax-lsa\s(?P\d+))? + (\swarning-only\s(?P\d+)? + (\signore-time\s(?P\d+))? + (\signore-count\s(?P\d+))? + (\sreset-time\s(?P)\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_log_max_lsa, + "result": { + "processes": { + "{{ pid }}": { + "max_lsa": { + "threshold": "{{ threshold|int }}", + "warning_only": "{{ warning_only|int }}", + "ignore_time": "{{ ignore_time|int }}", + "ignore_count": "{{ ignore_count|int }}", + "reset_time": "{{ reset_time|int }}", + }, + } + } + }, + }, + { + "name": "max_metric", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \smax-metric + \s*(?P) + (\s*external-lsa(?P))? + (\s(?P\d+))? + \s*(?Pinclude-stub)* + \s*(?Pon-startup)* + \s*(?P\d+)* + \s*(wait-for\sbgp)* + \s*(?P\d+)* + \s*(?Psummary-lsa)* + \s*(?P\d+)* + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_max_metric, + "remval": "max-metric router-lsa", + "result": { + "processes": { + '{{ "pid" }}': { + "max_metric": { + "router_lsa": { + "set": "{{ True if router_lsa is defined and external_lsa is undefined else None }}", + "external_lsa": { + "set": "{{ True if external_lsa is defined and max_metric_value is undefined else None }}", + "max_metric_value": "{{ max_metric_value }}", + }, + "include_stub": "{{ not not include_stub }}", + "on_startup": { + "set": "{{ True if on_startup is defined and (wait_period and bgp_asn) is undefined else None }}", + "wait_period": "{{ wait_period }}", + "wait_for_bgp_asn": "{{ bgp_asn }}", + }, + "summary_lsa": { + "set": "{{ True if summary_lsa is defined and sum_lsa_max_metric_value is undefined else None }}", + "max_metric_value": "{{ sum_lsa_max_metric_value }}", + }, + } + } + } + } + }, + }, + { + "name": "mpls_ldp", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \smpls(?P) + (\sauto-config(?P))? + (\ssync(?P))? + (\ssync-igp-shortcuts(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_mpls_ldp, + "compval": "mpls_ldp", + "result": { + "processes": { + "{{ pid }}": { + "mpls": { + "ldp": { + "auto_config": "{{ True if auto_config is defined }}", + "sync": "{{ True if sync is defined }}", + "sync_igp_shortcuts": "{{ True if sync_igp_shortcuts is defined }}", + } + }, + } + } + }, + }, + { + "name": "microloop_avoidance", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \smicroloop(?P) + \savoidance(?P) + (\s(?Pprotected))? + (\s(?Psegment-routing))? + (\srib-update-delay\s(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_microloop_avoidance, + "compval": "microloop_avoidance", + "result": { + "processes": { + "{{ pid }}": { + "microloop_avoidance": { + "protected": "{{ True if protected is defined }}", + "segment_routing": "{{ True if segment_routing is defined }}", + "rib_update_delay": "{{ rib_update_delay }}", + }, + } + } + }, + }, + { + "name": "mpls_traffic_eng", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \smpls(?P) + \straffic-end(?P) + (\sautoroute-exclude(?P))? + (\sroute-policy(?P\S+))? + (\s(?Pigp_intact))? + (\s(?Pldp-sync-update))? + (\s(?Pmulticast-intact))? + (\srouter-id\s(?P\S+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_mpls_traffic_eng, + "result": { + "processes": { + "{{ pid }}": { + "mpls": { + "autoroute_exclude": { + "route_policy": "{{ route_policy }}" + }, + "igp_intact": "{{ True if igp_intact is defined }}", + "ldp_sync_update": "{{ True if ldp_sync_update is defined }}", + "multicast_intact": "{{ True if multicast_intact is defined }}", + "router_id": "{{ router_id }}" + }, + } + } + }, + }, + { + "name": "prefix_suppression", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sprefix-suppression(?P) + (\s(?Psecondary-address))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_prefix_suppression, + "result": { + "processes": { + "{{ pid }}": { + "prefix_suppression": { + "set": "{{ True if prefix_suppression is defined and secondary_address is undefined }}", + "secondary_address": "{{ True if secondary_address is defined }}", + }, + } + } + }, + }, + { + "name": "protocol_shutdown", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \sprotocol-shutdown(?P) + (\s(?Phost-mode))? + (\s(?Pon-reload))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_protocol_shutdown, + "result": { + "processes": { + "{{ pid }}": { + "protocol_shutdown": { + "set": "{{ True if protocol_shutdown is defined and host_mode is undefined and on_reload is undefined }}", + "host_mode": "{{ True if host_mode is defined }}", + "on_reload": "{{ True if on_reload is defined }}", + }, + } + } + }, + }, + { + "name": "timers.lsa", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \stimers + \slsa + (\sgroup-pacing\s(?P\d+))? + (\smin-arrival\s(?P\d+))? + (\srefresh\s(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_timers_lsa, + "result": { + "processes": { + "{{ pid }}": { + "timers": { + "lsa": { + "group_pacing": "{{ group_pacing|int }}", + "min_arrival": "{{ min_arrival|int }}", + "refresh": "{{ refresh|int }}", + }, + } + } + } + }, + }, + { + "name": "timers.graceful_shutdown", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \stimers + \sgraceful_shutdown + (\sinitial delay\s(?P\d+))? + (\sretain routes\s(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_timers_graceful_shutdown, + "result": { + "processes": { + "{{ pid }}": { + "timers": { + "graceful_shutdown": { + "initial_delay": "{{ initial_delay|int }}", + "retain_routes": "{{ retain_routes|int }}", + }, + } + } + } + }, + }, + { + "name": "throttle.spf", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \stimers + \sthrottle + \sspf + (\s(?P\d+)) + (\s(?P\d+)) + (\s(?P\d+)) + $""", + re.VERBOSE, + ), + "setval": "timers throttle spf {{ throttle.spf.change_delay }} {{ throttle.spf.second_delay }} {{ throttle.spf.max_wait }}", + "compval": "throttle.lsa_all", + "result": { + "processes": { + "{{ pid }}": { + "timers": { + "throttle": { + "lsa_all": { + "initial_delay": "{{ initial_delay }}", + "min_delay": "{{ min_delay }}", + "max_delay": "{{ max_delay }}", + }, + } + } + } + } + }, + }, + { + "name": "throttle.lsa_all", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \stimers + \sthrottle + \slsa + \sall + (\s(?P\d+)) + (\s(?P\d+)) + (\s(?P\d+)) + $""", + re.VERBOSE, + ), + "setval": "timers throttle lsa all {{ throttle.lsa_all.initial_delay }} {{ throttle.lsa_all.min_delay }} {{ throttle.lsa_all.max_delay }}", + "compval": "throttle.lsa_all", + "result": { + "processes": { + "{{ pid }}": { + "timers": { + "throttle": { + "lsa_all": { + "initial_delay": "{{ initial_delay }}", + "min_delay": "{{ min_delay }}", + "max_delay": "{{ max_delay }}", + }, + } + } + } + } + }, + }, + { + "name": "throttle.fast_reroute", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \stimers + \sthrottle + \sfast-reroute\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "timers throttle fast-reroute {{ fast_reroute }}", + "compval": "throttle.fast_reroute", + "result": { + "processes": { + "{{ pid }}": { + "timers": { + "throttle": { + "fast_reroute": "{{ fast_reroute }}", + } + } + } + } + }, + }, + { + "name": "timers.pacing_flood", + "getval": re.compile( + r""" + ^router + \sospf\s(?P\S+) + \stimers + \spacing + \sflood\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "timers pacing flood {{ pacing_flood }}", + "compval": "timers.pacing_flood", + "result": { + "processes": { + "{{ pid }}": { + "timers": { + "pacing_flood": "{{ pacing_flood }}", + + } + } + } + }, + }, + ] + # fmt: on diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/ospfv3.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/ospfv3.py new file mode 100644 index 00000000..d458615e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/rm_templates/ospfv3.py @@ -0,0 +1,2801 @@ +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +import re +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network_template import ( + NetworkTemplate, +) +from ansible.module_utils.six import iteritems + + +def _tmplt_ospf_default_information(config_data): + if "default_information_originate" in config_data: + command = "default-information originate" + if "always" in config_data["default_information_originate"]: + command += " always" + if "metric" in config_data["default_information_originate"]: + command += " metric {metric}".format( + **config_data["default_information_originate"] + ) + if "metric_type" in config_data["default_information_originate"]: + command += " metric-type {metric_type}".format( + **config_data["default_information_originate"] + ) + if "route_policy" in config_data["default_information_originate"]: + command += " route-policy {route_policy}".format( + **config_data["default_information_originate"] + ) + return command + + +def _tmplt_ospf_auto_cost(config_data): + if "auto_cost" in config_data: + command = "auto-cost" + if "disable" in config_data["auto_cost"]: + command += " disable" + if "reference_bandwidth" in config_data["auto_cost"]: + command += " reference-bandwidth {reference_bandwidth}".format( + **config_data["auto_cost"] + ) + return command + + +def _tmplt_ospfv3_bfd_minimum_interval(config_data): + if "bfd" in config_data: + if "minimum_interval" in config_data["bfd"]: + command = "bfd minimum-interval {minimum_interval}".format( + **config_data["bfd"] + ) + return command + + +def _tmplt_ospfv3_bfd_multiplier(config_data): + if "bfd" in config_data: + if "multiplier" in config_data["bfd"]: + command = "bfd multiplier {multiplier}".format( + **config_data["bfd"] + ) + return command + + +def _tmplt_ospf_security(config_data): + if "security_ttl" in config_data: + command = "security_ttl" + if "set" in config_data["security_ttl"]: + command += " ttl" + elif config_data["security_ttl"].get("hops"): + command += " ttl hops {0}".format( + config_data["security_ttl"].get("hops") + ) + return command + + +def _tmplt_ospf_log_adjacency(config_data): + if "log_adjacency_changes" in config_data: + command = "log adjacency" + if "set" in config_data["log_adjacency_changes"]: + command += " changes" + elif config_data["log_adjacency_changes"].get("disable"): + command += " disable" + elif config_data["log_adjacency_changes"].get("details"): + command += " details" + return command + + +def _tmplt_ospf_log_max_lsa(config_data): + if "max_lsa" in config_data: + command = "max-lsa" + if "threshold" in config_data["max_lsa"]: + command += " {0}".format(config_data["max_lsa"].get("threshold")) + if "warning_only" in config_data["max_lsa"]: + command += " warning-only {0}".format( + config_data["max_lsa"].get("warning_only") + ) + if "ignore_time" in config_data["max_lsa"]: + command += " ignore-time {0}".format( + config_data["max_lsa"].get("ignore_time") + ) + if "ignore_count" in config_data["max_lsa"]: + command += " ignore-count {0}".format( + config_data["max_lsa"].get("ignore_count") + ) + if "reset_time" in config_data["max_lsa"]: + command += " reset-time {0}".format( + config_data["max_lsa"].get("reset_time") + ) + return command + + +def _tmplt_ospf_max_metric(config_data): + if "max_metric" in config_data: + command = "max-metric" + if "router_lsa" in config_data["max_metric"]: + command += " router-lsa" + if "external_lsa" in config_data["max_metric"]: + command += " external-lsa {external_lsa}".format( + **config_data["max_metric"] + ) + if "include_stub" in config_data["max_metric"]: + command += " include-stub" + if "on_startup" in config_data["max_metric"]: + if "time" in config_data["max_metric"]["on_startup"]: + command += " on-startup {time}".format( + **config_data["max_metric"]["on_startup"] + ) + elif "wait_for_bgp" in config_data["max_metric"]["on_startup"]: + command += " on-startup wait-for-bgp" + if "summary_lsa" in config_data["max_metric"]: + command += " summary-lsa {summary_lsa}".format( + **config_data["max_metric"] + ) + return command + + +def _tmplt_ospf_distance_admin(config_data): + if "admin_distance" in config_data: + command = "distance" + if config_data["admin_distance"].get("value"): + command += " {0}".format( + config_data["admin_distance"].get("value") + ) + if config_data["admin_distance"].get("source"): + command += " {0}".format( + config_data["admin_distance"].get("source") + ) + if config_data["admin_distance"].get("wildcard"): + command += " {0}".format( + config_data["admin_distance"].get("wildcard") + ) + if config_data["admin_distance"].get("access_list"): + command += " {0}".format( + config_data["admin_distance"].get("access_list") + ) + return command + + +def _tmplt_ospf_distance_ospf(config_data): + if "ospf_distance" in config_data: + command = "distance ospf" + if config_data["ospf_distance"].get("external"): + command += " external {0}".format( + config_data["ospf_distance"].get("external") + ) + if config_data["ospf_distance"].get("inter_area"): + command += " inter-area {0}".format( + config_data["ospf_distance"].get("inter_area") + ) + if config_data["ospf_distance"].get("intra_area"): + command += " intra-area {0}".format( + config_data["ospf_distance"].get("intra_area") + ) + return command + + +def _tmplt_ospf_nsr(config_data): + if "nsr" in config_data: + command = "nsr" + if "set" in config_data["nsr"]: + command += " nsr" + elif config_data["nsr"].get("disable"): + command += " nsr {0}".format("disable") + return command + + +def _tmplt_ospf_protocol(config_data): + if "protocol_shutdown" in config_data: + command = "protocol" + if "set" in config_data["protocol_shutdown"]: + command += " shutdown" + elif config_data["shutdown"].get("host_mode"): + command += " shutdown host-mode" + elif config_data["shutdown"].get("on_reload"): + command += " shutdown on-reload" + return command + + +def _tmplt_microloop_avoidance(config_data): + if "microloop_avoidance" in config_data: + command = "microloop avoidance" + if "protected" in config_data["microloop_avoidance"]: + command += " protected" + if "segment_routing" in config_data["microloop_avoidance"]: + command += " segment_routing" + if "rib_update_delay" in config_data["microloop_avoidance"]: + command += " rin-update-delay {0}".config_data[ + "microloop_avoidance" + ].get("rib_update_delay") + return command + + +def _tmplt_ospf_bfd_fast_detect(config_data): + if "bfd" in config_data: + if "fast_detect" in config_data["bfd"]: + command = "bfd" + fast_detect = config_data["bfd"].get("fast_detect") + command += " fast-detect" + if "strict_mode" in fast_detect: + command += " strict-mode" + return command + + +def _tmplt_ospf_mpls_traffic_eng(config_data): + if "traffic_eng" in config_data: + command = "mpls traffic-eng" + if "igp_intact" in config_data["traffic_eng"]: + command += " igp-intact" + if "ldp_sync_update" in config_data["traffic_eng"]: + command += " ldp_sync_update" + if "multicast_intact" in config_data["traffic_eng"]: + command += " multicast_intact" + if "auto_route_exclude" in config_data["traffic_eng"]: + policy = config_data["traffic_eng"].get("autoroute_exclude") + command += " autoroute-exlude route-policy {0}".format( + policy.get("route_policy") + ) + return command + + +def _tmplt_ospf_authentication_ipsec(config_data): + if "authentication" in config_data: + if config_data["authentication"].get("ipsec"): + command = "authentication ipsec" + md = config_data["authentication"].get("ipsec") + if md.get("spi"): + command += " spi " + str(md.get("spi")) + if md.get("algorithim_type"): + command += " " + md.get("algorithim_type") + if md.get("clear_key"): + command += " clear " + md.get("clear_key") + elif md.get("password_key"): + command += " password " + md.get("password_key") + elif md.get("key"): + command += " " + md.get("key") + return command + + +def _tmplt_ospfv3_demand_circuit(config_data): + if "demand_circuit" in config_data: + command = "demand-circuit" + return command + + +def _tmplt_ospfv3_passive(config_data): + if "passive" in config_data: + command = "passive" + return command + + +def _tmplt_ospfv3_demand_mtu_ignore(config_data): + if "mtu_ignore" in config_data: + command = "mtu-ignore" + return command + + +def _tmplt_ospfv3_authentication(config_data): + if "authentication" in config_data: + if config_data["authentication"].get("disable"): + command = "authentication disable" + return command + + +def _tmplt_ospf_adjacency_distribute_bgp_state(config_data): + if "distribute_link_list" in config_data: + command = "distribute link-state" + if config_data["distribute_link_list"].get("instance_id"): + command += " instance-id {0}".format( + config_data["distribute_link_list"].get("instance_id") + ) + elif config_data["distribute_link_list"].get("throttle"): + command += " throttle {0}".format( + config_data["distribute_link_list"].get("throttle") + ) + return command + elif "distribute_bgp_ls" in config_data: + command = "distribute bgp-ls" + if config_data["distribute_bgp_ls"].get("instance_id"): + command += " instance-id {0}".format( + config_data["distribute_bgp_ls"].get("instance_id") + ) + elif config_data["distribute_bgp_ls"].get("throttle"): + command += " throttle {0}".format( + config_data["distribute_bgp_ls"].get("throttle") + ) + return command + + +def _tmplt_ospf_capability_opaque(config_data): + if "capability" in config_data: + if "opaque" in config_data["capability"]: + command = "capability opaque" + opaque = config_data["capability"].get("opaque") + if "disable" in opaque: + command += "capability opaque disable" + return command + + +def _tmplt_ospfv3_area_authentication(config_data): + if "authentication" in config_data: + if config_data["authentication"].get("disable"): + command = "area {area_id} ".format(**config_data) + command += "authentication disable" + return command + + +def _tmplt_ospfv3_area_authentication_ipsec(config_data): + if "authentication" in config_data: + command = "area {area_id} ".format(**config_data) + if config_data["authentication"].get("ipsec"): + command += "authentication ipsec" + md = config_data["authentication"].get("ipsec") + if md.get("spi"): + command += " spi " + str(md.get("spi")) + if md.get("algorithim_type"): + command += " " + md.get("algorithim_type") + if md.get("clear_key"): + command += " clear " + md.get("clear_key") + elif md.get("password_key"): + command += " password " + md.get("password_key") + elif md.get("key"): + command += " " + md.get("key") + return command + + +def _tmplt_ospf_area_mpls_ldp(config_data): + commands = [] + if "mpls" in config_data: + command = "area {area_id} mpls".format(**config_data) + if config_data["mpls"].get("ldp"): + ldp = config_data["mpls"].get("ldp") + if "auto_config" in ldp: + command += " auto-config" + commands.append(command) + if "sync" in ldp: + command += " sync" + commands.append(command) + if "sync_igp_shortcuts" in ldp: + command += " sync-igp-shortcuts" + commands.append(command) + return commands + + +def _tmplt_ospfv3_area_bfd_minimum_interval(config_data): + if "bfd" in config_data: + if "minimum_interval" in config_data["bfd"]: + command = "area {area_id} ".format(**config_data) + command += " bfd minimum-interval {minimum_interval}".format( + **config_data["bfd"] + ) + return command + + +def _tmplt_ospfv3_area_bfd_multiplier(config_data): + if "bfd" in config_data: + if "multiplier" in config_data["bfd"]: + command = "area {area_id} ".format(**config_data) + command += "bfd multiplier {multiplier}".format( + **config_data["bfd"] + ) + return command + + +def _tmplt_ospfv3_area_bfd_fast_detect(config_data): + if "bfd" in config_data: + if "fast_detect" in config_data["bfd"]: + command = "area {area_id} ".format(**config_data) + fast_detect = config_data["bfd"].get("fast_detect") + command += "bfd fast-detect" + if "strict_mode" in fast_detect: + command += " strict-mode" + return command + + +def _tmplt_ospf_mpls_ldp(config_data): + commands = [] + if "mpls" in config_data: + command = "mpls".format(**config_data) + if config_data["mpls"].get("ldp"): + ldp = config_data["mpls"].get("ldp") + if "auto_config" in ldp: + command += " auto-config" + commands.append(command) + if "sync" in ldp: + command += " sync" + commands.append(command) + if "sync_igp_shortcuts" in ldp: + command += " sync-igp-shortcuts" + commands.append(command) + return commands + + +def _tmplt_ospf_area_nssa(config_data): + if "nssa" in config_data: + command = "area {area_id} nssa".format(**config_data) + if config_data["nssa"].get("no_redistribution"): + command += " no-redistribution" + if config_data["nssa"].get("no_summary"): + command += " no-summary" + return command + + +def _tmplt_ospf_area_nssa_def_info_origin(config_data): + if "nssa" in config_data: + command = "area {area_id} nssa".format(**config_data) + if "default_information_originate" in config_data["nssa"]: + command += " default-information-originate" + def_info_origin = config_data["nssa"].get( + "default_information_originate" + ) + if "metric" in def_info_origin: + command += " metric {metric}".format( + **config_data["nssa"]["default_information_originate"] + ) + if "metric_type" in def_info_origin: + command += " metric-type {metric_type}".format( + **config_data["nssa"]["default_information_originate"] + ) + return command + + +def _tmplt_ospf_area_nssa_translate(config_data): + if "nssa" in config_data: + command = "area {area_id} nssa".format(**config_data) + if config_data["nssa"].get("translate"): + command += " translate" + translate = config_data["nssa"].get("translate") + if "type7" in translate: + command += " type7" + if translate["type7"].get("always"): + command += " always" + return command + + +def _tmplt_ospf_area_vlink_authentication(config_data): + if "authentication" in config_data: + command = "area {area_id} virtual-link {id} authentication".format( + **config_data + ) + if config_data["authentication"].get("keychain"): + command += " keychain " + config_data["authentication"].get( + "keychain" + ) + elif config_data["authentication"].get("no_auth"): + command += " null" + return command + + +def _tmplt_ospf_area_vlink_authentication_md(config_data): + if "authentication" in config_data: + command = "area {area_id} virtual-link {id} authentication".format( + **config_data + ) + if config_data["authentication"].get("message_digest"): + command = "authentication message-digest" + md = config_data["authentication"].get("message_digest") + if md.get("keychain"): + command += " keychain " + md.get("keychain") + return command + + +def _tmplt_ospf_area_vlink_authentication_key(config_data): + if "authentication_key" in config_data: + command = "area {area_id} virtual-link {id} authentication-key".format( + **config_data + ) + if config_data["authentication_key"].get("password"): + command += " {0}".format( + config_data["authentication_key"].get("password") + ) + return command + + +def _tmplt_ospf_area_stub(config_data): + if "stub" in config_data: + command = "area {area_id} stub".format(**config_data) + if config_data["stub"].get("no_summary"): + command += " no-summary" + return command + + +def _tmplt_ospf_area_ranges(config_data): + if "ranges" in config_data: + commands = [] + for k, v in iteritems(config_data["ranges"]): + cmd = "area {area_id} range".format(**config_data) + temp_cmd = " {address}".format(**v) + if "advertise" in v: + temp_cmd += " advertise" + elif "not_advertise" in v: + temp_cmd += " not-advertise" + cmd += temp_cmd + commands.append(cmd) + return commands + + +def _tmplt_prefix_suppression(config_data): + if "prefix_suppression" in config_data: + if "set" in config_data["prefix_suppression"]: + command = "prefix-suppression" + if "secondary_address" in config_data["prefix_suppression"]: + command = "prefix-suppression secondary-address" + return command + + +def _tmplt_protocol_shutdown(config_data): + if "protocol_shutdown" in config_data: + if "set" in config_data["protocol_shutdown"]: + command = "protocol-shutdown" + if "host_mode" in config_data["protocol_shutdown"]: + command = "protocol-shutdown host-mode" + if "on_reload" in config_data["protocol_shutdown"]: + command = "protocol-shutdown on-reload" + return command + + +def _tmplt_timers_lsa(config_data): + if "timers" in config_data: + command = "timers lsa" + if "group_pacing" in config_data["timers"]["lsa"]: + command += " group-pacing {group_pacing}".format( + **config_data["timers"]["lsa"] + ) + if "min_arrival" in config_data["timers"]["lsa"]: + command += " min-arrival {min_arrival}".format( + **config_data["timers"]["lsa"] + ) + if "refresh" in config_data["timers"]["lsa"]: + command += " refresh {refresh}".format( + **config_data["timers"]["lsa"] + ) + return command + + +def _tmplt_timers_graceful_shutdown(config_data): + if "timers" in config_data: + command = "timers graceful-shutdown" + if "initial_delay" in config_data["timers"]["graceful-shutdown"]: + command += " initial delay {initial_delay}".format( + **config_data["timers"]["graceful-shutdown"] + ) + if "retain_routes" in config_data["timers"]["graceful-shutdown"]: + command += " retain routes {retain_routes}".format( + **config_data["timers"]["graceful-shutdown"] + ) + return command + + +class Ospfv3Template(NetworkTemplate): + def __init__(self, lines=None): + super(Ospfv3Template, self).__init__(lines=lines, tmplt=self) + + # fmt: off + PARSERS = [ + { + "name": "pid", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + $""", + re.VERBOSE, + ), + "setval": "router ospfv3 {{ process_id }}", + "result": { + "processes": {"{{ pid }}": {"process_id": "{{ pid }}"}} + }, + "shared": True, + }, + { + "name": "cost", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \scost(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "cost {{ cost }}", + "result": { + "processes": { + "{{ pid }}": { + "cost": "{{ cost|int }}", + } + } + }, + }, + { + "name": "default_metric", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sdefault-metric(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "default-metric {{ default_metric }}", + "result": { + "processes": { + "{{ pid }}": { + "default_metric": "{{ default_metric|int }}", + } + } + }, + }, + { + "name": "packet_size", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \spacket-size(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "packet-size {{ packet_size }}", + "result": { + "processes": { + "{{ pid }}": { + "packet_size": "{{ packet_size|int }}", + } + } + }, + }, + { + "name": "dead_interval", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sdead-interval(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "dead-interval {{ dead_interval }}", + "result": { + "processes": { + "{{ pid }}": { + "dead_interval": "{{ dead_interval|int }}", + } + } + }, + }, + { + "name": "hello_interval", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \shello-interval(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "hello-interval {{ hello_interval }}", + "result": { + "processes": { + "{{ pid }}": { + "hello_interval": "{{ hello_interval|int }}", + } + } + }, + }, + { + "name": "priority", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \spriority(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "priority {{ priority }}", + "result": { + "processes": { + "{{ pid }}": { + "priority": "{{ priority|int }}", + } + } + }, + }, + { + "name": "weight", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sweight(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "weight {{ weight }}", + "result": { + "processes": { + "{{ pid }}": { + "weight": "{{ weight|int }}", + } + } + }, + }, + { + "name": "retransmit_interval", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sretransmit-interval(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "retransmit-interval {{ retransmit_interval }}", + "result": { + "processes": { + "{{ pid }}": { + "retransmit_interval": "{{ retransmit_interval|int }}", + } + } + }, + }, + { + "name": "transmit_delay", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \stransmit-delay(?P\s\d+) + $""", + re.VERBOSE, + ), + + "setval": "transmit-delay {{ transmit_delay }}", + "result": { + "processes": { + "{{ pid }}": { + "transmit_delay": "{{ transmit_delay|int }}", + } + } + }, + }, + { + "name": "passive", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + (\spassive(?P))? + $""", + re.VERBOSE, + ), + + "setval": _tmplt_ospfv3_passive, + "result": { + "processes": { + "{{ pid }}": { + "passive": "{{ True if passive is defined }}", + } + } + }, + }, + { + "name": "process.database_filter", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sdatabase-filter + \sall + \sout\s(?P\s\S+) + $""", + re.VERBOSE, + ), + + "setval": "process.database_filter", + "result": { + "processes": { + "{{ pid }}": { + "database_filter": "{{ database_filter }}", + } + } + }, + }, + { + "name": "demand_circuit", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + (\sdemand-circuit(?P))? + $""", + re.VERBOSE, + ), + + "setval": _tmplt_ospfv3_demand_circuit, + "result": { + "processes": { + "{{ pid }}": { + "demand_circuit": "{{ True if demand_circuit is defined }}", + } + } + }, + }, + { + "name": "router_id", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \srouter-id\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "router-id {{ router_id }}", + "result": { + "processes": { + "{{ pid }}": { + "router_id": "{{ router_id }}", + } + } + }, + }, + { + "name": "mtu_ignore", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + (\smtu-ignore(?P))? + $""", + re.VERBOSE, + ), + + "setval": _tmplt_ospfv3_demand_mtu_ignore, + "result": { + "processes": { + "{{ pid }}": { + "mtu_ignore": "{{ True if mtu_ignore is defined }}", + } + } + }, + }, + { + "name": "flood_reduction", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sflood-reduction\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "flood-reduction {{ True if flood_reduction is defined }}", + "result": { + "processes": { + "{{ pid }}": { + "flood_reduction": "{{ flood_reduction }}", + } + } + }, + }, + { + "name": "loopback_stub_network", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sloopback(?P) + \sstub-network\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "loopback stub-network {{ stub_network }}", + "result": { + "processes": { + "{{ pid }}": { + "loopback_stub_network": "{{ loopback_stub_network }}", + } + } + }, + }, + { + "name": "address_family_unicast", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \saddress-family(?P) + \sipv4(?P) + \sunicast(?P) + $""", + re.VERBOSE, + ), + + "setval": "address_family_unicast", + "result": { + "processes": { + "{{ pid }}": { + "address_family_unicast": "{{ True if unicast is defined }}", + } + } + }, + }, + { + "name": "default_weight", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sapply-weight(?P) + \sdefault-weight(?P\s\d+) + $""", + re.VERBOSE, + ), + "setval": "apply-weight default-weight {{ default_weight }}", + "result": { + "processes": { + "{{ pid }}": { + "apply_weight": { + "default_weight": "{{ default_weight|int }}", + } + } + } + }, + }, + { + "name": "bandwidth", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sapply-weight(?P) + \sbandwidth(?P\s\d+)? + $""", + re.VERBOSE, + ), + "setval": "apply-weight bandwidth {{ bandwidth }}", + "result": { + "processes": { + "{{ pid }}": { + "apply_weight": { + "bandwidth": "{{ bandwidth|int }}", + } + } + } + }, + }, + { + "name": "authentication", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sauthentication(?P) + (\sdisable(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospfv3_authentication, + "result": { + "processes": { + "{{ pid }}": { + "authentication": { + "disable": "{{ True if disable is defined }}", + }, + } + } + }, + }, + { + "name": "authentication.ipsec", + "getval": re.compile( + r"""^router + \sospfv3\s(?P\S+) + \sauthentication(?P) + \sipsec(?P) + \sspi\s(?P\d+) + (\s(?P\S+))? + (\spassword\s(?P\S+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_authentication_ipsec, + "result": { + "processes": { + "{{ pid }}": { + "authentication": { + "ipsec": { + "spi": "{{ spi }}", + "algorithim_type": "{{ algo_type }}", + "clear_key": "{{ clear_key }}", + "password_key": "{{ password_key }}", + "key": "{{ key }}", + } + }, + } + } + }, + }, + { + "name": "default_information_originate", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sdefault-information(?P) + (\soriginate(?P))? + (\salways(?P))? + (\smetric\s(?P\d+))? + (\smetric-type\s(?P\d+))? + (\sroute_policy\s(?P)\S+)? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_default_information, + "result": { + "processes": { + "{{ pid }}": { + "default_information_originate": { + "always": "{{ True if always is defined }}", + "metric": "{{ metric|int }}", + "metric_type": "{{ metric_type|int }}", + "route_policy": "{{ route_policy }}", + "set": "{{ True if default_information is defined and always is undefined and metric " + "is undefined and metric_type is undefined and route_policy is undefined }}" + }, + } + } + }, + }, + { + "name": "auto_cost", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sauto-cost(?P) + (\sreference-bandwidth\s(?P\d+))? + (\sdisable(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_auto_cost, + "result": { + "processes": { + "{{ pid }}": { + "auto_cost": { + "disable": "{{ True if disable is defined }}", + "reference_bandwidth": "{{ reference_bandwidth|int }}", + }, + } + } + }, + }, + { + "name": "bfd.minimum_interval", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sbfd(?P) + \sminimum-interval\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospfv3_bfd_minimum_interval, + "result": { + "processes": { + "{{ pid }}": { + "bfd": { + "minimum_interval": "{{ minimum_interval|int }}", + }, + } + } + }, + }, + { + "name": "bfd.multiplier", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sbfd(?P) + \smultiplier\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospfv3_bfd_multiplier, + "result": { + "processes": { + "{{ pid }}": { + "bfd": { + "multiplier": "{{ multiplier|int }}", + }, + } + } + }, + }, + { + "name": "bfd.fast_detect", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sbfd(?P) + \sfast-detect(?P) + (\s(?Pdisable))? + (\s(?Pstrict-mode))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_bfd_fast_detect, + "result": { + "processes": { + "{{ pid }}": { + "bfd": { + "fast_detect": { + "set": "{{ True if disable is undefined and strict_mode is undefined }}", + "strict_mode": "{{ True if strict_mode is defined }}", + }, + }, + } + }, + }, + }, + { + "name": "security", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \ssecurity(?P) + \sttl(?P)? + (\shops\s(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_security, + "result": { + "processes": { + "{{ pid }}": { + "security_ttl": { + "set": "{{ True if ttl is defined and hops is undefined }}", + "hops": "{{ hops }}", + }, + } + } + }, + }, + { + "name": "nsr", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \snsr(?P) + \sdisable(?P)? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_nsr, + "result": { + "processes": { + "{{ pid }}": { + "nsr": { + "set": "{{ True if nsr is defined and disable is undefined }}", + "disable": "{{ True if disable is defined }}", + }, + } + } + }, + }, + { + "name": "protocol", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sprotocol(?P) + \s(shutdown(?P)) + (\shost-mode(?P))? + (\son-reload\s(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_protocol, + "result": { + "processes": { + "{{ pid }}": { + "protocol_shutdown": { + "set": "{{ True if shutdown is defined and host-mode is undefined and on_reload is undefined }}", + "host_mode": "{{ True if host_mode is defined }}", + "on_reload": "{{ True if on_reload is defined }}", + }, + } + } + }, + }, + { + "name": "capability", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \scapability(?P) + (\stype7\s(?P\S+))? + $""", + re.VERBOSE, + ), + "setval": "capability type7 {{ type7 }}", + "result": { + "processes": { + "{{ pid }}": { + "capability": { + "type7": "{{ type7 }}" + }, + } + } + }, + }, + { + "name": "capability.opaque", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \scapability(?P)? + \sopaque(?P) + (\sdisable(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_capability_opaque, + "result": { + "processes": { + "{{ pid }}": { + "capability": { + "opaque": { + "disable": "{{ True if disable is defined }}", + "set": "{{ True if opaque is defined and disable is undefined }}", + }, + }, + } + } + }, + }, + { + "name": "admin_distance", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sdistance\s(?Pd+) + \s(?P\S+) + \s(?P\S+) + (\s(?P\S+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_distance_admin, + "result": { + "processes": { + "{{ pid }}": { + "distance": { + "admin_distance": { + "value": "{{ value|int }}", + "source": "{{ source }}", + "wildcard": "{{ wildcard }}", + "access_list": "{{ access_list }}", + } + }, + } + } + }, + }, + + { + "name": "ospf_distance", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sdistance(?P) + \sospfv3(?P) + (\sexternal\s(?P\d+))? + (\sinter-area\s(?P\d+))? + (\sintra-area\s(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_distance_ospf, + "result": { + "processes": { + "{{ pid }}": { + "distance": { + "ospf_distance": { + "external": "{{ external|int }}", + "inter_area": "{{ inter_area|int }}", + "intra_area": "{{ intra_area|int }}", + } + }, + } + } + }, + }, + { + "name": "area.default_cost", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \sdefault-cost\s(?P\d+) + $""", + re.VERBOSE, + ), + + "setval": "area {{ area_id }} default-cost {{ default_cost }}", + "compval": "default_cost", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "default_cost": "{{ default_cost|int }}", + } + } + } + } + }, + }, + { + "name": "area.dead_interval", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \sdead-interval\s(?P\d+) + $""", + re.VERBOSE, + ), + + "setval": "area {{ area_id }} dead-interval {{ dead_interval }}", + "compval": "dead_interval", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "dead_interval": "{{ dead_interval|int }}", + } + } + } + } + }, + }, + { + "name": "area.hello_interval", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \shello-interval\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} hello-interval {{ hello_interval }}", + "compval": "hello_interval", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "hello_interval": "{{ hello_interval|int }}", + } + } + } + } + }, + }, + { + "name": "area.transmit_delay", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \stransmit-delay\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} transmit-delay {{ transmit_delay }}", + "compval": "transmit_delay", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "transmit_delay": "{{ transmit_delay|int }}", + } + } + } + } + }, + }, + { + "name": "area.cost", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \scost\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} cost {{ cost }}", + "compval": "cost", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "cost": "{{ cost|int }}", + } + } + } + } + }, + }, + { + "name": "area.priority", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \spriority\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} priority {{ priority }}", + "compval": "priority", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "priority": "{{ priority|int }}", + } + } + } + } + }, + }, + { + "name": "area.weight", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \sweight\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} weight {{ weight }}", + "compval": "weight", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "weight": "{{ weight|int }}", + } + } + } + } + }, + }, + { + "name": "area.packet_size", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \spacket-size\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} packet-size {{ packet_size }}", + "compval": "packet_size", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "packet_size": "{{ packet_size|int }}", + } + } + } + } + }, + }, + { + "name": "area.summary_in", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \ssummary-in\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "area {{ area_id }} summary-in {{ summary_in }}", + "compval": "summary_in", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "summary_in": "{{ summary_in }}", + } + } + } + } + }, + }, + { + "name": "area.demand_circuit", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \sdemand-circuit\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "area {{ area_id }} demand-circuit {{ demand_circuit }}", + "compval": "demand_circuit", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "demand_circuit": "{{ demand_circuit }}", + } + } + } + } + }, + }, + { + "name": "area.passive", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \spassive\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "area {{ area_id }} passive {{ passive }}", + "compval": "passive", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "passive": "{{ passive }}", + } + } + } + } + }, + }, + { + "name": "area.external_out", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \sexternal-out\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "area {{ area_id }} external-out {{ external_out }}", + "compval": "passive", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "external_out": "{{ external_out }}", + } + } + } + } + }, + }, + { + "name": "area.mtu_ignore", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \smtu-ignore\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "area {{ area_id }} mtu-ignore {{ mtu_ignore }}", + "compval": "mtu_ignore", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "mtu_ignore": "{{ mtu_ignore }}", + } + } + } + } + }, + }, + { + "name": "area.authentication", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \sauthentication(?P) + (\sdisable(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospfv3_area_authentication, + "compval": "authentication", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "authentication": { + "disable": "{{ True if disable is defined }}", + }, + } + } + } + } + }, + }, + { + "name": "area.authentication.ipsec", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \sauthentication(?P) + \sipsec(?P) + \sspi\s(?P\d+) + (\s(?P\S+))? + (\spassword\s(?P\S+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospfv3_area_authentication_ipsec, + "compval": "authentication.ipsec", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "authentication": { + "ipsec": { + "spi": "{{ spi }}", + "algorithim_type": "{{ algo_type }}", + "clear_key": "{{ clear_key }}", + "password_key": "{{ password_key }}", + "key": "{{ key }}", + }, + } + } + } + } + }, + }, + }, + { + "name": "area.mpls_traffic_eng", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \smpls(?P) + \straffic-end(?P) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} mpls traffic-eng", + "compval": "mpls_traffic_eng", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "mpls": { + "traffic_eng": "{{ True if traffic_eng is defined }}", + }, + } + } + } + } + }, + }, + { + "name": "area.mpls_ldp", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \smpls(?P) + (\sauto-config(?P))? + (\ssync(?P))? + (\ssync-igp-shortcuts(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_mpls_ldp, + "compval": "mpls_ldp", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "mpls": { + "ldp": { + "auto_config": "{{ True if auto_config is defined }}", + "sync": "{{ True if sync is defined }}", + "sync_igp_shortcuts": "{{ True if sync_igp_shortcuts is defined }}", + + } + }, + } + } + } + } + }, + }, + { + "name": "area.bfd.minimum_interval", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \sbfd(?P) + \sminimum-interval\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospfv3_area_bfd_minimum_interval, + "compval": "bfd.minimum_interval", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "bfd": { + "minimum_interval": "{{ minimum_interval|int }}", + }, + } + } + } + } + }, + }, + { + "name": "area.bfd.multiplier", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \sbfd(?P) + \smultiplier\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospfv3_area_bfd_multiplier, + "compval": "bfd.multiplier", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "bfd": { + "multiplier": "{{ multiplier|int }}", + }, + } + } + } + } + }, + }, + { + "name": "area.bfd.fast_detect", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sbfd(?P) + \sarea(?P) + \sfast-detect(?P) + (\s(?Pdisable))? + (\s(?Pstrict-mode))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospfv3_area_bfd_fast_detect, + "compval": "bfd.fast_detect", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "bfd": { + "fast_detect": { + "set": "{{ True if disable is undefined and strict_mode is undefined }}", + "strict_mode": "{{ True if strict_mode is defined }}", + }, + }, + } + } + } + }, + }, + }, + { + "name": "area.stub", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \sstub(?P) + (\sno-summary(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_stub, + "compval": "stub", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "area_id": "{{ area_id }}", + "stub": { + "set": "{{ True if stub is defined and no_summary is undefined }}", + "no_summary": "{{ True if no_summary is defined }}", + } + } + } + } + }, + }, + { + "name": "area.nssa", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \snssa(?P) + (\sno-redistribution(?P))? + (\sno-summary(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_nssa, + "compval": "nssa", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "area_id": "{{ area_id }}", + "nssa": { + "set": "{{ True if nssa is defined and no_summary is undefined and no_redis is undefined }}", + "no_summary": "{{ True if no_summary is defined }}", + "no_redistribution": "{{ True if no_redis is defined }}" + } + } + } + } + }, + }, + { + "name": "area.nssa.default_information_originate", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \snssa(?P) + (\sno-redistribution(?P))? + (\sdefault-information-originate(?P))? + (\smetric\s(?P\d+))? + (\smetric-type\s(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_nssa_def_info_origin, + "compval": "nssa.default_information_originate", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "nssa": { + "default_information_originate": { + "metric": "{{ metric|int }}", + "metric_type": "{{ metric_type|int }}", + }, + } + } + } + } + }, + }, + }, + { + "name": "area.ranges", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \srange(?P) + \s(?P
\S+) + (\sadvertise(?P)) + (\snot-advertise(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_ranges, + "compval": "ranges", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "ranges": [ + { + "address": "{{ address }}", + "advertise": "{{ True if advertise is defined }}", + "not_advertise": "{{ True if not_advertise is defined }}", + } + ], + } + } + } + } + }, + }, + { + "name": "area.nssa.translate", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \snssa(?P) + \stranslate(?P) + \stype7(?P) + \salways\s(?P) + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_nssa_translate, + "compval": "nssa.translate", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "area_id": "{{ area_id }}", + "nssa": { + "translate": { + "type7": { + "always": "{{ True if always is defined }}" + } + }, + } + } + } + } + }, + }, + { + "name": "virtual_link.hello_interval", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \svirtual-link\s(?P\S+) + \shello-interval\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} virtual-link {{ id }} hello-interval {{ hello_interval }}", + "compval": "hello_interval", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "virtual_link": { + "{{ id }}": + { + "id": "{{ id }}", + "hello_interval": "{{ hello_interval|int }}" + } + + } + } + } + } + } + }, + }, + { + "name": "virtual_link.dead_interval", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \svirtual-link\s(?P\S+) + \sdead-interval\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} virtual-link {{ id }} dead-interval {{ dead_interval }}", + "compval": "dead_interval", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "virtual_link": { + "{{ id }}": { + "id": "{{ id }}", + "dead_interval": "{{ dead_interval|int }}" + } + + } + } + } + } + } + }, + }, + { + "name": "virtual_link.retransmit_interval", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \svirtual-link\s(?P\S+) + \sretransmit-interval\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "area {{ area_id }} virtual-link {{ id }} retransmit-interval {{ retransmit_interval }}", + "compval": "retransmit_interval", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "virtual_link": { + "{{ id }}": { + "id": "{{ id }}", + "retransmit_interval": "{{ retransmit_interval|int }}" + } + } + + } + } + } + } + } + }, + { + "name": "virtual_link.authentication", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \savirtual-link\s(?P\S+) + \sauthentication(?P) + (\skeychain\s(?P\S+))? + (\snull(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_vlink_authentication, + "compval": "authentication", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "authentication": { + "no_auth": "{{ True if no_auth is defined }}", + "keychain": "{{ keychain }}", + }, + } + } + } + } + }, + }, + { + "name": "virtual_link.authentication_key", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \svirtual-link\s(?P\S+) + \sauthentication-key(?P) + (\s(?P\S+))? + (\sclear\s(?P)\S+)? + (\sencrypted(?P\S+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_vlink_authentication_key, + "compval": "authentication_key", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "virtual_link": { + "{{ id }}": { + "authentication_key": { + "clear": "{{ clear }}", + "encrypted": "{{ encrypted}}", + "password": "{{ password if clear is undefined and encrypted is undefined }}", + }, + } + } + } + } + } + } + }, + }, + { + "name": "virtual_link.authentication.message_digest", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sarea\s(?P\S+) + \svirtual-link\s(?P\S+) + \sauthentication(?P) + \smessage-digest(?P) + \skeychain(?P\s\S+) + *$""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_area_vlink_authentication_md, + "compval": "authentication.message_digest", + "result": { + "processes": { + "{{ pid }}": { + "areas": { + "{{ area_id }}": { + "area_id": "{{ area_id }}", + "virtual_link": { + "{{ id }}": { + "authentication": { + "message_digest": { + "keychain": "{{ md_key }}", + } + }, + } + } + } + } + } + } + }, + }, + { + "name": "link_down_fast_detect", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \slink-down + \sfast-detect(?P) + $""", + re.VERBOSE, + ), + "setval": "link-down fast-detect", + "result": { + "processes": { + "{{ pid }}": { + "link_down_fast_detect": "{{ True if fast_detect is defined }}", + } + } + }, + }, + { + "name": "nsr", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \snsr + \sdisable(?P) + $""", + re.VERBOSE, + ), + "setval": "nsr disable", + "result": { + "processes": { + "{{ pid }}": { + "disable": "{{ True if disable is defined }}", + } + } + }, + }, + { + "name": "database_filter", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sdatabase-filter + \sall + \sout\s(?P\S+) + $""", + re.VERBOSE, + ), + + "setval": "database-filter all out {{ outing }}", + "result": { + "processes": { + "{{ pid }}": { + "outing": "{{ outing }}" + } + } + }, + }, + { + "name": "distribute_link_state", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sdistribute(?P) + \slink-state(?P) + (\sinstance-id(?P\d+))? + (\sthrottle(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_adjacency_distribute_bgp_state, + "result": { + "processes": { + "{{ pid }}": { + "distribute_link_list": { + "instance_id": "{{ inst_id|int }}", + "throttle": "{{ throttle }}", + }, + } + } + }, + }, + { + "name": "distribute_bgp_ls", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sdistribute(?P) + \sbgp-ls(?P) + (\sinstance-id(?P\d+))? + (\sthrottle(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_adjacency_distribute_bgp_state, + "result": { + "processes": { + "{{ pid }}": { + "distribute_bgp_ls": { + "instance_id": "{{ inst_id|int }}", + "throttle": "{{ throttle }}", + }, + } + } + }, + }, + { + "name": "log_adjacency", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \slog(?P) + \sadjacency(?P)? + (\schanges(?P))? + (\sdisable(?P))? + (\sdetails(?P
))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_log_adjacency, + "result": { + "processes": { + "{{ pid }}": { + "log_adjacency_changes": { + "set": "{{ True changes id defined and disable is undefined and detail is undefined }}", + "disable": "{{ True if disable is defined }}", + "details": "{{ True if details is defined }}", + }, + } + } + }, + }, + { + "name": "max_lsa", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + (\smax-lsa\s(?P\d+))? + (\swarning-only\s(?P\d+)? + (\signore-time\s(?P\d+))? + (\signore-count\s(?P\d+))? + (\sreset-time\s(?P)\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_log_max_lsa, + "result": { + "processes": { + "{{ pid }}": { + "max_lsa": { + "threshold": "{{ threshold|int }}", + "warning_only": "{{ warning_only|int }}", + "ignore_time": "{{ ignore_time|int }}", + "ignore_count": "{{ ignore_count|int }}", + "reset_time": "{{ reset_time|int }}", + }, + } + } + }, + }, + { + "name": "max_metric", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \smax-metric + \s*(?P) + (\s*external-lsa(?P))? + (\s(?P\d+))? + \s*(?Pinclude-stub)* + \s*(?Pon-startup)* + \s*(?P\d+)* + \s*(wait-for\sbgp)* + \s*(?P\d+)* + \s*(?Psummary-lsa)* + \s*(?P\d+)* + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_max_metric, + "remval": "max-metric router-lsa", + "result": { + "processes": { + '{{ "pid" }}': { + "max_metric": { + "router_lsa": { + "set": "{{ True if router_lsa is defined and external_lsa is undefined else None }}", + "external_lsa": { + "set": "{{ True if external_lsa is defined and max_metric_value is undefined else None }}", + "max_metric_value": "{{ max_metric_value }}", + }, + "include_stub": "{{ not not include_stub }}", + "on_startup": { + "set": "{{ True if on_startup is defined and (wait_period and bgp_asn) is undefined else None }}", + "wait_period": "{{ wait_period }}", + "wait_for_bgp_asn": "{{ bgp_asn }}", + }, + "summary_lsa": { + "set": "{{ True if summary_lsa is defined and sum_lsa_max_metric_value is undefined else None }}", + "max_metric_value": "{{ sum_lsa_max_metric_value }}", + }, + } + } + } + } + }, + }, + { + "name": "mpls_ldp", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \smpls(?P) + (\sauto-config(?P))? + (\ssync(?P))? + (\ssync-igp-shortcuts(?P))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_mpls_ldp, + "compval": "mpls_ldp", + "result": { + "processes": { + "{{ pid }}": { + "mpls": { + "ldp": { + "auto_config": "{{ True if auto_config is defined }}", + "sync": "{{ True if sync is defined }}", + "sync_igp_shortcuts": "{{ True if sync_igp_shortcuts is defined }}", + } + }, + } + } + }, + }, + { + "name": "microloop_avoidance", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \smicroloop(?P) + \savoidance(?P) + (\s(?Pprotected))? + (\s(?Psegment-routing))? + (\srib-update-delay\s(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_microloop_avoidance, + "compval": "microloop_avoidance", + "result": { + "processes": { + "{{ pid }}": { + "microloop_avoidance": { + "protected": "{{ True if protected is defined }}", + "segment_routing": "{{ True if segment_routing is defined }}", + "rib_update_delay": "{{ rib_update_delay }}", + }, + } + } + }, + }, + { + "name": "mpls_traffic_eng", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \smpls(?P) + \straffic-end(?P) + (\sautoroute-exclude(?P))? + (\sroute-policy(?P\S+))? + (\s(?Pigp_intact))? + (\s(?Pldp-sync-update))? + (\s(?Pmulticast-intact))? + (\srouter-id\s(?P\S+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_ospf_mpls_traffic_eng, + "result": { + "processes": { + "{{ pid }}": { + "mpls": { + "autoroute_exclude": { + "route_policy": "{{ route_policy }}" + }, + "igp_intact": "{{ True if igp_intact is defined }}", + "ldp_sync_update": "{{ True if ldp_sync_update is defined }}", + "multicast_intact": "{{ True if multicast_intact is defined }}", + "router_id": "{{ router_id }}" + }, + } + } + }, + }, + { + "name": "prefix_suppression", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sprefix-suppression(?P) + (\s(?Psecondary-address))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_prefix_suppression, + "result": { + "processes": { + "{{ pid }}": { + "prefix_suppression": { + "set": "{{ True if prefix_suppression is defined and secondary_address is undefined }}", + "secondary_address": "{{ True if secondary_address is defined }}", + }, + } + } + }, + }, + { + "name": "protocol_shutdown", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \sprotocol-shutdown(?P) + (\s(?Phost-mode))? + (\s(?Pon-reload))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_protocol_shutdown, + "result": { + "processes": { + "{{ pid }}": { + "protocol_shutdown": { + "set": "{{ True if protocol_shutdown is defined and host_mode is undefined and on_reload is undefined }}", + "host_mode": "{{ True if host_mode is defined }}", + "on_reload": "{{ True if on_reload is defined }}", + }, + } + } + }, + }, + { + "name": "timers.lsa", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \stimers + \slsa + (\sgroup-pacing\s(?P\d+))? + (\smin-arrival\s(?P\d+))? + (\srefresh\s(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_timers_lsa, + "result": { + "processes": { + "{{ pid }}": { + "timers": { + "lsa": { + "group_pacing": "{{ group_pacing|int }}", + "min_arrival": "{{ min_arrival|int }}", + "refresh": "{{ refresh|int }}", + }, + } + } + } + }, + }, + { + "name": "timers.graceful_shutdown", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \stimers + \sgraceful_shutdown + (\sinitial delay\s(?P\d+))? + (\sretain routes\s(?P\d+))? + $""", + re.VERBOSE, + ), + "setval": _tmplt_timers_graceful_shutdown, + "result": { + "processes": { + "{{ pid }}": { + "timers": { + "graceful_shutdown": { + "initial_delay": "{{ initial_delay|int }}", + "retain_routes": "{{ retain_routes|int }}", + }, + } + } + } + }, + }, + { + "name": "throttle.spf", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \stimers + \sthrottle + \sspf + (\s(?P\d+)) + (\s(?P\d+)) + (\s(?P\d+)) + $""", + re.VERBOSE, + ), + "setval": "timers throttle spf {{ throttle.spf.change_delay }} {{ throttle.spf.second_delay }} {{ throttle.spf.max_wait }}", + "compval": "throttle.lsa_all", + "result": { + "processes": { + "{{ pid }}": { + "timers": { + "throttle": { + "lsa_all": { + "initial_delay": "{{ initial_delay }}", + "min_delay": "{{ min_delay }}", + "max_delay": "{{ max_delay }}", + }, + } + } + } + } + }, + }, + { + "name": "throttle.lsa_all", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \stimers + \sthrottle + \slsa + \sall + (\s(?P\d+)) + (\s(?P\d+)) + (\s(?P\d+)) + $""", + re.VERBOSE, + ), + "setval": "timers throttle lsa all {{ throttle.lsa_all.initial_delay }} {{ throttle.lsa_all.min_delay }} {{ throttle.lsa_all.max_delay }}", + "compval": "throttle.lsa_all", + "result": { + "processes": { + "{{ pid }}": { + "timers": { + "throttle": { + "lsa_all": { + "initial_delay": "{{ initial_delay }}", + "min_delay": "{{ min_delay }}", + "max_delay": "{{ max_delay }}", + }, + } + } + } + } + }, + }, + { + "name": "throttle.fast_reroute", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \stimers + \sthrottle + \sfast-reroute\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "timers throttle fast-reroute {{ fast_reroute }}", + "compval": "throttle.fast_reroute", + "result": { + "processes": { + "{{ pid }}": { + "timers": { + "throttle": { + "fast_reroute": "{{ fast_reroute }}", + } + } + } + } + }, + }, + { + "name": "timers.pacing_flood", + "getval": re.compile( + r""" + ^router + \sospfv3\s(?P\S+) + \stimers + \spacing + \sflood\s(?P\d+) + $""", + re.VERBOSE, + ), + "setval": "timers pacing flood {{ pacing_flood }}", + "compval": "timers.pacing_flood", + "result": { + "processes": { + "{{ pid }}": { + "timers": { + "pacing_flood": "{{ pacing_flood }}", + + } + } + } + }, + }, + ] + # fmt: on diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/utils/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/utils/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/utils/utils.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/utils/utils.py new file mode 100644 index 00000000..059c8167 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/utils/utils.py @@ -0,0 +1,391 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +# utils + + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +from ansible.module_utils._text import to_text +from ansible_collections.ansible.netcommon.plugins.module_utils.compat import ( + ipaddress, +) +from ansible.module_utils.six import iteritems +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + dict_diff, + is_masklen, + to_netmask, + search_obj_in_list, +) + + +def remove_command_from_config_list(interface, cmd, commands): + # To delete the passed config + if interface not in commands: + commands.insert(0, interface) + commands.append("no %s" % cmd) + return commands + + +def add_command_to_config_list(interface, cmd, commands): + # To set the passed config + if interface not in commands: + commands.insert(0, interface) + commands.append(cmd) + + +def dict_to_set(sample_dict): + # Generate a set with passed dictionary for comparison + test_dict = {} + if isinstance(sample_dict, dict): + for k, v in iteritems(sample_dict): + if v is not None: + if isinstance(v, list): + if isinstance(v[0], dict): + li = [] + for each in v: + for key, value in iteritems(each): + if isinstance(value, list): + each[key] = tuple(value) + li.append(tuple(iteritems(each))) + v = tuple(li) + else: + v = tuple(v) + elif isinstance(v, dict): + li = [] + for key, value in iteritems(v): + if isinstance(value, list): + v[key] = tuple(value) + li.extend(tuple(iteritems(v))) + v = tuple(li) + test_dict.update({k: v}) + return_set = set(tuple(iteritems(test_dict))) + else: + return_set = set(sample_dict) + return return_set + + +def filter_dict_having_none_value(want, have): + # Generate dict with have dict value which is None in want dict + test_dict = dict() + test_key_dict = dict() + name = want.get("name") + if name: + test_dict["name"] = name + diff_ip = False + want_ip = "" + for k, v in iteritems(want): + if isinstance(v, dict): + for key, value in iteritems(v): + if value is None and k in have and key in have.get(k): + dict_val = have.get(k).get(key) + test_key_dict.update({key: dict_val}) + test_dict.update({k: test_key_dict}) + if isinstance(v, list) and isinstance(v[0], dict): + for key, value in iteritems(v[0]): + if value is None and k in have and key in have.get(k): + dict_val = have.get(k).get(key) + test_key_dict.update({key: dict_val}) + test_dict.update({k: test_key_dict}) + # below conditions checks are added to check if + # secondary IP is configured, if yes then delete + # the already configured IP if want and have IP + # is different else if it's same no need to delete + for each in v: + if each.get("secondary"): + want_ip = each.get("address").split("/") + have_ip = have.get("ipv4") + for each in have_ip: + if len(want_ip) > 1 and each.get("secondary"): + have_ip = each.get("address").split(" ")[0] + if have_ip != want_ip[0]: + diff_ip = True + if each.get("secondary") and diff_ip is True: + test_key_dict.update({"secondary": True}) + test_dict.update({"ipv4": test_key_dict}) + # Checks if want doesn't have secondary IP but have has secondary IP set + elif have.get("ipv4"): + if [ + True + for each_have in have.get("ipv4") + if "secondary" in each_have + ]: + test_dict.update({"ipv4": {"secondary": True}}) + if k == "l2protocol": + diff = True + h_proto = have.get("l2protocol") + w_proto = want.get("l2protocol") + if h_proto: + if w_proto: + for h in h_proto: + for w in w_proto: + if h == w: + diff = False + if not diff: + break + else: + diff = True + if diff: + test_dict.update({k: v}) + if v is None: + val = have.get(k) + test_dict.update({k: val}) + return test_dict + + +def remove_duplicate_interface(commands): + # Remove duplicate interface from commands + set_cmd = [] + for each in commands: + if "interface" in each: + if each not in set_cmd: + set_cmd.append(each) + else: + set_cmd.append(each) + + return set_cmd + + +def flatten_dict(x): + result = {} + if not isinstance(x, dict): + return result + + for key, value in iteritems(x): + if isinstance(value, dict): + result.update(flatten_dict(value)) + else: + result[key] = value + + return result + + +def dict_delete(base, comparable): + """ + + This function generates a dict containing key, value pairs for keys + that are present in the `base` dict but not present in the `comparable` + dict. + + :param base: dict object to base the diff on + :param comparable: dict object to compare against base + + :returns: new dict object with key, value pairs that needs to be deleted. + + """ + to_delete = dict() + + for key in base: + if isinstance(base[key], dict): + sub_diff = dict_delete(base[key], comparable.get(key, {})) + if sub_diff: + to_delete[key] = sub_diff + else: + if key not in comparable: + to_delete[key] = base[key] + + return to_delete + + +def pad_commands(commands, interface): + commands.insert(0, "interface {0}".format(interface)) + + +def diff_list_of_dicts(w, h, key="member"): + """ + Returns a list containing diff between + two list of dictionaries + """ + if not w: + w = [] + if not h: + h = [] + + diff = [] + for w_item in w: + h_item = search_obj_in_list(w_item[key], h, key=key) or {} + d = dict_diff(h_item, w_item) + if d: + if key not in d.keys(): + d[key] = w_item[key] + diff.append(d) + + return diff + + +def validate_ipv4(value, module): + if value: + address = value.split("/") + if len(address) != 2: + module.fail_json( + msg="address format is /, got invalid format {0}".format( + value + ) + ) + + if not is_masklen(address[1]): + module.fail_json( + msg="invalid value for mask: {0}, mask should be in range 0-32".format( + address[1] + ) + ) + + +def validate_ipv6(value, module): + if value: + address = value.split("/") + if len(address) != 2: + module.fail_json( + msg="address format is /, got invalid format {0}".format( + value + ) + ) + else: + if not 0 <= int(address[1]) <= 128: + module.fail_json( + msg="invalid value for mask: {0}, mask should be in range 0-128".format( + address[1] + ) + ) + + +def validate_n_expand_ipv4(module, want): + # Check if input IPV4 is valid IP and expand IPV4 with its subnet mask + ip_addr_want = want.get("address") + if len(ip_addr_want.split(" ")) > 1: + return ip_addr_want + validate_ipv4(ip_addr_want, module) + ip = ip_addr_want.split("/") + if len(ip) == 2: + ip_addr_want = "{0} {1}".format(ip[0], to_netmask(ip[1])) + + return ip_addr_want + + +def normalize_interface(name): + """Return the normalized interface name + """ + if not name: + return + + def _get_number(name): + digits = "" + for char in name: + if char.isdigit() or char in "/.": + digits += char + return digits + + if name.lower().startswith("gi"): + if_type = "GigabitEthernet" + elif name.lower().startswith("fa"): + if_type = "FastEthernet" + elif name.lower().startswith("fo"): + if_type = "FortyGigE" + elif name.lower().startswith("te"): + if_type = "TenGigE" + elif name.lower().startswith("twe"): + if_type = "TwentyFiveGigE" + elif name.lower().startswith("hu"): + if_type = "HundredGigE" + elif name.lower().startswith("vl"): + if_type = "Vlan" + elif name.lower().startswith("lo"): + if_type = "Loopback" + elif name.lower().startswith("be"): + if_type = "Bundle-Ether" + elif name.lower().startswith("bp"): + if_type = "Bundle-POS" + else: + if_type = None + + number_list = name.split(" ") + if len(number_list) == 2: + number = number_list[-1].strip() + else: + number = _get_number(name) + + if if_type: + proper_interface = if_type + number + else: + proper_interface = name + + return proper_interface + + +def get_interface_type(interface): + """Gets the type of interface + """ + + if interface.upper().startswith("GI"): + return "GigabitEthernet" + elif interface.upper().startswith("FA"): + return "FastEthernet" + elif interface.upper().startswith("FO"): + return "FortyGigE" + elif interface.upper().startswith("ET"): + return "Ethernet" + elif interface.upper().startswith("LO"): + return "Loopback" + elif interface.upper().startswith("BE"): + return "Bundle-Ether" + elif interface.upper().startswith("NV"): + return "nve" + elif interface.upper().startswith("TWE"): + return "TwentyFiveGigE" + elif interface.upper().startswith("HU"): + return "HundredGigE" + elif interface.upper().startswith("PRE"): + return "preconfigure" + else: + return "unknown" + + +def isipaddress(data): + """ + Checks if the passed string is + a valid IPv4 or IPv6 address + """ + isipaddress = True + + try: + ipaddress.ip_address(data) + except ValueError: + isipaddress = False + + return isipaddress + + +def is_ipv4_address(data): + """ + Checks if the passed string is + a valid IPv4 address + """ + if "/" in data: + data = data.split("/")[0] + + if not isipaddress(to_text(data)): + raise ValueError("{0} is not a valid IP address".format(data)) + + return ipaddress.ip_address(to_text(data)).version == 4 + + +def prefix_to_address_wildcard(prefix): + """ Converts a IPv4 prefix into address and + wildcard mask + + :returns: IPv4 address and wildcard mask + """ + wildcard = [] + + subnet = to_text(ipaddress.IPv4Network(to_text(prefix)).netmask) + + for x in subnet.split("."): + component = 255 - int(x) + wildcard.append(str(component)) + + wildcard = ".".join(wildcard) + + return prefix.split("/")[0], wildcard diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_acl_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_acl_interfaces.py new file mode 100644 index 00000000..378b845c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_acl_interfaces.py @@ -0,0 +1,651 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# + +""" +The module file for iosxr_acl_interfaces +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_acl_interfaces +short_description: ACL interfaces resource module +description: +- This module manages adding and removing Access Control Lists (ACLs) from interfaces + on devices running IOS-XR software. +version_added: 1.0.0 +author: Nilashish Chakraborty (@NilashishC) +options: + config: + description: A dictionary of ACL options for interfaces. + type: list + elements: dict + suboptions: + name: + description: + - Name/Identifier for the interface + type: str + required: true + access_groups: + type: list + elements: dict + description: + - Specifies ACLs attached to the interfaces. + suboptions: + afi: + description: + - Specifies the AFI for the ACL(s) to be configured on this interface. + type: str + choices: + - ipv4 + - ipv6 + required: true + acls: + type: list + description: + - Specifies the ACLs for the provided AFI. + elements: dict + suboptions: + name: + description: + - Specifies the name of the IPv4/IPv6 ACL for the interface. + type: str + required: true + direction: + description: + - Specifies the direction of packets that the ACL will be applied + on. + type: str + choices: + - in + - out + required: true + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the IOS-XR device + by executing the command B(show running-config interface). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. + type: str + state: + description: + - The state the configuration should be left in. + type: str + choices: + - merged + - replaced + - overridden + - deleted + - gathered + - parsed + - rendered + default: merged + +""" +EXAMPLES = """ +# Using merged + +# Before state: +# ------------- +# +# RP/0/RP0/CPU0:ios#sh running-config interface +# Wed Jan 15 12:22:32.911 UTC +# interface MgmtEth0/RP0/CPU0/0 +# ipv4 address dhcp +# ! +# interface GigabitEthernet0/0/0/0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! + +- name: Merge the provided configuration with the existing running configuration + cisco.iosxr.iosxr_acl_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + access_groups: + - afi: ipv4 + acls: + - name: acl_1 + direction: in + - name: acl_2 + direction: out + - afi: ipv6 + acls: + - name: acl6_1 + direction: in + - name: acl6_2 + direction: out + + - name: GigabitEthernet0/0/0/1 + access_groups: + - afi: ipv4 + acls: + - name: acl_1 + direction: out + state: merged + +# After state: +# ------------- +# +# RP/0/RP0/CPU0:ios#sh running-config interface +# Wed Jan 15 12:27:49.378 UTC +# interface MgmtEth0/RP0/CPU0/0 +# ipv4 address dhcp +# ! +# interface GigabitEthernet0/0/0/0 +# shutdown +# ipv4 access-group acl_1 ingress +# ipv4 access-group acl_2 egress +# ipv6 access-group acl6_1 ingress +# ipv6 access-group acl6_2 egress +# ! +# interface GigabitEthernet0/0/0/1 +# shutdown +# ipv4 access-group acl_1 egress +# ! + +# Using merged to update interface ACL configuration + +# Before state: +# ------------- +# +# RP/0/RP0/CPU0:ios#sh running-config interface +# Wed Jan 15 12:27:49.378 UTC +# interface MgmtEth0/RP0/CPU0/0 +# ipv4 address dhcp +# ! +# interface GigabitEthernet0/0/0/0 +# shutdown +# ipv4 access-group acl_1 ingress +# ipv4 access-group acl_2 egress +# ipv6 access-group acl6_1 ingress +# ipv6 access-group acl6_2 egress +# ! +# interface GigabitEthernet0/0/0/1 +# shutdown +# ipv4 access-group acl_1 egress +# ! +# + +- name: Update acl_interfaces configuration using merged + cisco.iosxr.iosxr_acl_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + access_groups: + - afi: ipv4 + acls: + - name: acl_2 + direction: out + - name: acl_1 + direction: in + state: merged + +# After state: +# ------------- +# +# RP/0/RP0/CPU0:ios#sh running-config interface +# Wed Jan 15 12:27:49.378 UTC +# interface MgmtEth0/RP0/CPU0/0 +# ipv4 address dhcp +# ! +# interface GigabitEthernet0/0/0/0 +# shutdown +# ipv4 access-group acl_1 ingress +# ipv4 access-group acl_2 egress +# ipv6 access-group acl6_1 ingress +# ipv6 access-group acl6_2 egress +# ! +# interface GigabitEthernet0/0/0/1 +# shutdown +# ipv4 access-group acl_1 ingress +# ipv4 access-group acl_2 egress +# ! +# + +# Using replaced + +# Before state: +# ------------- +# +# RP/0/RP0/CPU0:ios#sh running-config interface +# Wed Jan 15 12:34:56.689 UTC +# interface MgmtEth0/RP0/CPU0/0 +# ipv4 address dhcp +# ! +# interface GigabitEthernet0/0/0/0 +# shutdown +# ipv4 access-group acl_1 ingress +# ipv4 access-group acl_2 egress +# ipv6 access-group acl6_1 ingress +# ipv6 access-group acl6_2 egress +# ! +# interface GigabitEthernet0/0/0/1 +# shutdown +# ipv4 access-group acl_1 egress +# ! + +- name: Replace device configurations of listed interface with provided configurations + cisco.iosxr.iosxr_acl_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + access_groups: + - afi: ipv6 + acls: + - name: acl6_3 + direction: in + state: replaced + +# After state: +# ------------- +# +# RP/0/RP0/CPU0:ios#sh running-config interface +# Wed Jan 15 12:34:56.689 UTC +# interface MgmtEth0/RP0/CPU0/0 +# ipv4 address dhcp +# ! +# interface GigabitEthernet0/0/0/0 +# shutdown +# ipv6 access-group acl6_3 ingress +# ! +# interface GigabitEthernet0/0/0/1 +# shutdown +# ipv4 access-group acl_1 egress +# ! +# + +# Using overridden + +# Before state: +# ------------- +# +# RP/0/RP0/CPU0:ios#sh running-config interface +# Wed Jan 15 12:34:56.689 UTC +# interface MgmtEth0/RP0/CPU0/0 +# ipv4 address dhcp +# ! +# interface GigabitEthernet0/0/0/0 +# shutdown +# ipv4 access-group acl_1 ingress +# ipv4 access-group acl_2 egress +# ipv6 access-group acl6_1 ingress +# ipv6 access-group acl6_2 egress +# ! +# interface GigabitEthernet0/0/0/1 +# shutdown +# ipv4 access-group acl_1 egress +# ! +# + +- name: Overridde all interface ACL configuration with provided configuration + cisco.iosxr.iosxr_acl_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + access_groups: + - afi: ipv4 + acls: + - name: acl_2 + direction: in + - afi: ipv6 + acls: + - name: acl6_3 + direction: out + state: overridden + +# After state: +# ------------- +# +# RP/0/RP0/CPU0:ios#sh running-config interface +# Wed Jan 15 12:34:56.689 UTC +# interface MgmtEth0/RP0/CPU0/0 +# ipv4 address dhcp +# ! +# interface GigabitEthernet0/0/0/0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/1 +# shutdown +# ipv4 access-group acl_2 ingress +# ipv6 access-group acl6_3 egress +# ! +# + +# Using 'deleted' to delete all ACL attributes of a single interface + +# Before state: +# ------------- +# +# RP/0/RP0/CPU0:ios#sh running-config interface +# Wed Jan 15 12:34:56.689 UTC +# interface MgmtEth0/RP0/CPU0/0 +# ipv4 address dhcp +# ! +# interface GigabitEthernet0/0/0/0 +# shutdown +# ipv4 access-group acl_1 ingress +# ipv4 access-group acl_2 egress +# ipv6 access-group acl6_1 ingress +# ipv6 access-group acl6_2 egress +# ! +# interface GigabitEthernet0/0/0/1 +# shutdown +# ipv4 access-group acl_1 egress +# ! +# + +- name: Delete all ACL attributes of GigabitEthernet0/0/0/1 + cisco.iosxr.iosxr_acl_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + state: deleted + +# After state: +# ------------- +# +# RP/0/RP0/CPU0:ios#sh running-config interface +# Wed Jan 15 12:34:56.689 UTC +# interface MgmtEth0/RP0/CPU0/0 +# ipv4 address dhcp +# ! +# interface GigabitEthernet0/0/0/0 +# shutdown +# ipv4 access-group acl_1 ingress +# ipv4 access-group acl_2 egress +# ipv6 access-group acl6_1 ingress +# ipv6 access-group acl6_2 egress +# ! +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! +# + +# Using 'deleted' to remove all ACLs attached to all the interfaces in the device + +# Before state: +# ------------- +# +# RP/0/RP0/CPU0:ios#sh running-config interface +# Wed Jan 15 12:34:56.689 UTC +# interface MgmtEth0/RP0/CPU0/0 +# ipv4 address dhcp +# ! +# interface GigabitEthernet0/0/0/0 +# shutdown +# ipv4 access-group acl_1 ingress +# ipv4 access-group acl_2 egress +# ipv6 access-group acl6_1 ingress +# ipv6 access-group acl6_2 egress +# ! +# interface GigabitEthernet0/0/0/1 +# shutdown +# ipv4 access-group acl_1 egress +# ! +# + +- name: Delete all ACL interfaces configuration from the device + cisco.iosxr.iosxr_acl_interfaces: + state: deleted + +# After state: +# ------------- +# +# RP/0/RP0/CPU0:ios#sh running-config interface +# Wed Jan 15 12:34:56.689 UTC +# interface MgmtEth0/RP0/CPU0/0 +# ipv4 address dhcp +# ! +# interface GigabitEthernet0/0/0/0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! +# + +# Using parsed + +# parsed.cfg +# ------------ +# +# interface MgmtEth0/RP0/CPU0/0 +# ipv4 address dhcp +# ! +# interface GigabitEthernet0/0/0/0 +# shutdown +# ipv4 access-group acl_1 ingress +# ipv4 access-group acl_2 egress +# ipv6 access-group acl6_1 ingress +# ipv6 access-group acl6_2 egress +# ! +# interface GigabitEthernet0/0/0/1 +# shutdown +# ipv4 access-group acl_1 egress +# ! + +# - name: Convert ACL interfaces config to argspec without connecting to the appliance +# cisco.iosxr.iosxr_acl_interfaces: +# running_config: "{{ lookup('file', './parsed.cfg') }}" +# state: parsed + + +# Task Output (redacted) +# ----------------------- + +# "parsed": [ +# { +# "name": "MgmtEth0/RP0/CPU0/0" +# }, +# { +# "access_groups": [ +# { +# "acls": [ +# { +# "direction": "in", +# "name": "acl_1" +# }, +# { +# "direction": "out", +# "name": "acl_2" +# } +# ], +# "afi": "ipv4" +# }, +# { +# "acls": [ +# { +# "direction": "in", +# "name": "acl6_1" +# }, +# { +# "direction": "out", +# "name": "acl6_2" +# } +# ], +# "afi": "ipv6" +# } +# ], +# "name": "GigabitEthernet0/0/0/0" +# }, +# { +# "access_groups": [ +# { +# "acls": [ +# { +# "direction": "out", +# "name": "acl_1" +# } +# ], +# "afi": "ipv4" +# } +# ], +# "name": "GigabitEthernet0/0/0/1" +# } +# ] +# } + + +# Using gathered + +- name: Gather ACL interfaces facts using gathered state + cisco.iosxr.iosxr_acl_interfaces: + state: gathered + + +# Task Output (redacted) +# ----------------------- +# +# "gathered": [ +# { +# "name": "MgmtEth0/RP0/CPU0/0" +# }, +# { +# "access_groups": [ +# { +# "acls": [ +# { +# "direction": "in", +# "name": "acl_1" +# }, +# { +# "direction": "out", +# "name": "acl_2" +# } +# ], +# "afi": "ipv4" +# } +# "name": "GigabitEthernet0/0/0/0" +# }, +# { +# "access_groups": [ +# { +# "acls": [ +# { +# "direction": "in", +# "name": "acl6_1" +# } +# ], +# "afi": "ipv6" +# } +# "name": "GigabitEthernet0/0/0/1" +# } +# ] + + +# Using rendered + +- name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_acl_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + access_groups: + - afi: ipv4 + acls: + - name: acl_1 + direction: in + - name: acl_2 + direction: out + state: rendered + +# Task Output (redacted) +# ----------------------- + +# "rendered": [ +# "interface GigabitEthernet0/0/0/0", +# "ipv4 access-group acl_1 ingress", +# "ipv4 access-group acl_2 egress" +# ] +""" +RETURN = """ +before: + description: The configuration prior to the model invocation. + returned: always + type: list + sample: > + The configuration returned will always be in the same format + of the parameters above. +after: + description: The resulting configuration model invocation. + returned: when changed + type: list + sample: > + The configuration returned will always be in the same format + of the parameters above. +commands: + description: The set of commands pushed to the remote device. + returned: always + type: list + sample: + - "interface GigabitEthernet0/0/0/1" + - "ipv4 access-group acl_1 ingress" + - "ipv4 access-group acl_2 egress" + - "ipv6 access-group acl6_1 ingress" + - "interface GigabitEthernet0/0/0/2" + - "no ipv4 access-group acl_3 ingress" + - "ipv4 access-group acl_4 egress" +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.acl_interfaces.acl_interfaces import ( + Acl_interfacesArgs, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.acl_interfaces.acl_interfaces import ( + Acl_interfaces, +) + + +def main(): + """ + Main entry point for module execution + + :returns: the result form module invocation + """ + required_if = [ + ("state", "merged", ("config",)), + ("state", "replaced", ("config",)), + ("state", "overridden", ("config",)), + ("state", "rendered", ("config",)), + ("state", "parsed", ("running_config",)), + ] + mutually_exclusive = [("config", "running_config")] + + module = AnsibleModule( + argument_spec=Acl_interfacesArgs.argument_spec, + required_if=required_if, + mutually_exclusive=mutually_exclusive, + supports_check_mode=True, + ) + + result = Acl_interfaces(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_acls.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_acls.py new file mode 100644 index 00000000..ef31676c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_acls.py @@ -0,0 +1,1451 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# + +""" +The module file for iosxr_acls +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_acls +short_description: ACLs resource module +description: +- This module manages Access Control Lists (ACLs) on devices running IOS-XR. +version_added: 1.0.0 +author: Nilashish Chakraborty (@NilashishC) +options: + config: + description: A list of dictionaries specifying ACL configurations. + type: list + elements: dict + suboptions: + afi: + description: + - The Address Family Indicator (AFI) for the Access Control Lists (ACL). + type: str + required: true + choices: + - ipv4 + - ipv6 + acls: + description: + - A list of Access Control Lists (ACLs). + type: list + elements: dict + suboptions: + name: + description: + - The name of the Access Control List (ACL). + type: str + aces: + description: + - List of Access Control Entries (ACEs) for this Access Control List (ACL). + type: list + elements: dict + suboptions: + sequence: + description: + - Sequence number for the Access Control Entry (ACE). + type: int + grant: + description: + - Forward or drop packets matching the Access Control Entry (ACE). + type: str + choices: + - permit + - deny + remark: + description: + - Comments or a description for the access list. + type: str + line: + description: + - An ACE excluding the sequence number. + - This key is mutually exclusive with all the other attributes except + 'sequence'. + - When used with other attributes, the value of this key will get + precedence and the other keys will be ignored. + - This should only be used when an attribute doesn't exist in the + argspec but is valid for the device. + - For fact gathering, any ACE that is not fully parsed, will show + up as a value of this attribute, excluding the sequence number, + which will be populated as value of the sequence key. + type: str + aliases: + - ace + source: + description: + - Specifies the packet source. + type: dict + suboptions: + host: + description: + - The host IP address to match. + type: str + address: + description: + - The source IP address to match. + type: str + wildcard_bits: + description: + - The Wildcard bits to apply to source address. + type: str + any: + description: + - Match any source address. + type: bool + prefix: + description: + - Source network prefix. + type: str + port_protocol: + description: + - Specify the source port or protocol. + type: dict + suboptions: + eq: + description: + - Match only packets on a given port number. + type: str + gt: + description: + - Match only packets with a greater port number. + type: str + lt: + description: + - Match only packets with a lower port number. + type: str + neq: + description: + - Match only packets not on a given port number. + type: str + range: + description: + - Match only packets in the range of port numbers + type: dict + suboptions: + start: + description: + - Specify the start of the port range + type: str + end: + description: + - Specify the end of the port range + type: str + destination: + description: + - Specifies the packet destination. + type: dict + suboptions: + host: + description: + - The host IP address to match. + type: str + address: + description: + - The destination IP address to match. + type: str + wildcard_bits: + description: + - The Wildcard bits to apply to destination address. + type: str + any: + description: + - Match any destination address. + type: bool + prefix: + description: + - Destination network prefix. + type: str + port_protocol: + description: + - Specify the source port or protocol. + type: dict + suboptions: + eq: + description: + - Match only packets on a given port number. + type: str + gt: + description: + - Match only packets with a greater port number. + type: str + lt: + description: + - Match only packets with a lower port number. + type: str + neq: + description: + - Match only packets not on a given port number. + type: str + range: + description: + - Match only packets in the range of port numbers + type: dict + suboptions: + start: + description: + - Specify the start of the port range + type: str + end: + description: + - Specify the end of the port range + type: str + protocol: + description: + - Specify the protocol to match. + - Refer to vendor documentation for valid values. + type: str + protocol_options: + description: + - Additional suboptions for the protocol. + type: dict + suboptions: + icmpv6: + description: Internet Control Message Protocol settings for IPv6. + type: dict + suboptions: + address_unreachable: + description: Address Unreachable + type: bool + administratively_prohibited: + description: Administratively Prohibited + type: bool + beyond_scope_of_source_address: + description: Administratively Prohibited + type: bool + destination_unreachable: + description: Destination Unreachable + type: bool + echo: + description: Echo + type: bool + echo_reply: + description: Echo Reply + type: bool + erroneous_header_field: + description: Erroneous Header Field + type: bool + group_membership_query: + description: Group Membership Query + type: bool + group_membership_report: + description: Group Membership Report + type: bool + group_membership_termination: + description: Group Membership Termination + type: bool + host_unreachable: + description: Host Unreachable + type: bool + nd_na: + description: Neighbor Discovery - Neighbor Advertisement + type: bool + nd_ns: + description: Neighbor Discovery - Neighbor Solicitation + type: bool + neighbor_redirect: + description: Neighbor Redirect + type: bool + no_route_to_destination: + description: No Route To Destination + type: bool + node_information_request_is_refused: + description: Node Information Request Is Refused + type: bool + node_information_successful_reply: + description: Node Information Successful Reply + type: bool + packet_too_big: + description: Packet Too Big + type: bool + parameter_problem: + description: Parameter Problem + type: bool + port_unreachable: + description: Port Unreachable + type: bool + query_subject_is_IPv4address: + description: Query Subject Is IPv4 address + type: bool + query_subject_is_IPv6address: + description: Query Subject Is IPv6 address + type: bool + query_subject_is_domainname: + description: Query Subject Is Domain name + type: bool + reassembly_timeout: + description: Reassembly Timeout + type: bool + redirect: + description: Redirect + type: bool + router_advertisement: + description: Router Advertisement + type: bool + router_renumbering: + description: Router Renumbering + type: bool + router_solicitation: + description: Router Solicitation + type: bool + rr_command: + description: RR Command + type: bool + rr_result: + description: RR Result + type: bool + rr_seqnum_reset: + description: RR Seqnum Reset + type: bool + time_exceeded: + description: Time Exceeded + type: bool + ttl_exceeded: + description: TTL Exceeded + type: bool + unknown_query_type: + description: Unknown Query Type + type: bool + unreachable: + description: Unreachable + type: bool + unrecognized_next_header: + description: Unrecognized Next Header + type: bool + unrecognized_option: + description: Unrecognized Option + type: bool + whoareyou_reply: + description: Whoareyou Reply + type: bool + whoareyou_request: + description: Whoareyou Request + type: bool + icmp: + description: Internet Control Message Protocol settings. + type: dict + suboptions: + administratively_prohibited: + description: Administratively prohibited + type: bool + alternate_address: + description: Alternate address + type: bool + conversion_error: + description: Datagram conversion + type: bool + dod_host_prohibited: + description: Host prohibited + type: bool + dod_net_prohibited: + description: Net prohibited + type: bool + echo: + description: Echo (ping) + type: bool + echo_reply: + description: Echo reply + type: bool + general_parameter_problem: + description: Parameter problem + type: bool + host_isolated: + description: Host isolated + type: bool + host_precedence_unreachable: + description: Host unreachable for precedence + type: bool + host_redirect: + description: Host redirect + type: bool + host_tos_redirect: + description: Host redirect for TOS + type: bool + host_tos_unreachable: + description: Host unreachable for TOS + type: bool + host_unknown: + description: Host unknown + type: bool + host_unreachable: + description: Host unreachable + type: bool + information_reply: + description: Information replies + type: bool + information_request: + description: Information requests + type: bool + mask_reply: + description: Mask replies + type: bool + mask_request: + description: Mask requests + type: bool + mobile_redirect: + description: Mobile host redirect + type: bool + net_redirect: + description: Network redirect + type: bool + net_tos_redirect: + description: Net redirect for TOS + type: bool + net_tos_unreachable: + description: Network unreachable for TOS + type: bool + net_unreachable: + description: Net unreachable + type: bool + network_unknown: + description: Network unknown + type: bool + no_room_for_option: + description: Parameter required but no room + type: bool + option_missing: + description: Parameter required but not present + type: bool + packet_too_big: + description: Fragmentation needed and DF set + type: bool + parameter_problem: + description: All parameter problems + type: bool + port_unreachable: + description: Port unreachable + type: bool + precedence_unreachable: + description: Precedence cutoff + type: bool + protocol_unreachable: + description: Protocol unreachable + type: bool + reassembly_timeout: + description: Reassembly timeout + type: bool + redirect: + description: All redirects + type: bool + router_advertisement: + description: Router discovery advertisements + type: bool + router_solicitation: + description: Router discovery solicitations + type: bool + source_quench: + description: Source quenches + type: bool + source_route_failed: + description: Source route failed + type: bool + time_exceeded: + description: All time exceededs + type: bool + timestamp_reply: + description: Timestamp replies + type: bool + timestamp_request: + description: Timestamp requests + type: bool + traceroute: + description: Traceroute + type: bool + ttl_exceeded: + description: TTL exceeded + type: bool + unreachable: + description: All unreachables + type: bool + tcp: + description: Match TCP packet flags + type: dict + suboptions: + ack: + description: Match on the ACK bit + type: bool + established: + description: Match established connections + type: bool + fin: + description: Match on the FIN bit + type: bool + psh: + description: Match on the PSH bit + type: bool + rst: + description: Match on the RST bit + type: bool + syn: + description: Match on the SYN bit + type: bool + urg: + description: Match on the URG bit + type: bool + igmp: + description: Internet Group Management Protocol (IGMP) settings. + type: dict + suboptions: + dvmrp: + description: Match Distance Vector Multicast Routing Protocol + type: bool + host_query: + description: Match Host Query + type: bool + host_report: + description: Match Host Report + type: bool + pim: + description: Match Protocol Independent Multicast + type: bool + trace: + description: Multicast trace + type: bool + mtrace: + description: Match mtrace + type: bool + mtrace_response: + description: Match mtrace response + type: bool + dscp: + description: + - Match packets with given DSCP value. + type: dict + suboptions: + eq: + description: Match only packets on a given dscp value + type: str + gt: + description: Match only packets with a greater dscp value + type: str + lt: + description: Match only packets with a lower dscp value + type: str + neq: + description: Match only packets not on a given dscp value + type: str + range: + description: Match only packets in the range of dscp values + type: dict + suboptions: + start: + description: Start of the dscp range + type: str + end: + description: End of the dscp range + type: str + fragments: + description: + - Check non-intial fragments. + type: bool + packet_length: + description: + - Match packets given packet length. + type: dict + suboptions: + eq: + description: Match only packets on a given packet length + type: int + gt: + description: Match only packets with a greater packet length + type: int + lt: + description: Match only packets with a lower packet length + type: int + neq: + description: Match only packets not on a given packet length + type: int + range: + description: Match only packets in the range of packet lengths + type: dict + suboptions: + start: + description: Start of the packet length range + type: int + end: + description: End of the packet length range + type: int + precedence: + description: Match packets with given precedence value + type: str + ttl: + description: Match against specified TTL value. + type: dict + suboptions: + eq: + description: Match only packets with exact TTL value. + type: int + gt: + description: Match only packets with a greater TTL value. + type: int + lt: + description: Match only packets with a lower TTL value. + type: int + neq: + description: Match only packets that won't have the given TTL + value. + type: int + range: + description: Match only packets in the range of given TTL values. + type: dict + suboptions: + start: + description: Start of the TTL range. + type: int + end: + description: End of the TTL range. + type: int + log: + description: + - Enable/disable log matches against this entry. + type: bool + log_input: + description: + - Enable/disable log matches against this entry, including input interface. + type: bool + icmp_off: + description: + - Enable/disable the ICMP message for this entry. + type: bool + capture: + description: + - Capture matched packet. + type: bool + destopts: + description: + - Match if destination opts header is present. + type: bool + authen: + description: + - Match if authentication header is present. + type: bool + routing: + description: + - Match if routing header is present. + type: bool + hop_by_hop: + description: + - Match if hop-by-hop opts header is present. + type: bool + running_config: + description: + - The module, by default, will connect to the remote device and retrieve the current + running-config to use as a base for comparing against the contents of source. + There are times when it is not desirable to have the task get the current running-config + for every task in a playbook. The I(running_config) argument allows the implementer + to pass in the configuration to use as the base config for comparison. This + value of this option should be the output received from device by executing + command B(show running-config router static). + type: str + state: + description: + - The state the configuration should be left in. + type: str + choices: + - merged + - replaced + - overridden + - deleted + - gathered + - rendered + - parsed + default: merged + +""" +EXAMPLES = """ +# Using merged to add new ACLs + +# Before state: +# ------------- + +# RP/0/RP0/CPU0:ios#sh access-lists afi-all +# Thu Feb 20 05:07:45.767 UTC +# RP/0/RP0/CPU0:ios# + +- name: Merge the provided configuration with the exisiting running configuration + cisco.iosxr.iosxr_acls: + config: + - afi: ipv6 + acls: + - name: acl6_1 + aces: + - sequence: 10 + grant: deny + protocol: tcp + source: + prefix: 2001:db8:1234::/48 + port_protocol: + range: + start: ftp + end: telnet + destination: + any: true + protocol_options: + tcp: + syn: true + ttl: + range: + start: 180 + end: 250 + routing: true + authen: true + log: true + + - sequence: 20 + grant: permit + protocol: icmpv6 + source: + any: true + destination: + any: true + protocol_options: + icmpv6: + router_advertisement: true + precedence: network + destopts: true + + - afi: ipv4 + acls: + - name: acl_1 + aces: + - sequence: 16 + remark: TEST_ACL_1_REMARK + + - sequence: 21 + grant: permit + protocol: tcp + source: + host: 192.0.2.10 + port_protocol: + range: + start: pop3 + end: 121 + destination: + address: 198.51.100.0 + wildcard_bits: 0.0.0.15 + protocol_options: + tcp: + rst: true + + - sequence: 23 + grant: deny + protocol: icmp + source: + any: true + destination: + prefix: 198.51.100.0/28 + protocol_options: + icmp: + reassembly_timeout: true + dscp: + lt: af12 + + - name: acl_2 + aces: + - sequence: 10 + remark: TEST_ACL_2_REMARK + state: merged + +# After state: +# ------------- + +# RP/0/RP0/CPU0:ios#sh access-lists afi-all +# Thu Feb 20 05:22:57.021 UTC +# ipv4 access-list acl_1 +# 16 remark TEST_ACL_1_REMARK +# 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst +# 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 +# ipv4 access-list acl_2 +# 10 remark TEST_ACL_2_REMARK +# ipv6 access-list acl6_1 +# 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log +# 20 permit icmpv6 any any router-advertisement precedence network destopts + +# Using merged to update existing ACLs + +# Before state: +# ------------- + +# RP/0/RP0/CPU0:ios#sh access-lists afi-all +# Thu Feb 20 05:22:57.021 UTC +# ipv4 access-list acl_1 +# 16 remark TEST_ACL_1_REMARK +# 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst +# 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 +# ipv4 access-list acl_2 +# 10 remark TEST_ACL_2_REMARK +# ipv6 access-list acl6_1 +# 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log +# 20 permit icmpv6 any any router-advertisement precedence network destopts + +- name: Update existing ACEs + cisco.iosxr.iosxr_acls: + config: + - afi: ipv4 + acls: + - name: acl_1 + aces: + - sequence: 21 + source: + prefix: 198.51.100.32/28 + port_protocol: + range: + start: pop3 + end: 121 + protocol_options: + tcp: + syn: true + + - sequence: 23 + protocol_options: + icmp: + router_advertisement: true + dscp: + eq: af23 + +# After state: +# ------------- + +# RP/0/RP0/CPU0:ios#sh access-lists afi-all +# Thu Feb 20 05:47:18.711 UTC +# ipv4 access-list acl_1 +# 16 remark TEST_ACL_1_REMARK +# 21 permit tcp 198.51.100.32 0.0.0.15 range pop3 121 198.51.100.0 0.0.0.15 syn +# 23 deny icmp any 198.51.100.0 0.0.0.15 router-advertisement dscp eq af23 +# ipv4 access-list acl_2 +# 10 remark TEST_ACL_2_REMARK +# ipv6 access-list acl6_1 +# 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log +# 20 permit icmpv6 any any router-advertisement precedence network destopts + +# Using replaced to replace a whole ACL + +# Before state: +# ------------- + +# RP/0/RP0/CPU0:ios#sh access-lists afi-all +# Thu Feb 20 05:22:57.021 UTC +# ipv4 access-list acl_1 +# 16 remark TEST_ACL_1_REMARK +# 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst +# 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 +# ipv4 access-list acl_2 +# 10 remark TEST_ACL_2_REMARK +# ipv6 access-list acl6_1 +# 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log +# 20 permit icmpv6 any any router-advertisement precedence network destopts + +- name: Replace device configurations of listed ACL with provided configurations + cisco.iosxr.iosxr_acls: + config: + - afi: ipv4 + acls: + - name: acl_2 + aces: + - sequence: 11 + grant: permit + protocol: igmp + source: + host: 198.51.100.130 + destination: + any: true + ttl: + eq: 100 + + - sequence: 12 + grant: deny + source: + any: true + destination: + any: true + protocol: icmp + state: replaced + +# After state: +# ------------- + +# RP/0/RP0/CPU0:ios#sh access-lists afi-all +# Thu Feb 20 06:19:51.496 UTC +# ipv4 access-list acl_1 +# 16 remark TEST_ACL_1_REMARK +# 21 permit tcp 198.51.100.32 0.0.0.15 range pop3 121 198.51.100.0 0.0.0.15 syn +# 23 deny icmp any 198.51.100.0 0.0.0.15 router-advertisement dscp eq af23 +# ipv4 access-list acl_2 +# 11 permit igmp host 198.51.100.130 any ttl eq 100 +# 12 deny icmp any any +# ipv6 access-list acl6_1 +# 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log +# 20 permit icmpv6 any any router-advertisement precedence network destopts + +# Using overridden to override all ACLs in the device + +# Before state: +# ------------- + +# RP/0/RP0/CPU0:ios#sh access-lists afi-all +# Thu Feb 20 05:22:57.021 UTC +# ipv4 access-list acl_1 +# 16 remark TEST_ACL_1_REMARK +# 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst +# 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 +# ipv4 access-list acl_2 +# 10 remark TEST_ACL_2_REMARK +# ipv6 access-list acl6_1 +# 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log +# 20 permit icmpv6 any any router-advertisement precedence network destopts + +- name: Overridde all ACLs configuration with provided configuration + cisco.iosxr.iosxr_acls: + config: + - afi: ipv4 + acls: + - name: acl_1 + aces: + - sequence: 10 + grant: permit + source: + any: true + destination: + any: true + protocol: tcp + + - name: acl_2 + aces: + - sequence: 20 + grant: permit + source: + any: true + destination: + any: true + protocol: igmp + state: overridden + +# After state: +# ------------- + +# RP/0/RP0/CPU0:ios#sh access-lists afi-all +# Thu Feb 20 06:31:22.178 UTC +# ipv4 access-list acl_1 +# 10 permit tcp any any +# ipv4 access-list acl_2 +# 20 permit igmp any any + +# Using deleted to delete an entire ACL + +# Before state: +# ------------- + +# RP/0/RP0/CPU0:ios#sh access-lists afi-all +# Thu Feb 20 05:22:57.021 UTC +# ipv4 access-list acl_1 +# 16 remark TEST_ACL_1_REMARK +# 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst +# 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 +# ipv4 access-list acl_2 +# 10 remark TEST_ACL_2_REMARK +# ipv6 access-list acl6_1 +# 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log +# 20 permit icmpv6 any any router-advertisement precedence network destopts + +- name: Delete a single ACL + cisco.iosxr.iosxr_acls: + config: + - afi: ipv6 + acls: + - name: acl6_1 + state: deleted + +# After state: +# ------------- + +# RP/0/RP0/CPU0:ios#sh access-lists afi-all +# Thu Feb 20 05:22:57.021 UTC +# ipv4 access-list acl_1 +# 16 remark TEST_ACL_1_REMARK +# 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst +# 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 +# ipv4 access-list acl_2 +# 10 remark TEST_ACL_2_REMARK + +# Using deleted to delete all ACLs under one AFI + +# Before state: +# ------------- + +# RP/0/RP0/CPU0:ios#sh access-lists afi-all +# Thu Feb 20 05:22:57.021 UTC +# ipv4 access-list acl_1 +# 16 remark TEST_ACL_1_REMARK +# 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst +# 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 +# ipv4 access-list acl_2 +# 10 remark TEST_ACL_2_REMARK +# ipv6 access-list acl6_1 +# 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log +# 20 permit icmpv6 any any router-advertisement precedence network destopts + +- name: Delete all ACLs under one AFI + cisco.iosxr.iosxr_acls: + config: + - afi: ipv4 + state: deleted + +# After state: +# ------------- + +# RP/0/RP0/CPU0:ios#sh access-lists afi-all +# Thu Feb 20 05:22:57.021 UTC +# ipv6 access-list acl6_1 +# 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log +# 20 permit icmpv6 any any router-advertisement precedence network destopts + +# Using deleted to delete all ACLs from the device + +# Before state: +# ------------- + +# RP/0/RP0/CPU0:ios#sh access-lists afi-all +# Thu Feb 20 05:22:57.021 UTC +# ipv4 access-list acl_1 +# 16 remark TEST_ACL_1_REMARK +# 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst +# 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 +# ipv4 access-list acl_2 +# 10 remark TEST_ACL_2_REMARK +# ipv6 access-list acl6_1 +# 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log +# 20 permit icmpv6 any any router-advertisement precedence network destopts + +- name: Delete all ACLs from the device + cisco.iosxr.iosxr_acls: + state: deleted + +# After state: +# ------------- + +# RP/0/RP0/CPU0:ios#sh access-lists afi-all +# Thu Feb 20 05:07:45.767 UTC +# RP/0/RP0/CPU0:ios# + +# Using gathered to gather ACL facts from the device + +- name: Gather ACL interfaces facts using gathered state + cisco.iosxr.iosxr_acls: + state: gathered + +# Task Output (redacted) +# ----------------------- +# + +# "gathered": [ +# { +# "acls": [ +# { +# "aces": [ +# { +# "remark": "TEST_ACL_1_REMARK", +# "sequence": 16 +# }, +# { +# "destination": { +# "address": "198.51.100.0", +# "wildcard_bits": "0.0.0.15" +# }, +# "grant": "permit", +# "protocol": "tcp", +# "protocol_options": { +# "tcp": { +# "rst": true +# } +# }, +# "sequence": 21, +# "source": { +# "host": "192.0.2.10", +# "port_protocol": { +# "range": { +# "end": "121", +# "start": "pop3" +# } +# } +# } +# }, +# { +# "destination": { +# "address": "198.51.100.0", +# "wildcard_bits": "0.0.0.15" +# }, +# "dscp": { +# "lt": "af12" +# }, +# "grant": "deny", +# "protocol": "icmp", +# "protocol_options": { +# "icmp": { +# "reassembly_timeout": true +# } +# }, +# "sequence": 23, +# "source": { +# "any": true +# } +# } +# ], +# "name": "acl_1" +# }, +# { +# "aces": [ +# { +# "remark": "TEST_ACL_2_REMARK", +# "sequence": 10 +# } +# ], +# "name": "acl_2" +# } +# ], +# "afi": "ipv4" +# }, +# { +# "acls": [ +# { +# "aces": [ +# { +# "authen": true, +# "destination": { +# "any": true +# }, +# "grant": "deny", +# "log": true, +# "protocol": "tcp", +# "protocol_options": { +# "tcp": { +# "syn": true +# } +# }, +# "routing": true, +# "sequence": 10, +# "source": { +# "port_protocol": { +# "range": { +# "end": "telnet", +# "start": "ftp" +# } +# }, +# "prefix": "2001:db8:1234::/48" +# }, +# "ttl": { +# "range": { +# "end": 250, +# "start": 180 +# } +# } +# }, +# { +# "destination": { +# "any": true +# }, +# "destopts": true, +# "grant": "permit", +# "precedence": "network", +# "protocol": "icmpv6", +# "protocol_options": { +# "icmpv6": { +# "router_advertisement": true +# } +# }, +# "sequence": 20, +# "source": { +# "any": true +# } +# } +# ], +# "name": "acl6_1" +# } +# ], +# "afi": "ipv6" +# } +# ] + +# Using rendered + +- name: Render platform specific commands (without connecting to the device) + cisco.iosxr.iosxr_acls: + config: + - afi: ipv4 + acls: + - name: acl_2 + aces: + - sequence: 11 + grant: permit + protocol: igmp + source: + host: 198.51.100.130 + destination: + any: true + ttl: + eq: 100 + + - sequence: 12 + grant: deny + source: + any: true + destination: + any: true + protocol: icmp + state: rendered + +# Task Output (redacted) +# ----------------------- + +# "rendered": [ +# "ipv4 access-list acl_2", +# "11 permit igmp host 198.51.100.130 any ttl eq 100", +# "12 deny icmp any any" + +# Using parsed + +# parsed.cfg +# ------------ +# +# ipv4 access-list acl_1 +# 10 remark TEST_ACL_2_REMARK +# ipv4 access-list acl_2 +# 11 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 authen routing log +# 21 permit icmpv6 any any router-advertisement precedence network packet-length eq 576 destopts +# ipv6 access-list acl6_1 +# 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log +# 20 permit icmpv6 any any router-advertisement precedence network packet-length eq 576 destopts + +- name: Parse externally provided ACL config to agnostic model + cisco.iosxr.iosxr_acls: + running_config: "{{ lookup('file', 'parsed.cfg') }}" + state: parsed + +# Task Output (redacted) +# ----------------------- +# "parsed": [ +# { +# "acls": [ +# { +# "aces": [ +# { +# "remark": "TEST_ACL_2_REMARK", +# "sequence": 10 +# } +# ], +# "name": "acl_1" +# }, +# { +# "aces": [ +# { +# "authen": true, +# "destination": { +# "any": true +# }, +# "grant": "deny", +# "log": true, +# "protocol": "tcp", +# "protocol_options": { +# "tcp": { +# "syn": true +# } +# }, +# "routing": true, +# "sequence": 11, +# "source": { +# "port_protocol": { +# "range": { +# "end": "telnet", +# "start": "ftp" +# } +# }, +# "prefix": "2001:db8:1234::/48" +# }, +# "ttl": { +# "range": { +# "end": 250, +# "start": 180 +# } +# } +# }, +# { +# "destination": { +# "any": true +# }, +# "destopts": true, +# "grant": "permit", +# "packet_length": { +# "eq": 576 +# }, +# "precedence": "network", +# "protocol": "icmpv6", +# "protocol_options": { +# "icmpv6": { +# "router_advertisement": true +# } +# }, +# "sequence": 21, +# "source": { +# "any": true +# } +# } +# ], +# "name": "acl_2" +# } +# ], +# "afi": "ipv4" +# }, +# { +# "acls": [ +# { +# "aces": [ +# { +# "authen": true, +# "destination": { +# "any": true +# }, +# "grant": "deny", +# "log": true, +# "protocol": "tcp", +# "protocol_options": { +# "tcp": { +# "syn": true +# } +# }, +# "routing": true, +# "sequence": 10, +# "source": { +# "port_protocol": { +# "range": { +# "end": "telnet", +# "start": "ftp" +# } +# }, +# "prefix": "2001:db8:1234::/48" +# }, +# "ttl": { +# "range": { +# "end": 250, +# "start": 180 +# } +# } +# }, +# { +# "destination": { +# "any": true +# }, +# "destopts": true, +# "grant": "permit", +# "packet_length": { +# "eq": 576 +# }, +# "precedence": "network", +# "protocol": "icmpv6", +# "protocol_options": { +# "icmpv6": { +# "router_advertisement": true +# } +# }, +# "sequence": 20, +# "source": { +# "any": true +# } +# } +# ], +# "name": "acl6_1" +# } +# ], +# "afi": "ipv6" +# } +# ] +""" +RETURN = """ +before: + description: The configuration prior to the model invocation. + returned: always + type: list + sample: > + The configuration returned will always be in the same format + of the parameters above. +after: + description: The resulting configuration model invocation. + returned: when changed + type: list + sample: > + The configuration returned will always be in the same format + of the parameters above. +commands: + description: The set of commands pushed to the remote device. + returned: always + type: list + sample: + - ipv6 access-list acl6_1 + - 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 authen routing log + - 20 permit icmpv6 any any router-advertisement precedence network destopts + - ipv4 access-list acl_1 + - 16 remark TEST_ACL_1_REMARK + - 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst + - 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.acls.acls import ( + AclsArgs, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.acls.acls import ( + Acls, +) + + +def main(): + """ + Main entry point for module execution + + :returns: the result form module invocation + """ + required_if = [ + ("state", "merged", ("config",)), + ("state", "replaced", ("config",)), + ("state", "overridden", ("config",)), + ("state", "rendered", ("config",)), + ("state", "parsed", ("running_config",)), + ] + + module = AnsibleModule( + argument_spec=AclsArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + + result = Acls(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_banner.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_banner.py new file mode 100644 index 00000000..be75ecaf --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_banner.py @@ -0,0 +1,316 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# Copyright: (c) 2017, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_banner +author: +- Trishna Guha (@trishnaguha) +- Kedar Kekan (@kedarX) +short_description: Manage multiline banners on Cisco IOS XR devices +description: +- This module will configure both exec and motd banners on remote device running Cisco + IOS XR. It allows playbooks to add or remove banner text from the running configuration. +version_added: 1.0.0 +requirements: +- ncclient >= 0.5.3 when using netconf +- lxml >= 4.1.1 when using netconf +extends_documentation_fragment: +- cisco.iosxr.iosxr +notes: +- Tested against IOS XRv 6.1.3. +- This module works with connection C(network_cli) and C(netconf). See L(the IOS-XR + Platform Options,../network/user_guide/platform_iosxr.html). +options: + banner: + description: + - Specifies the type of banner to configure on remote device. + required: true + type: str + choices: + - login + - motd + text: + description: + - Banner text to be configured. Accepts multi line string, without empty lines. + When using a multi line string, the first and last characters must be the + start and end delimiters for the banner + Requires I(state=present). + type: str + state: + description: + - Existential state of the configuration on the device. + default: present + type: str + choices: + - present + - absent +""" + +EXAMPLES = """ +- name: configure the login banner + cisco.iosxr.iosxr_banner: + banner: login + text: | + @this is my login banner + that contains a multiline + string@ + state: present +- name: remove the motd banner + cisco.iosxr.iosxr_banner: + banner: motd + state: absent +- name: Configure banner from file + cisco.iosxr.iosxr_banner: + banner: motd + text: "{{ lookup('file', './config_partial/raw_banner.cfg') }}" + state: present +""" + +RETURN = """ +commands: + description: The list of configuration mode commands sent to device with transport C(cli) + returned: always (empty list when no commands to send) + type: list + sample: + - banner login + - "@this is my login banner" + - that contains a multiline + - string@ + +xml: + description: NetConf rpc xml sent to device with transport C(netconf) + returned: always (empty list when no xml rpc to send) + type: list + sample: + - ' + + + motd + Ansible banner example + + + ' +""" + +import re +import collections + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + get_config, + load_config, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + iosxr_argument_spec, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + build_xml, + is_cliconf, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + etree_find, + is_netconf, +) + + +class ConfigBase(object): + def __init__(self, module): + self._module = module + self._result = {"changed": False, "warnings": []} + self._want = {} + self._have = {} + + def map_params_to_obj(self): + text = self._module.params["text"] + if text: + text = "{0}".format(str(text).strip()) + self._want.update( + { + "banner": self._module.params["banner"], + "text": text, + "state": self._module.params["state"], + } + ) + + +class CliConfiguration(ConfigBase): + def __init__(self, module): + super(CliConfiguration, self).__init__(module) + + def map_obj_to_commands(self): + commands = list() + state = self._module.params["state"] + if state == "absent": + if self._have.get("state") != "absent" and ( + "text" in self._have.keys() and self._have["text"] + ): + commands.append( + "no banner {0!s}".format(self._module.params["banner"]) + ) + elif state == "present": + if self._want["text"] and self._want["text"].encode().decode( + "unicode_escape" + ) != self._have.get("text"): + banner_cmd = "banner {0!s} ".format( + self._module.params["banner"] + ) + banner_cmd += self._want["text"].strip() + commands.append(banner_cmd) + self._result["commands"] = commands + if commands: + commit = not self._module.check_mode + diff = load_config(self._module, commands, commit=commit) + if diff: + self._result["diff"] = dict(prepared=diff) + self._result["changed"] = True + + def map_config_to_obj(self): + cli_filter = "banner {0!s}".format(self._module.params["banner"]) + output = get_config(self._module, config_filter=cli_filter) + match = re.search(r"banner (\S+) (.*)", output, re.DOTALL) + if match: + text = match.group(2) + else: + text = None + obj = {"banner": self._module.params["banner"], "state": "absent"} + if output: + obj["text"] = text + obj["state"] = "present" + self._have.update(obj) + + def run(self): + self.map_params_to_obj() + self.map_config_to_obj() + self.map_obj_to_commands() + + return self._result + + +class NCConfiguration(ConfigBase): + def __init__(self, module): + super(NCConfiguration, self).__init__(module) + self._banners_meta = collections.OrderedDict() + self._banners_meta.update( + [ + ( + "banner", + { + "xpath": "banners/banner", + "tag": True, + "attrib": "operation", + }, + ), + ("a:banner", {"xpath": "banner/banner-name"}), + ( + "a:text", + {"xpath": "banner/banner-text", "operation": "edit"}, + ), + ] + ) + + def map_obj_to_xml_rpc(self): + state = self._module.params["state"] + _get_filter = build_xml( + "banners", + xmap=self._banners_meta, + params=self._module.params, + opcode="filter", + ) + + running = get_config( + self._module, source="running", config_filter=_get_filter + ) + + banner_name = None + banner_text = None + if etree_find(running, "banner-text") is not None: + banner_name = etree_find(running, "banner-name").text + banner_text = etree_find(running, "banner-text").text + + opcode = None + if ( + state == "absent" + and banner_name == self._module.params["banner"] + and len(banner_text) + ): + opcode = "delete" + elif state == "present": + opcode = "merge" + + self._result["xml"] = [] + if opcode: + _edit_filter = build_xml( + "banners", + xmap=self._banners_meta, + params=self._module.params, + opcode=opcode, + ) + + if _edit_filter is not None: + commit = not self._module.check_mode + diff = load_config( + self._module, + _edit_filter, + commit=commit, + running=running, + nc_get_filter=_get_filter, + ) + + if diff: + self._result["xml"] = _edit_filter + if self._module._diff: + self._result["diff"] = dict(prepared=diff) + + self._result["changed"] = True + + def run(self): + self.map_params_to_obj() + self.map_obj_to_xml_rpc() + + return self._result + + +def main(): + """ main entry point for module execution + """ + argument_spec = dict( + banner=dict(required=True, choices=["login", "motd"]), + text=dict(), + state=dict(default="present", choices=["present", "absent"]), + ) + + argument_spec.update(iosxr_argument_spec) + + required_if = [("state", "present", ("text",))] + + module = AnsibleModule( + argument_spec=argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + + config_object = None + if is_cliconf(module): + # Commenting the below cliconf deprecation support call for Ansible 2.9 as it'll be continued to be supported + # module.deprecate("cli support for 'iosxr_interface' is deprecated. Use transport netconf instead", + # version='2.9') + config_object = CliConfiguration(module) + elif is_netconf(module): + config_object = NCConfiguration(module) + + result = None + if config_object is not None: + result = config_object.run() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_bgp.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_bgp.py new file mode 100644 index 00000000..7e496545 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_bgp.py @@ -0,0 +1,355 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# (c) 2019, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_bgp +author: Nilashish Chakraborty (@NilashishC) +short_description: Configure global BGP protocol settings on Cisco IOS-XR +description: +- This module provides configuration management of global BGP parameters on devices + running Cisco IOS-XR +version_added: 1.0.0 +notes: +- Tested against Cisco IOS XR Software Version 6.1.3 +- This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html). +options: + config: + description: + - Specifies the BGP related configuration. + type: dict + suboptions: + bgp_as: + description: + - Specifies the BGP Autonomous System (AS) number to configure on the device. + type: int + required: true + router_id: + description: + - Configures the BGP routing process router-id value. + type: str + log_neighbor_changes: + description: + - Enable/disable logging neighbor up/down and reset reason. + type: bool + neighbors: + description: + - Specifies BGP neighbor related configurations. + type: list + elements: dict + suboptions: + neighbor: + description: + - Neighbor router address. + type: str + required: true + remote_as: + description: + - Remote AS of the BGP neighbor to configure. + type: int + required: true + update_source: + description: + - Source of the routing updates. + type: str + password: + description: + - Password to authenticate the BGP peer connection. + type: str + enabled: + description: + - Administratively shutdown or enable a neighbor. + type: bool + description: + description: + - Neighbor specific description. + type: str + advertisement_interval: + description: + - Specifies the minimum interval (in seconds) between sending BGP routing + updates. + - The range is from 0 to 600. + type: int + tcp_mss: + description: + - Specifies the TCP initial maximum segment size to use. + - The range is from 68 to 10000. + type: int + ebgp_multihop: + description: + - Specifies the maximum hop count for EBGP neighbors not on directly connected + networks. + - The range is from 0 to 255. + type: int + timers: + description: + - Specifies BGP neighbor timer related configurations. + type: dict + suboptions: + keepalive: + description: + - Frequency with which the Cisco IOS-XR software sends keepalive messages + to its peer. + - The range is from 0 to 65535. + type: int + holdtime: + description: + - Interval after not receiving a keepalive message that the software + declares a peer dead. + - The range is from 3 to 65535. + type: int + min_neighbor_holdtime: + description: + - Interval specifying the minimum acceptable hold-time from a BGP + neighbor. + - The minimum acceptable hold-time must be less than, or equal to, + the interval specified in the holdtime argument. + - The range is from 3 to 65535. + type: int + address_family: + description: + - Specifies BGP address family related configurations. + type: list + elements: dict + suboptions: + afi: + description: + - Type of address family to configure. + choices: + - ipv4 + - ipv6 + required: true + type: str + safi: + description: + - Specifies the type of cast for the address family. + choices: + - flowspec + - unicast + - multicast + - labeled-unicast + type: str + default: unicast + redistribute: + description: + - Specifies the redistribute information from another routing protocol. + type: list + elements: dict + suboptions: + protocol: + description: + - Specifies the protocol for configuring redistribute information. + type: str + choices: + - ospf + - ospfv3 + - eigrp + - isis + - static + - connected + - lisp + - mobile + - rip + - subscriber + required: true + id: + description: + - Identifier for the routing protocol for configuring redistribute + information. + - Valid for protocols 'ospf', 'eigrp', 'isis' and 'ospfv3'. + type: str + metric: + description: + - Specifies the metric for redistributed routes. + type: int + route_map: + description: + - Specifies the route map reference. + type: str + networks: + description: + - Specify networks to announce via BGP. + - For operation replace, this option is mutually exclusive with root level + networks option. + type: list + elements: dict + suboptions: + network: + description: + - Network ID to announce via BGP. + required: true + aliases: + - prefix + type: str + masklen: + description: + - Subnet mask length for the network to announce(e.g, 8, 16, 24, etc.). + type: int + required: true + route_map: + description: + - Route map to modify the attributes. + type: str + operation: + description: + - Specifies the operation to be performed on the BGP process configured on the + device. + - In case of merge, the input configuration will be merged with the existing BGP + configuration on the device. + - In case of replace, if there is a diff between the existing configuration and + the input configuration, the existing configuration will be replaced by the + input configuration for every option that has the diff. + - In case of override, all the existing BGP configuration will be removed from + the device and replaced with the input configuration. + - In case of delete the existing BGP configuration will be removed from the device. + default: merge + type: str + choices: + - merge + - replace + - override + - delete +""" + +EXAMPLES = """ +- name: configure global bgp as 65000 + cisco.iosxr.iosxr_bgp: + bgp_as: 65000 + router_id: 1.1.1.1 + neighbors: + - neighbor: 182.168.10.1 + remote_as: 500 + description: PEER_1 + - neighbor: 192.168.20.1 + remote_as: 500 + update_source: GigabitEthernet 0/0/0/0 + address_family: + - name: ipv4 + cast: unicast + networks: + - network: 192.168.2.0/23 + - network: 10.0.0.0/8 + redistribute: + - protocol: ospf + id: 400 + metric: 110 + +- name: remove bgp as 65000 from config + ios_bgp: + bgp_as: 65000 + state: absent +""" + +RETURN = """ +commands: + description: The list of configuration mode commands to send to the device + returned: always + type: list + sample: + - router bgp 65000 + - bgp router-id 1.1.1.1 + - neighbor 182.168.10.1 remote-as 500 + - neighbor 182.168.10.1 description PEER_1 + - neighbor 192.168.20.1 remote-as 500 + - neighbor 192.168.20.1 update-source GigabitEthernet0/0/0/0 + - address-family ipv4 unicast + - redistribute ospf 400 metric 110 + - network 192.168.2.0/23 + - network 10.0.0.0/8 + - exit +""" +from ansible.module_utils._text import to_text +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.providers.module import ( + NetworkModule, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.providers.cli.config.bgp.process import ( + REDISTRIBUTE_PROTOCOLS, +) + + +def main(): + """ main entry point for module execution + """ + network_spec = { + "network": dict(aliases=["prefix"], required=True), + "masklen": dict(type="int", required=True), + "route_map": dict(), + } + + redistribute_spec = { + "protocol": dict(choices=REDISTRIBUTE_PROTOCOLS, required=True), + "id": dict(), + "metric": dict(type="int"), + "route_map": dict(), + } + + timer_spec = { + "keepalive": dict(type="int"), + "holdtime": dict(type="int"), + "min_neighbor_holdtime": dict(type="int"), + } + + neighbor_spec = { + "neighbor": dict(required=True), + "remote_as": dict(type="int", required=True), + "update_source": dict(), + "password": dict(no_log=True), + "enabled": dict(type="bool"), + "description": dict(), + "advertisement_interval": dict(type="int"), + "ebgp_multihop": dict(type="int"), + "tcp_mss": dict(type="int"), + "timers": dict(type="dict", options=timer_spec), + } + + address_family_spec = { + "afi": dict(choices=["ipv4", "ipv6"], required=True), + "safi": dict( + choices=["flowspec", "labeled-unicast", "multicast", "unicast"], + default="unicast", + ), + "networks": dict(type="list", elements="dict", options=network_spec), + "redistribute": dict( + type="list", elements="dict", options=redistribute_spec + ), + } + + config_spec = { + "bgp_as": dict(type="int", required=True), + "router_id": dict(), + "log_neighbor_changes": dict(type="bool"), + "neighbors": dict(type="list", elements="dict", options=neighbor_spec), + "address_family": dict( + type="list", elements="dict", options=address_family_spec + ), + } + + argument_spec = { + "config": dict(type="dict", options=config_spec), + "operation": dict( + default="merge", choices=["merge", "replace", "override", "delete"] + ), + } + + module = NetworkModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + try: + result = module.edit_config(config_filter="router bgp") + except Exception as exc: + module.fail_json(msg=to_text(exc)) + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_command.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_command.py new file mode 100644 index 00000000..68e990b1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_command.py @@ -0,0 +1,213 @@ +#!/usr/bin/python +# +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +module: iosxr_command +author: Ricardo Carrillo Cruz (@rcarrillocruz) +short_description: Run commands on remote devices running Cisco IOS XR +description: +- Sends arbitrary commands to an IOS XR node and returns the results read from the + device. This module includes an argument that will cause the module to wait for + a specific condition before returning or timing out if the condition is not met. +- This module does not support running commands in configuration mode. Please use + M(iosxr_config) to configure iosxr devices. +version_added: 1.0.0 +extends_documentation_fragment: +- cisco.iosxr.iosxr +notes: +- Make sure the user has been authorized to execute commands terminal length 0, terminal + width 512 and terminal exec prompt no-timestamp. +- This module works with C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html). +- This module does not support C(netconf) connection. +- Tested against IOS XR 6.1.3 +options: + commands: + description: + - List of commands to send to the remote iosxr device over the configured provider. + The resulting output from the command is returned. If the I(wait_for) argument + is provided, the module is not returned until the condition is satisfied or + the number of retries has expired. + - If a command sent to the device requires answering a prompt, it is possible to pass + a dict containing command, answer and prompt. Common answers are 'y' or "\\r" + (carriage return, must be double quotes). See examples + type: list + elements: raw + required: true + wait_for: + description: + - List of conditions to evaluate against the output of the command. The task will + wait for each condition to be true before moving forward. If the conditional + is not true within the configured number of retries, the task fails. See examples. + aliases: + - waitfor + type: list + elements: str + match: + description: + - The I(match) argument is used in conjunction with the I(wait_for) argument to + specify the match policy. Valid values are C(all) or C(any). If the value + is set to C(all) then all conditionals in the wait_for must be satisfied. If + the value is set to C(any) then only one of the values must be satisfied. + default: all + choices: + - any + - all + type: str + retries: + description: + - Specifies the number of retries a command should by tried before it is considered + failed. The command is run on the target device every retry and evaluated against + the I(wait_for) conditions. + default: 10 + type: int + interval: + description: + - Configures the interval in seconds to wait between retries of the command. If + the command does not pass the specified conditions, the interval indicates how + long to wait before trying the command again. + default: 1 + type: int +""" + +EXAMPLES = """ +- name: run show version on remote devices + cisco.iosxr.iosxr_command: + commands: show version + +- name: run show version and check to see if output contains iosxr + cisco.iosxr.iosxr_command: + commands: show version + wait_for: result[0] contains IOS-XR + +- name: run multiple commands on remote nodes + cisco.iosxr.iosxr_command: + commands: + - show version + - show interfaces + - {command: example command that prompts, prompt: expected prompt, answer: yes} + +- name: run multiple commands and evaluate the output + cisco.iosxr.iosxr_command: + commands: + - show version + - show interfaces + wait_for: + - result[0] contains IOS-XR + - result[1] contains Loopback0 +""" + +RETURN = """ +stdout: + description: The set of responses from the commands + returned: always apart from low level errors (such as action plugin) + type: list + sample: ['...', '...'] +stdout_lines: + description: The value of stdout split into a list + returned: always apart from low level errors (such as action plugin) + type: list + sample: [['...', '...'], ['...'], ['...']] +failed_conditions: + description: The list of conditionals that have failed + returned: failed + type: list + sample: ['...', '...'] +""" +import time + +from ansible.module_utils._text import to_text +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.parsing import ( + Conditional, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_lines, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + run_commands, + iosxr_argument_spec, +) + + +def parse_commands(module, warnings): + commands = module.params["commands"] + for item in list(commands): + try: + command = item["command"] + except Exception: + command = item + if module.check_mode and not command.startswith("show"): + warnings.append( + "Only show commands are supported when using check mode, not " + "executing %s" % command + ) + commands.remove(item) + + return commands + + +def main(): + argument_spec = dict( + commands=dict(type="list", required=True, elements="raw"), + wait_for=dict(type="list", aliases=["waitfor"], elements="str"), + match=dict(default="all", choices=["all", "any"]), + retries=dict(default=10, type="int"), + interval=dict(default=1, type="int"), + ) + + argument_spec.update(iosxr_argument_spec) + + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + warnings = list() + result = {"changed": False, "warnings": warnings} + commands = parse_commands(module, warnings) + wait_for = module.params["wait_for"] or list() + + try: + conditionals = [Conditional(c) for c in wait_for] + except AttributeError as exc: + module.fail_json(msg=to_text(exc)) + + retries = module.params["retries"] + interval = module.params["interval"] + match = module.params["match"] + + while retries > 0: + responses = run_commands(module, commands) + + for item in list(conditionals): + if item(responses): + if match == "any": + conditionals = list() + break + conditionals.remove(item) + + if not conditionals: + break + + time.sleep(interval) + retries -= 1 + + if conditionals: + failed_conditions = [item.raw for item in conditionals] + msg = "One or more conditional statements have not been satisfied" + module.fail_json(msg=msg, failed_conditions=failed_conditions) + + result.update( + {"stdout": responses, "stdout_lines": list(to_lines(responses))} + ) + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_config.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_config.py new file mode 100644 index 00000000..2a5d3080 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_config.py @@ -0,0 +1,480 @@ +#!/usr/bin/python +# +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_config +author: Ricardo Carrillo Cruz (@rcarrillocruz) +short_description: Manage Cisco IOS XR configuration sections +description: +- Cisco IOS XR configurations use a simple block indent file syntax for segmenting + configuration into sections. This module provides an implementation for working + with IOS XR configuration sections in a deterministic way. +version_added: 1.0.0 +extends_documentation_fragment: +- cisco.iosxr.iosxr +notes: +- This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html). +- Tested against IOS XRv 6.1.3. +- This module does not support C(netconf) connection +- Abbreviated commands are NOT idempotent, see L(Network FAQ,../network/user_guide/faq.html + #why-do-the-config-modules-always-return-changed-true-with-abbreviated-commands). +- Avoid service disrupting changes (viz. Management IP) from config replace. +- Do not use C(end) in the replace config file. +- To ensure idempotency and correct diff the configuration lines in the relevant module options should be similar to how they + appear if present in the running configuration on device including the indentation. +options: + lines: + description: + - The ordered set of commands that should be configured in the section. The commands + must be the exact same commands as found in the device running-config as found in the + device running-config to ensure idempotency and correct diff. Be sure to note the + configuration command syntax as some commands are automatically modified by the + device config parser. + type: list + elements: str + aliases: + - commands + parents: + description: + - The ordered set of parents that uniquely identify the section or hierarchy the + commands should be checked against. If the parents argument is omitted, the + commands are checked against the set of top level or global commands. + type: list + elements: str + src: + description: + - Specifies the source path to the file that contains the configuration or configuration + template to load. The path to the source file can either be the full path on + the Ansible control host or a relative path from the playbook or role root directory. This + argument is mutually exclusive with I(lines), I(parents). The configuration lines in the + source file should be similar to how it will appear if present in the running-configuration + of the device to ensure idempotency and correct diff. + type: path + before: + description: + - The ordered set of commands to push on to the command stack if a change needs + to be made. This allows the playbook designer the opportunity to perform configuration + commands prior to pushing any changes without affecting how the set of commands + are matched against the system. + type: list + elements: str + after: + description: + - The ordered set of commands to append to the end of the command stack if a change + needs to be made. Just like with I(before) this allows the playbook designer + to append a set of commands to be executed after the command set. + type: list + elements: str + match: + description: + - Instructs the module on the way to perform the matching of the set of commands + against the current device config. If match is set to I(line), commands are + matched line by line. If match is set to I(strict), command lines are matched + with respect to position. If match is set to I(exact), command lines must be + an equal match. Finally, if match is set to I(none), the module will not attempt + to compare the source configuration with the running configuration on the remote + device. + type: str + default: line + choices: + - line + - strict + - exact + - none + replace: + description: + - Instructs the module on the way to perform the configuration on the device. If + the replace argument is set to I(line) then the modified lines are pushed to + the device in configuration mode. If the replace argument is set to I(block) + then the entire command block is pushed to the device in configuration mode + if any line is not correct. + type: str + default: line + choices: + - line + - block + - config + force: + description: + - The force argument instructs the module to not consider the current devices + running-config. When set to true, this will cause the module to push the contents + of I(src) into the device without first checking if already configured. + - Note this argument should be considered deprecated. To achieve the equivalent, + set the C(match=none) which is idempotent. This argument will be removed in + a future release. + type: bool + default: no + config: + description: + - The module, by default, will connect to the remote device and retrieve the current + running-config to use as a base for comparing against the contents of source. There + are times when it is not desirable to have the task get the current running-config + for every task in a playbook. The I(config) argument allows the implementer + to pass in the configuration to use as the base config for comparison. + The configuration lines for this option should be similar to how it will appear if present + in the running-configuration of the device to ensure idempotency and correct diff. + type: str + backup: + description: + - This argument will cause the module to create a full backup of the current C(running-config) + from the remote device before any changes are made. If the C(backup_options) + value is not given, the backup file is written to the C(backup) folder in the + playbook root directory or role root directory, if playbook is part of an ansible + role. If the directory does not exist, it is created. + type: bool + default: no + comment: + description: + - Allows a commit description to be specified to be included when the configuration + is committed. If the configuration is not changed or committed, this argument + is ignored. + type: str + default: configured by iosxr_config + admin: + description: + - Enters into administration configuration mode for making config changes to the + device. + type: bool + default: no + label: + description: + - Allows a commit label to be specified to be included when the configuration + is committed. A valid label must begin with an alphabet and not exceed 30 characters, + only alphabets, digits, hyphens and underscores are allowed. If the configuration + is not changed or committed, this argument is ignored. + type: str + backup_options: + description: + - This is a dict object containing configurable options related to backup file + path. The value of this option is read only when C(backup) is set to I(yes), + if C(backup) is set to I(no) this option will be silently ignored. + suboptions: + filename: + description: + - The filename to be used to store the backup configuration. If the filename + is not given it will be generated based on the hostname, current time and + date in format defined by _config.@ + type: str + dir_path: + description: + - This option provides the path ending with directory name in which the backup + configuration file will be stored. If the directory does not exist it will + be first created and the filename is either the value of C(filename) or + default filename as described in C(filename) options description. If the + path value is not given in that case a I(backup) directory will be created + in the current working directory and backup configuration will be copied + in C(filename) within I(backup) directory. + type: path + type: dict + exclusive: + description: + - Enters into exclusive configuration mode that locks out all users from committing + configuration changes until the exclusive session ends. + type: bool + default: false +""" + +EXAMPLES = """ +- name: configure top level configuration + cisco.iosxr.iosxr_config: + lines: hostname {{ inventory_hostname }} + +- name: configure interface settings + cisco.iosxr.iosxr_config: + lines: + - description test interface + - ip address 172.31.1.1 255.255.255.0 + parents: interface GigabitEthernet0/0/0/0 + +- name: load a config from disk and replace the current config + cisco.iosxr.iosxr_config: + src: config.cfg + replace: config + backup: yes + +- name: for idempotency, use full-form commands + cisco.iosxr.iosxr_config: + lines: + # - shut + - shutdown + # parents: int g0/0/0/1 + parents: interface GigabitEthernet0/0/0/1 + +- name: configurable backup path + cisco.iosxr.iosxr_config: + src: config.cfg + backup: yes + backup_options: + filename: backup.cfg + dir_path: /home/user +""" + +RETURN = """ +commands: + description: The set of commands that will be pushed to the remote device + returned: If there are commands to run against the host + type: list + sample: ['hostname foo', 'router ospf 1', 'router-id 1.1.1.1'] +backup_path: + description: The full path to the backup file + returned: when backup is yes + type: str + sample: /playbooks/ansible/backup/iosxr01_config.2016-07-16@22:28:34 +filename: + description: The name of the backup file + returned: when backup is yes and filename is not specified in backup options + type: str + sample: iosxr01_config.2016-07-16@22:28:34 +shortname: + description: The full path to the backup file excluding the timestamp + returned: when backup is yes and filename is not specified in backup options + type: str + sample: /playbooks/ansible/backup/iosxr01_config +date: + description: The date extracted from the backup file name + returned: when backup is yes + type: str + sample: "2016-07-16" +time: + description: The time extracted from the backup file name + returned: when backup is yes + type: str + sample: "22:28:34" +""" +import re + +from ansible.module_utils._text import to_text, to_bytes +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.connection import ConnectionError +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + load_config, + get_config, + get_connection, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + iosxr_argument_spec, + copy_file, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config import ( + NetworkConfig, + dumps, +) + +DEFAULT_COMMIT_COMMENT = "configured by iosxr_config" + + +def copy_file_to_node(module): + """ Copy config file to IOS-XR node. We use SFTP because older IOS-XR versions don't handle SCP very well. + """ + src = "/tmp/ansible_config.txt" + file = open(src, "wb") + file.write(to_bytes(module.params["src"], errors="surrogate_or_strict")) + file.close() + + dst = "/harddisk:/ansible_config.txt" + copy_file(module, src, dst, "sftp") + + return True + + +def check_args(module, warnings): + if module.params["comment"]: + if len(module.params["comment"]) > 60: + module.fail_json( + msg="comment argument cannot be more than 60 characters" + ) + if module.params["label"]: + label = module.params["label"] + if len(label) > 30: + module.fail_json( + msg="label argument cannot be more than 30 characters" + ) + if not label[0].isalpha(): + module.fail_json(msg="label argument must begin with an alphabet") + valid_chars = re.match(r"[\w-]*$", label) + if not valid_chars: + module.fail_json( + msg="label argument must only contain alphabets," + + "digits, underscores or hyphens" + ) + if module.params["force"]: + warnings.append( + "The force argument is deprecated, please use " + "match=none instead. This argument will be " + "removed in the future" + ) + + +def get_running_config(module): + contents = module.params["config"] + if not contents: + contents = get_config(module) + return contents + + +def get_candidate(module): + candidate = "" + if module.params["src"]: + candidate = module.params["src"] + elif module.params["lines"]: + candidate_obj = NetworkConfig(indent=1, comment_tokens=["!"]) + parents = module.params["parents"] or list() + candidate_obj.add(module.params["lines"], parents=parents) + candidate = dumps(candidate_obj, "raw") + return candidate + + +def run(module, result): + match = module.params["match"] + replace = module.params["replace"] + replace_config = replace == "config" + path = module.params["parents"] + comment = module.params["comment"] + admin = module.params["admin"] + exclusive = module.params["exclusive"] + check_mode = module.check_mode + label = module.params["label"] + + candidate_config = get_candidate(module) + running_config = get_running_config(module) + + commands = None + replace_file_path = None + connection = get_connection(module) + try: + response = connection.get_diff( + candidate=candidate_config, + running=running_config, + diff_match=match, + path=path, + diff_replace=replace, + ) + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + + config_diff = response.get("config_diff") + + if replace_config: + running_base_diff_resp = connection.get_diff( + candidate=running_config, + running=candidate_config, + diff_match=match, + path=path, + diff_replace=replace, + ) + if config_diff or running_base_diff_resp["config_diff"]: + ret = copy_file_to_node(module) + if not ret: + module.fail_json(msg="Copy of config file to the node failed") + + commands = ["load harddisk:/ansible_config.txt"] + replace_file_path = "harddisk:/ansible_config.txt" + + if config_diff or commands: + if not replace_config: + commands = config_diff.split("\n") + + if any((module.params["lines"], module.params["src"])): + msg = ( + "To ensure idempotency and correct diff the input configuration lines should be" + " similar to how they appear if present in the running configuration on device" + ) + if module.params["src"]: + msg += " including the indentation" + module.warn(msg) + + if module.params["before"]: + commands[:0] = module.params["before"] + + if module.params["after"]: + commands.extend(module.params["after"]) + + result["commands"] = commands + + commit = not check_mode + diff = load_config( + module, + commands, + commit=commit, + replace=replace_file_path, + comment=comment, + admin=admin, + exclusive=exclusive, + label=label, + ) + if diff: + result["diff"] = dict(prepared=diff) + + result["changed"] = True + + +def main(): + """main entry point for module execution + """ + backup_spec = dict(filename=dict(), dir_path=dict(type="path")) + argument_spec = dict( + src=dict(type="path"), + lines=dict(aliases=["commands"], type="list", elements="str"), + parents=dict(type="list", elements="str"), + before=dict(type="list", elements="str"), + after=dict(type="list", elements="str"), + match=dict( + default="line", choices=["line", "strict", "exact", "none"] + ), + replace=dict(default="line", choices=["line", "block", "config"]), + # this argument is deprecated in favor of setting match: none + # it will be removed in a future version + force=dict(default=False, type="bool"), + config=dict(), + backup=dict(type="bool", default=False), + backup_options=dict(type="dict", options=backup_spec), + comment=dict(default=DEFAULT_COMMIT_COMMENT), + admin=dict(type="bool", default=False), + exclusive=dict(type="bool", default=False), + label=dict(), + ) + + argument_spec.update(iosxr_argument_spec) + + mutually_exclusive = [("lines", "src"), ("parents", "src")] + + required_if = [ + ("match", "strict", ["lines"]), + ("match", "exact", ["lines"]), + ("replace", "block", ["lines"]), + ("replace", "config", ["src"]), + ] + + module = AnsibleModule( + argument_spec=argument_spec, + mutually_exclusive=mutually_exclusive, + required_if=required_if, + supports_check_mode=True, + ) + + if module.params["force"] is True: + module.params["match"] = "none" + + warnings = list() + check_args(module, warnings) + + result = dict(changed=False, warnings=warnings) + + if module.params["backup"]: + result["__backup__"] = get_config(module) + + if any((module.params["src"], module.params["lines"])): + run(module, result) + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_facts.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_facts.py new file mode 100644 index 00000000..5ac8effa --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_facts.py @@ -0,0 +1,218 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# 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 + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_facts +short_description: Get facts about iosxr devices. +extends_documentation_fragment: +- cisco.iosxr.iosxr +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. +version_added: 1.0.0 +notes: +- Tested against IOS-XR 6.1.3. +- This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html). +author: +- Ricardo Carrillo Cruz (@rcarrillocruz) +- Nilashish Chakraborty (@Nilashishc) +options: + gather_subset: + description: + - When supplied, this argument will restrict the facts collected to a given subset. Possible + values for this argument include all, hardware, config, 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: '!config' + type: list + elements: str + 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, + lacp 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. Valid subsets are 'all', 'lacp', 'lacp_interfaces', 'lldp_global', + 'lldp_interfaces', 'interfaces', 'l2_interfaces', 'l3_interfaces', 'lag_interfaces', + 'acls', 'acl_interfaces', 'static_routes', 'ospfv2'. + required: false + type: list + elements: str +""" + +EXAMPLES = """ +# Gather all facts +- cisco.iosxr.iosxr_facts: + gather_subset: all + gather_network_resources: all + +# Collect only the config and default facts +- cisco.iosxr.iosxr_facts: + gather_subset: + - config + +# Do not collect hardware facts +- cisco.iosxr.iosxr_facts: + gather_subset: + - '!hardware' + +# Collect only the lacp facts +- cisco.iosxr.iosxr_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - lacp + +# Do not collect lacp_interfaces facts +- cisco.iosxr.iosxr_facts: + gather_network_resources: + - '!lacp_interfaces' + +# Collect lacp and minimal default facts +- cisco.iosxr.iosxr_facts: + gather_subset: min + gather_network_resources: lacp + +# Collect only the interfaces facts +- cisco.iosxr.iosxr_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - interfaces + - l2_interfaces +""" + +RETURN = """ +ansible_net_gather_subset: + description: The list of fact subsets collected from the device + returned: always + type: list + +# default +ansible_net_version: + description: The operating system version running on the remote device + returned: always + type: str +ansible_net_hostname: + description: The configured hostname of the device + returned: always + type: str +ansible_net_image: + description: The image file the device is running + returned: always + type: str +ansible_net_api: + description: The name of the transport + returned: always + type: str +ansible_net_python_version: + description: The Python version Ansible controller is using + returned: always + type: str +ansible_net_model: + description: The model name returned from the device + returned: always + type: str + +# hardware +ansible_net_filesystems: + description: All file system names available on the device + returned: when hardware is configured + type: list +ansible_net_memfree_mb: + description: The available free memory on the remote device in Mb + returned: when hardware is configured + type: int +ansible_net_memtotal_mb: + description: The total memory on the remote device in Mb + returned: when hardware is configured + type: int + +# config +ansible_net_config: + description: The current active config from the device + returned: when config is configured + type: str + +# interfaces +ansible_net_all_ipv4_addresses: + description: All IPv4 addresses configured on the device + returned: when interfaces is configured + type: list +ansible_net_all_ipv6_addresses: + description: All IPv6 addresses configured on the device + returned: when interfaces is configured + type: list +ansible_net_interfaces: + description: A hash of all interfaces running on the system + returned: when interfaces is configured + type: dict +ansible_net_neighbors: + description: The list of LLDP neighbors from the remote device + returned: when interfaces is configured + type: dict + +# network resources +ansible_net_gather_network_resources: + description: The list of fact resource subsets collected from the device + returned: always + type: list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + iosxr_argument_spec, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.facts.facts import ( + FactsArgs, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.facts import ( + Facts, +) + + +def main(): + """ + Main entry point for module execution + + :returns: ansible_facts + """ + argument_spec = FactsArgs.argument_spec + argument_spec.update(iosxr_argument_spec) + + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + warnings = [] + if module.params["gather_subset"] == "!config": + warnings.append( + "default value for `gather_subset` will be changed to `min` from `!config` v2.11 onwards" + ) + + result = Facts(module).get_facts() + + ansible_facts, additional_warnings = result + warnings.extend(additional_warnings) + + module.exit_json(ansible_facts=ansible_facts, warnings=warnings) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_interface.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_interface.py new file mode 100644 index 00000000..d3dca6e9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_interface.py @@ -0,0 +1,1057 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# Copyright: (c) 2017, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_interface +author: +- Ganesh Nalawade (@ganeshrn) +- Kedar Kekan (@kedarX) +short_description: (deprecated, removed after 2022-06-01) Manage Interface on Cisco + IOS XR network devices +description: +- This module provides declarative management of Interfaces on Cisco IOS XR network + devices. +version_added: 1.0.0 +deprecated: + alternative: iosxr_interfaces + why: Newer and updated modules released with more functionality in Ansible 2.9 + removed_at_date: '2022-06-01' +requirements: +- ncclient >= 0.5.3 when using netconf +- lxml >= 4.1.1 when using netconf +extends_documentation_fragment: +- cisco.iosxr.iosxr +notes: +- This module works with connection C(network_cli) and C(netconf). See L(the IOS-XR + Platform Options,../network/user_guide/platform_iosxr.html). +- Tested against IOS XRv 6.1.3. +- Preconfiguration of physical interfaces is not supported with C(netconf) transport. +options: + name: + description: + - Name of the interface to configure in C(type + path) format. e.g. C(GigabitEthernet0/0/0/0) + type: str + required: true + description: + description: + - Description of Interface being configured. + type: str + enabled: + description: + - Removes the shutdown configuration, which removes the forced administrative + down on the interface, enabling it to move to an up or down state. + type: bool + default: true + active: + description: + - Whether the interface is C(active) or C(preconfigured). Preconfiguration allows + you to configure modular services cards before they are inserted into the router. + When the cards are inserted, they are instantly configured. Active cards are + the ones already inserted. + type: str + choices: + - active + - preconfigure + default: active + speed: + description: + - Configure the speed for an interface. Default is auto-negotiation when not configured. + choices: + - '10' + - '100' + - '1000' + type: str + mtu: + description: + - Sets the MTU value for the interface. Range is between 64 and 65535' + type: str + duplex: + description: + - Configures the interface duplex mode. Default is auto-negotiation when not configured. + type: str + choices: + - full + - half + tx_rate: + description: + - Transmit rate in bits per second (bps). + - This is state check parameter only. + - Supports conditionals, see L(Conditionals in Networking Modules,../network/user_guide/network_working_with_command_output.html) + type: str + rx_rate: + description: + - Receiver rate in bits per second (bps). + - This is state check parameter only. + - Supports conditionals, see L(Conditionals in Networking Modules,../network/user_guide/network_working_with_command_output.html) + type: str + delay: + description: + - Time in seconds to wait before checking for the operational state on remote + device. This wait is applicable for operational state argument which are I(state) + with values C(up)/C(down), I(tx_rate) and I(rx_rate). + default: 10 + type: int + aggregate: + description: List of interfaces definition + type: list + elements: dict + suboptions: + name: + description: + - Name of the interface to configure in C(type + path) format. e.g. C(GigabitEthernet0/0/0/0) + type: str + description: + description: + - Description of Interface being configured. + type: str + enabled: + description: + - Removes the shutdown configuration, which removes the forced administrative + down on the interface, enabling it to move to an up or down state. + type: bool + active: + description: + - Whether the interface is C(active) or C(preconfigured). Preconfiguration allows + you to configure modular services cards before they are inserted into the router. + When the cards are inserted, they are instantly configured. Active cards are + the ones already inserted. + type: str + choices: + - active + - preconfigure + speed: + description: + - Configure the speed for an interface. Default is auto-negotiation when not configured. + choices: + - '10' + - '100' + - '1000' + type: str + mtu: + description: + - Sets the MTU value for the interface. Range is between 64 and 65535' + type: str + duplex: + description: + - Configures the interface duplex mode. Default is auto-negotiation when not configured. + type: str + choices: + - full + - half + tx_rate: + description: + - Transmit rate in bits per second (bps). + - This is state check parameter only. + - Supports conditionals, see L(Conditionals in Networking Modules,../network/user_guide/network_working_with_command_output.html) + type: str + rx_rate: + description: + - Receiver rate in bits per second (bps). + - This is state check parameter only. + - Supports conditionals, see L(Conditionals in Networking Modules,../network/user_guide/network_working_with_command_output.html) + type: str + delay: + description: + - Time in seconds to wait before checking for the operational state on remote + device. This wait is applicable for operational state argument which are I(state) + with values C(up)/C(down), I(tx_rate) and I(rx_rate). + type: int + state: + description: + - State of the Interface configuration, C(up) means present and operationally + up and C(down) means present and operationally C(down) + type: str + choices: + - present + - absent + - up + - down + state: + description: + - State of the Interface configuration, C(up) means present and operationally + up and C(down) means present and operationally C(down) + type: str + default: present + choices: + - present + - absent + - up + - down + + +""" + +EXAMPLES = """ +- name: configure interface + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/2 + description: test-interface + speed: 100 + duplex: half + mtu: 512 + +- name: remove interface + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/2 + state: absent + +- name: make interface up + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/2 + enabled: true + +- name: make interface down + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/2 + enabled: false + +- name: Create interface using aggregate + cisco.iosxr.iosxr_interface: + aggregate: + - name: GigabitEthernet0/0/0/3 + - name: GigabitEthernet0/0/0/2 + speed: 100 + duplex: full + mtu: 512 + state: present + +- name: Create interface using aggregate along with additional params in aggregate + cisco.iosxr.iosxr_interface: + aggregate: + - {name: GigabitEthernet0/0/0/3, description: test-interface 3} + - {name: GigabitEthernet0/0/0/2, description: test-interface 2} + speed: 100 + duplex: full + mtu: 512 + state: present + +- name: Delete interface using aggregate + cisco.iosxr.iosxr_interface: + aggregate: + - name: GigabitEthernet0/0/0/3 + - name: GigabitEthernet0/0/0/2 + state: absent + +- name: Check intent arguments + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/5 + state: up + delay: 20 + +- name: Config + intent + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/5 + enabled: false + state: down + delay: 20 +""" + +RETURN = """ +commands: + description: The list of configuration mode commands sent to device with transport C(cli) + returned: always (empty list when no commands to send) + type: list + sample: + - interface GigabitEthernet0/0/0/2 + - description test-interface + - duplex half + - mtu 512 + +xml: + description: NetConf rpc xml sent to device with transport C(netconf) + returned: always (empty list when no xml rpc to send) + type: list + sample: + - ' + + + act + GigabitEthernet0/0/0/0 + test-interface-0 + + GigabitEthernet + 512 + + + 100 + half + + + ' +""" +import re +from time import sleep +from copy import deepcopy +import collections + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + get_config, + load_config, + build_xml, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + run_commands, + iosxr_argument_spec, + get_oper, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + is_netconf, + is_cliconf, + etree_findall, + etree_find, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + conditional, + remove_default_spec, +) + + +def validate_mtu(value): + if value and not 64 <= int(value) <= 65535: + return False, "mtu must be between 64 and 65535" + return True, None + + +class ConfigBase(object): + def __init__(self, module): + self._module = module + self._result = {"changed": False, "warnings": []} + self._want = list() + self._have = list() + + def validate_param_values(self, param=None): + for key, value in param.items(): + # validate the param value (if validator func exists) + validator = globals().get("validate_%s" % key) + if callable(validator): + rc, msg = validator(value) + if not rc: + self._module.fail_json(msg=msg) + + def map_params_to_obj(self): + aggregate = self._module.params.get("aggregate") + if aggregate: + for item in aggregate: + for key in item: + if item.get(key) is None: + item[key] = self._module.params[key] + + self.validate_param_values(item) + d = item.copy() + + match = re.match(r"(^[a-z]+)([0-9/]+$)", d["name"], re.I) + if match: + d["owner"] = match.groups()[0] + + if d["active"] == "preconfigure": + d["active"] = "pre" + else: + d["active"] = "act" + + self._want.append(d) + + else: + self.validate_param_values(self._module.params) + params = { + "name": self._module.params["name"], + "description": self._module.params["description"], + "speed": self._module.params["speed"], + "mtu": self._module.params["mtu"], + "duplex": self._module.params["duplex"], + "state": self._module.params["state"], + "delay": self._module.params["delay"], + "tx_rate": self._module.params["tx_rate"], + "rx_rate": self._module.params["rx_rate"], + "enabled": self._module.params["enabled"], + "active": self._module.params["active"], + } + + match = re.match(r"(^[a-z]+)([0-9/]+$)", params["name"], re.I) + if match: + params["owner"] = match.groups()[0] + + if params["active"] == "preconfigure": + params["active"] = "pre" + else: + params["active"] = "act" + + self._want.append(params) + + +class CliConfiguration(ConfigBase): + def __init__(self, module): + super(CliConfiguration, self).__init__(module) + + def parse_shutdown(self, intf_config): + for cfg in intf_config: + match = re.search(r"%s" % "shutdown", cfg, re.M) + if match: + return True + return False + + def parse_config_argument(self, intf_config, arg): + for cfg in intf_config: + match = re.search(r"%s (.+)$" % arg, cfg, re.M) + if match: + return match.group(1) + + def search_obj_in_list(self, name): + for obj in self._have: + if obj["name"] == name: + return obj + return None + + def map_config_to_obj(self): + data = get_config(self._module, config_filter="interface") + data_lines = data.splitlines() + start_indexes = [ + i for i, e in enumerate(data_lines) if e.startswith("interface") + ] + end_indexes = [i for i, e in enumerate(data_lines) if e == "!"] + + intf_configs = list() + for start_index, end_index in zip(start_indexes, end_indexes): + intf_configs.append( + [i.strip() for i in data_lines[start_index:end_index]] + ) + + if not intf_configs: + return list() + + for intf_config in intf_configs: + name = intf_config[0].strip().split()[1] + + active = "act" + if name == "preconfigure": + active = "pre" + name = intf_config[0].strip().split()[2] + + obj = { + "name": name, + "description": self.parse_config_argument( + intf_config, "description" + ), + "speed": self.parse_config_argument(intf_config, "speed"), + "duplex": self.parse_config_argument(intf_config, "duplex"), + "mtu": self.parse_config_argument(intf_config, "mtu"), + "enabled": not bool(self.parse_shutdown(intf_config)), + "active": active, + "state": "present", + } + self._have.append(obj) + + def map_obj_to_commands(self): + commands = list() + + args = ("speed", "description", "duplex", "mtu") + for want_item in self._want: + name = want_item["name"] + disable = not want_item["enabled"] + state = want_item["state"] + + obj_in_have = self.search_obj_in_list(name) + interface = "interface " + name + + if state == "absent" and obj_in_have: + commands.append("no " + interface) + + elif state in ("present", "up", "down"): + if obj_in_have: + for item in args: + candidate = want_item.get(item) + running = obj_in_have.get(item) + if candidate != running: + if candidate: + cmd = ( + interface + + " " + + item + + " " + + str(candidate) + ) + commands.append(cmd) + + if disable and obj_in_have.get("enabled", False): + commands.append(interface + " shutdown") + elif not disable and not obj_in_have.get("enabled", False): + commands.append("no " + interface + " shutdown") + else: + for item in args: + value = want_item.get(item) + if value: + commands.append( + interface + " " + item + " " + str(value) + ) + if not disable: + commands.append("no " + interface + " shutdown") + self._result["commands"] = commands + + if commands: + commit = not self._module.check_mode + diff = load_config(self._module, commands, commit=commit) + if diff: + self._result["diff"] = dict(prepared=diff) + self._result["changed"] = True + + def check_declarative_intent_params(self): + failed_conditions = [] + for want_item in self._want: + want_state = want_item.get("state") + want_tx_rate = want_item.get("tx_rate") + want_rx_rate = want_item.get("rx_rate") + if ( + want_state not in ("up", "down") + and not want_tx_rate + and not want_rx_rate + ): + continue + + if self._result["changed"]: + sleep(want_item["delay"]) + + command = "show interfaces {0!s}".format(want_item["name"]) + out = run_commands(self._module, command)[0] + + if want_state in ("up", "down"): + match = re.search(r"%s (\w+)" % "line protocol is", out, re.M) + have_state = None + if match: + have_state = match.group(1) + if have_state.strip() == "administratively": + match = re.search( + r"%s (\w+)" % "administratively", out, re.M + ) + if match: + have_state = match.group(1) + + if have_state is None or not conditional( + want_state, have_state.strip() + ): + failed_conditions.append( + "state " + "eq({0!s})".format(want_state) + ) + + if want_tx_rate: + match = re.search(r"%s (\d+)" % "output rate", out, re.M) + have_tx_rate = None + if match: + have_tx_rate = match.group(1) + + if have_tx_rate is None or not conditional( + want_tx_rate, have_tx_rate.strip(), cast=int + ): + failed_conditions.append("tx_rate " + want_tx_rate) + + if want_rx_rate: + match = re.search(r"%s (\d+)" % "input rate", out, re.M) + have_rx_rate = None + if match: + have_rx_rate = match.group(1) + + if have_rx_rate is None or not conditional( + want_rx_rate, have_rx_rate.strip(), cast=int + ): + failed_conditions.append("rx_rate " + want_rx_rate) + + if failed_conditions: + msg = "One or more conditional statements have not been satisfied" + self._module.fail_json( + msg=msg, failed_conditions=failed_conditions + ) + + def run(self): + self.map_params_to_obj() + self.map_config_to_obj() + self.map_obj_to_commands() + self.check_declarative_intent_params() + + return self._result + + +class NCConfiguration(ConfigBase): + def __init__(self, module): + super(NCConfiguration, self).__init__(module) + + self._intf_meta = collections.OrderedDict() + self._shut_meta = collections.OrderedDict() + self._data_rate_meta = collections.OrderedDict() + self._line_state_meta = collections.OrderedDict() + + def map_obj_to_xml_rpc(self): + self._intf_meta.update( + [ + ( + "interface-configuration", + { + "xpath": "interface-configurations/interface-configuration", + "tag": True, + "attrib": "operation", + }, + ), + ( + "a:active", + { + "xpath": "interface-configurations/interface-configuration/active", + "operation": "edit", + }, + ), + ( + "a:name", + { + "xpath": "interface-configurations/interface-configuration/interface-name" + }, + ), + ( + "a:description", + { + "xpath": "interface-configurations/interface-configuration/description", + "operation": "edit", + }, + ), + ( + "mtus", + { + "xpath": "interface-configurations/interface-configuration/mtus", + "tag": True, + "operation": "edit", + }, + ), + ( + "mtu", + { + "xpath": "interface-configurations/interface-configuration/mtus/mtu", + "tag": True, + "operation": "edit", + }, + ), + ( + "a:owner", + { + "xpath": "interface-configurations/interface-configuration/mtus/mtu/owner", + "operation": "edit", + }, + ), + ( + "a:mtu", + { + "xpath": "interface-configurations/interface-configuration/mtus/mtu/mtu", + "operation": "edit", + }, + ), + ( + "CEthernet", + { + "xpath": "interface-configurations/interface-configuration/ethernet", + "tag": True, + "operation": "edit", + "ns": True, + }, + ), + ( + "a:speed", + { + "xpath": "interface-configurations/interface-configuration/ethernet/speed", + "operation": "edit", + }, + ), + ( + "a:duplex", + { + "xpath": "interface-configurations/interface-configuration/ethernet/duplex", + "operation": "edit", + }, + ), + ] + ) + + self._shut_meta.update( + [ + ( + "interface-configuration", + { + "xpath": "interface-configurations/interface-configuration", + "tag": True, + }, + ), + ( + "a:active", + { + "xpath": "interface-configurations/interface-configuration/active", + "operation": "edit", + }, + ), + ( + "a:name", + { + "xpath": "interface-configurations/interface-configuration/interface-name" + }, + ), + ( + "shutdown", + { + "xpath": "interface-configurations/interface-configuration/shutdown", + "tag": True, + "operation": "edit", + "attrib": "operation", + }, + ), + ] + ) + state = self._module.params["state"] + + _get_filter = build_xml( + "interface-configurations", + xmap=self._intf_meta, + params=self._want, + opcode="filter", + ) + + running = get_config( + self._module, source="running", config_filter=_get_filter + ) + intfcfg_nodes = etree_findall(running, "interface-configuration") + + intf_list = set() + shut_list = set() + for item in intfcfg_nodes: + intf_name = etree_find(item, "interface-name").text + if intf_name is not None: + intf_list.add(intf_name) + + if etree_find(item, "shutdown") is not None: + shut_list.add(intf_name) + + intf_params = list() + shut_params = list() + noshut_params = list() + for index, item in enumerate(self._want): + if item["name"] in intf_list: + intf_params.append(item) + if not item["enabled"]: + shut_params.append(item) + if item["name"] in shut_list and item["enabled"]: + noshut_params.append(item) + + opcode = None + if state == "absent": + if intf_params: + opcode = "delete" + elif state in ("present", "up", "down"): + intf_params = self._want + opcode = "merge" + + self._result["xml"] = [] + _edit_filter_list = list() + if opcode: + _edit_filter_list.append( + build_xml( + "interface-configurations", + xmap=self._intf_meta, + params=intf_params, + opcode=opcode, + ) + ) + + if opcode == "merge": + if len(shut_params): + _edit_filter_list.append( + build_xml( + "interface-configurations", + xmap=self._shut_meta, + params=shut_params, + opcode="merge", + ) + ) + if len(noshut_params): + _edit_filter_list.append( + build_xml( + "interface-configurations", + xmap=self._shut_meta, + params=noshut_params, + opcode="delete", + ) + ) + diff = None + if len(_edit_filter_list): + commit = not self._module.check_mode + diff = load_config( + self._module, + _edit_filter_list, + commit=commit, + running=running, + nc_get_filter=_get_filter, + ) + + if diff: + if self._module._diff: + self._result["diff"] = dict(prepared=diff) + + self._result["xml"] = _edit_filter_list + self._result["changed"] = True + + def check_declarative_intent_params(self): + failed_conditions = [] + + self._data_rate_meta.update( + [ + ( + "interfaces", + {"xpath": "infra-statistics/interfaces", "tag": True}, + ), + ( + "interface", + { + "xpath": "infra-statistics/interfaces/interface", + "tag": True, + }, + ), + ( + "a:name", + { + "xpath": "infra-statistics/interfaces/interface/interface-name" + }, + ), + ( + "cache", + { + "xpath": "infra-statistics/interfaces/interface/cache", + "tag": True, + }, + ), + ( + "data-rate", + { + "xpath": "infra-statistics/interfaces/interface/cache/data-rate", + "tag": True, + }, + ), + ( + "input-data-rate", + { + "xpath": "infra-statistics/interfaces/interface/cache/data-rate/input-data-rate", + "tag": True, + }, + ), + ( + "output-data-rate", + { + "xpath": "infra-statistics/interfaces/interface/cache/data-rate/output-data-rate", + "tag": True, + }, + ), + ] + ) + + self._line_state_meta.update( + [ + ( + "data-nodes", + {"xpath": "interface-properties/data-nodes", "tag": True}, + ), + ( + "data-node", + { + "xpath": "interface-properties/data-nodes/data-node", + "tag": True, + }, + ), + ( + "system-view", + { + "xpath": "interface-properties/data-nodes/data-node/system-view", + "tag": True, + }, + ), + ( + "interfaces", + { + "xpath": "interface-properties/data-nodes/data-node/system-view/interfaces", + "tag": True, + }, + ), + ( + "interface", + { + "xpath": "interface-properties/data-nodes/data-node/system-view/interfaces/interface", + "tag": True, + }, + ), + ( + "a:name", + { + "xpath": "interface-properties/data-nodes/data-node/system-view/interfaces/interface/interface-name" + }, + ), + ( + "line-state", + { + "xpath": "interface-properties/data-nodes/data-node/system-view/interfaces/interface/line-state", + "tag": True, + }, + ), + ] + ) + + _rate_filter = build_xml( + "infra-statistics", + xmap=self._data_rate_meta, + params=self._want, + opcode="filter", + ) + out = get_oper(self._module, filter=_rate_filter) + data_rate_list = etree_findall(out, "interface") + data_rate_map = dict() + for item in data_rate_list: + data_rate_map.update( + {etree_find(item, "interface-name").text: dict()} + ) + data_rate_map[etree_find(item, "interface-name").text].update( + { + "input-data-rate": etree_find( + item, "input-data-rate" + ).text, + "output-data-rate": etree_find( + item, "output-data-rate" + ).text, + } + ) + + _line_state_filter = build_xml( + "interface-properties", + xmap=self._line_state_meta, + params=self._want, + opcode="filter", + ) + out = get_oper(self._module, filter=_line_state_filter) + line_state_list = etree_findall(out, "interface") + line_state_map = dict() + for item in line_state_list: + line_state_map.update( + { + etree_find(item, "interface-name") + .text: etree_find(item, "line-state") + .text + } + ) + + for want_item in self._want: + want_state = want_item.get("state") + want_tx_rate = want_item.get("tx_rate") + want_rx_rate = want_item.get("rx_rate") + if ( + want_state not in ("up", "down") + and not want_tx_rate + and not want_rx_rate + ): + continue + + if self._result["changed"]: + sleep(want_item["delay"]) + + if want_state in ("up", "down"): + if want_state not in line_state_map[want_item["name"]]: + failed_conditions.append( + "state " + "eq({0!s})".format(want_state) + ) + + if want_tx_rate: + if ( + want_tx_rate + != data_rate_map[want_item["name"]]["output-data-rate"] + ): + failed_conditions.append("tx_rate " + want_tx_rate) + + if want_rx_rate: + if ( + want_rx_rate + != data_rate_map[want_item["name"]]["input-data-rate"] + ): + failed_conditions.append("rx_rate " + want_rx_rate) + + if failed_conditions: + msg = "One or more conditional statements have not been satisfied" + self._module.fail_json( + msg=msg, failed_conditions=failed_conditions + ) + + def run(self): + self.map_params_to_obj() + self.map_obj_to_xml_rpc() + self.check_declarative_intent_params() + return self._result + + +def main(): + """ main entry point for module execution + """ + element_spec = dict( + name=dict(type="str"), + description=dict(type="str"), + speed=dict(choices=["10", "100", "1000"]), + mtu=dict(), + duplex=dict(choices=["full", "half"]), + enabled=dict(default=True, type="bool"), + active=dict( + type="str", choices=["active", "preconfigure"], default="active" + ), + tx_rate=dict(), + rx_rate=dict(), + delay=dict(default=10, type="int"), + state=dict( + default="present", choices=["present", "absent", "up", "down"] + ), + ) + + aggregate_spec = deepcopy(element_spec) + aggregate_spec["name"] = dict(required=True) + + # remove default in aggregate spec, to handle common arguments + remove_default_spec(aggregate_spec) + + argument_spec = dict( + aggregate=dict(type="list", elements="dict", options=aggregate_spec) + ) + + argument_spec.update(element_spec) + argument_spec.update(iosxr_argument_spec) + + required_one_of = [["name", "aggregate"]] + mutually_exclusive = [["name", "aggregate"]] + + module = AnsibleModule( + argument_spec=argument_spec, + required_one_of=required_one_of, + mutually_exclusive=mutually_exclusive, + supports_check_mode=True, + ) + + config_object = None + if is_cliconf(module): + # Commenting the below cliconf deprecation support call for Ansible 2.9 as it'll be continued to be supported + # module.deprecate("cli support for 'iosxr_interface' is deprecated. Use transport netconf instead", + # version='2.9') + config_object = CliConfiguration(module) + elif is_netconf(module): + if module.params["active"] == "preconfigure": + module.fail_json( + msg="Physical interface pre-configuration is not supported with transport 'netconf'" + ) + config_object = NCConfiguration(module) + + result = {} + if config_object: + result = config_object.run() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_interfaces.py new file mode 100644 index 00000000..8a607f65 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_interfaces.py @@ -0,0 +1,558 @@ +#!/usr/bin/python +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . +# + +""" +The module file for iosxr_interfaces +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +DOCUMENTATION = """ +module: iosxr_interfaces +short_description: Interfaces resource module +description: This module manages the interface attributes on Cisco IOS-XR network + devices. +version_added: 1.0.0 +author: +- Sumit Jaiswal (@justjais) +- Rohit Thakur (@rohitthakur2590) +notes: +- Tested against Cisco IOS-XRv Version 6.1.3 on VIRL. +- This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html). +options: + config: + description: A dictionary of interface options + type: list + elements: dict + suboptions: + name: + description: + - Full name of the interface to configure in C(type + path) format. e.g. C(GigabitEthernet0/0/0/0) + type: str + required: true + description: + description: + - Interface description. + type: str + enabled: + default: true + description: + - Administrative state of the interface. + - Set the value to C(True) to administratively enable the interface or C(False) + to disable it. + type: bool + speed: + description: + - Configure the speed for an interface. Default is auto-negotiation when not + configured. + type: int + mtu: + description: + - Sets the MTU value for the interface. Applicable for Ethernet interfaces + only. + - Refer to vendor documentation for valid values. + type: int + duplex: + description: + - Configures the interface duplex mode. Default is auto-negotiation when not + configured. + type: str + choices: + - full + - half + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the IOS-XR device + by executing the command B(show running-config interface). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. + type: str + state: + choices: + - merged + - parsed + - deleted + - replaced + - rendered + - gathered + - overridden + default: merged + description: + - The state of the configuration after module completion + type: str +""" + +EXAMPLES = """ +# Using merged +# Before state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# vrf custB +# ipv4 address 178.18.169.23 255.255.255.0 +# dot1q native vlan 30 +# ! +# interface GigabitEthernet0/0/0/3 +# description Replaced by Ansible Team +# mtu 2000 +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# dot1q native vlan 1021 +# ! +- name: Configure Ethernet interfaces + cisco.iosxr.iosxr_interfaces: + config: + - name: GigabitEthernet0/0/0/2 + description: Configured by Ansible + enabled: true + - name: GigabitEthernet0/0/0/3 + description: Configured by Ansible Network + enabled: false + duplex: full + state: merged +# After state: +# ------------ +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# description Configured and Merged by Ansible Network +# vrf custB +# ipv4 address 178.18.169.23 255.255.255.0 +# dot1q native vlan 30 +# ! +# interface GigabitEthernet0/0/0/3 +# description Configured and Merged by Ansible Network +# mtu 2600 +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# duplex full +# shutdown +# dot1q native vlan 1021 +# ! +# Using replaced +# Before state: +# ------------ +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# description Configured by Ansible +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# description Test +# vrf custB +# ipv4 address 178.18.169.23 255.255.255.0 +# dot1q native vlan 30 +# ! +# interface GigabitEthernet0/0/0/3 +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# dot1q native vlan 1021 +# ! +- name: Configure following interfaces and replace their existing config + cisco.iosxr.iosxr_interfaces: + config: + - name: GigabitEthernet0/0/0/2 + description: Configured by Ansible + enabled: true + mtu: 2000 + - name: GigabitEthernet0/0/0/3 + description: Configured by Ansible Network + enabled: false + duplex: auto + state: replaced +# After state: +# ------------ +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# description Configured by Ansible +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# description Configured and Replaced by Ansible +# mtu 2000 +# vrf custB +# ipv4 address 178.18.169.23 255.255.255.0 +# dot1q native vlan 30 +# ! +# interface GigabitEthernet0/0/0/3 +# description Configured and Replaced by Ansible Network +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# duplex half +# shutdown +# dot1q native vlan 1021 +# ! +# Using overridden +# Before state: +# ------------ +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# description Configured by Ansible +# vrf custB +# ipv4 address 178.18.169.23 255.255.255.0 +# dot1q native vlan 30 +# ! +# interface GigabitEthernet0/0/0/3 +# description Configured by Ansible +# mtu 2600 +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# duplex full +# shutdown +# dot1q native vlan 1021 +# ! +- name: Override interfaces + cisco.iosxr.iosxr_interfaces: + config: + - name: GigabitEthernet0/0/0/2 + description: Configured by Ansible + enabled: true + duplex: auto + - name: GigabitEthernet0/0/0/3 + description: Configured by Ansible Network + enabled: false + speed: 1000 + state: overridden +# After state: +# ------------ +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# description Configured and Overridden by Ansible Network +# vrf custB +# ipv4 address 178.18.169.23 255.255.255.0 +# speed 1000 +# dot1q native vlan 30 +# ! +# interface GigabitEthernet0/0/0/3 +# description Configured and Overridden by Ansible Network +# mtu 2000 +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# duplex full +# shutdown +# dot1q native vlan 1021 +# ! +# Using deleted +# Before state: +# ------------ +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# description Configured and Overridden by Ansible Network +# vrf custB +# ipv4 address 178.18.169.23 255.255.255.0 +# speed 1000 +# dot1q native vlan 30 +# ! +# interface GigabitEthernet0/0/0/3 +# description Configured and Overridden by Ansible Network +# mtu 2000 +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# duplex full +# shutdown +# dot1q native vlan 1021 +# ! +- name: Delete IOSXR interfaces as in given arguments + cisco.iosxr.iosxr_interfaces: + config: + - name: GigabitEthernet0/0/0/2 + - name: GigabitEthernet0/0/0/3 + state: deleted +# After state: +# ------------ +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# vrf custB +# ipv4 address 178.18.169.23 255.255.255.0 +# dot1q native vlan 30 +# ! +# interface GigabitEthernet0/0/0/3 +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# dot1q native vlan 1021 +# ! +# Using parsed +# parsed.cfg +# ------------ +# +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 10.8.38.70 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/0 +# description Configured and Merged by Ansible-Network +# mtu 110 +# ipv4 address 172.31.1.1 255.255.255.0 +# duplex half +# ! +# interface GigabitEthernet0/0/0/3 +# shutdown +# ! +# interface GigabitEthernet0/0/0/4 +# shutdown +# ! +# - name: Convert ACL interfaces config to argspec without connecting to the appliance +# cisco.iosxr.iosxr_interfaces: +# running_config: "{{ lookup('file', './parsed.cfg') }}" +# state: parsed +# Task Output (redacted) +# ----------------------- +# "parsed": [ +# { +# "name": "MgmtEth0/RP0/CPU0/0" +# }, +# { +# "access_groups": [ +# { +# "acls": [ +# { +# "direction": "in", +# "name": "acl_1" +# }, +# { +# "direction": "out", +# "name": "acl_2" +# } +# ], +# "afi": "ipv4" +# }, +# { +# "acls": [ +# { +# "direction": "in", +# "name": "acl6_1" +# }, +# { +# "direction": "out", +# "name": "acl6_2" +# } +# ], +# "afi": "ipv6" +# } +# ], +# "name": "GigabitEthernet0/0/0/0" +# }, +# { +# "access_groups": [ +# { +# "acls": [ +# { +# "direction": "out", +# "name": "acl_1" +# } +# ], +# "afi": "ipv4" +# } +# ], +# "name": "GigabitEthernet0/0/0/1" +# } +# ] +# } +# Using rendered +- name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + description: Configured and Merged by Ansible-Network + mtu: 110 + enabled: true + duplex: half + - name: GigabitEthernet0/0/0/1 + description: Configured and Merged by Ansible-Network + mtu: 2800 + enabled: false + speed: 100 + duplex: full + state: rendered +# Task Output (redacted) +# ----------------------- +# "rendered": [ +# "interface GigabitEthernet0/0/0/0", +# "description Configured and Merged by Ansible-Network", +# "mtu 110", +# "duplex half", +# "no shutdown", +# "interface GigabitEthernet0/0/0/1", +# "description Configured and Merged by Ansible-Network", +# "mtu 2800", +# "speed 100", +# "duplex full", +# "shutdown" +# ] +# Using gathered +# Before state: +# ------------ +# +# RP/0/0/CPU0:an-iosxr-02#show running-config interface +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 10.8.38.70 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/0 +# description Configured and Merged by Ansible-Network +# mtu 110 +# ipv4 address 172.31.1.1 255.255.255.0 +# duplex half +# ! +# interface GigabitEthernet0/0/0/3 +# shutdown +# ! +# interface GigabitEthernet0/0/0/4 +# shutdown +# ! +- name: Gather IOSXR interfaces as in given arguments + cisco.iosxr.iosxr_interfaces: + config: + state: gathered +# Task Output (redacted) +# ----------------------- +# +# "gathered": [ +# { +# "description": "test for ansible", +# "enabled": false, +# "name": "Loopback888" +# }, +# { +# "description": "Configured and Merged by Ansible-Network", +# "duplex": "half", +# "enabled": true, +# "mtu": 110, +# "name": "GigabitEthernet0/0/0/0" +# }, +# { +# "enabled": false, +# "name": "GigabitEthernet0/0/0/3" +# }, +# { +# "enabled": false, +# "name": "GigabitEthernet0/0/0/4" +# } +# ] +# After state: +# ------------ +# +# RP/0/0/CPU0:an-iosxr-02#show running-config interface +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 10.8.38.70 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/0 +# description Configured and Merged by Ansible-Network +# mtu 110 +# ipv4 address 172.31.1.1 255.255.255.0 +# duplex half +# ! +# interface GigabitEthernet0/0/0/3 +# shutdown +# ! +# interface GigabitEthernet0/0/0/4 +# shutdown +# ! +""" + +RETURN = """ +before: + description: The configuration as structured data prior to module invocation. + returned: always + type: list + sample: The configuration returned will always be in the same format of the parameters above. +after: + description: The configuration as structured data after module completion. + returned: when changed + type: list + sample: The configuration returned will always be in the same format of the parameters above. +commands: + description: The set of commands pushed to the remote device + returned: always + type: list + sample: ['interface GigabitEthernet0/0/0/2', 'description: Configured by Ansible', 'shutdown'] +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.interfaces.interfaces import ( + InterfacesArgs, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.interfaces.interfaces import ( + Interfaces, +) + + +def main(): + """ + Main entry point for module execution + :returns: the result form module invocation + """ + required_if = [ + ("state", "merged", ("config",)), + ("state", "replaced", ("config",)), + ("state", "rendered", ("config",)), + ("state", "overridden", ("config",)), + ("state", "parsed", ("running_config",)), + ] + mutually_exclusive = [("config", "running_config")] + module = AnsibleModule( + argument_spec=InterfacesArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + mutually_exclusive=mutually_exclusive, + ) + + result = Interfaces(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_l2_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_l2_interfaces.py new file mode 100644 index 00000000..c92104d9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_l2_interfaces.py @@ -0,0 +1,687 @@ +#!/usr/bin/python +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . +# + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +GENERATOR_VERSION = "1.0" + + +DOCUMENTATION = """ +module: iosxr_l2_interfaces +short_description: L2 interfaces resource module +description: This module manages the Layer-2 interface attributes on Cisco IOS-XR + devices. +version_added: 1.0.0 +author: +- Sumit Jaiswal (@justjais) +- Rohit Thakur (@rohitthakur2590) +notes: +- Tested against Cisco IOS-XRv Version 6.1.3 on VIRL. +- This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html). +options: + config: + description: A dictionary of Layer-2 interface options + type: list + elements: dict + suboptions: + name: + description: + - Full name of the interface/sub-interface excluding any logical unit number, + e.g. GigabitEthernet0/0/0/1 or GigabitEthernet0/0/0/1.100. + type: str + required: true + native_vlan: + description: + - Configure a native VLAN ID for the trunk + type: int + l2transport: + description: + - Switchport mode access command to configure the interface as a layer 2 access + type: bool + l2protocol: + description: + - Configures Layer 2 protocol tunneling and protocol data unit (PDU) filtering + on an interface. + type: list + elements: dict + suboptions: + cdp: + description: + - Cisco Discovery Protocol (CDP) tunneling and data unit parameters. + choices: + - drop + - forward + - tunnel + type: str + pvst: + description: + - Configures the per-VLAN Spanning Tree Protocol (PVST) tunneling and + data unit parameters. + choices: + - drop + - forward + - tunnel + type: str + stp: + description: + - Spanning Tree Protocol (STP) tunneling and data unit parameters. + choices: + - drop + - forward + - tunnel + type: str + vtp: + description: + - VLAN Trunk Protocol (VTP) tunneling and data unit parameters. + choices: + - drop + - forward + - tunnel + type: str + q_vlan: + description: + - 802.1Q VLAN configuration. Note that it can accept either 2 VLAN IDs when + configuring Q-in-Q VLAN, or it will accept 1 VLAN ID and 'any' as input + list when configuring Q-in-any vlan as input. Note, that this option is + valid only with respect to Sub-Interface and is not valid when configuring + for Interface. + type: list + elements: int + propagate: + description: + - Propagate Layer 2 transport events. Note that it will work only when the + I(l2tranport) option is set to TRUE + type: bool + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the IOS-XR device + by executing the command B(show running-config interface). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. + type: str + state: + choices: + - merged + - replaced + - overridden + - deleted + - rendered + - gathered + - parsed + default: merged + description: + - The state of the configuration after module completion + type: str +""" + +EXAMPLES = """ +# Using merged +# +# Before state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/3 +# description Ansible Network +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# duplex half +# shutdown +# ! +# interface GigabitEthernet0/0/0/4 +# description Test description +# ! + +- name: Merge provided configuration with device configuration + cisco.iosxr.iosxr_l2_interfaces: + config: + - name: GigabitEthernet0/0/0/3 + native_vlan: 20 + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + l2transport: true + l2protocol: + - stp: tunnel + - name: GigabitEthernet0/0/0/3.900 + l2transport: true + q_vlan: + - 20 + - 40 + state: merged + +# After state: +# ------------ +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/3 +# description Ansible Network +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# duplex half +# shutdown +# dot1q native vlan 20 +# ! +# interface GigabitEthernet0/0/0/4 +# description Test description +# dot1q native vlan 10 +# l2transport +# l2protocol stp tunnel +# ! +# ! +# interface GigabitEthernet0/0/0/3.900 l2transport +# dot1q vlan 20 40 +# ! + +# Using replaced +# +# Before state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/3 +# description Ansible Network +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# duplex half +# shutdown +# dot1q native vlan 20 +# ! +# interface GigabitEthernet0/0/0/4 +# description Test description +# dot1q native vlan 10 +# l2transport +# l2protocol stp tunnel +# ! +# ! +# interface GigabitEthernet0/0/0/3.900 l2transport +# dot1q vlan 20 40 +# ! + +- name: Replaces device configuration of listed interfaces with provided configuration + cisco.iosxr.iosxr_l2_interfaces: + config: + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + l2transport: true + l2protocol: + - stp: forward + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - any + state: replaced + +# After state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/3 +# description Ansible Network +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# duplex half +# shutdown +# dot1q native vlan 20 +# ! +# interface GigabitEthernet0/0/0/4 +# description Test description +# dot1q native vlan 40 +# l2transport +# l2protocol stp forward +# ! +# ! +# interface GigabitEthernet0/0/0/3.900 l2transport +# dot1q vlan 20 any +# ! + +# Using overridden +# +# Before state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/3 +# description Ansible Network +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# duplex half +# shutdown +# dot1q native vlan 20 +# ! +# interface GigabitEthernet0/0/0/4 +# description Test description +# dot1q native vlan 10 +# l2transport +# l2protocol stp tunnel +# ! +# ! +# interface GigabitEthernet0/0/0/3.900 l2transport +# dot1q vlan 20 40 +# ! + +- name: Override device configuration of all interfaces with provided configuration + cisco.iosxr.iosxr_l2_interfaces: + config: + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + l2transport: true + l2protocol: + - stp: forward + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - any + state: overridden + +# After state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/3 +# description Ansible Network +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# duplex half +# shutdown +# ! +# interface GigabitEthernet0/0/0/4 +# description Test description +# dot1q native vlan 40 +# l2transport +# l2protocol stp forward +# ! +# ! +# interface GigabitEthernet0/0/0/3.900 +# dot1q vlan 20 any +# ! + +# Using deleted +# +# Before state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/3 +# description Ansible Network +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# duplex half +# shutdown +# dot1q native vlan 20 +# ! +# interface GigabitEthernet0/0/0/4 +# description Test description +# dot1q native vlan 10 +# l2transport +# l2protocol stp tunnel +# ! +# ! +# + +- name: "Delete L2 attributes of given interfaces (Note: This won't delete the interface itself)" + cisco.iosxr.iosxr_l2_interfaces: + config: + - name: GigabitEthernet0/0/0/4 + state: deleted + +# After state: +# ------------ +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/3 +# description Ansible Network +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# duplex half +# shutdown +# dot1q native vlan 20 +# ! +# interface GigabitEthernet0/0/0/4 +# description Test description +# ! + +# Using Deleted without any config passed +# "(NOTE: This will delete all of configured resource module attributes from each configured interface)" +# +# Before state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/3 +# description Ansible Network +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# duplex half +# shutdown +# dot1q native vlan 20 +# ! +# interface GigabitEthernet0/0/0/4 +# description Test description +# dot1q native vlan 10 +# l2transport +# l2protocol stp tunnel +# ! +# ! + +- name: "Delete L2 attributes of all interfaces (Note: This won't delete the interface itself)" + cisco.iosxr.iosxr_l2_interfaces: + state: deleted + +# After state: +# ------------ +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/3 +# description Ansible Network +# vrf custB +# ipv4 address 10.10.0.2 255.255.255.0 +# duplex half +# shutdown +# ! +# interface GigabitEthernet0/0/0/4 +# description Test description +# ! + + +# Using parsed +# parsed.cfg +# ------------ +# +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 10.8.38.70 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/0 +# description Configured and Merged by Ansible-Network +# mtu 110 +# ipv4 address 172.31.1.1 255.255.255.0 +# duplex half +# ! +# interface GigabitEthernet0/0/0/1 +# dot1q native vlan 10 +# l2transport +# l2protocol cdp forward +# l2protocol pvst tunnel +# propagate remote-status +# ! +# ! +# interface GigabitEthernet0/0/0/3 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3.900 +# encapsulation dot1q 20 second-dot1q 40 +# ! +# interface GigabitEthernet0/0/0/4 +# shutdown +# dot1q native vlan 40 +# ! +- name: Convert L2 interfaces config to argspec without connecting to the appliance + cisco.iosxr.iosxr_l2_interfaces: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed +# Task Output (redacted) +# ----------------------- +# "parsed": [ +# { +# "name": "GigabitEthernet0/0/0/0" +# }, +# { +# "l2protocol": [ +# { +# "cdp": "forward" +# }, +# { +# "pvst": "tunnel" +# } +# ], +# "l2transport": true, +# "name": "GigabitEthernet0/0/0/1", +# "native_vlan": 10, +# "propagate": true +# }, +# { +# "name": "GigabitEthernet0/0/0/3" +# }, +# { +# "name": "GigabitEthernet0/0/0/3.900", +# "q_vlan": [ +# 20, +# 40 +# ] +# }, +# { +# "name": "GigabitEthernet0/0/0/4", +# "native_vlan": 40 +# } +# ] + + +# Using rendered +- name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_l2_interfaces: + config: + + - name: GigabitEthernet0/0/0/1 + native_vlan: 10 + l2transport: true + l2protocol: + + - pvst: tunnel + + - cdp: forward + propagate: true + + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - 40 + + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + state: rendered +# Task Output (redacted) +# ----------------------- +# "rendered": [ +# "interface GigabitEthernet0/0/0/1", +# "dot1q native vlan 10", +# "l2transport l2protocol pvst tunnel", +# "l2transport l2protocol cdp forward", +# "l2transport propagate remote-status", +# "interface GigabitEthernet0/0/0/3.900", +# "dot1q vlan 20 40", +# "interface GigabitEthernet0/0/0/4", +# "dot1q native vlan 40" +# ] + + +# Using gathered +# Before state: +# ------------ +# +# RP/0/0/CPU0:an-iosxr-02#show running-config interface +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 10.8.38.70 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/0 +# description Configured and Merged by Ansible-Network +# mtu 110 +# ipv4 address 172.31.1.1 255.255.255.0 +# duplex half +# ! +# interface GigabitEthernet0/0/0/1 +# dot1q native vlan 10 +# l2transport +# l2protocol cdp forward +# l2protocol pvst tunnel +# propagate remote-status +# ! +# ! +# interface GigabitEthernet0/0/0/3 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3.900 +# encapsulation dot1q 20 second-dot1q 40 +# ! +# interface GigabitEthernet0/0/0/4 +# shutdown +# dot1q native vlan 40 +# ! +- name: Gather IOSXR l2 interfaces as in given arguments + cisco.iosxr.iosxr_l2_interfaces: + config: + state: gathered +# Task Output (redacted) +# ----------------------- +# +# "gathered": [ +# { +# "name": "GigabitEthernet0/0/0/0" +# }, +# { +# "l2protocol": [ +# { +# "cdp": "forward" +# }, +# { +# "pvst": "tunnel" +# } +# ], +# "l2transport": true, +# "name": "GigabitEthernet0/0/0/1", +# "native_vlan": 10, +# "propagate": true +# }, +# { +# "name": "GigabitEthernet0/0/0/3" +# }, +# { +# "name": "GigabitEthernet0/0/0/3.900", +# "q_vlan": [ +# 20, +# 40 +# ] +# }, +# { +# "name": "GigabitEthernet0/0/0/4", +# "native_vlan": 40 +# } +# ] +# After state: +# ------------ +# +# RP/0/0/CPU0:an-iosxr-02#show running-config interface +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 10.8.38.70 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/0 +# description Configured and Merged by Ansible-Network +# mtu 110 +# ipv4 address 172.31.1.1 255.255.255.0 +# duplex half +# ! +# interface GigabitEthernet0/0/0/1 +# dot1q native vlan 10 +# l2transport +# l2protocol cdp forward +# l2protocol pvst tunnel +# propagate remote-status +# ! +# ! +# interface GigabitEthernet0/0/0/3 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3.900 +# encapsulation dot1q 20 second-dot1q 40 +# ! +# interface GigabitEthernet0/0/0/4 +# shutdown +# dot1q native vlan 40 +# ! + + + +""" + +RETURN = """ +before: + description: The configuration as structured data prior to module invocation. + returned: always + type: list + sample: The configuration returned will always be in the same format of the parameters above. +after: + description: The configuration as structured data after module completion. + returned: when changed + type: list + sample: The configuration returned will always be in the same format of the parameters above. +commands: + description: The set of commands pushed to the remote device + returned: always + type: list + sample: ['interface GigabitEthernet0/0/0/2', 'l2transport l2protocol pvst tunnel'] +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.l2_interfaces.l2_interfaces import ( + L2_InterfacesArgs, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.l2_interfaces.l2_interfaces import ( + L2_Interfaces, +) + + +def main(): + """ + Main entry point for module execution + :returns: the result form module invocation + """ + required_if = [ + ("state", "merged", ("config",)), + ("state", "replaced", ("config",)), + ("state", "rendered", ("config",)), + ("state", "overridden", ("config",)), + ("state", "parsed", ("running_config",)), + ] + mutually_exclusive = [("config", "running_config")] + module = AnsibleModule( + argument_spec=L2_InterfacesArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + mutually_exclusive=mutually_exclusive, + ) + + result = L2_Interfaces(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_l3_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_l3_interfaces.py new file mode 100644 index 00000000..07af8314 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_l3_interfaces.py @@ -0,0 +1,671 @@ +#!/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) + +############################################## +# WARNING +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +# +############################################## + +""" +The module file for ios_l3_interfaces +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_l3_interfaces +short_description: L3 interfaces resource module +description: This module provides declarative management of Layer-3 interface on Cisco + IOS-XR devices. +version_added: 1.0.0 +author: +- Sumit Jaiswal (@justjais) +- Rohit Thakur (@rohitthakur2590) +notes: +- Tested against Cisco IOS-XRv Version 6.1.3 on VIRL. +- This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html). +options: + config: + description: A dictionary of Layer-3 interface options + type: list + elements: dict + suboptions: + name: + description: + - Full name of the interface excluding any logical unit number, i.e. GigabitEthernet0/1. + type: str + required: true + ipv4: + description: + - IPv4 address to be set for the Layer-3 interface mentioned in I(name) option. + - The address format is /, the mask is number in range + 0-32 eg. 192.168.0.1/24 + type: list + elements: dict + suboptions: + address: + description: + - Configures the IPv4 address for Interface. + type: str + secondary: + description: + - Configures the IP address as a secondary address. + type: bool + ipv6: + description: + - IPv6 address to be set for the Layer-3 interface mentioned in I(name) option. + - The address format is /, the mask is number in range + 0-128 eg. fd5d:12c9:2201:1::1/64 + type: list + elements: dict + suboptions: + address: + description: + - Configures the IPv6 address for Interface. + type: str + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the IOS-XR device + by executing the command B(show running-config interface). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. + type: str + state: + choices: + - merged + - replaced + - overridden + - deleted + - parsed + - rendered + - gathered + default: merged + description: + - The state of the configuration after module completion + type: str +""" + +EXAMPLES = """ +# Using merged + +# Before state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3 +# ipv4 address 192.168.0.2 255.255.255.0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3.700 +# ! +# interface GigabitEthernet0/0/0/4 +# ipv6 address fd5d:12c9:2201:1::1/64 +# shutdown +# ! + +- name: Merge provided configuration with device configuration + cisco.iosxr.iosxr_l3_interfaces: + config: + - name: GigabitEthernet0/0/0/2 + ipv4: + - address: 192.168.0.1/24 + - name: GigabitEthernet0/0/0/3 + ipv4: + - address: 192.168.2.1/24 + secondary: true + state: merged + +# After state: +# ------------ +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# ipv4 address 192.168.0.1 255.255.255.0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3 +# ipv4 address 192.168.1.0 255.255.255.0 +# ipv4 address 192.168.2.1 255.255.255.0 secondary +# shutdown +# ! +# interface GigabitEthernet0/0/0/3.700 +# ! +# interface GigabitEthernet0/0/0/4 +# ipv6 address fd5d:12c9:2201:1::1/64 +# shutdown +# ! + +# Using overridden + +# Before state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# ipv4 address 192.168.0.1 255.255.255.0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3 +# ipv4 address 192.168.1.0 255.255.255.0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3.700 +# ! +# interface GigabitEthernet0/0/0/4 +# ipv6 address fd5d:12c9:2201:1::1/64 +# shutdown +# ! + +- name: Override device configuration of all interfaces with provided configuration + cisco.iosxr.iosxr_l3_interfaces: + config: + - name: GigabitEthernet0/0/0/3 + ipv4: + - address: 192.168.0.1/24 + - name: GigabitEthernet0/0/0/3.700 + ipv4: + - address: 192.168.0.2/24 + - address: 192.168.2.1/24 + secondary: true + state: overridden + +# After state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3 +# ipv4 address 192.168.0.1 255.255.255.0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3.700 +# ipv4 address 192.168.0.2 255.255.255.0 +# ipv4 address 192.168.2.1 255.255.255.0 secondary +# ! +# interface GigabitEthernet0/0/0/4 +# shutdown +# ! + +# Using replaced + +# Before state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3 +# ipv4 address 192.168.0.2 255.255.255.0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3.700 +# ipv4 address 192.168.0.1 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/4 +# ipv6 address fd5d:12c9:2201:1::1/64 +# shutdown +# ! + +- name: Replaces device configuration of listed interfaces with provided configuration + cisco.iosxr.iosxr_l3_interfaces: + config: + - name: GigabitEthernet0/0/0/3 + ipv6: + - address: fd5d:12c9:2201:1::1/64 + - name: GigabitEthernet0/0/0/4 + ipv4: + - address: 192.168.0.2/24 + state: replaced + +# After state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3 +# ipv6 address fd5d:12c9:2201:1::1/64 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3.700 +# ipv4 address 192.168.0.1 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/4 +# ipv4 address 192.168.0.2 255.255.255.0 +# shutdown +# ! + +# Using deleted + +# Before state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# ipv4 address 192.168.2.1 255.255.255.0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# ipv4 address 192.168.3.1 255.255.255.0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3 +# ipv4 address 192.168.0.2 255.255.255.0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3.700 +# ipv4 address 192.168.0.1 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/4 +# ipv6 address fd5d:12c9:2201:1::1/64 +# shutdown +# ! + +- name: "Delete L3 attributes of given interfaces (Note: This won't delete the interface itself)" + cisco.iosxr.iosxr_l3_interfaces: + config: + - name: GigabitEthernet0/0/0/3 + - name: GigabitEthernet0/0/0/4 + - name: GigabitEthernet0/0/0/3.700 + state: deleted + +# After state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# ipv4 address 192.168.2.1 255.255.255.0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# ipv4 address 192.168.3.1 255.255.255.0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3.700 +# ! +# interface GigabitEthernet0/0/0/4 +# shutdown +# ! + +# Using Deleted without any config passed +# "(NOTE: This will delete all of configured resource module attributes from each configured interface)" + +# Before state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# ipv4 address 192.168.2.1 255.255.255.0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# ipv4 address 192.168.3.1 255.255.255.0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3 +# ipv4 address 192.168.0.2 255.255.255.0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3.700 +# ipv4 address 192.168.0.1 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/4 +# ipv6 address fd5d:12c9:2201:1::1/64 +# shutdown +# ! + + +- name: "Delete L3 attributes of all interfaces (Note: This won't delete the interface itself)" + cisco.iosxr.iosxr_l3_interfaces: + state: deleted + +# After state: +# ------------- +# +# viosxr#show running-config interface +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3.700 +# ! +# interface GigabitEthernet0/0/0/4 +# shutdown +# ! + + +# Using parsed +# parsed.cfg +# ------------ +# +# nterface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 10.8.38.70 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/0 +# description Configured and Merged by Ansible-Network +# mtu 66 +# ipv4 address 192.0.2.1 255.255.255.0 +# ipv4 address 192.0.2.2 255.255.255.0 secondary +# ipv6 address 2001:db8:0:3::/64 +# duplex half +# ! +# interface GigabitEthernet0/0/0/1 +# description Configured and Merged by Ansible-Network +# mtu 66 +# speed 100 +# duplex full +# dot1q native vlan 10 +# l2transport +# l2protocol cdp forward +# l2protocol pvst tunnel +# propagate remote-status +# ! +# ! +# interface GigabitEthernet0/0/0/3 +# ipv4 address 192.0.22.1 255.255.255.0 +# ipv4 address 192.0.23.1 255.255.255.0 +# ! +# - name: Convert L3 interfaces config to argspec without connecting to the appliance +# cisco.iosxr.iosxr_l3_interfaces: +# running_config: "{{ lookup('file', './parsed.cfg') }}" +# state: parsed +# Task Output (redacted) +# ----------------------- +# "parsed": [ +# { +# "ipv4": [ +# { +# "address": "192.0.2.1 255.255.255.0" +# }, +# { +# "address": "192.0.2.2 255.255.255.0", +# "secondary": true +# } +# ], +# "ipv6": [ +# { +# "address": "2001:db8:0:3::/64" +# } +# ], +# "name": "GigabitEthernet0/0/0/0" +# }, +# { +# "name": "GigabitEthernet0/0/0/1" +# }, +# { +# "ipv4": [ +# { +# "address": "192.0.22.1 255.255.255.0" +# }, +# { +# "address": "192.0.23.1 255.255.255.0" +# } +# ], +# "name": "GigabitEthernet0/0/0/3" +# } +# ] + + +# Using rendered +- name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_l3_interfaces: + config: + + - name: GigabitEthernet0/0/0/0 + ipv4: + + - address: 198.51.100.1/24 + + - name: GigabitEthernet0/0/0/1 + ipv6: + + - address: 2001:db8:0:3::/64 + ipv4: + + - address: 192.0.2.1/24 + + - address: 192.0.2.2/24 + secondary: true + state: rendered +# Task Output (redacted) +# ----------------------- +# "rendered": [ +# "interface GigabitEthernet0/0/0/0", +# "ipv4 address 198.51.100.1 255.255.255.0", +# "interface GigabitEthernet0/0/0/1", +# "ipv4 address 192.0.2.2 255.255.255.0 secondary", +# "ipv4 address 192.0.2.1 255.255.255.0", +# "ipv6 address 2001:db8:0:3::/64" +# ] +# Using gathered +# Before state: +# ------------ +# +# RP/0/0/CPU0:an-iosxr-02#show running-config interface +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 10.8.38.70 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/0 +# description Configured and Merged by Ansible-Network +# mtu 66 +# ipv4 address 192.0.2.1 255.255.255.0 +# ipv4 address 192.0.2.2 255.255.255.0 secondary +# ipv6 address 2001:db8:0:3::/64 +# duplex half +# ! +# interface GigabitEthernet0/0/0/1 +# description Configured and Merged by Ansible-Network +# mtu 66 +# speed 100 +# duplex full +# dot1q native vlan 10 +# l2transport +# l2protocol cdp forward +# l2protocol pvst tunnel +# propagate remote-status +# ! +# ! +# interface GigabitEthernet0/0/0/3 +# shutdown +# ! +# interface GigabitEthernet0/0/0/4 +# shutdown +# dot1q native vlan 40 +# ! +- name: Gather IOSXR l3 interfaces as in given arguments + cisco.iosxr.iosxr_l3_interfaces: + config: + state: gathered +# Task Output (redacted) +# ----------------------- +# +# "gathered": [ +# { +# "name": "Loopback888" +# }, +# { +# "ipv4": [ +# { +# "address": "192.0.2.1 255.255.255.0" +# }, +# { +# "address": "192.0.2.2 255.255.255.0", +# "secondary": true +# } +# ], +# "ipv6": [ +# { +# "address": "2001:db8:0:3::/64" +# } +# ], +# "name": "GigabitEthernet0/0/0/0" +# }, +# { +# "name": "GigabitEthernet0/0/0/1" +# }, +# { +# "name": "GigabitEthernet0/0/0/3" +# }, +# { +# "name": "GigabitEthernet0/0/0/4" +# } +# ] +# After state: +# ------------ +# +# RP/0/0/CPU0:an-iosxr-02#show running-config interface +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 10.8.38.70 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/0 +# description Configured and Merged by Ansible-Network +# mtu 66 +# ipv4 address 192.0.2.1 255.255.255.0 +# ipv4 address 192.0.2.2 255.255.255.0 secondary +# ipv6 address 2001:db8:0:3::/64 +# duplex half +# ! +# interface GigabitEthernet0/0/0/1 +# description Configured and Merged by Ansible-Network +# mtu 66 +# speed 100 +# duplex full +# dot1q native vlan 10 +# l2transport +# l2protocol cdp forward +# l2protocol pvst tunnel +# propagate remote-status +# ! +# ! +# interface GigabitEthernet0/0/0/3 +# shutdown +# ! +# interface GigabitEthernet0/0/0/4 +# shutdown +# dot1q native vlan 40 +# ! + + +""" + +RETURN = """ +before: + description: The configuration as structured data prior to module invocation. + returned: always + type: list + sample: The configuration returned will always be in the same format of the parameters above. +after: + description: The configuration as structured data after module completion. + returned: when changed + type: list + sample: The configuration returned will always be in the same format of the parameters above. +commands: + description: The set of commands pushed to the remote device + returned: always + type: list + sample: ['interface GigabitEthernet0/0/0/1', 'ipv4 address 192.168.0.1 255.255.255.0'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.l3_interfaces.l3_interfaces import ( + L3_InterfacesArgs, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.l3_interfaces.l3_interfaces import ( + L3_Interfaces, +) + + +def main(): + """ + Main entry point for module execution + :returns: the result form module invocation + """ + required_if = [ + ("state", "merged", ("config",)), + ("state", "replaced", ("config",)), + ("state", "rendered", ("config",)), + ("state", "overridden", ("config",)), + ("state", "parsed", ("running_config",)), + ] + + mutually_exclusive = [("config", "running_config")] + module = AnsibleModule( + argument_spec=L3_InterfacesArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + mutually_exclusive=mutually_exclusive, + ) + + result = L3_Interfaces(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lacp.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lacp.py new file mode 100644 index 00000000..a005f90a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lacp.py @@ -0,0 +1,392 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# + +""" +The module file for iosxr_lacp +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_lacp +short_description: LACP resource module +description: +- This module manages Global Link Aggregation Control Protocol (LACP) on IOS-XR devices. +version_added: 1.0.0 +author: +- Nilashish Chakraborty (@nilashishc) +- Rohit Thakur (@rohitthakur2590) +notes: +- Tested against IOS-XR 6.1.3. +- This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html). +options: + config: + description: The provided configurations. + type: dict + suboptions: + system: + description: This option sets the default system parameters for LACP bundles. + type: dict + suboptions: + priority: + description: + - The system priority to use in LACP negotiations. + - Lower value is higher priority. + - Refer to vendor documentation for valid values. + type: int + mac: + type: dict + description: + - The system MAC related configuration for LACP. + suboptions: + address: + description: + - The system ID to use in LACP negotiations. + type: str + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the IOS-XR device + by executing the command B(show running-config lacp). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. + type: str + state: + description: + - The state of the configuration after module completion. + type: str + choices: + - merged + - replaced + - deleted + - parsed + - rendered + - gathered + default: merged +""" +EXAMPLES = """ +# Using merged +# +# +# ------------ +# Before state +# ------------ +# +# +# RP/0/0/CPU0:iosxr01#show running-config lacp +# Tue Jul 16 17:46:08.147 UTC +# % No such configuration item(s) +# +# + +- name: Merge provided configuration with device configuration + cisco.iosxr.iosxr_lacp: + config: + system: + priority: 10 + mac: + address: 00c1.4c00.bd15 + state: merged + +# +# +# ----------------------- +# Module Execution Result +# ----------------------- +# +# "before": {} +# +# +# "commands": [ +# "lacp system priority 10", +# "lacp system mac 00c1.4c00.bd15" +# ] +# +# +# "after": { +# "system": { +# "mac": { +# "address": "00c1.4c00.bd15" +# }, +# "priority": 10 +# } +# } +# +# ----------- +# After state +# ----------- +# +# +# RP/0/0/CPU0:iosxr01#sh run lacp +# Tue Jul 16 17:51:29.365 UTC +# lacp system mac 00c1.4c00.bd15 +# lacp system priority 10 +# +# + +# Using replaced +# +# +# ------------- +# Before state +# ------------- +# +# +# RP/0/0/CPU0:iosxr01#sh run lacp +# Tue Jul 16 17:53:59.904 UTC +# lacp system mac 00c1.4c00.bd15 +# lacp system priority 10 +# + +- name: Replace device global lacp configuration with the given configuration + cisco.iosxr.iosxr_lacp: + config: + system: + priority: 11 + state: replaced +# +# +# ----------------------- +# Module Execution Result +# ----------------------- +# "before": { +# "system": { +# "mac": { +# "address": "00c1.4c00.bd15" +# }, +# "priority": 10 +# } +# } +# +# +# "commands": [ +# "no lacp system mac", +# "lacp system priority 11" +# ] +# +# +# "after": { +# "system": { +# "priority": 11 +# } +# } +# +# ----------- +# After state +# ----------- +# +# +# RP/0/0/CPU0:iosxr01#sh run lacp +# Tue Jul 16 18:02:40.379 UTC +# lacp system priority 11 +# +# + +# Using deleted +# +# +# ------------ +# Before state +# ------------ +# +# +# RP/0/0/CPU0:iosxr01#sh run lacp +# Tue Jul 16 18:37:09.727 UTC +# lacp system mac 00c1.4c00.bd15 +# lacp system priority 11 +# +# + +- name: Delete global LACP configurations from the device + cisco.iosxr.iosxr_lacp: + state: deleted + +# +# +# ----------------------- +# Module Execution Result +# ----------------------- +# "before": { +# "system": { +# "mac": { +# "address": "00c1.4c00.bd15" +# }, +# "priority": 11 +# } +# } +# +# +# "commands": [ +# "no lacp system mac", +# "no lacp system priority" +# ] +# +# +# "after": {} +# +# ------------ +# After state +# ------------ +# +# +# RP/0/0/CPU0:iosxr01#sh run lacp +# Tue Jul 16 18:39:44.116 UTC +# % No such configuration item(s) +# +# + + +# Using parsed +# parsed.cfg +# ------------ +# +# lacp system mac 00c1.4c00.bd15 +# lacp system priority 11 +# - name: Convert LACP config to argspec without connecting to the appliance +# cisco.iosxr.iosxr_lacp: +# running_config: "{{ lookup('file', './parsed.cfg') }}" +# state: parsed +# Task Output (redacted) +# ----------------------- +# "parsed": { +# "system": { +# "mac": { +# "address": "00c1.4c00.bd15" +# }, +# "priority": 11 +# } +# } + + +# Using rendered +- name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_lacp: + config: + system: + priority: 11 + mac: + address: 00c1.4c00.bd15 + state: rendered +# Task Output (redacted) +# ----------------------- +# "rendered": [ +# "lacp system priority 11", +# "lacp system mac 00c1.4c00.bd15" +# ] + + +# Using gathered +# Before state: +# ------------ +# +# RP/0/0/CPU0:an-iosxr-02#show running-config lacp +# lacp system mac 00c1.4c00.bd15 +# lacp system priority 11 +- name: Gather IOSXR LACP configuration + cisco.iosxr.iosxr_lacp: + config: + state: gathered +# Task Output (redacted) +# ----------------------- +# +# "gathered": { +# "system": { +# "mac": { +# "address": "00c1.4c00.bd15" +# }, +# "priority": 11 +# } +# } +# After state: +# ------------ +# +# RP/0/0/CPU0:an-iosxr-02#show running-config lacp +# lacp system mac 00c1.4c00.bd15 +# lacp system priority + + +""" +RETURN = """ +before: + description: The configuration as structured data prior to module invocation. + returned: always + type: dict + sample: > + The configuration returned will always be in the same format + of the parameters above. +after: + description: The configuration as structured data after module completion. + returned: when changed + type: dict + sample: > + The configuration returned will always be in the same format + of the parameters above. +commands: + description: The set of commands pushed to the remote device. + returned: always + type: list + sample: ['lacp system priority 10', 'lacp system mac 00c1.4c00.bd15'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.lacp.lacp import ( + LacpArgs, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.lacp.lacp import ( + Lacp, +) + + +def main(): + """ + Main entry point for module execution + + :returns: the result form module invocation + """ + required_if = [ + ("state", "merged", ("config",)), + ("state", "replaced", ("config",)), + ("state", "rendered", ("config",)), + ("state", "parsed", ("running_config",)), + ] + + mutually_exclusive = [("config", "running_config")] + module = AnsibleModule( + argument_spec=LacpArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + mutually_exclusive=mutually_exclusive, + ) + + result = Lacp(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lacp_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lacp_interfaces.py new file mode 100644 index 00000000..dc156891 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lacp_interfaces.py @@ -0,0 +1,652 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# + +""" +The module file for iosxr_lacp_interfaces +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_lacp_interfaces +short_description: LACP interfaces resource module +description: +- This module manages Link Aggregation Control Protocol (LACP) attributes of interfaces + on IOS-XR devices. +version_added: 1.0.0 +notes: +- Tested against IOS-XR 6.1.3. +- This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html). +author: Nilashish Chakraborty (@nilashishc) +options: + config: + description: A dictionary of LACP interfaces options. + type: list + elements: dict + suboptions: + name: + description: + - Name/Identifier of the interface or Ether-Bundle. + type: str + churn_logging: + description: + - Specifies the parameter for logging of LACP churn events. + - Valid only for ether-bundles. + - Mode 'actor' logs actor churn events only. + - Mode 'partner' logs partner churn events only. + - Mode 'both' logs actor and partner churn events only. + type: str + choices: + - actor + - partner + - both + collector_max_delay: + description: + - Specifies the collector max delay to be signaled to the LACP partner. + - Valid only for ether-bundles. + - Refer to vendor documentation for valid values. + type: int + period: + description: + - Specifies the rate at which packets are sent or received. + - For ether-bundles, this specifies the period to be used by its member links. + - Refer to vendor documentation for valid values. + type: int + switchover_suppress_flaps: + description: + - Specifies the time for which to suppress flaps during a LACP switchover. + - Valid only for ether-bundles. + - Refer to vendor documentation for valid values. + type: int + system: + description: + - This dict object contains configurable options related to LACP system parameters + for ether-bundles. + type: dict + suboptions: + priority: + description: + - Specifies the system priority to use in LACP negotiations for the bundle. + - Refer to vendor documentation for valid values. + type: int + mac: + description: + - Specifies the system ID to use in LACP negotiations for the bundle, + encoded as a MAC address. + type: str + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the IOS-XR device + by executing the command B(show running-config int). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. + type: str + state: + description: + - The state of the configuration after module completion. + type: str + choices: + - merged + - replaced + - overridden + - deleted + - parsed + - gathered + - rendered + default: merged + +""" +EXAMPLES = """ +# Using merged +# +# +# ------------ +# Before state +# ------------ +# +# +# +# RP/0/0/CPU0:an-iosxr#sh running-config interface +# Sun Jul 21 18:01:35.079 UTC +# interface Bundle-Ether10 +# ! +# interface Bundle-Ether11 +# ! +# interface Bundle-Ether12 +# ! +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description 'GigabitEthernet - 1' +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# ! +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# ! +# +# + +- name: Merge provided configuration with device configuration + cisco.iosxr.iosxr_lacp_interfaces: + config: + - name: Bundle-Ether10 + churn_logging: actor + collector_max_delay: 100 + switchover_suppress_flaps: 500 + + - name: Bundle-Ether11 + system: + mac: 00c2.4c00.bd15 + + - name: GigabitEthernet0/0/0/1 + period: 200 + state: merged + +# +# +# ----------- +# After state +# ----------- +# +# +# RP/0/0/CPU0:an-iosxr#sh run int +# Sun Jul 21 18:24:52.413 UTC +# interface Bundle-Ether10 +# lacp churn logging actor +# lacp switchover suppress-flaps 500 +# lacp collector-max-delay 100 +# ! +# interface Bundle-Ether11 +# lacp system mac 00c2.4c00.bd15 +# ! +# interface Bundle-Ether12 +# ! +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description 'GigabitEthernet - 1" +# lacp period 200 +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# ! +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# ! +# + + +# Using replaced +# +# +# ------------ +# Before state +# ------------ +# +# +# RP/0/0/CPU0:an-iosxr#sh run int +# Sun Jul 21 18:24:52.413 UTC +# interface Bundle-Ether10 +# lacp churn logging actor +# lacp switchover suppress-flaps 500 +# lacp collector-max-delay 100 +# ! +# interface Bundle-Ether11 +# lacp system mac 00c2.4c00.bd15 +# ! +# interface Bundle-Ether12 +# ! +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description 'GigabitEthernet - 1" +# lacp period 200 +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# ! +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# ! +# + +- name: Replace LACP configuration of listed interfaces with provided configuration + cisco.iosxr.iosxr_lacp_interfaces: + config: + - name: Bundle-Ether10 + churn_logging: partner + + - name: GigabitEthernet0/0/0/2 + period: 300 + state: replaced + +# +# +# ----------- +# After state +# ----------- +# +# +# RP/0/0/CPU0:an-iosxr#sh run int +# Sun Jul 21 18:50:21.929 UTC +# interface Bundle-Ether10 +# lacp churn logging partner +# ! +# interface Bundle-Ether11 +# lacp system mac 00c2.4c00.bd15 +# ! +# interface Bundle-Ether12 +# ! +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description 'GigabitEthernet - 1" +# lacp period 200 +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# lacp period 300 +# ! +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# ! +# +# + + +# Using overridden +# +# +# ------------ +# Before state +# ------------ +# +# +# RP/0/0/CPU0:an-iosxr#sh run int +# Sun Jul 21 18:24:52.413 UTC +# interface Bundle-Ether10 +# lacp churn logging actor +# lacp switchover suppress-flaps 500 +# lacp collector-max-delay 100 +# ! +# interface Bundle-Ether11 +# lacp system mac 00c2.4c00.bd15 +# ! +# interface Bundle-Ether12 +# ! +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description 'GigabitEthernet - 1" +# lacp period 200 +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# lacp period 200 +# ! +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# ! +# +# + +- name: Override all interface LACP configuration with provided configuration + cisco.iosxr.iosxr_lacp_interfaces: + config: + - name: Bundle-Ether12 + churn_logging: both + collector_max_delay: 100 + switchover_suppress_flaps: 500 + + - name: GigabitEthernet0/0/0/1 + period: 300 + state: overridden + +# +# +# ----------- +# After state +# ----------- +# +# +# RP/0/0/CPU0:an-iosxr(config-if)#do sh run int +# Sun Jul 21 19:32:36.115 UTC +# interface Bundle-Ether10 +# ! +# interface Bundle-Ether11 +# ! +# interface Bundle-Ether12 +# lacp churn logging both +# lacp switchover suppress-flaps 500 +# lacp collector-max-delay 100 +# ! +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description 'GigabitEthernet - 1" +# lacp period 300 +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# ! +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# ! +# + + +# Using deleted +# +# +# ------------ +# Before state +# ------------ +# +# +# RP/0/0/CPU0:an-iosxr#sh run int +# Sun Jul 21 18:24:52.413 UTC +# interface Bundle-Ether10 +# lacp churn logging actor +# lacp switchover suppress-flaps 500 +# lacp collector-max-delay 100 +# ! +# interface Bundle-Ether11 +# lacp non-revertive +# ! +# interface Bundle-Ether12 +# ! +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description 'GigabitEthernet - 1" +# lacp period 200 +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# lacp period 300 +# ! +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# ! +# + +- name: Deleted LACP configurations of provided interfaces (Note - This won't delete + the interface itself) + cisco.iosxr.iosxr_lacp_interfaces: + config: + - name: Bundle-Ether10 + - name: Bundle-Ether11 + - name: GigabitEthernet0/0/0/1 + - name: GigabitEthernet0/0/0/2 + state: deleted + +# +# +# ----------- +# After state +# ----------- +# +# +# Using parsed: + +# parsed.cfg +# interface Bundle-Ether10 +# lacp churn logging actor +# lacp switchover suppress-flaps 500 +# lacp collector-max-delay 100 +# ! +# interface Bundle-Ether11 +# lacp system mac 00c2.4c00.bd15 +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# lacp period 200 +# ! +# + +- name: Convert lacp interfaces config to argspec without connecting to the appliance + cisco.iosxr.iosxr_lacp_interfaces: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed + +# -------------- +# Output: +# -------------- + +# parsed: +# - name: Bundle-Ether10 +# churn_logging: actor +# collector_max_delay: 100 +# switchover_suppress_flaps: 500 +# +# - name: Bundle-Ether11 +# system: +# mac: 00c2.4c00.bd15 +# +# - name: GigabitEthernet0/0/0/1 +# period: 200 +# +# + +# Using gathered: + +# Native config: +# interface Bundle-Ether10 +# lacp churn logging actor +# lacp switchover suppress-flaps 500 +# lacp collector-max-delay 100 +# ! +# interface Bundle-Ether11 +# lacp system mac 00c2.4c00.bd15 +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# lacp period 200 +# ! +# + +- name: Gather IOSXR lacp interfaces configuration + cisco.iosxr.iosxr_lacp_interfaces: + config: + state: gathered + +# ---------- +# Output +# --------- +# gathered: +# - name: Bundle-Ether10 +# churn_logging: actor +# collector_max_delay: 100 +# switchover_suppress_flaps: 500 +# +# - name: Bundle-Ether11 +# system: +# mac: 00c2.4c00.bd15 +# +# - name: GigabitEthernet0/0/0/1 +# period: 200 + +# Using rendered: + +- name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_lacp_interfaces: + config: + - name: Bundle-Ether10 + churn_logging: actor + collector_max_delay: 100 + switchover_suppress_flaps: 500 + + - name: Bundle-Ether11 + system: + mac: 00c2.4c00.bd15 + + - name: GigabitEthernet0/0/0/1 + period: 200 + state: rendered + +# ------------- +# Output +# ------------- +# rendered: [ +# - "interface Bundle-Ether10" +# - " lacp churn logging actor" +# - " lacp switchover suppress-flaps 500" +# - " lacp collector-max-delay 100" +# - "interface Bundle-Ether11" +# - " lacp system mac 00c2.4c00.bd15" +# - "interface MgmtEth0/0/CPU0/0" +# - " ipv4 address 192.0.2.11 255.255.255.0" +# - "interface GigabitEthernet0/0/0/1" +# - " lacp period 200" +# + + +""" +RETURN = """ +before: + description: The configuration as structured data prior to module invocation. + returned: always + type: list + sample: > + The configuration returned will always be in the same format + of the parameters above. +after: + description: The configuration as structured data after module completion. + returned: when changed + type: list + sample: > + The configuration returned will always be in the same format + of the parameters above. +commands: + description: The set of commands pushed to the remote device. + returned: always + type: list + sample: ['interface Bundle-Ether10', 'lacp churn logging partner', 'lacp period 150'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.lacp_interfaces.lacp_interfaces import ( + Lacp_interfacesArgs, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.lacp_interfaces.lacp_interfaces import ( + Lacp_interfaces, +) + + +def main(): + """ + Main entry point for module execution + + :returns: the result form module invocation + """ + required_if = [ + ("state", "merged", ("config",)), + ("state", "replaced", ("config",)), + ("state", "overridden", ("config",)), + ("state", "rendered", ("config",)), + ("state", "parsed", ("running_config",)), + ] + + mutually_exclusive = [("config", "running_config")] + module = AnsibleModule( + argument_spec=Lacp_interfacesArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + mutually_exclusive=mutually_exclusive, + ) + + result = Lacp_interfaces(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lag_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lag_interfaces.py new file mode 100644 index 00000000..201365e8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lag_interfaces.py @@ -0,0 +1,853 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# + +""" +The module file for iosxr_lag_interfaces +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +DOCUMENTATION = """ +module: iosxr_lag_interfaces +short_description: LAG interfaces resource module +description: +- This module manages the attributes of LAG/Ether-Bundle interfaces on IOS-XR devices. +version_added: 1.0.0 +notes: +- Tested against IOS-XR 6.1.3. +- This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html). +author: Nilashish Chakraborty (@NilashishC) +options: + config: + description: A provided Link Aggregation Group (LAG) configuration. + type: list + elements: dict + suboptions: + name: + description: + - Name/Identifier of the LAG/Ether-Bundle to configure. + type: str + required: true + members: + description: + - List of member interfaces for the LAG/Ether-Bundle. + type: list + elements: dict + suboptions: + member: + description: + - Name of the member interface. + type: str + mode: + description: + - Specifies the mode of the operation for the member interface. + - Mode 'active' runs LACP in active mode. + - Mode 'on' does not run LACP over the port. + - Mode 'passive' runs LACP in passive mode over the port. + - Mode 'inherit' runs LACP as configured in the bundle. + type: str + choices: ["on", "active", "passive", "inherit"] + mode: + description: + - LAG mode. + - Mode 'active' runs LACP in active mode over the port. + - Mode 'on' does not run LACP over the port. + - Mode 'passive' runs LACP in passive mode over the port. + type: str + choices: ["on", "active", "passive"] + links: + description: + - This dict contains configurable options related to LAG/Ether-Bundle links. + type: dict + suboptions: + max_active: + description: + - Specifies the limit on the number of links that can be active in the LAG/Ether-Bundle. + - Refer to vendor documentation for valid values. + type: int + min_active: + description: + - Specifies the minimum number of active links needed to bring up the LAG/Ether-Bundle. + - Refer to vendor documentation for valid values. + type: int + load_balancing_hash: + description: + - Specifies the hash function used for traffic forwarded over the LAG/Ether-Bundle. + - Option 'dst-ip' uses the destination IP as the hash function. + - Option 'src-ip' uses the source IP as the hash function. + type: str + choices: ["dst-ip", "src-ip"] + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the IOS-XR device + by executing the command B(show running-config int). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. + type: str + state: + description: + - The state of the configuration after module completion. + type: str + choices: + - merged + - replaced + - overridden + - deleted + - parsed + - rendered + - gathered + default: merged + +""" +EXAMPLES = """ +# Using merged +# +# +# ------------ +# Before state +# ------------ +# +# RP/0/0/CPU0:iosxr01#show run int +# Sun Jul 7 19:42:59.416 UTC +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description "GigabitEthernet - 1" +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# ! +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# ! +# +# +- name: Merge provided configuration with device configuration + cisco.iosxr.iosxr_lag_interfaces: + config: + - name: Bundle-Ether10 + members: + - member: GigabitEthernet0/0/0/1 + mode: inherit + - member: GigabitEthernet0/0/0/3 + mode: inherit + mode: active + links: + max_active: 5 + min_active: 2 + load_balancing_hash: src-ip + + - name: Bundle-Ether12 + members: + - member: GigabitEthernet0/0/0/2 + mode: passive + - member: GigabitEthernet0/0/0/4 + mode: passive + load_balancing_hash: dst-ip + state: merged +# +# +# ----------- +# After state +# ----------- +# +# RP/0/0/CPU0:iosxr01#show run int +# Sun Jul 7 20:51:17.685 UTC +# interface Bundle-Ether10 +# lacp mode active +# bundle load-balancing hash src-ip +# bundle maximum-active links 5 +# bundle minimum-active links 2 +# ! +# interface Bundle-Ether12 +# bundle load-balancing hash dst-ip +# ! +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description 'GigabitEthernet - 1" +# bundle id 10 mode inherit +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# bundle id 12 mode passive +# ! +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# bundle id 10 mode inherit +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# bundle id 12 mode passive +# ! +# + + +# Using replaced +# +# +# ------------- +# Before state +# ------------- +# +# +# RP/0/0/CPU0:iosxr01#sho run int +# Sun Jul 7 20:58:06.527 UTC +# interface Bundle-Ether10 +# lacp mode active +# bundle load-balancing hash src-ip +# bundle maximum-active links 5 +# bundle minimum-active links 2 +# ! +# interface Bundle-Ether12 +# bundle load-balancing hash dst-ip +# ! +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description 'GigabitEthernet - 1" +# bundle id 10 mode inherit +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# bundle id 12 mode passive +# ! +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# bundle id 10 mode inherit +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# bundle id 12 mode passive +# ! +# +# +- name: Replace device configuration of listed Bundles with provided configurations + cisco.iosxr.iosxr_lag_interfaces: + config: + - name: Bundle-Ether12 + members: + - name: GigabitEthernet0/0/0/2 + mode: passive + + - name: Bundle-Ether11 + members: + - name: GigabitEthernet0/0/0/4 + load_balancing_hash: src-ip + state: replaced +# +# +# ----------- +# After state +# ----------- +# +# +# RP/0/0/CPU0:iosxr01#sh run int +# Sun Jul 7 21:22:27.397 UTC +# interface Bundle-Ether10 +# lacp mode active +# bundle load-balancing hash src-ip +# bundle maximum-active links 5 +# bundle minimum-active links 2 +# ! +# interface Bundle-Ether11 +# bundle load-balancing hash src-ip +# ! +# interface Bundle-Ether12 +# lacp mode passive +# ! +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description 'GigabitEthernet - 1" +# bundle id 10 mode inherit +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# bundle id 12 mode on +# ! +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# bundle id 10 mode inherit +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# bundle id 11 mode on +# ! +# +# + + +# Using overridden +# +# +# ------------ +# Before state +# ------------ +# +# +# RP/0/0/CPU0:iosxr01#sh run int +# Sun Jul 7 21:22:27.397 UTC +# interface Bundle-Ether10 +# lacp mode active +# bundle load-balancing hash src-ip +# bundle maximum-active links 5 +# bundle minimum-active links 2 +# ! +# interface Bundle-Ether11 +# bundle load-balancing hash src-ip +# ! +# interface Bundle-Ether12 +# lacp mode passive +# ! +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description 'GigabitEthernet - 1" +# bundle id 10 mode inherit +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# bundle id 12 mode on +# ! +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# bundle id 10 mode inherit +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# bundle id 11 mode on +# ! +# +# + +- name: Overrides all device configuration with provided configuration + cisco.iosxr.iosxr_lag_interfaces: + config: + - name: Bundle-Ether10 + members: + - member: GigabitEthernet0/0/0/1 + mode: inherit + - member: GigabitEthernet0/0/0/2 + mode: inherit + mode: active + load_balancing_hash: dst-ip + state: overridden +# +# +# ------------ +# After state +# ------------ +# +# +# RP/0/0/CPU0:iosxr01#sh run int +# Sun Jul 7 21:43:04.802 UTC +# interface Bundle-Ether10 +# lacp mode active +# bundle load-balancing hash dst-ip +# ! +# interface Bundle-Ether11 +# ! +# interface Bundle-Ether12 +# ! +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description 'GigabitEthernet - 1" +# bundle id 10 mode inherit +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# bundle id 10 mode inherit +# ! +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# ! +# +# + + +# Using deleted +# +# +# ------------ +# Before state +# ------------ +# +# RP/0/0/CPU0:iosxr01#sh run int +# Sun Jul 7 21:22:27.397 UTC +# interface Bundle-Ether10 +# lacp mode active +# bundle load-balancing hash src-ip +# bundle maximum-active links 5 +# bundle minimum-active links 2 +# ! +# interface Bundle-Ether11 +# bundle load-balancing hash src-ip +# ! +# interface Bundle-Ether12 +# lacp mode passive +# ! +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description 'GigabitEthernet - 1" +# bundle id 10 mode inherit +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# bundle id 12 mode on +# !n +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# bundle id 10 mode inherit +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# bundle id 11 mode on +# ! +# +# + +- name: Delete attributes of given bundles and removes member interfaces from them + (Note - This won't delete the bundles themselves) + cisco.iosxr.iosxr_lag_interfaces: + config: + - name: Bundle-Ether10 + - name: Bundle-Ether11 + - name: Bundle-Ether12 + state: deleted + +# +# +# ------------ +# After state +# ------------ +# +# RP/0/0/CPU0:iosxr01#sh run int +# Sun Jul 7 21:49:50.004 UTC +# interface Bundle-Ether10 +# ! +# interface Bundle-Ether11 +# ! +# interface Bundle-Ether12 +# ! +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description 'GigabitEthernet - 1" +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# ! +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# ! +# +# + +# Using deleted (without config) +# +# +# ------------ +# Before state +# ------------ +# +# RP/0/0/CPU0:an-iosxr#sh run int +# Sun Aug 18 19:49:51.908 UTC +# interface Bundle-Ether10 +# lacp mode active +# bundle load-balancing hash src-ip +# bundle maximum-active links 10 +# bundle minimum-active links 2 +# ! +# interface Bundle-Ether11 +# bundle load-balancing hash dst-ip +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/1 +# bundle id 10 mode inherit +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# bundle id 10 mode passive +# shutdown +# ! +# interface GigabitEthernet0/0/0/3 +# bundle id 11 mode passive +# shutdown +# ! +# interface GigabitEthernet0/0/0/4 +# bundle id 11 mode passive +# shutdown +# ! +# + +- name: Delete attributes of all bundles and removes member interfaces from them (Note + - This won't delete the bundles themselves) + cisco.iosxr.iosxr_lag_interfaces: + state: deleted + +# +# +# ------------ +# After state +# ------------ +# +# +# RP/0/0/CPU0:an-iosxr#sh run int +# Sun Aug 18 19:54:22.389 UTC +# interface Bundle-Ether10 +# ! +# interface Bundle-Ether11 +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 10.8.38.69 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/0 +# shutdown +# ! +# interface GigabitEthernet0/0/0/1 +# shutdown +# ! +# interface GigabitEthernet0/0/0/2 +# shutdown +# ! +# interface GigabitEthernet0/0/0/3 +# shutdown +# ! +# interface GigabitEthernet0/0/0/4 +# shutdown +# ! + +# Using parsed: + +# parsed.cfg + +# interface Bundle-Ether10 +# lacp mode active +# bundle load-balancing hash src-ip +# bundle maximum-active links 5 +# bundle minimum-active links 2 +# ! +# interface Bundle-Ether12 +# bundle load-balancing hash dst-ip +# ! +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description 'GigabitEthernet - 1" +# bundle id 10 mode inherit +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# bundle id 12 mode passive +# ! +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# bundle id 10 mode inherit +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# bundle id 12 mode passive +# ! +# +- name: Convert lag interfaces config to argspec without connecting to the appliance + cisco.iosxr.iosxr_lag_interfaces: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed + +# -------------- +# Output +# -------------- +# parsed: +# - name: Bundle-Ether10 +# members: +# - member: GigabitEthernet0/0/0/1 +# mode: inherit +# - member: GigabitEthernet0/0/0/3 +# mode: inherit +# mode: active +# links: +# max_active: 5 +# min_active: 2 +# load_balancing_hash: src-ip + +# - name: Bundle-Ether12 +# members: +# - member: GigabitEthernet0/0/0/2 +# mode: passive +# - member: GigabitEthernet0/0/0/4 +# mode: passive +# load_balancing_hash: dst-ip + +# using gathered + +# Device Config: +# ------------- + +# interface Bundle-Ether10 +# lacp mode active +# bundle load-balancing hash src-ip +# bundle maximum-active links 5 +# bundle minimum-active links 2 +# ! +# interface Bundle-Ether12 +# bundle load-balancing hash dst-ip +# ! +# interface Loopback888 +# description test for ansible +# shutdown +# ! +# interface MgmtEth0/0/CPU0/0 +# ipv4 address 192.0.2.11 255.255.255.0 +# ! +# interface GigabitEthernet0/0/0/1 +# description 'GigabitEthernet - 1" +# bundle id 10 mode inherit +# ! +# interface GigabitEthernet0/0/0/2 +# description "GigabitEthernet - 2" +# bundle id 12 mode passive +# ! +# interface GigabitEthernet0/0/0/3 +# description "GigabitEthernet - 3" +# bundle id 10 mode inherit +# ! +# interface GigabitEthernet0/0/0/4 +# description "GigabitEthernet - 4" +# bundle id 12 mode passive +# ! +# + +- name: Gather IOSXR lag interfaces configuration + cisco.iosxr.iosxr_lag_interfaces: + config: + state: gathered + +# -------------- +# Output +# -------------- +# gathered: +# - name: Bundle-Ether10 +# members: +# - member: GigabitEthernet0/0/0/1 +# mode: inherit +# - member: GigabitEthernet0/0/0/3 +# mode: inherit +# mode: active +# links: +# max_active: 5 +# min_active: 2 +# load_balancing_hash: src-ip + +# - name: Bundle-Ether12 +# members: +# - member: GigabitEthernet0/0/0/2 +# mode: passive +# - member: GigabitEthernet0/0/0/4 +# mode: passive +# load_balancing_hash: dst-ip + +# Using rendered: +- name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_lag_interfaces: + config: + - name: Bundle-Ether10 + members: + - member: GigabitEthernet0/0/0/1 + mode: inherit + - member: GigabitEthernet0/0/0/3 + mode: inherit + mode: active + links: + max_active: 5 + min_active: 2 + load_balancing_hash: src-ip + + - name: Bundle-Ether12 + members: + - member: GigabitEthernet0/0/0/2 + mode: passive + - member: GigabitEthernet0/0/0/4 + mode: passive + load_balancing_hash: dst-ip + state: rendered + +# Output: + +# rendered: +# [ +# - "interface Bundle-Ether10" +# - " lacp mode active" +# - " bundle load-balancing hash src-ip" +# - " bundle maximum-active links 5" +# - " bundle minimum-active links 2" +# - "interface Bundle-Ether12" +# - " bundle load-balancing hash dst-ip" +# - "interface Loopback888" +# - " description test for ansible" +# - " shutdown" +# - "interface MgmtEth0/0/CPU0/0" +# - " ipv4 address 192.0.2.11 255.255.255.0" +# - "interface GigabitEthernet0/0/0/1" +# - " description 'GigabitEthernet - 1"" +# - " bundle id 10 mode inherit" +# - "interface GigabitEthernet0/0/0/2" +# - " description "GigabitEthernet - 2"" +# - " bundle id 12 mode passive" +# - "interface GigabitEthernet0/0/0/3" +# - " description "GigabitEthernet - 3"" +# - " bundle id 10 mode inherit" +# - "interface GigabitEthernet0/0/0/4" +# - " description "GigabitEthernet - 4"" +# - " bundle id 12 mode passive" +# ] +# +# + + +""" +RETURN = """ +before: + description: The configuration as structured data prior to module invocation. + returned: always + type: list + sample: > + The configuration returned will always be in the same format + of the parameters above. +after: + description: The configuration as structured data after module completion. + returned: when changed + type: list + sample: > + The configuration returned will always be in the same format + of the parameters above. +commands: + description: The set of commands pushed to the remote device. + returned: always + type: list + sample: ['interface Bundle-Ether10', 'bundle minimum-active links 2', 'bundle load-balancing hash src-ip'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.lag_interfaces.lag_interfaces import ( + Lag_interfacesArgs, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.lag_interfaces.lag_interfaces import ( + Lag_interfaces, +) + + +def main(): + """ + Main entry point for module execution + + :returns: the result form module invocation + """ + required_if = [ + ("state", "merged", ("config",)), + ("state", "replaced", ("config",)), + ("state", "overridden", ("config",)), + ("state", "rendered", ("config",)), + ("state", "parsed", ("running_config",)), + ] + + mutually_exclusive = [("config", "running_config")] + module = AnsibleModule( + argument_spec=Lag_interfacesArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + mutually_exclusive=mutually_exclusive, + ) + + result = Lag_interfaces(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lldp_global.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lldp_global.py new file mode 100644 index 00000000..0aa7bb4b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lldp_global.py @@ -0,0 +1,489 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# + +""" +The module file for iosxr_lldp_global +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_lldp_global +short_description: LLDP resource module +description: +- This module manages Global Link Layer Discovery Protocol (LLDP) settings on IOS-XR + devices. +version_added: 1.0.0 +notes: +- Tested against IOS-XR 6.1.3. +- This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html). +author: Nilashish Chakraborty (@NilashishC) +options: + config: + description: The provided global LLDP configuration. + type: dict + suboptions: + holdtime: + description: + - Specifies the holdtime (in sec) to be sent in packets. + type: int + reinit: + description: + - Specifies the delay (in sec) for LLDP initialization on any interface. + type: int + subinterfaces: + description: + - Enable or disable LLDP over sub-interfaces. + type: bool + timer: + description: + - Specifies the rate at which LLDP packets are sent (in sec). + type: int + tlv_select: + description: + - Specifies the LLDP TLVs to enable or disable. + type: dict + suboptions: + management_address: + description: + - Enable or disable management address TLV. + type: bool + port_description: + description: + - Enable or disable port description TLV. + type: bool + system_capabilities: + description: + - Enable or disable system capabilities TLV. + type: bool + system_description: + description: + - Enable or disable system description TLV. + type: bool + system_name: + description: + - Enable or disable system name TLV. + type: bool + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the IOS-XR device + by executing the command B(show running-config lldp). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. + type: str + state: + description: + - The state of the configuration after module completion. + type: str + choices: + - merged + - replaced + - deleted + - parsed + - gathered + - rendered + default: merged + +""" +EXAMPLES = """ +# Using merged +# +# +# ------------- +# Before State +# ------------- +# +# +# RP/0/0/CPU0:an-iosxr#sh run lldp +# Tue Aug 6 19:27:54.933 UTC +# % No such configuration item(s) +# +# + +- name: Merge provided LLDP configuration with the existing configuration + cisco.iosxr.iosxr_lldp_global: + config: + holdtime: 100 + reinit: 2 + timer: 3000 + subinterfaces: true + tlv_select: + management_address: false + system_description: false + state: merged + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "before": {} +# +# "commands": [ +# "lldp subinterfaces enable", +# "lldp holdtime 100", +# "lldp reinit 2", +# "lldp tlv-select system-description disable", +# "lldp tlv-select management-address disable", +# "lldp timer 3000" +# ] +# +# "after": { +# "holdtime": 100, +# "reinit": 2, +# "subinterfaces": true, +# "timer": 3000, +# "tlv_select": { +# "management_address": false, +# "system_description": false +# } +# } +# +# +# ------------ +# After state +# ------------ +# +# +# RP/0/0/CPU0:an-iosxr#sh run lldp +# Tue Aug 6 21:31:10.587 UTC +# lldp +# timer 3000 +# reinit 2 +# subinterfaces enable +# holdtime 100 +# tlv-select +# management-address disable +# system-description disable +# ! +# ! +# +# + + +# Using replaced +# +# +# ------------- +# Before State +# ------------- +# +# RP/0/0/CPU0:an-iosxr#sh run lldp +# Tue Aug 6 21:31:10.587 UTC +# lldp +# timer 3000 +# reinit 2 +# subinterfaces enable +# holdtime 100 +# tlv-select +# management-address disable +# system-description disable +# ! +# ! +# +# + +- name: Replace existing LLDP device configuration with provided configuration + cisco.iosxr.iosxr_lldp_global: + config: + holdtime: 100 + tlv_select: + port_description: false + system_description: true + management_description: true + state: replaced + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "before": { +# "holdtime": 100, +# "reinit": 2, +# "subinterfaces": true, +# "timer": 3000, +# "tlv_select": { +# "management_address": false, +# "system_description": false +# } +# } +# +# "commands": [ +# "no lldp reinit 2", +# "no lldp subinterfaces enable", +# "no lldp timer 3000", +# "no lldp tlv-select management-address disable", +# "no lldp tlv-select system-description disable", +# "lldp tlv-select port-description disable" +# ] +# +# "after": { +# "holdtime": 100, +# "tlv_select": { +# "port_description": false +# } +# } +# +# +# ------------ +# After state +# ------------ +# +# RP/0/0/CPU0:an-iosxr#sh run lldp +# Tue Aug 6 21:53:08.407 UTC +# lldp +# holdtime 100 +# tlv-select +# port-description disable +# ! +# ! +# +# + + +# Using deleted +# +# ------------ +# Before state +# ------------ +# +# +# RP/0/0/CPU0:an-iosxr#sh run lldp +# Tue Aug 6 21:31:10.587 UTC +# lldp +# timer 3000 +# reinit 2 +# subinterfaces enable +# holdtime 100 +# tlv-select +# management-address disable +# system-description disable +# ! +# ! +# +# + +- name: Deleted existing LLDP configurations from the device + cisco.iosxr.iosxr_lldp_global: + state: deleted + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "before": { +# "holdtime": 100, +# "reinit": 2, +# "subinterfaces": true, +# "timer": 3000, +# "tlv_select": { +# "management_address": false, +# "system_description": false +# } +# }, +# +# "commands": [ +# "no lldp holdtime 100", +# "no lldp reinit 2", +# "no lldp subinterfaces enable", +# "no lldp timer 3000", +# "no lldp tlv-select management-address disable", +# "no lldp tlv-select system-description disable" +# ] +# +# "after": {} +# +# +# ----------- +# After state +# ----------- +# +# RP/0/0/CPU0:an-iosxr#sh run lldp +# Tue Aug 6 21:38:31.187 UTC +# lldp +# ! +# +# Using parsed: + +# parsed.cfg +# lldp +# timer 3000 +# reinit 2 +# subinterfaces enable +# holdtime 100 +# tlv-select +# management-address disable +# system-description disable +# ! +# ! + +- name: Convert lldp global config to argspec without connecting to the appliance + cisco.iosxr.iosxr_lldp_global: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed + +# ------------------------ +# Module Execution Result +# ------------------------ +# parsed: +# holdtime: 100 +# reinit: 2 +# timer: 3000 +# subinterfaces: True +# tlv_select: +# management_address: False +# system_description: False + +# using gathered: + +# Device config: +# lldp +# timer 3000 +# reinit 2 +# subinterfaces enable +# holdtime 100 +# tlv-select +# management-address disable +# system-description disable +# ! +# ! + +- name: Gather IOSXR lldp global configuration + cisco.iosxr.iosxr_lldp_global: + config: + state: gathered + + +# ------------------------ +# Module Execution Result +# ------------------------ +# gathered: +# holdtime: 100 +# reinit: 2 +# timer: 3000 +# subinterfaces: True +# tlv_select: +# management_address: False +# system_description: False + +# using rendered: + +- name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_lldp_global: + config: + holdtime: 100 + reinit: 2 + timer: 3000 + subinterfaces: true + tlv_select: + management_address: false + system_description: false + state: rendered + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "rendered": [ +# "lldp subinterfaces enable", +# "lldp holdtime 100", +# "lldp reinit 2", +# "lldp tlv-select system-description disable", +# "lldp tlv-select management-address disable", +# "lldp timer 3000" +# ] + + + +""" +RETURN = """ +before: + description: The configuration as structured data prior to module invocation. + returned: always + type: dict + sample: > + The configuration returned will always be in the same format + of the parameters above. +after: + description: The configuration as structured data after module completion. + returned: when changed + type: dict + sample: > + The configuration returned will always be in the same format + of the parameters above. +commands: + description: The set of commands pushed to the remote device. + returned: always + type: list + sample: ['lldp subinterfaces enable', 'lldp holdtime 100', 'no lldp tlv-select management-address disable'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.lldp_global.lldp_global import ( + Lldp_globalArgs, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.lldp_global.lldp_global import ( + Lldp_global, +) + + +def main(): + """ + Main entry point for module execution + + :returns: the result form module invocation + """ + required_if = [ + ("state", "merged", ("config",)), + ("state", "replaced", ("config",)), + ("state", "rendered", ("config",)), + ("state", "parsed", ("running_config",)), + ] + mutually_exclusive = [("config", "running_config")] + module = AnsibleModule( + argument_spec=Lldp_globalArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + mutually_exclusive=mutually_exclusive, + ) + + result = Lldp_global(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lldp_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lldp_interfaces.py new file mode 100644 index 00000000..f730f62a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lldp_interfaces.py @@ -0,0 +1,724 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# + +""" +The module file for iosxr_lldp_interfaces +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_lldp_interfaces +short_description: LLDP interfaces resource module +description: +- This module manages Link Layer Discovery Protocol (LLDP) attributes of interfaces + on IOS-XR devices. +version_added: 1.0.0 +notes: +- Tested against IOS-XR 6.1.3. +- This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html). +author: Nilashish Chakraborty (@nilashishc) +options: + config: + description: A dictionary of LLDP interfaces options. + type: list + elements: dict + suboptions: + name: + description: + - Name/Identifier of the interface or Ether-Bundle. + type: str + destination: + description: + - Specifies LLDP destination configuration on the interface. + suboptions: + mac_address: + description: + - Specifies the LLDP destination mac address on the interface. + type: str + choices: + - ieee-nearest-bridge + - ieee-nearest-non-tmpr-bridge + type: dict + receive: + description: + - Enable/disable LLDP RX on an interface. + type: bool + transmit: + description: + - Enable/disable LLDP TX on an interface. + type: bool + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the IOS-XR device + by executing the command B(show running-config int). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. + type: str + state: + description: + - The state of the configuration after module completion. + type: str + choices: + - merged + - replaced + - overridden + - deleted + - parsed + - rendered + - gathered + default: merged + +""" +EXAMPLES = """ +# Using merged +# +# +# ------------ +# Before state +# ------------ +# +# +# RP/0/RP0/CPU0:ios#sh run int +# Mon Aug 12 12:40:23.104 UTC +# interface TenGigE0/0/0/0 +# ipv4 address 192.0.2.11 255.255.255.192 +# ! +# interface preconfigure GigabitEthernet0/0/0/1 +# ! +# interface preconfigure GigabitEthernet0/0/0/2 +# ! +# +# + +- name: Merge provided configuration with running configuration + cisco.iosxr.iosxr_lldp_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + destination: + mac_address: ieee-nearest-non-tmpr-bridge + transmit: false + + - name: GigabitEthernet0/0/0/2 + destination: + mac_address: ieee-nearest-bridge + receive: false + state: merged + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# +# "before": [ +# { +# "name": "TenGigE0/0/0/0" +# }, +# { +# "name": "GigabitEthernet0/0/0/1" +# }, +# { +# "name": "GigabitEthernet0/0/0/2" +# } +# ] +# +# "commands": [ +# "interface GigabitEthernet0/0/0/2", +# "lldp destination mac-address ieee-nearest-non-tmpr-bridge", +# "lldp transmit disable", +# "interface GigabitEthernet0/0/0/1", +# "lldp receive disable", +# "lldp destination mac-address ieee-nearest-bridge" +# ] +# +# "after": [ +# { +# "name": "TenGigE0/0/0/0" +# }, +# { +# "destination": { +# "mac_address": "ieee-nearest-bridge" +# }, +# "name": "GigabitEthernet0/0/0/1", +# "receive": false +# }, +# { +# "destination": { +# "mac_address": "ieee-nearest-non-tmpr-bridge" +# }, +# "name": "GigabitEthernet0/0/0/2", +# "transmit": false +# } +# ] +# +# +# ------------ +# After state +# ------------ +# +# +# RP/0/RP0/CPU0:ios#sh run int +# Mon Aug 12 12:49:51.517 UTC +# interface TenGigE0/0/0/0 +# ipv4 address 192.0.2.11 255.255.255.192 +# ! +# interface preconfigure GigabitEthernet0/0/0/1 +# lldp +# receive disable +# destination mac-address +# ieee-nearest-bridge +# ! +# ! +# ! +# interface preconfigure GigabitEthernet0/0/0/2 +# lldp +# transmit disable +# destination mac-address +# ieee-nearest-non-tmpr-bridge +# ! +# ! +# ! +# +# + + +# Using replaced +# +# +# ------------- +# Before state +# ------------- +# +# +# RP/0/RP0/CPU0:ios#sh run int +# Mon Aug 12 12:49:51.517 UTC +# interface TenGigE0/0/0/0 +# ipv4 address 192.0.2.11 255.255.255.192 +# ! +# interface preconfigure GigabitEthernet0/0/0/1 +# lldp +# receive disable +# destination mac-address +# ieee-nearest-bridge +# ! +# ! +# ! +# interface preconfigure GigabitEthernet0/0/0/2 +# lldp +# transmit disable +# destination mac-address +# ieee-nearest-non-tmpr-bridge +# ! +# ! +# ! +# +# + +- name: Replace existing LLDP configurations of specified interfaces with provided + configuration + cisco.iosxr.iosxr_lldp_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + destination: + mac_address: ieee-nearest-non-tmpr-bridge + state: replaced + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "before": [ +# { +# "name": "TenGigE0/0/0/0" +# }, +# { +# "destination": { +# "mac_address": "ieee-nearest-bridge" +# }, +# "name": "GigabitEthernet0/0/0/1", +# "receive": false +# }, +# { +# "destination": { +# "mac_address": "ieee-nearest-non-tmpr-bridge" +# }, +# "name": "GigabitEthernet0/0/0/2", +# "transmit": false +# } +# ] +# +# +# "commands": [ +# "interface GigabitEthernet0/0/0/1", +# "no lldp receive disable", +# "lldp destination mac-address ieee-nearest-non-tmpr-bridge" +# ] +# +# +# "after": [ +# { +# "name": "TenGigE0/0/0/0" +# }, +# { +# "destination": { +# "mac_address": "ieee-nearest-non-tmpr-bridge" +# }, +# "name": "GigabitEthernet0/0/0/1" +# }, +# { +# "destination": { +# "mac_address": "ieee-nearest-non-tmpr-bridge" +# }, +# "name": "GigabitEthernet0/0/0/2", +# "transmit": false +# } +# ] +# +# +# ------------ +# After state +# ------------ +# +# +# RP/0/RP0/CPU0:ios#sh run int +# Mon Aug 12 13:02:57.062 UTC +# interface TenGigE0/0/0/0 +# ipv4 address 192.0.2.11 255.255.255.192 +# ! +# interface preconfigure GigabitEthernet0/0/0/1 +# lldp +# destination mac-address +# ieee-nearest-non-tmpr-bridge +# ! +# ! +# ! +# interface preconfigure GigabitEthernet0/0/0/2 +# lldp +# transmit disable +# destination mac-address +# ieee-nearest-non-tmpr-bridge +# ! +# ! +# ! +# +# + + +# Using overridden +# +# +# ------------- +# Before state +# ------------- +# +# +# RP/0/RP0/CPU0:ios#sh run int +# Mon Aug 12 13:15:40.465 UTC +# interface TenGigE0/0/0/0 +# ipv4 address 192.0.2.11 255.255.255.192 +# ! +# interface preconfigure GigabitEthernet0/0/0/1 +# lldp +# receive disable +# destination mac-address +# ieee-nearest-bridge +# ! +# ! +# ! +# interface preconfigure GigabitEthernet0/0/0/2 +# lldp +# transmit disable +# destination mac-address +# ieee-nearest-non-tmpr-bridge +# ! +# ! +# ! +# +# + +- name: Override the LLDP configurations of all the interfaces with provided configurations + cisco.iosxr.iosxr_lldp_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + transmit: false + state: overridden + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# +# "before": [ +# { +# "name": "TenGigE0/0/0/0" +# }, +# { +# "destination": { +# "mac_address": "ieee-nearest-bridge" +# }, +# "name": "GigabitEthernet0/0/0/1", +# "receive": false +# }, +# { +# "destination": { +# "mac_address": "ieee-nearest-non-tmpr-bridge" +# }, +# "name": "GigabitEthernet0/0/0/2", +# "transmit": false +# } +# ] +# +# "commands": [ +# "interface GigabitEthernet0/0/0/2", +# "no lldp destination mac-address ieee-nearest-non-tmpr-bridge", +# "no lldp transmit disable", +# "interface GigabitEthernet0/0/0/1", +# "no lldp destination mac-address ieee-nearest-bridge", +# "no lldp receive disable", +# "lldp transmit disable" +# ] +# +# +# "after": [ +# { +# "name": "TenGigE0/0/0/0" +# }, +# { +# "name": "GigabitEthernet0/0/0/1", +# "transmit": false +# }, +# { +# "name": "GigabitEthernet0/0/0/2" +# } +# ] +# +# +# ------------ +# After state +# ------------ +# +# +# RP/0/RP0/CPU0:ios#sh run int +# Mon Aug 12 13:22:25.604 UTC +# interface TenGigE0/0/0/0 +# ipv4 address 192.0.2.11 255.255.255.192 +# ! +# interface preconfigure GigabitEthernet0/0/0/1 +# lldp +# transmit disable +# ! +# ! +# interface preconfigure GigabitEthernet0/0/0/2 +# ! +# +# + + +# Using deleted +# +# +# ------------- +# Before state +# ------------- +# +# +# RP/0/RP0/CPU0:ios#sh run int +# Mon Aug 12 13:26:21.498 UTC +# interface TenGigE0/0/0/0 +# ipv4 address 192.0.2.11 255.255.255.192 +# ! +# interface preconfigure GigabitEthernet0/0/0/1 +# lldp +# receive disable +# destination mac-address +# ieee-nearest-bridge +# ! +# ! +# ! +# interface preconfigure GigabitEthernet0/0/0/2 +# lldp +# transmit disable +# destination mac-address +# ieee-nearest-non-tmpr-bridge +# ! +# ! +# ! +# +# + +- name: Delete LLDP configurations of all interfaces (Note - This won't delete the + interfaces themselves) + cisco.iosxr.iosxr_lldp_interfaces: + state: deleted + +# +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# +# "before": [ +# { +# "name": "TenGigE0/0/0/0" +# }, +# { +# "destination": { +# "mac_address": "ieee-nearest-bridge" +# }, +# "name": "GigabitEthernet0/0/0/1", +# "receive": false +# }, +# { +# "destination": { +# "mac_address": "ieee-nearest-non-tmpr-bridge" +# }, +# "name": "GigabitEthernet0/0/0/2", +# "transmit": false +# } +# ] +# +# +# "commands": [ +# "interface GigabitEthernet0/0/0/1", +# "no lldp destination mac-address ieee-nearest-bridge", +# "no lldp receive disable", +# "interface GigabitEthernet0/0/0/2", +# "no lldp destination mac-address ieee-nearest-non-tmpr-bridge", +# "no lldp transmit disable" +# ] +# +# +# "after": [ +# { +# "name": "TenGigE0/0/0/0" +# }, +# { +# "name": "GigabitEthernet0/0/0/1" +# }, +# { +# "name": "GigabitEthernet0/0/0/2" +# } +# ] +# +# +# ------------ +# After state +# ------------ +# +# +# RP/0/RP0/CPU0:ios#sh run int +# Mon Aug 12 13:30:14.618 UTC +# interface TenGigE0/0/0/0 +# ipv4 address 192.0.2.11 255.255.255.192 +# ! +# interface preconfigure GigabitEthernet0/0/0/1 +# ! +# interface preconfigure GigabitEthernet0/0/0/2 +# ! +# +# +# Using parsed: +# parsed.cfg + +# interface TenGigE0/0/0/0 +# ipv4 address 192.0.2.11 255.255.255.192 +# ! +# interface preconfigure GigabitEthernet0/0/0/1 +# lldp +# receive disable +# destination mac-address +# ieee-nearest-bridge +# ! +# ! +# ! +# interface preconfigure GigabitEthernet0/0/0/2 +# lldp +# transmit disable +# destination mac-address +# ieee-nearest-non-tmpr-bridge + +- name: Convert lacp interfaces config to argspec without connecting to the appliance + cisco.iosxr.iosxr_lldp_interfaces: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed + +# ------------------------ +# Module Execution Result +# ------------------------ + +# parsed: [ +# - name: GigabitEthernet0/0/0/1 +# destination: +# mac_address: ieee-nearest-non-tmpr-bridge +# transmit: False + +# - name: GigabitEthernet0/0/0/2 +# destination: +# mac_address: ieee-nearest-bridge +# receive: False +# ] + +# Using gathered: +# Device config: + +# RP/0/RP0/CPU0:ios#sh run int +# Mon Aug 12 12:49:51.517 UTC +# interface TenGigE0/0/0/0 +# ipv4 address 192.0.2.11 255.255.255.192 +# ! +# interface preconfigure GigabitEthernet0/0/0/1 +# lldp +# receive disable +# destination mac-address +# ieee-nearest-bridge +# ! +# ! +# ! +# interface preconfigure GigabitEthernet0/0/0/2 +# lldp +# transmit disable +# destination mac-address +# ieee-nearest-non-tmpr-bridge + +- name: Gather IOSXR lldp interfaces configuration + cisco.iosxr.iosxr_lldp_interfaces: + config: + state: gathered + +# ------------------------ +# Module Execution Result +# ------------------------ + +# gathered: +# - name: GigabitEthernet0/0/0/1 +# destination: +# mac_address: ieee-nearest-non-tmpr-bridge +# transmit: False + +# - name: GigabitEthernet0/0/0/2 +# destination: +# mac_address: ieee-nearest-bridge +# receive: False + +# Using rendred: +- name: Render platform specific commands from task input using rendered state + cisco.iosxr.iosxr_lldp_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + destination: + mac_address: ieee-nearest-non-tmpr-bridge + transmit: false + + - name: GigabitEthernet0/0/0/2 + destination: + mac_address: ieee-nearest-bridge + receive: false + state: rendered + +# ------------------------ +# Module Execution Result +# ------------------------ + +# "rendered": [ +# "interface GigabitEthernet0/0/0/2", +# "lldp destination mac-address ieee-nearest-non-tmpr-bridge", +# "lldp transmit disable", +# "interface GigabitEthernet0/0/0/1", +# "lldp receive disable", +# "lldp destination mac-address ieee-nearest-bridge" +# ] + +""" +RETURN = """ +before: + description: The configuration as structured data prior to module invocation. + returned: always + type: list + sample: > + The configuration returned will always be in the same format + of the parameters above. +after: + description: The configuration as structured data after module completion. + returned: when changed + type: list + sample: > + The configuration returned will always be in the same format + of the parameters above. +commands: + description: The set of commands pushed to the remote device. + returned: always + type: list + sample: ['interface GigabitEthernet0/0/0/1', 'lldp destination mac-address ieee-nearest-non-tmpr-bridge', 'no lldp transmit disable'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.lldp_interfaces.lldp_interfaces import ( + Lldp_interfacesArgs, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.lldp_interfaces.lldp_interfaces import ( + Lldp_interfaces, +) + + +def main(): + """ + Main entry point for module execution + + :returns: the result form module invocation + """ + required_if = [ + ("state", "merged", ("config",)), + ("state", "replaced", ("config",)), + ("state", "overridden", ("config",)), + ("state", "rendered", ("config",)), + ("state", "parsed", ("running_config",)), + ] + mutually_exclusive = [("config", "running_config")] + module = AnsibleModule( + argument_spec=Lldp_interfacesArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + mutually_exclusive=mutually_exclusive, + ) + + result = Lldp_interfaces(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_logging.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_logging.py new file mode 100644 index 00000000..bb6bf2e1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_logging.py @@ -0,0 +1,1220 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2017, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_logging +author: +- Trishna Guha (@trishnaguha) +- Kedar Kekan (@kedarX) +short_description: Configuration management of system logging services on network + devices +description: +- This module provides declarative management configuration of system logging (syslog) + on Cisco IOS XR devices. +version_added: 1.0.0 +requirements: +- ncclient >= 0.5.3 when using netconf +- lxml >= 4.1.1 when using netconf +notes: +- This module works with connection C(network_cli) and C(netconf). See L(the IOS-XR + Platform Options,../network/user_guide/platform_iosxr.html). +- Tested against IOS XRv 6.1.3 +options: + dest: + description: + - Destination for system logging (syslog) messages. + choices: + - host + - console + - monitor + - buffered + - file + type: str + name: + description: + - When C(dest) = I(file) name indicates file-name + - When C(dest) = I(host) name indicates the host-name or ip-address of syslog + server. + type: str + vrf: + description: + - vrf name when syslog server is configured, C(dest) = C(host) + type: str + default: default + size: + description: + - Size of buffer when C(dest) = C(buffered). The acceptable value is in the range + I(307200 to 125000000 bytes). Default 307200 + - Size of file when C(dest) = C(file). The acceptable value is in the range I(1 + to 2097152)KB. Default 2 GB + type: int + facility: + description: + - To configure the type of syslog facility in which system logging (syslog) messages + are sent to syslog servers Optional config for C(dest) = C(host) + default: local7 + type: str + hostnameprefix: + description: + - To append a hostname prefix to system logging (syslog) messages logged to syslog + servers. Optional config for C(dest) = C(host) + type: str + level: + description: + - Specifies the severity level for the logging. + type: str + default: debugging + aliases: + - severity + choices: ["emergencies", "alerts", "critical", "errors", "warning", "notifications", "informational", "debugging"] + aggregate: + description: List of syslog logging configuration definitions. + type: list + elements: dict + suboptions: + dest: + description: + - Destination for system logging (syslog) messages. + choices: + - host + - console + - monitor + - buffered + - file + type: str + name: + description: + - When C(dest) = I(file) name indicates file-name + - When C(dest) = I(host) name indicates the host-name or ip-address of syslog + server. + type: str + vrf: + description: + - vrf name when syslog server is configured, C(dest) = C(host) + type: str + size: + description: + - Size of buffer when C(dest) = C(buffered). The acceptable value is in the range + I(307200 to 125000000 bytes). Default 307200 + - Size of file when C(dest) = C(file). The acceptable value is in the range I(1 + to 2097152)KB. Default 2 GB + type: int + facility: + description: + - To configure the type of syslog facility in which system logging (syslog) messages + are sent to syslog servers Optional config for C(dest) = C(host) + type: str + hostnameprefix: + description: + - To append a hostname prefix to system logging (syslog) messages logged to syslog + servers. Optional config for C(dest) = C(host) + type: str + level: + description: + - Specifies the severity level for the logging. + type: str + aliases: + - severity + choices: ["emergencies", "alerts", "critical", "errors", "warning", "notifications", "informational", "debugging"] + state: + description: + - Existential state of the logging configuration on the node. + choices: + - present + - absent + type: str + state: + description: + - Existential state of the logging configuration on the node. + default: present + choices: + - present + - absent + type: str +extends_documentation_fragment: +- cisco.iosxr.iosxr +""" + +EXAMPLES = """ +- name: configure logging for syslog server host + cisco.iosxr.iosxr_logging: + dest: host + name: 10.10.10.1 + level: critical + state: present + +- name: add hostnameprefix configuration + cisco.iosxr.iosxr_logging: + hostnameprefix: host1 + state: absent + +- name: add facility configuration + cisco.iosxr.iosxr_logging: + facility: local1 + state: present + +- name: configure console logging level + cisco.iosxr.iosxr_logging: + dest: console + level: debugging + state: present + +- name: configure monitor logging level + cisco.iosxr.iosxr_logging: + dest: monitor + level: errors + state: present + +- name: configure syslog to a file + cisco.iosxr.iosxr_logging: + dest: file + name: file_name + size: 2048 + level: errors + state: present + +- name: configure buffered logging with size + cisco.iosxr.iosxr_logging: + dest: buffered + size: 5100000 + +- name: Configure logging using aggregate + cisco.iosxr.iosxr_logging: + aggregate: + - {dest: console, level: warning} + - {dest: buffered, size: 4800000} + - {dest: file, name: file3, size: 2048} + - {dest: host, name: host3, level: critical} + +- name: Delete logging using aggregate + cisco.iosxr.iosxr_logging: + aggregate: + - {dest: console, level: warning} + - {dest: buffered, size: 4800000} + - {dest: file, name: file3, size: 2048} + - {dest: host, name: host3, level: critical} + state: absent +""" + +RETURN = """ +commands: + description: The list of configuration mode commands to send to the device + returned: always (empty list when no commands to send) + type: list + sample: + - logging 10.10.10.1 vrf default severity debugging + - logging facility local7 + - logging hostnameprefix host1 + - logging console critical + - logging buffered 2097153 + - logging buffered warnings + - logging monitor errors + - logging file log_file maxfilesize 1024 severity info +xml: + description: NetConf rpc xml sent to device with transport C(netconf) + returned: always (empty list when no xml rpc to send) + type: list + sample: + - ' + + + + file1 + + 2097152 + 2 + + + + + ' +""" + +import re +import collections +from copy import deepcopy + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + get_config, + load_config, + build_xml, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + iosxr_argument_spec, + etree_findall, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + is_netconf, + is_cliconf, + etree_find, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + remove_default_spec, +) + + +severity_level = { + "emergency": "0", + "alert": "1", + "critical": "2", + "error": "3", + "warning": "4", + "notice": "5", + "info": "6", + "debug": "7", + "disable": "15", +} + +severity_transpose = { + "emergencies": "emergency", + "alerts": "alert", + "critical": "critical", + "errors": "error", + "warning": "warning", + "notifications": "notice", + "informational": "info", + "debugging": "debug", +} + + +class ConfigBase(object): + def __init__(self, module): + self._flag = None + self._module = module + self._result = {"changed": False, "warnings": []} + self._want = list() + self._have = list() + + def validate_size(self, value, type=None): + if value: + if type == "buffer": + if value and not int(307200) <= value <= int(125000000): + self._module.fail_json( + msg="buffer size must be between 307200 and 125000000" + ) + elif type == "file": + if value and not int(1) <= value <= int(2097152): + self._module.fail_json( + msg="file size must be between 1 and 2097152" + ) + return value + + def map_params_to_obj(self, required_if=None): + aggregate = self._module.params.get("aggregate") + if aggregate: + for item in aggregate: + for key in item: + if item.get(key) is None: + item[key] = self._module.params[key] + + d = item.copy() + + if d["dest"] not in ("host", "file"): + d["name"] = None + + if d["dest"] == "buffered": + if d["size"] is not None: + d["size"] = str( + self.validate_size(d["size"], "buffer") + ) + else: + d["size"] = str(307200) + elif d["dest"] == "file": + if d["size"] is not None: + d["size"] = str(self.validate_size(d["size"], "file")) + else: + d["size"] = str(2097152) + else: + d["size"] = None + + if self._flag == "NC": + d["level"] = severity_transpose[d["level"]] + + self._want.append(d) + + else: + params = self._module.params + if params["dest"] not in ("host", "file"): + params["name"] = None + + if params["dest"] == "buffered": + if params["size"] is not None: + params["size"] = str( + self.validate_size(params["size"], "buffer") + ) + else: + params["size"] = str(307200) + elif params["dest"] == "file": + if params["size"] is not None: + params["size"] = str( + self.validate_size(params["size"], "file") + ) + else: + params["size"] = str(2097152) + else: + params["size"] = None + + if self._flag == "NC": + params["level"] = severity_transpose[params["level"]] + + self._want.append( + { + "dest": params["dest"], + "name": params["name"], + "vrf": params["vrf"], + "size": params["size"], + "facility": params["facility"], + "level": params["level"], + "hostnameprefix": params["hostnameprefix"], + "state": params["state"], + } + ) + + +class CliConfiguration(ConfigBase): + def __init__(self, module): + super(CliConfiguration, self).__init__(module) + self._file_list = set() + self._host_list = set() + + def map_obj_to_commands(self): + commands = list() + for want_item in self._want: + dest = want_item["dest"] + name = want_item["name"] + size = want_item["size"] + facility = want_item["facility"] + level = want_item["level"] + vrf = want_item["vrf"] + hostnameprefix = want_item["hostnameprefix"] + state = want_item["state"] + del want_item["state"] + + have_size = None + have_console_level = None + have_monitor_level = None + have_prefix = None + have_facility = None + + for item in self._have: + if item["dest"] == "buffered": + have_size = item["size"] + if item["dest"] == "console": + have_console_level = item["level"] + if item["dest"] == "monitor": + have_monitor_level = item["level"] + if item["dest"] is None and item["hostnameprefix"] is not None: + have_prefix = item["hostnameprefix"] + if ( + item["dest"] is None + and item["hostnameprefix"] is None + and item["facility"] is not None + ): + have_facility = item["facility"] + + if state == "absent": + if dest == "host" and name in self._host_list: + commands.append("no logging {0} vrf {1}".format(name, vrf)) + elif dest == "file" and name in self._file_list: + commands.append("no logging file {0}".format(name)) + elif dest == "console" and have_console_level is not None: + commands.append("no logging {0}".format(dest)) + elif dest == "monitor" and have_monitor_level: + commands.append("no logging {0}".format(dest)) + elif dest == "buffered" and have_size: + commands.append("no logging {0}".format(dest)) + + if ( + dest is None + and hostnameprefix is not None + and have_prefix == hostnameprefix + ): + commands.append( + "no logging hostnameprefix {0}".format(hostnameprefix) + ) + if ( + dest is None + and facility is not None + and have_facility == facility + ): + commands.append("no logging facility {0}".format(facility)) + + if state == "present": + if dest == "host" and name not in self._host_list: + if level == "errors" or level == "informational": + level = severity_transpose[level] + commands.append( + "logging {0} vrf {1} severity {2}".format( + name, vrf, level + ) + ) + elif dest == "file" and name not in self._file_list: + if level == "errors" or level == "informational": + level = severity_transpose[level] + commands.append( + "logging file {0} maxfilesize {1} severity {2}".format( + name, size, level + ) + ) + elif dest == "buffered" and ( + have_size is None + or (have_size is not None and size != have_size) + ): + commands.append("logging buffered {0}".format(size)) + elif dest == "console" and ( + have_console_level is None + or ( + have_console_level is not None + and have_console_level != level + ) + ): + commands.append("logging console {0}".format(level)) + elif dest == "monitor" and ( + have_monitor_level is None + or ( + have_monitor_level is not None + and have_monitor_level != level + ) + ): + commands.append("logging monitor {0}".format(level)) + + if ( + dest is None + and hostnameprefix is not None + and ( + have_prefix is None + or ( + have_prefix is not None + and hostnameprefix != have_prefix + ) + ) + ): + commands.append( + "logging hostnameprefix {0}".format(hostnameprefix) + ) + if ( + dest is None + and hostnameprefix is None + and facility != have_facility + ): + commands.append("logging facility {0}".format(facility)) + + self._result["commands"] = commands + if commands: + commit = not self._module.check_mode + diff = load_config(self._module, commands, commit=commit) + if diff: + self._result["diff"] = dict(prepared=diff) + self._result["changed"] = True + + def parse_facility(self, line): + match = re.search(r"logging facility (\S+)", line, re.M) + facility = None + if match: + facility = match.group(1) + + return facility + + def parse_size(self, line, dest): + size = None + + if dest == "buffered": + match = re.search(r"logging buffered (\S+)", line, re.M) + if match: + try: + int_size = int(match.group(1)) + except ValueError: + int_size = None + + if int_size is not None: + if isinstance(int_size, int): + size = str(match.group(1)) + return size + + def parse_hostnameprefix(self, line): + prefix = None + match = re.search(r"logging hostnameprefix (\S+)", line, re.M) + if match: + prefix = match.group(1) + return prefix + + def parse_name(self, line, dest): + name = None + if dest == "file": + match = re.search(r"logging file (\S+)", line, re.M) + if match: + name = match.group(1) + elif dest == "host": + match = re.search(r"logging (\S+)", line, re.M) + if match: + name = match.group(1) + + return name + + def parse_level(self, line, dest): + level_group = ( + "emergencies", + "alerts", + "critical", + "errors", + "warning", + "notifications", + "informational", + "debugging", + ) + + level = None + match = re.search(r"logging {0} (\S+)".format(dest), line, re.M) + if match: + if match.group(1) in level_group: + level = match.group(1) + + return level + + def parse_dest(self, line, group): + dest_group = ("console", "monitor", "buffered", "file") + dest = None + if group in dest_group: + dest = group + elif "vrf" in line: + dest = "host" + + return dest + + def parse_vrf(self, line, dest): + vrf = None + if dest == "host": + match = re.search(r"logging (\S+) vrf (\S+)", line, re.M) + if match: + vrf = match.group(2) + return vrf + + def map_config_to_obj(self): + data = get_config(self._module, config_filter="logging") + lines = data.split("\n") + + for line in lines: + match = re.search(r"logging (\S+)", line, re.M) + if match: + dest = self.parse_dest(line, match.group(1)) + name = self.parse_name(line, dest) + if dest == "host" and name is not None: + self._host_list.add(name) + if dest == "file" and name is not None: + self._file_list.add(name) + + self._have.append( + { + "dest": dest, + "name": name, + "size": self.parse_size(line, dest), + "facility": self.parse_facility(line), + "level": self.parse_level(line, dest), + "vrf": self.parse_vrf(line, dest), + "hostnameprefix": self.parse_hostnameprefix(line), + } + ) + + def run(self): + self.map_params_to_obj() + self.map_config_to_obj() + self.map_obj_to_commands() + + return self._result + + +class NCConfiguration(ConfigBase): + def __init__(self, module): + super(NCConfiguration, self).__init__(module) + self._flag = "NC" + self._log_file_meta = collections.OrderedDict() + self._log_host_meta = collections.OrderedDict() + self._log_console_meta = collections.OrderedDict() + self._log_monitor_meta = collections.OrderedDict() + self._log_buffered_size_meta = collections.OrderedDict() + self._log_buffered_level_meta = collections.OrderedDict() + self._log_facility_meta = collections.OrderedDict() + self._log_prefix_meta = collections.OrderedDict() + + def map_obj_to_xml_rpc(self): + self._log_file_meta.update( + [ + ( + "files", + { + "xpath": "syslog/files", + "tag": True, + "operation": "edit", + }, + ), + ( + "file", + { + "xpath": "syslog/files/file", + "tag": True, + "operation": "edit", + "attrib": "operation", + }, + ), + ( + "a:name", + { + "xpath": "syslog/files/file/file-name", + "operation": "edit", + }, + ), + ( + "file-attrib", + { + "xpath": "syslog/files/file/file-log-attributes", + "tag": True, + "operation": "edit", + }, + ), + ( + "a:size", + { + "xpath": "syslog/files/file/file-log-attributes/max-file-size", + "operation": "edit", + }, + ), + ( + "a:level", + { + "xpath": "syslog/files/file/file-log-attributes/severity", + "operation": "edit", + }, + ), + ] + ) + self._log_host_meta.update( + [ + ( + "host-server", + { + "xpath": "syslog/host-server", + "tag": True, + "operation": "edit", + }, + ), + ( + "vrfs", + { + "xpath": "syslog/host-server/vrfs", + "tag": True, + "operation": "edit", + }, + ), + ( + "vrf", + { + "xpath": "syslog/host-server/vrfs/vrf", + "tag": True, + "operation": "edit", + }, + ), + ( + "a:vrf", + { + "xpath": "syslog/host-server/vrfs/vrf/vrf-name", + "operation": "edit", + }, + ), + ( + "ipv4s", + { + "xpath": "syslog/host-server/vrfs/vrf/ipv4s", + "tag": True, + "operation": "edit", + }, + ), + ( + "ipv4", + { + "xpath": "syslog/host-server/vrfs/vrf/ipv4s/ipv4", + "tag": True, + "operation": "edit", + "attrib": "operation", + }, + ), + ( + "a:name", + { + "xpath": "syslog/host-server/vrfs/vrf/ipv4s/ipv4/address", + "operation": "edit", + }, + ), + ( + "ipv4-sev", + { + "xpath": "syslog/host-server/vrfs/vrf/ipv4s/ipv4/ipv4-severity-port", + "tag": True, + "operation": "edit", + }, + ), + ( + "a:level", + { + "xpath": "syslog/host-server/vrfs/vrf/ipv4s/ipv4/ipv4-severity-port/severity", + "operation": "edit", + }, + ), + ] + ) + self._log_console_meta.update( + [ + ( + "a:enable-console", + { + "xpath": "syslog/enable-console-logging", + "operation": "edit", + "attrib": "operation", + }, + ), + ( + "console", + { + "xpath": "syslog/console-logging", + "tag": True, + "operation": "edit", + "attrib": "operation", + }, + ), + ( + "a:console-level", + { + "xpath": "syslog/console-logging/logging-level", + "operation": "edit", + }, + ), + ] + ) + self._log_monitor_meta.update( + [ + ( + "monitor", + { + "xpath": "syslog/monitor-logging", + "tag": True, + "operation": "edit", + "attrib": "operation", + }, + ), + ( + "a:monitor-level", + { + "xpath": "syslog/monitor-logging/logging-level", + "operation": "edit", + }, + ), + ] + ) + self._log_buffered_size_meta.update( + [ + ( + "buffered", + { + "xpath": "syslog/buffered-logging", + "tag": True, + "operation": "edit", + "attrib": "operation", + }, + ), + ( + "a:size", + { + "xpath": "syslog/buffered-logging/buffer-size", + "operation": "edit", + }, + ), + ] + ) + self._log_buffered_level_meta.update( + [ + ( + "buffered", + { + "xpath": "syslog/buffered-logging", + "tag": True, + "operation": "edit", + "attrib": "operation", + }, + ), + ( + "a:level", + { + "xpath": "syslog/buffered-logging/logging-level", + "operation": "edit", + }, + ), + ] + ) + self._log_facility_meta.update( + [ + ( + "facility", + { + "xpath": "syslog/logging-facilities", + "tag": True, + "operation": "edit", + "attrib": "operation", + }, + ), + ( + "a:facility", + { + "xpath": "syslog/logging-facilities/facility-level", + "operation": "edit", + }, + ), + ] + ) + self._log_prefix_meta.update( + [ + ( + "a:hostnameprefix", + { + "xpath": "syslog/host-name-prefix", + "operation": "edit", + "attrib": "operation", + }, + ) + ] + ) + + state = self._module.params["state"] + + _get_filter = build_xml("syslog", opcode="filter") + running = get_config( + self._module, source="running", config_filter=_get_filter + ) + + file_ele = etree_findall(running, "file") + file_list = list() + if len(file_ele): + for file in file_ele: + file_name = etree_find(file, "file-name") + file_list.append( + file_name.text if file_name is not None else None + ) + vrf_ele = etree_findall(running, "vrf") + host_list = list() + for vrf in vrf_ele: + host_ele = etree_findall(vrf, "ipv4") + for host in host_ele: + host_name = etree_find(host, "address") + host_list.append( + host_name.text if host_name is not None else None + ) + + console_ele = etree_find(running, "console-logging") + console_level = ( + etree_find(console_ele, "logging-level") + if console_ele is not None + else None + ) + have_console = ( + console_level.text if console_level is not None else None + ) + + monitor_ele = etree_find(running, "monitor-logging") + monitor_level = ( + etree_find(monitor_ele, "logging-level") + if monitor_ele is not None + else None + ) + have_monitor = ( + monitor_level.text if monitor_level is not None else None + ) + + buffered_ele = etree_find(running, "buffered-logging") + buffered_size = ( + etree_find(buffered_ele, "buffer-size") + if buffered_ele is not None + else None + ) + have_buffered = ( + buffered_size.text if buffered_size is not None else None + ) + + facility_ele = etree_find(running, "logging-facilities") + facility_level = ( + etree_find(facility_ele, "facility-level") + if facility_ele is not None + else None + ) + have_facility = ( + facility_level.text if facility_level is not None else None + ) + + prefix_ele = etree_find(running, "host-name-prefix") + have_prefix = prefix_ele.text if prefix_ele is not None else None + + file_params = list() + host_params = list() + console_params = dict() + monitor_params = dict() + buffered_params = dict() + facility_params = dict() + prefix_params = dict() + + opcode = None + if state == "absent": + opcode = "delete" + for item in self._want: + if item["dest"] == "file" and item["name"] in file_list: + item["level"] = severity_level[item["level"]] + file_params.append(item) + elif item["dest"] == "host" and item["name"] in host_list: + item["level"] = severity_level[item["level"]] + host_params.append(item) + elif item["dest"] == "console" and have_console: + console_params.update({"console-level": item["level"]}) + elif item["dest"] == "monitor" and have_monitor: + monitor_params.update({"monitor-level": item["level"]}) + elif item["dest"] == "buffered" and have_buffered: + buffered_params["size"] = ( + str(item["size"]) if item["size"] else None + ) + buffered_params["level"] = ( + item["level"] if item["level"] else None + ) + elif ( + item["dest"] is None + and item["hostnameprefix"] is None + and item["facility"] is not None + and have_facility + ): + facility_params.update({"facility": item["facility"]}) + elif ( + item["dest"] is None + and item["hostnameprefix"] is not None + and have_prefix + ): + prefix_params.update( + {"hostnameprefix": item["hostnameprefix"]} + ) + elif state == "present": + opcode = "merge" + for item in self._want: + if item["dest"] == "file": + item["level"] = severity_level[item["level"]] + file_params.append(item) + elif item["dest"] == "host": + item["level"] = severity_level[item["level"]] + host_params.append(item) + elif item["dest"] == "console": + console_params.update({"console-level": item["level"]}) + elif item["dest"] == "monitor": + monitor_params.update({"monitor-level": item["level"]}) + elif item["dest"] == "buffered": + buffered_params["size"] = ( + str(item["size"]) if item["size"] else None + ) + buffered_params["level"] = ( + item["level"] if item["level"] else None + ) + elif ( + item["dest"] is None + and item["hostnameprefix"] is None + and item["facility"] is not None + ): + facility_params.update({"facility": item["facility"]}) + elif ( + item["dest"] is None and item["hostnameprefix"] is not None + ): + prefix_params.update( + {"hostnameprefix": item["hostnameprefix"]} + ) + + self._result["xml"] = [] + _edit_filter_list = list() + if opcode: + if len(file_params): + _edit_filter_list.append( + build_xml( + "syslog", + xmap=self._log_file_meta, + params=file_params, + opcode=opcode, + ) + ) + if len(host_params): + _edit_filter_list.append( + build_xml( + "syslog", + xmap=self._log_host_meta, + params=host_params, + opcode=opcode, + ) + ) + if len(console_params): + _edit_filter_list.append( + build_xml( + "syslog", + xmap=self._log_console_meta, + params=console_params, + opcode=opcode, + ) + ) + if len(monitor_params): + _edit_filter_list.append( + build_xml( + "syslog", + xmap=self._log_monitor_meta, + params=monitor_params, + opcode=opcode, + ) + ) + if len(buffered_params): + _edit_filter_list.append( + build_xml( + "syslog", + xmap=self._log_buffered_size_meta, + params=buffered_params, + opcode=opcode, + ) + ) + _edit_filter_list.append( + build_xml( + "syslog", + xmap=self._log_buffered_level_meta, + params=buffered_params, + opcode=opcode, + ) + ) + if len(facility_params): + _edit_filter_list.append( + build_xml( + "syslog", + xmap=self._log_facility_meta, + params=facility_params, + opcode=opcode, + ) + ) + if len(prefix_params): + _edit_filter_list.append( + build_xml( + "syslog", + xmap=self._log_prefix_meta, + params=prefix_params, + opcode=opcode, + ) + ) + + diff = None + if len(_edit_filter_list): + commit = not self._module.check_mode + diff = load_config( + self._module, + _edit_filter_list, + commit=commit, + running=running, + nc_get_filter=_get_filter, + ) + + if diff: + if self._module._diff: + self._result["diff"] = dict(prepared=diff) + + self._result["xml"] = _edit_filter_list + self._result["changed"] = True + + def run(self): + self.map_params_to_obj() + self.map_obj_to_xml_rpc() + + return self._result + + +def main(): + """ main entry point for module execution + """ + element_spec = dict( + dest=dict( + type="str", + choices=["host", "console", "monitor", "buffered", "file"], + ), + name=dict(type="str"), + size=dict(type="int"), + vrf=dict(type="str", default="default"), + facility=dict(type="str", default="local7"), + hostnameprefix=dict(type="str"), + level=dict( + type="str", + default="debugging", + aliases=["severity"], + choices=[ + "emergencies", + "alerts", + "critical", + "errors", + "warning", + "notifications", + "informational", + "debugging", + ], + ), + state=dict(default="present", choices=["present", "absent"]), + ) + + aggregate_spec = deepcopy(element_spec) + + # remove default in aggregate spec, to handle common arguments + remove_default_spec(aggregate_spec) + + mutually_exclusive = [("dest", "facility", "hostnameprefix")] + + required_if = [ + ("dest", "host", ["name"]), + ("dest", "file", ["name"]), + ("dest", "buffered", ["size"]), + ("dest", "console", ["level"]), + ("dest", "monitor", ["level"]), + ] + + argument_spec = dict( + aggregate=dict( + type="list", + elements="dict", + options=aggregate_spec, + mutually_exclusive=mutually_exclusive, + required_if=required_if, + ) + ) + + argument_spec.update(element_spec) + argument_spec.update(iosxr_argument_spec) + + module = AnsibleModule( + argument_spec=argument_spec, + mutually_exclusive=mutually_exclusive, + required_if=required_if, + supports_check_mode=True, + ) + + config_object = None + if is_cliconf(module): + # Commenting the below cliconf deprecation support call for Ansible 2.9 as it'll be continued to be supported + # module.deprecate("cli support for 'iosxr_interface' is deprecated. Use transport netconf instead", + # version='2.9') + config_object = CliConfiguration(module) + elif is_netconf(module): + config_object = NCConfiguration(module) + + if config_object: + result = config_object.run() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_netconf.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_netconf.py new file mode 100644 index 00000000..a075958f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_netconf.py @@ -0,0 +1,221 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2017, Ansible by Red Hat, Inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_netconf +author: Kedar Kekan (@kedarX) +short_description: Configures NetConf sub-system service on Cisco IOS-XR devices +description: +- This module provides an abstraction that enables and configures the netconf system + service running on Cisco IOS-XR Software. This module can be used to easily enable + the Netconf API. Netconf provides a programmatic interface for working with configuration + and state resources as defined in RFC 6242. +version_added: 1.0.0 +extends_documentation_fragment: +- cisco.iosxr.iosxr +options: + netconf_port: + description: + - This argument specifies the port the netconf service should listen on for SSH + connections. The default port as defined in RFC 6242 is 830. + required: false + type: int + default: 830 + aliases: + - listens_on + netconf_vrf: + description: + - netconf vrf name + required: false + type: str + default: default + aliases: + - vrf + state: + description: + - Specifies the state of the C(iosxr_netconf) resource on the remote device. If + the I(state) argument is set to I(present) the netconf service will be configured. If + the I(state) argument is set to I(absent) the netconf service will be removed + from the configuration. + type: str + required: false + default: present + choices: + - present + - absent +notes: +- This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html). +- Tested against Cisco IOS XR Software, Version 6.1.3 +""" + +EXAMPLES = """ +- name: enable netconf service on port 830 + cisco.iosxr.iosxr_netconf: + listens_on: 830 + state: present + +- name: disable netconf service + cisco.iosxr.iosxr_netconf: + state: absent +""" + +RETURN = """ +commands: + description: Returns the command sent to the remote device + returned: when changed is True + type: str + sample: 'ssh server netconf port 830' +""" +import re + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + iosxr_argument_spec, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + get_config, + load_config, +) +from ansible.module_utils.six import iteritems + +USE_PERSISTENT_CONNECTION = True + + +def map_obj_to_commands(updates): + want, have = updates + commands = list() + + if want["state"] == "absent": + if have["state"] == "present": + commands.append("no netconf-yang agent ssh") + + if "netconf_port" in have: + commands.append( + "no ssh server netconf port %s" % have["netconf_port"] + ) + + if have["netconf_vrf"]: + for vrf in have["netconf_vrf"]: + commands.append("no ssh server netconf vrf %s" % vrf) + else: + if have["state"] == "absent": + commands.append("netconf-yang agent ssh") + + if want["netconf_port"] is not None and ( + want["netconf_port"] != have.get("netconf_port") + ): + commands.append( + "ssh server netconf port %s" % want["netconf_port"] + ) + if want["netconf_vrf"] is not None and ( + want["netconf_vrf"] not in have["netconf_vrf"] + ): + commands.append("ssh server netconf vrf %s" % want["netconf_vrf"]) + + return commands + + +def parse_vrf(config): + match = re.search(r"vrf (\w+)", config) + if match: + return match.group(1) + + +def parse_port(config): + match = re.search(r"port (\d+)", config) + if match: + return int(match.group(1)) + + +def map_config_to_obj(module): + obj = {"state": "absent"} + + netconf_config = get_config(module, config_filter="netconf-yang agent") + + ssh_config = get_config(module, config_filter="ssh server") + ssh_config = [ + config_line + for config_line in (line.strip() for line in ssh_config.splitlines()) + if config_line + ] + obj["netconf_vrf"] = [] + for config in ssh_config: + if "netconf port" in config: + obj.update({"netconf_port": parse_port(config)}) + if "netconf vrf" in config: + obj["netconf_vrf"].append(parse_vrf(config)) + if "ssh" in netconf_config and ( + "netconf_port" in obj or obj["netconf_vrf"] + ): + obj.update({"state": "present"}) + + if "ssh" in netconf_config and "netconf_port" not in obj: + obj.update({"netconf_port": 830}) + + return obj + + +def validate_netconf_port(value, module): + if not 1 <= value <= 65535: + module.fail_json(msg="netconf_port must be between 1 and 65535") + + +def map_params_to_obj(module): + obj = { + "netconf_port": module.params["netconf_port"], + "netconf_vrf": module.params["netconf_vrf"], + "state": module.params["state"], + } + + for key, value in iteritems(obj): + # validate the param value (if validator func exists) + validator = globals().get("validate_%s" % key) + if callable(validator): + validator(value, module) + + return obj + + +def main(): + """main entry point for module execution + """ + argument_spec = dict( + netconf_port=dict(type="int", default=830, aliases=["listens_on"]), + netconf_vrf=dict(aliases=["vrf"], default="default"), + state=dict(default="present", choices=["present", "absent"]), + ) + argument_spec.update(iosxr_argument_spec) + + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + warnings = list() + + result = {"changed": False, "warnings": warnings} + + want = map_params_to_obj(module) + have = map_config_to_obj(module) + commands = map_obj_to_commands((want, have)) + result["commands"] = commands + + if commands: + commit = not module.check_mode + diff = load_config(module, commands, commit=commit) + if diff: + result["diff"] = dict(prepared=diff) + result["changed"] = True + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_ospf_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_ospf_interfaces.py new file mode 100644 index 00000000..0626461c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_ospf_interfaces.py @@ -0,0 +1,1210 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 2020 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +""" +The module file for iosxr_ospf_interfaces +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +module: iosxr_ospf_interfaces +version_added: 1.2.0 +short_description: OSPF Interfaces Resource Module. +description: + - This module manages OSPF(v2/v3) configuration of interfaces on devices running Cisco IOS-XR. +author: Rohit Thakur (@rohitthakur2590) +notes: + - Tested against IOS-XR 6.1.3 + - This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html) +options: + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the IOS-XR device + by executing the command B(show running-config router ospf'). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. + type: str + config: + description: A list of OSPF configuration for interfaces. + type: list + elements: dict + suboptions: + name: + description: + - Name/Identifier of the interface. + type: str + required: True + type: + description: + - Type of the interface. + type: str + required: True + address_family: + description: + - OSPF settings on the interfaces in address-family context. + type: list + elements: dict + suboptions: + afi: + description: + - Address Family Identifier (AFI) for OSPF settings on the interfaces. + type: str + choices: ['ipv4', 'ipv6'] + required: True + processes: + description: + - Interfaces configuration for an OSPF process. + type: list + elements: dict + suboptions: + process_id: + description: + - OSPF process tag. + type: str + required: True + area: + description: Specify the area-id + type: dict + suboptions: + area_id: + description: + - OSPF interfaces area ID as a decimal value. Please + refer vendor documentation of Valid values. + - OSPF interfaces area ID in IP address format(e.g. + A.B.C.D) + type: str + apply_group_option: + description: Specify configuration from a group + type: dict + suboptions: + group_name: + description: Specify the name of the group + type: str + operation: + description: Specify the group config operation + type: str + choices: [add, remove, append] + authentication: + description: Enable authentication + type: dict + suboptions: + message_digest: + description: Use message-digest authentication + type: dict + suboptions: + keychain: + description: Specify keychain name + type: str + null_auth: + description: Use no authentication + type: bool + authentication_key: + description: Specify authentication password (key) + type: dict + suboptions: + password: + description: The OSPFv2 password (key) + type: str + clear: + description: Specifies an UNENCRYPTED password (key) will follow + type: str + encrypted: + description: Specifies an ENCRYPTED password (key) will follow + type: str + bfd: + description: Configure BFD parameters + type: dict + suboptions: + fast_detect: + description: Configure fast detection + type: dict + suboptions: + set: + description: Enable fast detection only + type: bool + strict_mode: + description: Hold down neighbor session until BFD session is up + type: bool + minimum_interval: + description: Hello interval in milli-seconds + type: int + multiplier: + description: Detect multiplier + type: int + cost: + description: Specify Interface cost + type: int + cost_fallback: + description: Specify Cost when cumulative bandwidth goes below the theshold + type: dict + suboptions: + cost: + description: Specify cost w.r.t cummulative bandwidth + type: int + threshold: + description: Specify threshold bandwidth when cost-fallback is applied + type: int + database_filter: + description: Filter OSPF LSAs during synchronization and flooding + type: dict + suboptions: + all_outgoing_lsa: + description: Filter all outgoing LSA + type: bool + dead_interval: + description: Specify interval after which a neighbor is declared dead + type: int + demand_circuit: + description: Enable/Disable demand circuits + type: bool + fast_reroute: + description: Specify IP Fast Reroute + type: dict + suboptions: + disabled: + description: Disable IP fast reroute + type: bool + per_link: + description: Specify per-prefix computation + type: dict + suboptions: + information_type: + description: Specify per-link LFA exclusion or FRR LFA candidate information + type: str + choices: ["exclude", "lfa_candidate"] + use_candidate_only: + description: Enable/Disable backup selection from candidate-list only + type: bool + interface: + description: Specify Per-link LFA exclusion information + type: dict + suboptions: + bvi: + description: Specify Bridge-Group Virtual Interface + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: int + bundle_ether: + description: Specify Aggregated Ethernet interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: int + pos_int: + description: Specify Aggregated pos interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: int + fast_ethernet: + description: Specify FastEthernet/IEEE 802.3 interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: str + fiftygige: + description: Specify FiftyGigE/IEEE 802.3 interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: str + fortygige: + description: Specify FortyGigE/IEEE 802.3 interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: str + fourhundredgige: + description: Specify FourHundredGigE/IEEE 802.3 interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: str + gigabitethernet: + description: Specify GigabitEthernet/IEEE 802.3 interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: str + hundredgige: + description: Specify HundredGigE/IEEE 802.3 interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: str + mgmteth: + description: Specify MgmtEth/IEEE 802.3 interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: str + multilink: + description: Specify Multilink network interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: str + pw_ether: + description: Specify PWHE Ethernet Interface + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: int + pw_iw: + description: Specify PWHE VC11 IP Interworking Interface + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: int + srp: + description: Specify SRP interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: str + serial: + description: Specify Serial network interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: str + tengige: + description: Specify TenGigabitEthernet/IEEE 802.3 interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: str + twentyfivegige: + description: Specify TwentyFiveGigabitEthernet/IEEE 802.3 interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: str + twohundredgige: + description: Specify TwoHundredGigE/IEEE 802.3 interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: str + nve: + description: Specify Network Virtualization Endpoint Interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: int + tunnel_ip: + description: Specify GRE/IPinIP Tunnel Interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: int + tunnel_ipsec: + description: Specify IPSec Tunnel interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: int + tunnel_mte: + description: Specify MPLS Traffic Engineering P2MP Tunnel interface(s) + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: int + tunnel_mpls: + description: MPLS Transport Protocol Tunnel interface + type: list + elements: dict + suboptions: + name: + description: Specify the interface id + type: str + flood_reduction: + description: Enable/Disable flood reduction + type: bool + hello_interval: + description: Specify Time between HELLO packets + type: int + link_down_fast_detect: + description: Configure interface down parameters + type: bool + message_digest_key: + description: Message digest authentication password (key) + type: dict + suboptions: + id: + description: Key ID + type: int + required: true + md5: + description: Use MD5 Algorithm + type: dict + required: true + suboptions: + password: + description: The OSPFv2 password (key) + type: str + clear: + description: Specifies an UNENCRYPTED password (key) will follow + type: bool + encrypted: + description: Specifies an ENCRYPTED password (key) will follow + type: bool + mpls_ldp_sync: + description: Enable/Disable MPLS LDP Sync + type: bool + mtu_ignore: + description: Enable/Disable ignoring of MTU in DBD packets + type: bool + network: + description: Specify Network type + type: str + choices: ["broadcast", "non-broadcast", "point-to-multipoint", "point-to-point"] + neighbors: + description: Specify a neighbor routers + type: list + elements: dict + suboptions: + neighbor_id: + description: Specify Neighbor address (name) + type: str + cost: + description: Specify OSPF cost for point-to-multipoint neighbor + type: int + db_filter_all_out: + description: Specify Filter OSPF LSA during synchronization and flooding for point-to-multipoint neighbor + type: bool + poll_interval: + description: Specify OSPF dead-router polling interval + type: int + priority: + description: Specify OSPF priority of non-broadcast neighbor + type: int + packet_size: + description: Customize size of OSPF packets upto MTU + type: int + passive: + description: Enable/Disable passive + type: bool + prefix_suppression: + description: Suppress advertisement of the prefixes + type: bool + priority: + description: Specify Router priority + type: int + retransmit_interval: + description: Specify time between retransmitting lost link state advertisements + type: int + security_ttl: + description: Enable security + type: dict + suboptions: + set: + description: Enable ttl security + type: bool + hops: + description: Maximum number of IP hops allowed <1-254> + type: int + transmit_delay: + description: Specify estimated time needed to send link-state update packet + type: int + state: + description: + - The state the configuration should be left in. + type: str + choices: + - merged + - replaced + - overridden + - deleted + - gathered + - parsed + - rendered + default: merged +""" +EXAMPLES = """ +# Using merged + +# Before state: +# ------------- +# +# RP/0/RP0/CPU0:anton#show running-config router ospf +# % No such configuration item(s) +# + +- name: Merge provided OSPF interfaces configuration with the existing configuration + cisco.iosxr.iosxr_ospf_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.3 + cost: 20 + authentication: + message_digest: + keychain: cisco + - afi: ipv6 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.2 + cost: 30 + state: merged + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "before": [] +# +# "commands": [ +# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 cost 20", +# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest", +# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest keychain cisco", +# "router ospfv3 LAB3 area 0.0.0.2 interface GigabitEthernet 0/0/0/0 cost 30" +# ] +# +# "after": [ +# { +# "address_family": [ +# { +# "afi": "ipv4", +# "authentication": { +# "message_digest": { +# "keychain": "cisco" +# } +# }, +# "cost": 20, +# "processes": [ +# { +# "area": { +# "area_id": "0.0.0.3" +# }, +# "process_id": "LAB3" +# } +# ] +# }, +# { +# "afi": "ipv6", +# "cost": 30, +# "processes": [ +# { +# "area": { +# "area_id": "0.0.0.2" +# }, +# "process_id": "LAB3" +# } +# ] +# } +# ], +# "name": "GigabitEthernet0/0/0/0", +# "type": "gigabitethernet" +# } +# ] +# +# +# ------------ +# After state +# ------------ +# +# RP/0/0/CPU0:an-iosxr-02#show running-config router ospf +# Thu Oct 23 06:00:57.217 UTC +# router ospf LAB +# area 0.0.0.0 +# ! +# area 0.0.0.9 +# ! +# ! +# router ospf LAB1 +# area 0.0.0.1 +# ! +# area 0.0.0.3 +# ! +# ! +# router ospf LAB3 +# area 0.0.0.3 +# interface GigabitEthernet0/0/0/0 +# cost 20 +# authentication message-digest keychain cisco +# ! +# ! +# ! +# router ospf ipv4 +# ! + +# Using replaced +# +# ------------ +# Before state +# ------------ +# +# +# RP/0/0/CPU0:an-iosxr-02#show running-config router ospf +# Thu Oct 23 06:00:57.217 UTC +# router ospf LAB +# area 0.0.0.0 +# ! +# area 0.0.0.9 +# ! +# ! +# router ospf LAB1 +# area 0.0.0.1 +# ! +# area 0.0.0.3 +# ! +# ! +# router ospf LAB3 +# area 0.0.0.3 +# interface GigabitEthernet0/0/0/0 +# cost 20 +# authentication message-digest keychain cisco +# ! +# ! +# ! +# router ospf ipv4 +# ! + +- name: Replace OSPF interfaces configuration + cisco.iosxr.iosxr_ospf_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.3 + cost: 30 + authentication: + message_digest: + keychain: ciscoiosxr + - afi: ipv6 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.2 + cost: 30 + state: replaced + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "before": [ +# { +# "address_family": [ +# { +# "afi": "ipv4", +# "authentication": { +# "message_digest": { +# "keychain": "cisco" +# } +# }, +# "cost": 20, +# "processes": [ +# { +# "area": { +# "area_id": "0.0.0.3" +# }, +# "process_id": "LAB3" +# } +# ] +# }, +# { +# "afi": "ipv6", +# "cost": 30, +# "processes": [ +# { +# "area": { +# "area_id": "0.0.0.2" +# }, +# "process_id": "LAB3" +# } +# ] +# } +# ], +# "name": "GigabitEthernet0/0/0/0", +# "type": "gigabitethernet" +# } +# ] +# +# "commands": [ +# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 cost 30", +# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest", +# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest keychain ciscoiosxr" +# ] +# +# "after": [ +# { +# "address_family": [ +# { +# "afi": "ipv4", +# "authentication": { +# "message_digest": { +# "keychain": "ciscoiosxr" +# } +# }, +# "cost": 30, +# "processes": [ +# { +# "area": { +# "area_id": "0.0.0.3" +# }, +# "process_id": "LAB3" +# } +# ] +# }, +# { +# "afi": "ipv6", +# "cost": 30, +# "processes": [ +# { +# "area": { +# "area_id": "0.0.0.2" +# }, +# "process_id": "LAB3" +# } +# ] +# } +# ], +# "name": "GigabitEthernet0/0/0/0", +# "type": "gigabitethernet" +# } +# ] +# +# +# ----------- +# After state +# ----------- +# +# RP/0/0/CPU0:an-iosxr-02#show running-config router ospf +# Thu Oct 23 06:10:39.827 UTC +# router ospf LAB +# area 0.0.0.0 +# ! +# area 0.0.0.9 +# ! +# ! +# router ospf LAB1 +# area 0.0.0.1 +# ! +# area 0.0.0.3 +# ! +# ! +# router ospf LAB3 +# area 0.0.0.3 +# interface GigabitEthernet0/0/0/0 +# cost 30 +# authentication message-digest keychain ciscoiosxr +# ! +# ! +# ! +# router ospf ipv4 +# ! + +- name: Override existing OSPF interfaces configuration + cisco.iosxr.iosxr_ospf_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB1" + area: + area_id: 0.0.0.3 + cost: 10 + authentication: + message_digest: + keychain: iosxr + state: overridden + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "before": [ +# { +# "address_family": [ +# { +# "afi": "ipv4", +# "authentication": { +# "message_digest": { +# "keychain": "ciscoiosxr" +# } +# }, +# "cost": 30, +# "processes": [ +# { +# "area": { +# "area_id": "0.0.0.3" +# }, +# "process_id": "LAB3" +# } +# ] +# }, +# { +# "afi": "ipv6", +# "cost": 30, +# "processes": [ +# { +# "area": { +# "area_id": "0.0.0.2" +# }, +# "process_id": "LAB3" +# } +# ] +# } +# ], +# "name": "GigabitEthernet0/0/0/0", +# "type": "gigabitethernet" +# } +# ] +# +# "commands": [ +# "no router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0", +# "no router ospfv3 LAB3 area 0.0.0.2 interface GigabitEthernet 0/0/0/0", +# "router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 cost 10", +# "router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 authentication message-digest", +# "router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 authentication message-digest keychain iosxr" +# ] +# +# "after": [ +# { +# "address_family": [ +# { +# "afi": "ipv4", +# "authentication": { +# "message_digest": { +# "keychain": "iosxr" +# } +# }, +# "cost": 10, +# "processes": [ +# { +# "area": { +# "area_id": "0.0.0.3" +# }, +# "process_id": "LAB1" +# } +# ] +# } +# ], +# "name": "GigabitEthernet0/0/0/1", +# "type": "gigabitethernet" +# } +# ] +# +# +# ----------- +# After state +# ----------- +# +# RP/0/0/CPU0:an-iosxr-02#show running-config router ospf +# Thu Oct 23 06:28:15.025 UTC +# router ospf LAB +# area 0.0.0.0 +# ! +# area 0.0.0.9 +# ! +# ! +# router ospf LAB1 +# area 0.0.0.1 +# ! +# area 0.0.0.3 +# interface GigabitEthernet0/0/0/1 +# cost 10 +# authentication message-digest keychain iosxr +# ! +# ! +# ! +# router ospf LAB3 +# area 0.0.0.3 +# ! +# ! +# router ospf ipv4 +# ! + +# Using deleted +# +# ------------ +# Before state +# ------------ +# +# +# RP/0/0/CPU0:an-iosxr-02#show running-config router ospf +# Thu Oct 23 06:28:15.025 UTC +# router ospf LAB +# area 0.0.0.0 +# ! +# area 0.0.0.9 +# ! +# ! +# router ospf LAB1 +# area 0.0.0.1 +# ! +# area 0.0.0.3 +# interface GigabitEthernet0/0/0/1 +# cost 10 +# authentication message-digest keychain iosxr +# ! +# ! +# ! +# router ospf LAB3 +# area 0.0.0.3 +# ! +# ! +# router ospf ipv4 +# ! + +- name: Deleted existing OSPF interfaces from the device + cisco.iosxr.iosxr_ospf_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + type: gigabitethernet + state: deleted + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "before": [ +# { +# "address_family": [ +# { +# "afi": "ipv4", +# "authentication": { +# "message_digest": { +# "keychain": "iosxr" +# } +# }, +# "cost": 10, +# "processes": [ +# { +# "area": { +# "area_id": "0.0.0.3" +# }, +# "process_id": "LAB1" +# } +# ] +# } +# ], +# "name": "GigabitEthernet0/0/0/1", +# "type": "gigabitethernet" +# } +# ], +# +# "commands": [ +# "no router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1" +# ] +# +# "after": [] +# +# +# ----------- +# After state +# ----------- +# +# RP/0/0/CPU0:an-iosxr-02#show running-config router ospf +# Thu Oct 23 06:34:38.319 UTC +# router ospf LAB +# area 0.0.0.0 +# ! +# area 0.0.0.9 +# ! +# ! +# router ospf LAB1 +# area 0.0.0.1 +# ! +# area 0.0.0.3 +# ! +# ! +# router ospf LAB3 +# area 0.0.0.3 +# ! +# ! +# router ospf ipv4 +# ! + +# Using parsed +# parsed.cfg +# ------------ +# router ospf LAB +# area 0.0.0.0 +# ! +# area 0.0.0.9 +# ! +# ! +# router ospf LAB1 +# area 0.0.0.1 +# ! +# area 0.0.0.3 +# ! +# ! +# router ospf LAB3 +# area 0.0.0.3 +# interface GigabitEthernet0/0/0/0 +# cost 20 +# authentication message-digest keychain cisco +# ! +# ! +# ! +# router ospf ipv4 +# ! +- name: Parsed the device configuration to get output commands + cisco.iosxr.iosxr_ospf_interfaces: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# +# "parsed": [ +# { +# "address_family": [ +# { +# "afi": "ipv4", +# "authentication": { +# "message_digest": { +# "keychain": "cisco" +# } +# }, +# "cost": 20, +# "processes": [ +# { +# "area": { +# "area_id": "0.0.0.3" +# }, +# "process_id": "LAB3" +# } +# ] +# } +# ], +# "name": "GigabitEthernet0/0/0/0", +# "type": "gigabitethernet" +# } +# ] +# +# Using rendered +# +# +- name: Render the commands for provided configuration + cisco.iosxr.iosxr_ospf_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.3 + cost: 20 + authentication: + message_digest: + keychain: cisco + - afi: ipv6 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.2 + cost: 30 + state: rendered + +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# +# "rendered": [ +# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 cost 20", +# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest", +# "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest keychain cisco", +# "router ospfv3 LAB3 area 0.0.0.2 interface GigabitEthernet 0/0/0/0 cost 30" +# ] + + +# Using gathered +# +# Before state: +# ------------- +# +# RP/0/0/CPU0:an-iosxr-02#show running-config router ospf +# Thu Oct 23 06:50:38.743 UTC +# router ospf LAB +# area 0.0.0.0 +# ! +# area 0.0.0.9 +# ! +# ! +# router ospf LAB1 +# area 0.0.0.1 +# ! +# area 0.0.0.3 +# ! +# ! +# router ospf LAB3 +# area 0.0.0.3 +# interface GigabitEthernet0/0/0/0 +# cost 20 +# authentication message-digest keychain cisco +# ! +# ! +# ! +# router ospf ipv4 +# ! + + +- name: Gather ospf_interfaces routes configuration + cisco.iosxr.iosxr_ospf_interfaces: + state: gathered +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# "gathered": [ +# { +# "address_family": [ +# { +# "afi": "ipv4", +# "authentication": { +# "message_digest": { +# "keychain": "cisco" +# } +# }, +# "cost": 20, +# "processes": [ +# { +# "area": { +# "area_id": "0.0.0.3" +# }, +# "process_id": "LAB3" +# } +# ] +# }, +# { +# "afi": "ipv6", +# "cost": 30, +# "processes": [ +# { +# "area": { +# "area_id": "0.0.0.2" +# }, +# "process_id": "LAB3" +# } +# ] +# } +# ], +# "name": "GigabitEthernet0/0/0/0", +# "type": "gigabitethernet" +# } +# ] +# +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.ospf_interfaces.ospf_interfaces import ( + Ospf_interfacesArgs, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.ospf_interfaces.ospf_interfaces import ( + Ospf_interfaces, +) + + +def main(): + """ + Main entry point for module execution + + :returns: the result form module invocation + """ + module = AnsibleModule( + argument_spec=Ospf_interfacesArgs.argument_spec, + mutually_exclusive=[["config", "running_config"]], + required_if=[ + ["state", "merged", ["config"]], + ["state", "replaced", ["config"]], + ["state", "overridden", ["config"]], + ["state", "rendered", ["config"]], + ["state", "parsed", ["running_config"]], + ], + supports_check_mode=True, + ) + + result = Ospf_interfaces(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_ospfv2.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_ospfv2.py new file mode 100644 index 00000000..660387bb --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_ospfv2.py @@ -0,0 +1,2544 @@ +#!/usr/bin/python +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . +# + +""" +The module file for iosxr_ospfv2 +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +module: iosxr_ospfv2 +short_description: OSPFv2 resource module +description: This module manages global OSPFv2 configuration on devices running Cisco + IOS-XR +version_added: 1.0.0 +author: +- Rohit Thakur (@rohitthakur2590) +notes: +- Tested against IOS-XR 6.1.3 +- This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html) +options: + config: + description: A list of OSPFv2 process configuration + type: dict + suboptions: + processes: + description: A list of OSPFv2 instances configuration + type: list + elements: dict + suboptions: + address_family_unicast: + description: Enable unicast topology for ipv4 address family + type: bool + adjacency_stagger: + description: Stagger OSPFv2 adjacency bring up + type: dict + suboptions: + min_adjacency: + description: Initial number of neighbors to bring up per area (default + 2) + type: int + max_adjacency: + description: Maximum simultaneous neighbors to bring up + type: int + disable: + description: Disable stagger OSPFv2 adjacency + type: bool + authentication: + description: Enable authentication + type: dict + suboptions: + keychain: + description: Specify keychain name + type: str + message_digest: + description: Use message-digest authentication + type: dict + suboptions: + set: + description: Specify message-digest selection + type: bool + keychain: + description: Specify keychain name + type: str + no_auth: + description: Use no authentication + type: bool + apply_weight: + description: Enable weights configured under interfaces for load sharing + type: dict + suboptions: + bandwidth: + description: Reference bandwidth to use for calculation (Mbits/sec) + type: int + default_weight: + description: Specify default weight value to use when it is not configured + under interface + type: int + areas: + description: Configure OSPFv2 areas' properties + type: list + elements: dict + suboptions: + area_id: + description: Area ID as IP address or integer + type: str + required: true + authentication: + description: Enable authentication + type: dict + suboptions: + keychain: + description: Specify keychain name + type: str + message_digest: + description: Use message-digest authentication + type: dict + suboptions: + keychain: + description: Specify keychain name + type: str + no_auth: + description: Use no authentication + type: bool + authentication_key: + description: Used to mention authentication password (key) + type: dict + suboptions: + password: + description: The OSPFv2 password (key) + type: str + clear: + description: Specifies an UNENCRYPTED password (key) will follow + type: str + encrypted: + description: Specifies an ENCRYPTED password (key) will follow + type: str + default_cost: + description: Set the summary default-cost of a NSSA/stub area. Stub's + advertised external route metric + type: int + cost: + description: Interface cost + type: int + dead_interval: + description: Interval after which a neighbor is declared dead + type: int + hello_interval: + description: Time between HELLO packets + type: int + transmit_delay: + description: Estimated time needed to send link-state update packet + type: int + mpls: + description: Configure MPLS routing protocol parameters + type: dict + suboptions: + traffic_eng: + description: Configure an ospf area to run MPLS Traffic Engineering + type: bool + ldp: + description: Configure LDP parameters + type: dict + suboptions: + auto_config: + description: Enable LDP IGP interface auto-configuration + type: bool + sync: + description: Enable LDP IGP synchronization + type: bool + sync_igp_shortcuts: + description: LDP sync for igp-shortcut tunnels + type: bool + mtu_ignore: + description: Enable/Disable ignoring of MTU in DBD packets + type: str + choices: + - enable + - disable + bfd: + description: Configure BFD parameters + type: dict + suboptions: + fast_detect: + description: Configure fast detection + type: dict + suboptions: + set: + description: Enable fast detection only + type: bool + strict_mode: + description: Hold down neighbor session until BFD session is up + type: bool + minimum_interval: + description: Hello interval in milli-seconds + type: int + multiplier: + description: Detect multiplier + type: int + nssa: + description: + - NSSA settings for the area + type: dict + suboptions: + set: + description: Configure area as NSSA + type: bool + default_information_originate: + description: Originate default Type 7 LSA + type: dict + suboptions: + metric: + description: OSPFv2 default metric + type: int + metric_type: + description: Metric type for default routes + type: int + no_redistribution: + description: Do not send redistributed LSAs into NSSA area + type: bool + no_summary: + description: Do not send summary LSAs into NSSA area + type: bool + translate: + description: Translate LSA + type: dict + suboptions: + type7: + description: + - Translate from Type 7 to Type 5 + type: dict + suboptions: + always: + description: + - Always translate LSAs + type: bool + ranges: + description: Summarize routes matching address/mask (border routers + only) + type: list + elements: dict + suboptions: + address: + description: IP in Prefix format (x.x.x.x/len) + type: str + required: true + advertise: + description: Advertise this range (default) + type: bool + not_advertise: + description: DoNotAdvertise this range + type: bool + route_policy: + description: Specify the route-policy to filter type 3 LSAs (list + can have one inbound and/or one outbound policy only) + type: list + elements: dict + suboptions: + parameters: + description: Specify parameter values for the policy + type: list + elements: str + direction: + description: Specify inbound or outbound + type: str + choices: + - in + - out + stub: + description: + - Settings for configuring the area as a stub + type: dict + suboptions: + set: + description: + - Configure the area as a stub + type: bool + no_summary: + description: + - Do not send summary LSA into stub area + type: bool + virtual_link: + description: Define a virtual link + type: list + elements: dict + suboptions: + id: + description: Router-ID of virtual link neighbor (A.B.C.D) + type: str + required: true + authentication: + description: Enable authentication + type: dict + suboptions: + keychain: + description: Specify keychain name + type: str + message_digest: + description: Use message-digest authentication + type: dict + suboptions: + keychain: + description: Specify keychain name + type: str + no_auth: + description: Use no authentication + type: bool + authentication_key: + description: Used to mention authentication password (key) + type: dict + suboptions: + password: + description: The OSPFv2 password (key) + type: str + clear: + description: Specifies an UNENCRYPTED password (key) will + follow + type: str + encrypted: + description: Specifies an ENCRYPTED password (key) will follow + type: str + dead_interval: + description: Interval after which a neighbor is declared dead + type: int + hello_interval: + description: Time between HELLO packets + type: int + retransmit_interval: + description: Delay between LSA retransmissions + type: int + transmit_delay: + description: Link state transmit delay + type: int + message_digest_key: + description: Message digest authentication password (key) + type: dict + suboptions: + id: + description: Key ID (1-255) + type: int + required: true + md5: + description: Use MD5 Algorithm + type: dict + suboptions: + password: + description: The OSPFv2 password (key) + type: str + clear: + description: Specifies an UNENCRYPTED password (key) will + follow + type: bool + encrypted: + description: Specifies an ENCRYPTED password (key) will + follow + type: bool + + authentication_key: + description: Used to mention authentication password (key) + type: dict + suboptions: + password: + description: The OSPFv2 password (key) + type: str + clear: + description: Specifies an UNENCRYPTED password (key) will follow + type: bool + encrypted: + description: Specifies an ENCRYPTED password (key) will follow + type: bool + auto_cost: + description: Calculate OSPFv2 interface cost according to bandwidth + type: dict + suboptions: + reference_bandwidth: + description: Specify reference bandwidth in megabits per sec + type: int + disable: + description: Assign OSPFv2 cost based on interface type + type: bool + bfd: + description: Configure BFD parameters + type: dict + suboptions: + fast_detect: + description: Configure fast detection + type: dict + suboptions: + set: + description: Enable fast detection only + type: bool + strict_mode: + description: Hold down neighbor session until BFD session is up + type: bool + minimum_interval: + description: Hello interval in milli-seconds + type: int + multiplier: + description: Detect multiplier + type: int + capability: + description: Enable specific OSPFv2 feature + type: dict + suboptions: + type7: + description: NSSA capability + type: str + opaque: + description: Configure opaque LSA + type: dict + suboptions: + disable: + description: Disable Opaque LSA capability + type: bool + set: + description: Enable opaque LSA + type: bool + cost: + description: Interface cost (1-65535) + type: int + database_filter: + description: Filter OSPFv2 LSA during synchronization and flooding (all + outgoing LSA). Enable/Disable filtering + type: str + choices: [enable, disable] + dead_interval: + description: Interval after which a neighbor is declared dead + type: int + default_information_originate: + description: Distribute default route + type: dict + suboptions: + always: + description: Always advertise default route + type: bool + metric: + description: OSPFv2 default metric + type: int + metric_type: + description: OSPFv2 metric type for default routes + type: int + route_policy: + description: Apply route-policy to default-information origination + type: str + set: + description: Enable distribution of default route + type: bool + default_metric: + description: Set metric of redistributed routes + type: int + demand_circuit: + description: Enable/Disable OSPFv2 demand circuit + type: str + choices: [enable, disable] + distance: + description: Define an administrative distance + type: dict + suboptions: + admin_distance: + description: Administrative distance + type: list + elements: dict + suboptions: + value: + description: Distance value + type: int + source: + description: Source IP address + type: str + wildcard: + description: IP wild card bits (A.B.C.D) + type: str + access_list: + description: Access list name + type: str + ospf_distance: + description: OSPFv2 administrative distance + type: dict + suboptions: + external: + description: Distance for external routes + type: int + inter_area: + description: Distance for inter-area routes + type: int + intra_area: + description: Distance for intra-area routes + type: int + distribute_link_state: + description: Enable Distribution of LSAs to external services + type: dict + suboptions: + instance_id: + description: Set distribution process instance identifier + type: int + throttle: + description: Throttle time between successive LSA updates + type: int + distribute_bgp_ls: + description: Enable Distribution of LSAs to external services + type: dict + suboptions: + instance_id: + description: Set distribution process instance identifier + type: int + throttle: + description: Throttle time between successive LSA updates + type: int + distribute_list: + description: Filter networks in routing updates (list can have one inbound + and/or one outbound policy only) + type: list + elements: dict + suboptions: + access_list: + description: Inbound/outbound access-list + type: str + direction: + description: Filter incoming/outgoing routing updates + type: str + choices: + - in + - out + outgoing_params: + description: Specify additional parameters for outgoing updates only + type: dict + suboptions: + route_type: + description: Type of routes + type: str + choices: + - bgp + - connected + - dagr + - ospf + - static + id: + description: + - For BGP, specify AS number. 2-byte AS number (or) 4-byte AS + number in asdot (X.Y) format (or) 4-byte AS number in asplain + format + - For OSPF, specify OSPFv2 instance name + type: str + route_policy: + description: Route Policy to filter OSPFv2 prefixes (for incoming + updates only) + type: str + external_out: + description: Enable/Disable advertisement of intra-area prefixes as external + type: str + choices: + - enable + - disable + flood_reduction: + description: Enable/Disable OSPFv2 Flood Reduction + type: str + choices: + - enable + - disable + hello_interval: + description: Time between HELLO packets (<1-65535> seconds) + type: int + ignore_lsa_mospf: + description: Do not complain upon receiving MOSPFv2 Type 6 LSA + type: bool + link_down_fast_detect: + description: Enable fast or early detection of link-down events + type: bool + log_adjacency_changes: + description: Log adjacency state changes + type: dict + suboptions: + set: + description: Set log adjacency + type: bool + disable: + description: Disable log adjacency changes + type: bool + detail: + description: Log all state changes + type: bool + loopback_stub_network: + description: Advertise loopback as a stub network + type: str + choices: + - enable + - disable + max_lsa: + description: + - Feature to limit the number of non-self-originated LSAs + type: dict + suboptions: + threshold: + description: + - Threshold value (%) at which to generate a warning message + type: int + ignore_count: + description: + - Set count on how many times adjacencies can be suppressed + type: int + ignore_time: + description: + - Set number of minutes during which all adjacencies are suppressed + type: int + reset_time: + description: + - Set number of minutes after which ignore-count is reset to zero + type: int + warning_only: + description: + - Log a warning message when limit is exceeded + type: bool + max_metric: + description: Set maximum metric + type: dict + suboptions: + router_lsa: + description: Maximum metric in self-originated router-LSAs + type: dict + suboptions: + set: + description: Set router-lsa attribute + type: bool + external_lsa: + description: External LSA configuration + type: dict + suboptions: + set: + description: Set external-lsa attribute + type: bool + max_metric_value: + description: Set max metric value for external LSAs + type: int + include_stub: + description: + - Advertise Max metric for Stub links as well + type: bool + on_startup: + description: + - Effective only at startup + type: dict + suboptions: + set: + description: + - Set on-startup attribute + type: bool + wait_period: + description: + - Wait period in seconds after startup + type: int + wait_for_bgp_asn: + description: + - ASN of BGP to wait for + type: int + summary_lsa: + description: + - Summary LSAs configuration + type: dict + suboptions: + set: + description: + - Set summary-lsa attribute + type: bool + max_metric_value: + description: + - Max metric value for summary LSAs + type: int + message_digest_key: + description: Message digest authentication password (key) + type: dict + suboptions: + id: + description: Key ID + type: int + required: true + md5: + description: Use MD5 Algorithm + type: dict + required: true + suboptions: + password: + description: The OSPFv2 password (key) + type: str + clear: + description: Specifies an UNENCRYPTED password (key) will follow + type: bool + encrypted: + description: Specifies an ENCRYPTED password (key) will follow + type: bool + microloop_avoidance: + description: Avoid microloops + type: dict + suboptions: + protected: + description: Avoid microloops for protected prefixes only) + type: bool + rib_update_delay: + description: Delay to introduce between SPF and RIB updates + type: int + segment_routing: + description: Enable segment routing microloop avoidance + type: bool + monitor_convergence: + description: Enables OSPFv2 route convergence monitoring + type: dict + suboptions: + prefix_list: + description: Enables Individual Prefix Monitoring + type: str + track_external_routes: + description: Enables Tracking External(Type-5/7) Prefix monitoring + type: bool + track_ip_frr: + description: Enables Tracking IP-Frr Convergence + type: bool + track_summary_routes: + description: Enables Tracking Summary(Inter-Area) Prefix monitoring + type: bool + mpls: + description: Configure MPLS routing protocol parameters + type: dict + suboptions: + traffic_eng: + description: Routing protocol commands for MPLS Traffic Engineering + type: dict + suboptions: + autoroute_exclude: + description: Exclude IP address destinations from using TE tunnels + type: dict + suboptions: + route_policy: + description: Policy name + type: str + parameters: + description: Specify parameter values for the policy + type: list + elements: str + igp_intact: + description: Retain one or more IPv4 nexthops with tunnel nexthops + type: bool + ldp_sync_update: + description: Enable LDP sync induced metric propagation + type: bool + multicast_intact: + description: Publish multicast-intact paths to RIB + type: bool + router_id: + description: Traffic Engineering stable IP address for system + type: str + ldp: + description: Configure LDP parameters + type: dict + suboptions: + auto_config: + description: Enable LDP IGP interface auto-configuration + type: bool + sync: + description: Enable LDP IGP synchronization + type: bool + sync_igp_shortcuts: + description: LDP sync for igp-shortcut tunnels + type: bool + mtu_ignore: + description: Enable/Disable ignoring of MTU in DBD packets + type: str + choices: + - enable + - disable + network: + description: Network type + type: dict + suboptions: + broadcast: + description: Specify OSPFv2 broadcast multi-access network + type: bool + non_broadcast: + description: Specify OSPFv2 NBMA network + type: bool + point_to_multipoint: + description: Specify OSPFv2 point-to-multipoint network + type: bool + point_to_point: + description: Specify OSPFv2 point-to-point network + type: bool + nsf: + description: Non-stop forwarding + type: dict + suboptions: + cisco: + description: Cisco Non-stop forwarding + type: dict + suboptions: + enforce_global: + description: Cancel NSF restart when non-NSF-aware neighbors detected + for the whole OSPFv2 process + type: bool + set: + description: Enable Cisco NSF + type: bool + flush_delay_time: + description: Maximum time allowed for external route learning + type: int + ietf: + description: IETF graceful restart + type: dict + suboptions: + helper_disable: + description: Disable router's helper support level + type: bool + set: + description: Only enable ietf option + type: bool + interval: + description: Minimum interval between NSF restarts (<90-3600> seconds) + type: int + lifetime: + description: Maximum route lifetime following restart (<90-1800> seconds) + type: int + nsr: + description: Enable NSR for all VRFs in this process. 'False' option to + disable NSR for all VRFs in this process + type: bool + packet_size: + description: Size of OSPFv2 packets to use. min=576 max=MTU bytes + type: int + passive: + description: Enable/Disable passive + type: str + choices: + - enable + - disable + prefix_suppression: + description: Suppress advertisement of the prefixes + type: dict + suboptions: + set: + description: Set the suppression option + type: bool + secondary_address: + description: Enable/Disable secondary address suppression + type: bool + priority: + description: Router priority + type: int + process_id: + description: The OSPFv2 Process ID + type: str + required: true + protocol_shutdown: + description: Protocol specific configuration + type: dict + suboptions: + host_mode: + description: Only traffic destined for this box allowed(cisco-support) + type: bool + on_reload: + description: Shutdown post reload only + type: bool + set: + description: Shutdown the OSPFv2 Protocol + type: bool + limit: + description: High watermark for incoming priority events + type: dict + suboptions: + high: + description: Hello events are dropped when incoming event queue + exceeds this value + type: int + low: + description: DBD/LS Update/Req packets are dropped when incoming + event queue exceeds this value + type: int + medium: + description: LSA ACKs are dropped when incoming event queue exceeds + this value + type: int + redistribute: + description: Redistribute information from another routing Protocol + type: dict + suboptions: + route_type: + description: Route type to redistribute + type: str + choices: [application, bgp, connected, dagr, eigrp, isis, mobile, + ospf, rip, static, subscriber] + id: + description: OnePK application name for application routes (or) AS + number for bgp and eigrp (or) instance name for isis and ospf + type: str + level: + description: ISIS levels + choices: [1, 2, 12] + type: int + lsa_type_summary: + description: LSA type 3 for redistributed routes + type: bool + match: + description: Redistribution of routes. For OSPFv2 - external/internal/nssa-external + 1/2. For EIGRP - external/internal + type: str + metric: + description: Metric for redistributed routes + type: int + metric_type: + description: OSPFv2 exterior metric type for redistributed routes + type: int + choices: [1, 2] + route_policy: + description: Apply route-policy to redistribution + type: dict + suboptions: + name: + description: Name of the policy + type: str + parameters: + description: Specify parameter values for the policy + type: list + elements: str + nssa_only: + description: Redistribute to NSSA areas only + type: bool + preserve_med: + description: Preserve med of BGP routes + type: bool + tag: + description: Set tag for routes redistributed into OSPFv2 + type: int + retransmit_interval: + description: Delay between LSA retransmissions + type: int + router_id: + description: OSPFv2 router-id in IPv4 address format (A.B.C.D) + type: str + security_ttl: + description: Enable security + type: dict + suboptions: + set: + description: Enable ttl security + type: bool + hops: + description: Maximum number of IP hops allowed <1-254> + type: int + summary_in: + description: Enable/Disable advertisement of external prefixes as inter-area + type: str + choices: [enable, disable] + summary_prefix: + description: Configure IP address summaries + type: list + elements: dict + suboptions: + prefix: + description: IP summary address/mask (A.B.C.D/prefix) + type: str + required: true + not_advertise: + description: Suppress routes that match the specified prefix/mask + pair + type: bool + tag: + description: Set tag + type: int + timers: + description: Configure timer related constants + type: dict + suboptions: + graceful_shutdown: + description: Timers for graceful shutdown(cisco-support) + type: dict + suboptions: + initial_delay: + description: Delay before starting graceful shutdown + type: int + retain_routes: + description: Time to keep routes active after graceful shutdown + type: int + lsa: + description: OSPFv2 global LSA timers + type: dict + suboptions: + group_pacing: + description: OSPFv2 LSA group pacing timer. Interval between group + of LSA being refreshed or maxaged + type: int + min_arrival: + description: OSPFv2 MinLSArrival timer. The minimum interval in + millisec between accepting the same LSA + type: int + refresh: + description: OSPFv2 LSA refresh interval. How often self-originated + LSAs should be refreshed, in seconds + type: int + throttle: + description: OSPFv2 throttle timers + type: dict + suboptions: + lsa_all: + description: LSA throttle timers for all types of OSPFv2 LSAs + type: dict + suboptions: + initial_delay: + description: Delay to generate first occurance of LSA in milliseconds + type: int + min_delay: + description: Minimum delay between originating the same LSA + in milliseconds + type: int + max_delay: + description: Maximum delay between originating the same LSA + in milliseconds + type: int + spf: + description: OSPFv2 SPF throttle timers + type: dict + suboptions: + change_delay: + description: Delay between receiving a change to SPF calculation + in milliseconds + type: int + second_delay: + description: Delay between first and second SPF calculation + in milliseconds + type: int + max_wait: + description: Maximum wait time in milliseconds for SPF calculations + type: int + fast_reroute: + description: Fast-reroute throttle timer. Delay between end of + SPF and start of the fast-reroute computation in milliseconds + type: int + pacing_flood: + description: OSPFv2 flood pacing timer. Interval in msec to pace flooding + on all interfaces + type: int + transmit_delay: + description: Estimated time needed to send link-state update packet + type: int + weight: + description: Interface weight + type: int + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the IOS-XR device + by executing the command B(show running-config router ospf). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. + type: str + state: + description: + - The state the configuration should be left in. + type: str + choices: + - merged + - replaced + - deleted + - parsed + - gathered + - rendered + - overridden + default: merged + +""" + +EXAMPLES = """ +# Using merged + +# Before state: +# ------------- +# +# RP/0/RP0/CPU0:anton#show running-config router ospf +# Thu Jun 11 15:54:44.569 UTC +# % No such configuration item(s) +# + +- name: Merge provided OSPFv2 configuration with the existing configuration + cisco.iosxr.iosxr_ospfv2: + config: + processes: + - process_id: '27' + areas: + - area_id: '10' + hello_interval: 2 + authentication: + keychain: ansi11393 + - process_id: '26' + adjacency_stagger: + max_adjacency: 20 + min_adjacency: 10 + - process_id: '10' + authentication: + keychain: ansible_test1102 + areas: + - area_id: '11' + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: '30' + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + weight: 2 + packet_size: 577 + priority: 1 + router_id: 2.2.2.2 + demand_circuit: enable + passive: disable + summary_in: enable + flood_reduction: disable + mtu_ignore: enable + external_out: disable + state: merged + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "before": {} +# +# "commands": [ +# "router ospf 30", +# "cost 2", +# "weight 2", +# "passive disable", +# "priority 1", +# "flood-reduction disable", +# "default-metric 10", +# "router-id 2.2.2.2", +# "demand-circuit enable", +# "packet-size 577", +# "transmit-delay 2", +# "summary-in enable", +# "external-out disable", +# "dead-interval 2", +# "hello-interval 1", +# "retransmit-interval 2", +# "mtu-ignore enable", +# "area 11 default-cost 5", +# "area 22 default-cost 6", +# "router ospf 26", +# "adjacency stagger 10 20", +# "authentication message-digest keychain ansible1101pass", +# "router ospf 27", +# "area 10 authentication keychain ansi11393", +# "area 10 hello-interval 2", +# "router ospf 10", +# "authentication keychain ansible_test1102", +# "area 11 default-cost 5", +# "area 11 cost 11", +# "area 22 default-cost 6" +# ] +# +# "after": { +# "processes": [ +# { +# "areas": [ +# { +# "area_id": "11", +# "cost": 11, +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "authentication": { +# "keychain": "ansible_test1102" +# }, +# "process_id": "10" +# }, +# { +# "adjacency_stagger": { +# "max_adjacency": 20, +# "min_adjacency": 10 +# }, +# "authentication": { +# "message_digest": { +# "keychain": "ansible1101pass" +# } +# }, +# "process_id": "26" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "authentication": { +# "keychain": "ansi11393" +# }, +# "hello_interval": 2 +# } +# ], +# "process_id": "27" +# }, +# { +# "areas": [ +# { +# "area_id": "11", +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "cost": 2, +# "dead_interval": 2, +# "default_metric": 10, +# "demand_circuit": "enable", +# "external_out": "disable", +# "flood_reduction": "disable", +# "hello_interval": 1, +# "mtu_ignore": "enable", +# "packet_size": 577, +# "passive": "disable", +# "priority": 1, +# "process_id": "30", +# "retransmit_interval": 2, +# "router_id": "2.2.2.2", +# "summary_in": "enable", +# "transmit_delay": 2, +# "weight": 2 +# } +# ] +# } +# +# +# ------------ +# After state +# ------------ +# +# RP/0/RP0/CPU0:anton#show running-config router ospf +# Thu Jun 11 16:06:44.406 UTC +# router ospf 10 +# authentication keychain ansible_test1102 +# area 11 +# cost 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# router ospf 26 +# authentication message-digest keychain ansible1101pass +# adjacency stagger 10 20 +# ! +# router ospf 27 +# area 10 +# authentication keychain ansi11393 +# hello-interval 2 +# ! +# ! +# router ospf 30 +# router-id 2.2.2.2 +# summary-in enable +# external-out disable +# cost 2 +# packet-size 577 +# weight 2 +# passive disable +# priority 1 +# mtu-ignore enable +# flood-reduction disable +# dead-interval 2 +# retransmit-interval 2 +# demand-circuit enable +# hello-interval 1 +# transmit-delay 2 +# default-metric 10 +# area 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# + + +# Using replaced +# +# ------------ +# Before state +# ------------ +# +# +# RP/0/RP0/CPU0:anton#show running-config router ospf +# Thu Jun 11 16:06:44.406 UTC +# router ospf 10 +# authentication keychain ansible_test1102 +# area 11 +# cost 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# router ospf 26 +# authentication message-digest keychain ansible1101pass +# adjacency stagger 10 20 +# ! +# router ospf 27 +# area 10 +# authentication keychain ansi11393 +# hello-interval 2 +# ! +# ! +# router ospf 30 +# router-id 2.2.2.2 +# summary-in enable +# external-out disable +# cost 2 +# packet-size 577 +# weight 2 +# passive disable +# priority 1 +# mtu-ignore enable +# flood-reduction disable +# dead-interval 2 +# retransmit-interval 2 +# demand-circuit enable +# hello-interval 1 +# transmit-delay 2 +# default-metric 10 +# area 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# + +- name: Replace OSPFv2 routes configurations from the device + cisco.iosxr.iosxr_ospfv2: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - area_id: 20 + cost: 2 + default_cost: 2 + authentication: + keychain: ansi11393 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 + state: replaced + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "before": { +# "processes": [ +# { +# "areas": [ +# { +# "area_id": "11", +# "cost": 11, +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "authentication": { +# "keychain": "ansible_test1102" +# }, +# "process_id": "10" +# }, +# { +# "adjacency_stagger": { +# "max_adjacency": 20, +# "min_adjacency": 10 +# }, +# "authentication": { +# "message_digest": { +# "keychain": "ansible1101pass" +# } +# }, +# "process_id": "26" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "authentication": { +# "keychain": "ansi11393" +# }, +# "hello_interval": 2 +# } +# ], +# "process_id": "27" +# }, +# { +# "areas": [ +# { +# "area_id": "11", +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "cost": 2, +# "dead_interval": 2, +# "default_metric": 10, +# "demand_circuit": "enable", +# "external_out": "disable", +# "flood_reduction": "disable", +# "hello_interval": 1, +# "mtu_ignore": "enable", +# "packet_size": 577, +# "passive": "disable", +# "priority": 1, +# "process_id": "30", +# "retransmit_interval": 2, +# "router_id": "2.2.2.2", +# "summary_in": "enable", +# "transmit_delay": 2, +# "weight": 2 +# } +# ] +# } +# +# "commands": [ +# "router ospf 27", +# "no area 10 authentication keychain ansi11393", +# "area 20 authentication keychain ansi11393", +# "area 20 default-cost 2", +# "area 20 cost 2" +# ] +# +# "after": { +# "processes": [ +# { +# "areas": [ +# { +# "area_id": "11", +# "cost": 11, +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "authentication": { +# "keychain": "ansible_test1102" +# }, +# "process_id": "10" +# }, +# { +# "adjacency_stagger": { +# "max_adjacency": 20, +# "min_adjacency": 10 +# }, +# "authentication": { +# "message_digest": { +# "keychain": "ansible1101pass" +# } +# }, +# "process_id": "26" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "hello_interval": 2 +# }, +# { +# "area_id": "20", +# "authentication": { +# "keychain": "ansi11393" +# }, +# "cost": 2, +# "default_cost": 2 +# } +# ], +# "process_id": "27" +# }, +# { +# "areas": [ +# { +# "area_id": "11", +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "cost": 2, +# "dead_interval": 2, +# "default_metric": 10, +# "demand_circuit": "enable", +# "external_out": "disable", +# "flood_reduction": "disable", +# "hello_interval": 1, +# "mtu_ignore": "enable", +# "packet_size": 577, +# "passive": "disable", +# "priority": 1, +# "process_id": "30", +# "retransmit_interval": 2, +# "router_id": "2.2.2.2", +# "summary_in": "enable", +# "transmit_delay": 2, +# "weight": 2 +# } +# ] +# } +# +# +# ----------- +# After state +# ----------- +# +# RP/0/RP0/CPU0:anton(config)#do show running-config router ospf +# Thu Jun 11 16:40:31.038 UTC +# router ospf 10 +# authentication keychain ansible_test1102 +# area 11 +# cost 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# router ospf 26 +# authentication message-digest keychain ansible1101pass +# adjacency stagger 10 20 +# ! +# router ospf 27 +# area 10 +# hello-interval 2 +# ! +# area 20 +# cost 2 +# authentication keychain ansi11393 +# default-cost 2 +# ! +# ! +# router ospf 30 +# router-id 2.2.2.2 +# summary-in enable +# external-out disable +# cost 2 +# packet-size 577 +# weight 2 +# passive disable +# priority 1 +# mtu-ignore enable +# flood-reduction disable +# dead-interval 2 +# retransmit-interval 2 +# demand-circuit enable +# hello-interval 1 +# transmit-delay 2 +# default-metric 10 +# area 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# + + +# Using overridden +# +# ------------ +# Before state +# ------------ +# +# +# RP/0/RP0/CPU0:anton#show running-config router ospf +# Thu Jun 11 16:06:44.406 UTC +# router ospf 10 +# authentication keychain ansible_test1102 +# area 11 +# cost 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# router ospf 26 +# authentication message-digest keychain ansible1101pass +# adjacency stagger 10 20 +# ! +# router ospf 27 +# area 10 +# authentication keychain ansi11393 +# hello-interval 2 +# ! +# ! +# router ospf 30 +# router-id 2.2.2.2 +# summary-in enable +# external-out disable +# cost 2 +# packet-size 577 +# weight 2 +# passive disable +# priority 1 +# mtu-ignore enable +# flood-reduction disable +# dead-interval 2 +# retransmit-interval 2 +# demand-circuit enable +# hello-interval 1 +# transmit-delay 2 +# default-metric 10 +# area 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# + +- name: Override existing OSPFv2 configurations from the device + cisco.iosxr.iosxr_ospfv2: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + authentication: + keychain: ansi11393 + - area_id: 20 + cost: 2 + default_cost: 2 + authentication: + keychain: ansi11393 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 + state: overridden + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "before": { +# "processes": [ +# { +# "areas": [ +# { +# "area_id": "11", +# "cost": 11, +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "authentication": { +# "keychain": "ansible_test1102" +# }, +# "process_id": "10" +# }, +# { +# "adjacency_stagger": { +# "max_adjacency": 20, +# "min_adjacency": 10 +# }, +# "authentication": { +# "message_digest": { +# "keychain": "ansible1101pass" +# } +# }, +# "process_id": "26" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "authentication": { +# "keychain": "ansi11393" +# }, +# "hello_interval": 2 +# } +# ], +# "process_id": "27" +# }, +# { +# "areas": [ +# { +# "area_id": "11", +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "cost": 2, +# "dead_interval": 2, +# "default_metric": 10, +# "demand_circuit": "enable", +# "external_out": "disable", +# "flood_reduction": "disable", +# "hello_interval": 1, +# "mtu_ignore": "enable", +# "packet_size": 577, +# "passive": "disable", +# "priority": 1, +# "process_id": "30", +# "retransmit_interval": 2, +# "router_id": "2.2.2.2", +# "summary_in": "enable", +# "transmit_delay": 2, +# "weight": 2 +# } +# ] +# } +# +# "commands": [ +# "router ospf 10", +# "no authentication keychain ansible_test1102", +# "no area 11 default-cost 5", +# "no area 11 cost 11", +# "no area 22 default-cost 6", +# "router ospf 30", +# "no cost 2", +# "no weight 2", +# "no passive disable", +# "no priority 1", +# "no flood-reduction disable", +# "no default-metric 10", +# "no router-id 2.2.2.2", +# "no demand-circuit enable", +# "no packet-size 577", +# "no transmit-delay 2", +# "no summary-in enable", +# "no external-out disable", +# "no dead-interval 2", +# "no hello-interval 1", +# "no retransmit-interval 2", +# "no mtu-ignore enable", +# "no area 11 default-cost 5", +# "no area 22 default-cost 6", +# "router ospf 27", +# "area 20 authentication keychain ansi11393", +# "area 20 default-cost 2", +# "area 20 cost 2" +# ] +# +# "after": { +# "processes": [ +# { +# "process_id": "10" +# }, +# { +# "adjacency_stagger": { +# "max_adjacency": 20, +# "min_adjacency": 10 +# }, +# "authentication": { +# "message_digest": { +# "keychain": "ansible1101pass" +# } +# }, +# "process_id": "26" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "authentication": { +# "keychain": "ansi11393" +# }, +# "hello_interval": 2 +# }, +# { +# "area_id": "20", +# "authentication": { +# "keychain": "ansi11393" +# }, +# "cost": 2, +# "default_cost": 2 +# } +# ], +# "process_id": "27" +# }, +# { +# "process_id": "30" +# } +# ] +# } +# +# +# ----------- +# After state +# ----------- +# +# RP/0/RP0/CPU0:anton#show running-config router ospf +# Thu Jun 11 16:50:36.332 UTC +# router ospf 10 +# ! +# router ospf 26 +# authentication message-digest keychain ansible1101pass +# adjacency stagger 10 20 +# ! +# router ospf 27 +# area 10 +# authentication keychain ansi11393 +# hello-interval 2 +# ! +# area 20 +# cost 2 +# authentication keychain ansi11393 +# default-cost 2 +# ! +# ! +# router ospf 30 +# ! +# + + +# Using deleted +# +# ------------ +# Before state +# ------------ +# +# +# RP/0/RP0/CPU0:anton#show running-config router ospf +# Thu Jun 11 16:06:44.406 UTC +# router ospf 10 +# authentication keychain ansible_test1102 +# area 11 +# cost 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# router ospf 26 +# authentication message-digest keychain ansible1101pass +# adjacency stagger 10 20 +# ! +# router ospf 27 +# area 10 +# authentication keychain ansi11393 +# hello-interval 2 +# ! +# ! +# router ospf 30 +# router-id 2.2.2.2 +# summary-in enable +# external-out disable +# cost 2 +# packet-size 577 +# weight 2 +# passive disable +# priority 1 +# mtu-ignore enable +# flood-reduction disable +# dead-interval 2 +# retransmit-interval 2 +# demand-circuit enable +# hello-interval 1 +# transmit-delay 2 +# default-metric 10 +# area 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# + +- name: Deleted existing OSPFv2 configurations from the device + cisco.iosxr.iosxr_ospfv2: + config: + processes: + - process_id: '10' + - process_id: '26' + - process_id: '27' + - process_id: '30' + state: deleted + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "before": { +# "processes": [ +# { +# "areas": [ +# { +# "area_id": "11", +# "cost": 11, +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "authentication": { +# "keychain": "ansible_test1102" +# }, +# "process_id": "10" +# }, +# { +# "adjacency_stagger": { +# "max_adjacency": 20, +# "min_adjacency": 10 +# }, +# "authentication": { +# "message_digest": { +# "keychain": "ansible1101pass" +# } +# }, +# "process_id": "26" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "authentication": { +# "keychain": "ansi11393" +# }, +# "hello_interval": 2 +# } +# ], +# "process_id": "27" +# }, +# { +# "areas": [ +# { +# "area_id": "11", +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "cost": 2, +# "dead_interval": 2, +# "default_metric": 10, +# "demand_circuit": "enable", +# "external_out": "disable", +# "flood_reduction": "disable", +# "hello_interval": 1, +# "mtu_ignore": "enable", +# "packet_size": 577, +# "passive": "disable", +# "priority": 1, +# "process_id": "30", +# "retransmit_interval": 2, +# "router_id": "2.2.2.2", +# "summary_in": "enable", +# "transmit_delay": 2, +# "weight": 2 +# } +# ] +# }, +# +# "commands": [ +# "router ospf 10", +# "no authentication keychain ansible_test1102", +# "no area 11 default-cost 5", +# "no area 11 cost 11", +# "no area 22 default-cost 6", +# "router ospf 26", +# "no adjacency stagger 10 20", +# "no authentication message-digest keychain ansible1101pass", +# "router ospf 27", +# "no area 10 authentication keychain ansi11393", +# "no area 10 hello-interval 2", +# "router ospf 30", +# "no cost 2", +# "no weight 2", +# "no passive disable", +# "no priority 1", +# "no flood-reduction disable", +# "no default-metric 10", +# "no router-id 2.2.2.2", +# "no demand-circuit enable", +# "no packet-size 577", +# "no transmit-delay 2", +# "no summary-in enable", +# "no external-out disable", +# "no dead-interval 2", +# "no hello-interval 1", +# "no retransmit-interval 2", +# "no mtu-ignore enable", +# "no area 11 default-cost 5", +# "no area 22 default-cost 6" +# ] +# +# "after": { +# "processes": [ +# { +# "process_id": "10" +# }, +# { +# "process_id": "26" +# }, +# { +# "process_id": "27" +# }, +# { +# "process_id": "30" +# } +# ] +# } +# +# +# ----------- +# After state +# ----------- +# +# RP/0/RP0/CPU0:anton(config)#show running-config router ospf +# Thu Jun 11 17:07:34.218 UTC +# router ospf 10 +# ! +# router ospf 26 +# ! +# router ospf 27 +# ! +# router ospf 30 +# ! + + +# Using parsed +# parsed.cfg +# ------------ +# Thu Jun 11 17:28:51.918 UTC +# router ospf 10 +# authentication keychain ansible_test1102 +# area 11 +# cost 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# router ospf 26 +# authentication message-digest keychain ansible1101pass +# adjacency stagger 10 20 +# ! +# router ospf 27 +# area 10 +# authentication keychain ansi11393 +# hello-interval 2 +# ! +# ! +# router ospf 30 +# router-id 2.2.2.2 +# summary-in enable +# external-out disable +# cost 2 +# packet-size 577 +# weight 2 +# passive disable +# priority 1 +# mtu-ignore enable +# flood-reduction disable +# dead-interval 2 +# retransmit-interval 2 +# demand-circuit enable +# hello-interval 1 +# transmit-delay 2 +# default-metric 10 +# area 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +- name: Parsed the device configuration to get output commands + cisco.iosxr.iosxr_ospfv2: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# +# "parsed": { +# "processes": [ +# { +# "areas": [ +# { +# "area_id": "11", +# "cost": 11, +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "authentication": { +# "keychain": "ansible_test1102" +# }, +# "process_id": "10" +# }, +# { +# "adjacency_stagger": { +# "max_adjacency": 20, +# "min_adjacency": 10 +# }, +# "authentication": { +# "message_digest": { +# "keychain": "ansible1101pass" +# } +# }, +# "process_id": "26" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "authentication": { +# "keychain": "ansi11393" +# }, +# "hello_interval": 2 +# } +# ], +# "process_id": "27" +# }, +# { +# "areas": [ +# { +# "area_id": "11", +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "cost": 2, +# "dead_interval": 2, +# "default_metric": 10, +# "demand_circuit": "enable", +# "external_out": "disable", +# "flood_reduction": "disable", +# "hello_interval": 1, +# "mtu_ignore": "enable", +# "packet_size": 577, +# "passive": "disable", +# "priority": 1, +# "process_id": "30", +# "retransmit_interval": 2, +# "router_id": "2.2.2.2", +# "summary_in": "enable", +# "transmit_delay": 2, +# "weight": 2 +# } +# ] +# } + + + +# Using rendered +# +# +- name: Render the commands for provided configuration + cisco.iosxr.iosxr_ospfv2: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + authentication: + keychain: ansi11393 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 + - process_id: 10 + authentication: + keychain: ansible_test1102 + areas: + - area_id: 11 + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: 30 + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + weight: 2 + packet_size: 577 + priority: 1 + router_id: 2.2.2.2 + demand_circuit: enable + passive: disable + summary_in: enable + flood_reduction: disable + mtu_ignore: enable + external_out: disable + state: rendered + +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# +# "rendered": [ +# "router ospf 27", +# "area 10 authentication keychain ansi11393", +# "area 10 hello-interval 2", +# "router ospf 26", +# "adjacency stagger 10 20", +# "authentication message-digest keychain ansible1101pass", +# "router ospf 10", +# "authentication keychain ansible_test1102", +# "area 11 default-cost 5", +# "area 11 cost 11", +# "area 22 default-cost 6", +# "router ospf 30", +# "cost 2", +# "weight 2", +# "passive disable", +# "priority 1", +# "flood-reduction disable", +# "default-metric 10", +# "router-id 2.2.2.2", +# "demand-circuit enable", +# "packet-size 577", +# "transmit-delay 2", +# "summary-in enable", +# "external-out disable", +# "dead-interval 2", +# "hello-interval 1", +# "retransmit-interval 2", +# "mtu-ignore enable", +# "area 11 default-cost 5", +# "area 22 default-cost 6" +# ] + + +# Using gathered +# +# Before state: +# ------------- +# +# RP/0/RP0/CPU0:anton#show running-config router ospf +# Thu Jun 11 16:06:44.406 UTC +# router ospf 10 +# authentication keychain ansible_test1102 +# area 11 +# cost 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# router ospf 26 +# authentication message-digest keychain ansible1101pass +# adjacency stagger 10 20 +# ! +# router ospf 27 +# area 10 +# authentication keychain ansi11393 +# hello-interval 2 +# ! +# ! +# router ospf 30 +# router-id 2.2.2.2 +# summary-in enable +# external-out disable +# cost 2 +# packet-size 577 +# weight 2 +# passive disable +# priority 1 +# mtu-ignore enable +# flood-reduction disable +# dead-interval 2 +# retransmit-interval 2 +# demand-circuit enable +# hello-interval 1 +# transmit-delay 2 +# default-metric 10 +# area 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# +- name: Gather ospfv2 routes configuration + cisco.iosxr.iosxr_ospfv2: + state: gathered +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# "gathered": { +# "processes": [ +# { +# "areas": [ +# { +# "area_id": "11", +# "cost": 11, +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "authentication": { +# "keychain": "ansible_test1102" +# }, +# "process_id": "10" +# }, +# { +# "adjacency_stagger": { +# "max_adjacency": 20, +# "min_adjacency": 10 +# }, +# "authentication": { +# "message_digest": { +# "keychain": "ansible1101pass" +# } +# }, +# "process_id": "26" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "authentication": { +# "keychain": "ansi11393" +# }, +# "hello_interval": 2 +# } +# ], +# "process_id": "27" +# }, +# { +# "areas": [ +# { +# "area_id": "11", +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "cost": 2, +# "dead_interval": 2, +# "default_metric": 10, +# "demand_circuit": "enable", +# "external_out": "disable", +# "flood_reduction": "disable", +# "hello_interval": 1, +# "mtu_ignore": "enable", +# "packet_size": 577, +# "passive": "disable", +# "priority": 1, +# "process_id": "30", +# "retransmit_interval": 2, +# "router_id": "2.2.2.2", +# "summary_in": "enable", +# "transmit_delay": 2, +# "weight": 2 +# } +# ] +# } +# +# After state: +# ------------- +# +# RP/0/RP0/CPU0:anton#show running-config router ospf +# Thu Jun 11 16:06:44.406 UTC +# router ospf 10 +# authentication keychain ansible_test1102 +# area 11 +# cost 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# router ospf 26 +# authentication message-digest keychain ansible1101pass +# adjacency stagger 10 20 +# ! +# router ospf 27 +# area 10 +# authentication keychain ansi11393 +# hello-interval 2 +# ! +# ! +# router ospf 30 +# router-id 2.2.2.2 +# summary-in enable +# external-out disable +# cost 2 +# packet-size 577 +# weight 2 +# passive disable +# priority 1 +# mtu-ignore enable +# flood-reduction disable +# dead-interval 2 +# retransmit-interval 2 +# demand-circuit enable +# hello-interval 1 +# transmit-delay 2 +# default-metric 10 +# area 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# +# + +""" +RETURN = """ +before: + description: The configuration prior to the model invocation. + returned: always + type: dict + sample: > + The configuration returned will always be in the same format + of the parameters above. +after: + description: The resulting configuration model invocation. + returned: when changed + type: dict + sample: > + The configuration returned will always be in the same format + of the parameters above. +commands: + description: The set of commands pushed to the remote device. + returned: always + type: list + sample: + - "router ospf 30" + - "authentication message-digest keychain 'ansible1101pass'" +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.ospfv2.ospfv2 import ( + Ospfv2Args, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.ospfv2.ospfv2 import ( + Ospfv2, +) + + +def main(): + """ + Main entry point for module execution + + :returns: the result form module invocation + """ + required_if = [ + ("state", "merged", ("config",)), + ("state", "replaced", ("config",)), + ("state", "overridden", ("config",)), + ("state", "rendered", ("config",)), + ("state", "parsed", ("running_config",)), + ] + mutually_exclusive = [("config", "running_config")] + module = AnsibleModule( + argument_spec=Ospfv2Args.argument_spec, + required_if=required_if, + supports_check_mode=True, + mutually_exclusive=mutually_exclusive, + ) + result = Ospfv2(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_ospfv3.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_ospfv3.py new file mode 100644 index 00000000..ae9f5719 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_ospfv3.py @@ -0,0 +1,2783 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 2020 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# + +""" +The module file for iosxr_ospfv3 +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +module: iosxr_ospfv3 +version_added: 1.1.0 +short_description: ospfv3 resource module +description: + - This module manages global ospfv3 configuration on devices running Cisco IOS-XR +author: Rohit Thakur (@rohitthakur2590) +notes: + - Tested against IOS-XR 6.1.3 + - This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html) +options: + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the IOS-XR device + by executing the command B(show running-config router ospfv3). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. + type: str + config: + description: A list of ospfv3 process configuration + type: dict + suboptions: + processes: + description: A list of ospfv3 instances configuration + type: list + elements: dict + suboptions: + process_id: + description: The OSPFv3 Process ID + type: str + required: true + address_family_unicast: + description: Enable unicast topology for ipv4 address family + type: bool + authentication: + description: Enable authentication + type: dict + suboptions: + disable: + description: Do not authenticate OSPFv3 packets + type: bool + default: false + ipsec: + description: Specify IPSec AH authentication attributes + type: dict + suboptions: + spi: + description: Specify the Security Parameter Index value + type: int + algorithim_type: + description: Specify the type of algorithim + type: str + choices: ["md5", "sha1"] + key: + description: Specify key + type: str + clear_key: + description: Specify key in cleartext form + type: str + password_key: + description: Specify key in encrypted form + type: str + auto_cost: + description: Calculate ospfv3 interface cost according to bandwidth + type: dict + suboptions: + reference_bandwidth: + description: Specify reference bandwidth in megabits per sec + type: int + disable: + description: Assign ospfv3 cost based on interface type + type: bool + bfd: + description: Configure BFD parameters + type: dict + suboptions: + fast_detect: + description: Configure fast detection + type: dict + suboptions: + set: + description: Enable fast detection only + type: bool + strict_mode: + description: Hold down neighbor session until BFD session is up + type: bool + minimum_interval: + description: Hello interval in milli-seconds + type: int + multiplier: + description: Detect multiplier + type: int + areas: + description: Configure ospfv3 areas' properties + type: list + elements: dict + suboptions: + area_id: + description: Area ID as IP address or integer + type: str + required: True + authentication: + description: Enable authentication + type: dict + suboptions: + disable: + description: Do not authenticate OSPFv3 packets + type: bool + default: false + ipsec: + description: Specify IPSec AH authentication attributes + type: dict + suboptions: + spi: + description: Specify the Security Parameter Index value + type: int + algorithim_type: + description: Specify the type of algorithim + type: str + choices: ["md5", "sha1"] + key: + description: Specify key + type: str + clear_key: + description: Specify key in cleartext form + type: str + password_key: + description: Specify key in encrypted form + type: str + bfd: + description: Configure BFD parameters + type: dict + suboptions: + fast_detect: + description: Configure fast detection + type: dict + suboptions: + set: + description: Enable fast detection only + type: bool + strict_mode: + description: Hold down neighbor session until BFD session is up + type: bool + minimum_interval: + description: Hello interval in milli-seconds + type: int + multiplier: + description: Detect multiplier + type: int + cost: + description: Interface cost + type: int + database_filter: + description: Filter LSAs during synchronization and flooding + type: dict + suboptions: + all_outgoing_lsa: + description: Filter all outgoing LSA + type: bool + dead_interval: + description: Interval after which a neighbor is declared dead + type: int + default_cost: + description: Set the summary default-cost of a NSSA/stub area. Stub's advertised external route metric + type: int + demand_circuit: + description: Enable/Disable ospfv3 demand circuit + type: bool + distrinbute_rib_prefix_list_name: + description: Filter LSAs during synchronization and flooding + type: str + fast_reroute: + description: Specify IP Fast Reroute + type: dict + suboptions: + disabled: + description: Disable IP fast reroute + type: bool + per_link: + description: Specify per-prefix computation + type: dict + suboptions: + information_type: + description: Specify per-link LFA exclusion or FRR LFA candidate information + type: str + choices: ["exclude", "lfa_candidate"] + use_candidate_only: + description: Enable/Disable backup selection from candidate-list only + type: bool + interface: + description: Specify Per-link LFA exclusion information + type: dict + suboptions: + bvi: + description: Specify Bridge-Group Virtual Interface + type: list + elements: int + bundle_ether: + description: Specify Aggregated Ethernet interface(s) + type: list + elements: int + pos_int: + description: Specify Aggregated pos interface(s) + type: list + elements: int + fast_ethernet: + description: Specify FastEthernet/IEEE 802.3 interface(s) + type: list + elements: str + fiftygige: + description: Specify FiftyGigE/IEEE 802.3 interface(s) + type: list + elements: str + fortygige: + description: Specify FortyGigE/IEEE 802.3 interface(s) + type: list + elements: str + fourhundredgige: + description: Specify FourHundredGigE/IEEE 802.3 interface(s) + type: list + elements: str + gigabitethernet: + description: Specify GigabitEthernet/IEEE 802.3 interface(s) + type: list + elements: str + hundredgige: + description: Specify HundredGigE/IEEE 802.3 interface(s) + type: list + elements: str + mgmteth: + description: Specify MgmtEth/IEEE 802.3 interface(s) + type: list + elements: str + multilink: + description: Specify Multilink network interface(s) + type: list + elements: str + pw_ether: + description: Specify PWHE Ethernet Interface + type: list + elements: int + pw_iw: + description: Specify PWHE VC11 IP Interworking Interface + type: list + elements: int + srp: + description: Specify SRP interface(s) + type: list + elements: str + serial: + description: Specify Serial network interface(s) + type: list + elements: str + tengige: + description: Specify TenGigabitEthernet/IEEE 802.3 interface(s) + type: list + elements: str + twentyfivegige: + description: Specify TwentyFiveGigabitEthernet/IEEE 802.3 interface(s) + type: list + elements: str + twohundredgige: + description: Specify TwoHundredGigE/IEEE 802.3 interface(s) + type: list + elements: str + nve: + description: Specify Network Virtualization Endpoint Interface(s) + type: list + elements: int + tunnel_ip: + description: Specify GRE/IPinIP Tunnel Interface(s) + type: list + elements: int + tunnel_ipsec: + description: Specify IPSec Tunnel interface(s) + type: list + elements: int + tunnel_mte: + description: Specify MPLS Traffic Engineering P2MP Tunnel interface(s) + type: list + elements: int + tunnel_mpls: + description: MPLS Transport Protocol Tunnel interface + type: int + per_prefix: + description: Specify per-prefix computation + type: dict + suboptions: + information_type: + description: Specify per_prefix LFA exclusion or FRR LFA candidate information + type: str + choices: ["exclude", "lfa_candidate"] + use_candidate_only: + description: Enable/Disable backup selection from candidate-list only + type: bool + interface: + description: Specify Per-link LFA exclusion information + type: dict + suboptions: + bvi: + description: Specify Bridge-Group Virtual Interface + type: list + elements: int + bundle_ether: + description: Specify Aggregated Ethernet interface(s) + type: list + elements: int + pos_int: + description: Specify Aggregated pos interface(s) + type: list + elements: int + fast_ethernet: + description: Specify FastEthernet/IEEE 802.3 interface(s) + type: list + elements: str + fiftygige: + description: Specify FiftyGigE/IEEE 802.3 interface(s) + type: list + elements: str + fortygige: + description: Specify FortyGigE/IEEE 802.3 interface(s) + type: list + elements: str + fourhundredgige: + description: Specify FourHundredGigE/IEEE 802.3 interface(s) + type: list + elements: str + gigabitethernet: + description: Specify GigabitEthernet/IEEE 802.3 interface(s) + type: list + elements: str + hundredgige: + description: Specify HundredGigE/IEEE 802.3 interface(s) + type: list + elements: str + mgmteth: + description: Specify MgmtEth/IEEE 802.3 interface(s) + type: list + elements: str + multilink: + description: Specify Multilink network interface(s) + type: list + elements: str + pw_ether: + description: Specify PWHE Ethernet Interface + type: list + elements: int + pw_iw: + description: Specify PWHE VC11 IP Interworking Interface + type: list + elements: int + srp: + description: Specify SRP interface(s) + type: list + elements: str + serial: + description: Specify Serial network interface(s) + type: list + elements: str + tengige: + description: Specify TenGigabitEthernet/IEEE 802.3 interface(s) + type: list + elements: str + twentyfivegige: + description: Specify TwentyFiveGigabitEthernet/IEEE 802.3 interface(s) + type: list + elements: str + twohundredgige: + description: Specify TwoHundredGigE/IEEE 802.3 interface(s) + type: list + elements: str + nve: + description: Specify Network Virtualization Endpoint Interface(s) + type: list + elements: int + tunnel_ip: + description: Specify GRE/IPinIP Tunnel Interface(s) + type: list + elements: int + tunnel_ipsec: + description: Specify IPSec Tunnel interface(s) + type: list + elements: int + tunnel_mte: + description: Specify MPLS Traffic Engineering P2MP Tunnel interface(s) + type: list + elements: int + tunnel_mpls: + description: MPLS Transport Protocol Tunnel interface + type: int + flood_reduction: + description: Enable/Disable flood reduction + type: bool + hello_interval: + description: Specify Time between HELLO packets + type: int + instance_id: + description: Specify instance ID + type: int + mtu_ignore: + description: Enable/Disable ignoring of MTU in DBD packets + type: bool + mpls_ldp_sync: + description: Enable/Disable MPLS LDP Sync + type: bool + network: + description: Specify Network type + type: str + choices: ["broadcast", "non-broadcast", "point-to-multipoint", "point-to-point"] + nssa: + description: NSSA settings for the area + type: dict + suboptions: + set: + description: Configure area as NSSA + type: bool + default_information_originate: + description: Originate default Type 7 LSA + type: dict + suboptions: + set: + description: Set nssa to default information originate + type: bool + metric: + description: ospfv3 default metric + type: int + metric_type: + description: Metric type for default routes + type: int + no_redistribution: + description: Do not send redistributed LSAs into NSSA area + type: bool + no_summary: + description: Do not send summary LSAs into NSSA area + type: bool + translate: + description: Translate LSA + type: dict + suboptions: + type7: + description: Translate from Type 7 to Type 5 + type: dict + suboptions: + always: + description: Always translate LSAs + type: bool + required: true + packet_size: + description: Specify limit size of OSPFv3 packets + type: int + passive: + description: Enable/Disable routing updates on an interface + type: bool + prefix_suppression: + description: Hide all transit addresses on this interface + type: bool + priority: + description: Specify Router priority + type: int + ranges: + description: Summarize routes matching address/mask (border routers only) + type: list + elements: dict + suboptions: + address: + description: IP in Prefix format (X:X::X/length) + type: str + required: True + cost: + description: Specify user specified metric for this range + type: int + advertise: + description: Advertise this range (default) + type: bool + not_advertise: + description: DoNotAdvertise this range + type: bool + retransmit_interval: + description: Specify Delay between LSA retransmissions + type: int + stub: + description: Settings for configuring the area as a stub + type: dict + suboptions: + set: + description: Configure the area as a stub + type: bool + no_summary: + description: Do not send summary LSA into stub area + type: bool + transmit_delay: + description: Specify estimated time needed to send link-state update packet + type: int + virtual_link: + description: Define a virtual link + type: list + elements: dict + suboptions: + id: + description: Router-ID of virtual link neighbor (A.B.C.D) + type: str + required: True + authentication: + description: Enable authentication + type: dict + suboptions: + disable: + description: Do not authenticate OSPFv3 packets + type: bool + default: false + ipsec: + description: Specify IPSec AH authentication attributes + type: dict + suboptions: + spi: + description: Specify the Security Parameter Index value + type: int + algorithim_type: + description: Specify the type of algorithim + type: str + choices: ["md5", "sha1"] + key: + description: Specify key + type: str + clear_key: + description: Specify key in cleartext form + type: str + password_key: + description: Specify key in encrypted form + type: str + dead_interval: + description: Interval after which a neighbor is declared dead + type: int + hello_interval: + description: Time between HELLO packets + type: int + retransmit_interval: + description: Delay between LSA retransmissions + type: int + transmit_delay: + description: Link state transmit delay + type: int + encryption: + description: Encrypt and authenticate OSPFv3 packets + type: dict + suboptions: + disable: + description: Do not encrypt OSPFv3 packets + type: bool + default: false + ipsec: + description: Specify IPSec ESP encryption and authentication + type: dict + suboptions: + spi: + description: Specify the Security Parameter Index value + type: int + esp: + description: Specify encryption parameters + type: dict + suboptions: + triple_des: + description: This specify the triple DES algorithim + type: dict + suboptions: + key: + description: Cleartext 3DES key + type: str + clear_key: + description: Specify 3DES key in cleartext form + type: str + password_key: + description: Specify 3DES key in encrypted form + type: str + aes: + description: This specify the aes algorithim + type: dict + suboptions: + algorithim_type: + description: Specify the bit encryption for aes algorithim + type: str + choices: ["192", "256"] + key: + description: Cleartext AES key + type: str + clear_key: + description: Specify AES key in cleartext form + type: str + password_key: + description: Specify AES key in encrypted form + type: str + des: + description: This specify the des algorithim + type: dict + suboptions: + key: + description: Cleartext AES key + type: str + clear_key: + description: Specify AES key in cleartext form + type: str + password_key: + description: Specify AES key in encrypted form + type: str + null_encryption: + description: Specify null encryption attributes + type: dict + suboptions: + authentication: + description: Specify authentication parameters + type: dict + suboptions: + algorithim_type: + description: Specify the type of algorithim + type: str + choices: ["md5", "sha1"] + key: + description: Specify key + type: str + clear_key: + description: Specify key in cleartext form + type: str + password_key: + description: Specify key in encrypted form + type: str + encryption: + description: Encrypt and authenticate OSPFv3 packets + type: dict + suboptions: + disable: + description: Do not encrypt OSPFv3 packets + type: bool + default: false + ipsec: + description: Specify IPSec ESP encryption and authentication + type: dict + suboptions: + spi: + description: Specify the Security Parameter Index value + type: int + esp: + description: Specify encryption parameters + type: dict + suboptions: + triple_des: + description: This specify the triple DES algorithim + type: dict + suboptions: + key: + description: Cleartext 3DES key + type: str + clear_key: + description: Specify 3DES key in cleartext form + type: str + password_key: + description: Specify 3DES key in encrypted form + type: str + aes: + description: This specify the aes algorithim + type: dict + suboptions: + algorithim_type: + description: Specify the bit encryption for aes algorithim + type: str + choices: ["192", "256"] + key: + description: Cleartext AES key + type: str + clear_key: + description: Specify AES key in cleartext form + type: str + password_key: + description: Specify AES key in encrypted form + type: str + des: + description: This specify the des algorithim + type: dict + suboptions: + key: + description: Cleartext AES key + type: str + clear_key: + description: Specify AES key in cleartext form + type: str + password_key: + description: Specify AES key in encrypted form + type: str + null_encryption: + description: Specify null encryption attributes + type: dict + suboptions: + authentication: + description: Specify authentication parameters + type: dict + suboptions: + algorithim_type: + description: Specify the type of algorithim + type: str + choices: ["md5", "sha1"] + key: + description: Specify key + type: str + clear_key: + description: Specify key in cleartext form + type: str + password_key: + description: Specify key in encrypted form + type: str + capability: + description: Enable specific OSPFv3 feature + type: dict + suboptions: + type7: + description: Specify type7 nssa capability + type: dict + suboptions: + prefer: + description: Prefer type7 externals over type5 + type: bool + translate: + description: Translate type7 to type5 + type: bool + cost: + description: Specify Interface cost + type: int + database_filter: + description: Filter LSAs during synchronization and flooding + type: dict + suboptions: + all_outgoing_lsa: + description: Filter all outgoing LSA + type: bool + dead_interval: + description: Interval after which a neighbor is declared dead + type: int + default_information_originate: + description: Control distribution of default information + type: dict + suboptions: + always: + description: Always advertise default route + type: bool + metric: + description: ospfv3 default metric + type: int + metric_type: + description: ospfv3 metric type for default routes + type: int + route_policy: + description: Apply route-policy to default-information origination + type: str + tag: + description: Set tag for default route + type: int + set: + description: Enable distribution of default route + type: bool + default_metric: + description: Set metric of redistributed routes + type: int + demand_circuit: + description: Enable/Disable ospfv3 demand circuit + type: bool + distance: + description: Define an administrative distance + type: dict + suboptions: + admin_distance: + description: Administrative distance + type: int + ospfv3_distance: + description: ospfv3 administrative distance + type: dict + suboptions: + external: + description: Distance for external routes + type: int + inter_area: + description: Distance for inter-area routes + type: int + intra_area: + description: Distance for intra-area routes + type: int + distribute_list: + description: Filter prefixes to/from RIB + type: dict + suboptions: + prefix_list: + description: Filter prefixes based on an IPv6 prefix-list + type: list + elements: str + suboptions: + name: + description: Specify Prefix-list name + type: str + in: + description: Filter prefixes installed to RIB + type: bool + out: + description: Filter prefixes redistributed from RIB + type: bool + encryption: + description: Encrypt and authenticate OSPFv3 packets + type: dict + suboptions: + disable: + description: Do not encrypt OSPFv3 packets + type: bool + default: false + ipsec: + description: Specify IPSec ESP encryption and authentication + type: dict + suboptions: + spi: + description: Specify the Security Parameter Index value + type: int + esp: + description: Specify encryption parameters + type: dict + suboptions: + triple_des: + description: This specify the triple DES algorithim + type: dict + suboptions: + key: + description: Cleartext 3DES key + type: str + clear_key: + description: Specify 3DES key in cleartext form + type: str + password_key: + description: Specify 3DES key in encrypted form + type: str + aes: + description: This specify the aes algorithim + type: dict + suboptions: + algorithim_type: + description: Specify the bit encryption for aes algorithim + type: str + choices: ["192", "256"] + key: + description: Cleartext AES key + type: str + clear_key: + description: Specify AES key in cleartext form + type: str + password_key: + description: Specify AES key in encrypted form + type: str + des: + description: This specify the des algorithim + type: dict + suboptions: + key: + description: Cleartext AES key + type: str + clear_key: + description: Specify AES key in cleartext form + type: str + password_key: + description: Specify AES key in encrypted form + type: str + null_encryption: + description: Specify null encryption attributes + type: dict + suboptions: + authentication: + description: Specify authentication parameters + type: dict + suboptions: + algorithim_type: + description: Specify the type of algorithim + type: str + choices: ["md5", "sha1"] + key: + description: Specify key + type: str + clear_key: + description: Specify key in cleartext form + type: str + password_key: + description: Specify key in encrypted form + type: str + fast_reroute: + description: Specify IP Fast Reroute + type: dict + suboptions: + disabled: + description: Disable IP fast reroute + type: bool + per_link: + description: Specify per-prefix computation + type: dict + suboptions: + information_type: + description: Specify per-link LFA exclusion or FRR LFA candidate information + type: str + choices: ["exclude", "lfa_candidate"] + use_candidate_only: + description: Enable/Disable backup selection from candidate-list only + type: bool + interface: + description: Specify Per-link LFA exclusion information + type: dict + suboptions: + bvi: + description: Specify Bridge-Group Virtual Interface + type: list + elements: int + bundle_ether: + description: Specify Aggregated Ethernet interface(s) + type: list + elements: int + pos_int: + description: Specify Aggregated pos interface(s) + type: list + elements: int + fast_ethernet: + description: Specify FastEthernet/IEEE 802.3 interface(s) + type: list + elements: str + fiftygige: + description: Specify FiftyGigE/IEEE 802.3 interface(s) + type: list + elements: str + fortygige: + description: Specify FortyGigE/IEEE 802.3 interface(s) + type: list + elements: str + fourhundredgige: + description: Specify FourHundredGigE/IEEE 802.3 interface(s) + type: list + elements: str + gigabitethernet: + description: Specify GigabitEthernet/IEEE 802.3 interface(s) + type: list + elements: str + hundredgige: + description: Specify HundredGigE/IEEE 802.3 interface(s) + type: list + elements: str + mgmteth: + description: Specify MgmtEth/IEEE 802.3 interface(s) + type: list + elements: str + multilink: + description: Specify Multilink network interface(s) + type: list + elements: str + pw_ether: + description: Specify PWHE Ethernet Interface + type: list + elements: int + pw_iw: + description: Specify PWHE VC11 IP Interworking Interface + type: list + elements: int + srp: + description: Specify SRP interface(s) + type: list + elements: str + serial: + description: Specify Serial network interface(s) + type: list + elements: str + tengige: + description: Specify TenGigabitEthernet/IEEE 802.3 interface(s) + type: list + elements: str + twentyfivegige: + description: Specify TwentyFiveGigabitEthernet/IEEE 802.3 interface(s) + type: list + elements: str + twohundredgige: + description: Specify TwoHundredGigE/IEEE 802.3 interface(s) + type: list + elements: str + nve: + description: Specify Network Virtualization Endpoint Interface(s) + type: list + elements: int + tunnel_ip: + description: Specify GRE/IPinIP Tunnel Interface(s) + type: list + elements: int + tunnel_ipsec: + description: Specify IPSec Tunnel interface(s) + type: list + elements: int + tunnel_mte: + description: Specify MPLS Traffic Engineering P2MP Tunnel interface(s) + type: list + elements: int + tunnel_mpls: + description: MPLS Transport Protocol Tunnel interface + type: int + per_prefix: + description: Specify per-prefix computation + type: dict + suboptions: + information_type: + description: Specify per_prefix LFA exclusion or FRR LFA candidate information + type: str + choices: ["exclude", "lfa_candidate"] + use_candidate_only: + description: Enable/Disable backup selection from candidate-list only + type: bool + interface: + description: Specify Per-link LFA exclusion information + type: dict + suboptions: + bvi: + description: Specify Bridge-Group Virtual Interface + type: list + elements: int + bundle_ether: + description: Specify Aggregated Ethernet interface(s) + type: list + elements: int + post_int: + description: Specify Aggregated pos interface(s) + type: list + elements: int + fast_ethernet: + description: Specify FastEthernet/IEEE 802.3 interface(s) + type: list + elements: str + fiftygige: + description: Specify FiftyGigE/IEEE 802.3 interface(s) + type: list + elements: str + fortygige: + description: Specify FortyGigE/IEEE 802.3 interface(s) + type: list + elements: str + fourhundredgige: + description: Specify FourHundredGigE/IEEE 802.3 interface(s) + type: list + elements: str + gigabitethernet: + description: Specify GigabitEthernet/IEEE 802.3 interface(s) + type: list + elements: str + hundredgige: + description: Specify HundredGigE/IEEE 802.3 interface(s) + type: list + elements: str + mgmteth: + description: Specify MgmtEth/IEEE 802.3 interface(s) + type: list + elements: str + multilink: + description: Specify Multilink network interface(s) + type: list + elements: str + pw_ether: + description: Specify PWHE Ethernet Interface + type: list + elements: int + pw_iw: + description: Specify PWHE VC11 IP Interworking Interface + type: list + elements: int + srp: + description: Specify SRP interface(s) + type: list + elements: str + serial: + description: Specify Serial network interface(s) + type: list + elements: str + tengige: + description: Specify TenGigabitEthernet/IEEE 802.3 interface(s) + type: list + elements: str + twentyfivegige: + description: Specify TwentyFiveGigabitEthernet/IEEE 802.3 interface(s) + type: list + elements: str + twohundredgige: + description: Specify TwoHundredGigE/IEEE 802.3 interface(s) + type: list + elements: str + nve: + description: Specify Network Virtualization Endpoint Interface(s) + type: list + elements: int + tunnel_ip: + description: Specify GRE/IPinIP Tunnel Interface(s) + type: list + elements: int + tunnel_ipsec: + description: Specify IPSec Tunnel interface(s) + type: list + elements: int + tunnel_mte: + description: Specify MPLS Traffic Engineering P2MP Tunnel interface(s) + type: list + elements: int + tunnel_mpls: + description: MPLS Transport Protocol Tunnel interface + type: int + flood_reduction: + description: Enable/Disable flood reduction + type: bool + graceful_restart: + description: Enable Graceful-Restart + type: dict + suboptions: + set: + description: Set graceful restart + type: bool + helper_disable: + description: Disable router's helper support level + type: bool + min_interval: + description: Minimum interval between Graceful Restarts + type: int + max_interval: + description: Maximum route lifetime following restart + type: int + hello_interval: + description: Specify Time between HELLO packets + type: int + ignore_mospf_type6_lsa: + description: Ignore MOSPF Type 6 LSA + type: bool + instance_id: + description: Specify instance ID + type: int + log_adjacency_changes: + description: Log adjacency state changes + type: dict + suboptions: + set: + description: Set log adjacency + type: bool + disable: + description: Disable log adjacency changes + type: bool + detail: + description: Log all state changes + type: bool + maximum: + description: Set OSPFv3 limits + type: dict + suboptions: + interfaces: + description: Specify limit for number of interfaces + type: int + paths: + description: Specify limit for number of paths + type: int + redistributed_prefixes: + description: Specify limit for number of redistributed prefixes + type: int + mpls_ldp_sync: + description: Enable/Disable MPLS LDP Sync + type: bool + mtu_ignore: + description: Enable/Disable ignoring of MTU in DBD packets + type: bool + network: + description: Specify Network type + type: str + choices: ["broadcast", "non-broadcast", "point-to-multipoint", "point-to-point"] + nsr: + description: Enable/Disable NSR for all VRFs in this process + type: bool + packet_size: + description: Specify limit size of OSPFv3 packets + type: int + passive: + description: Enable/Disable routing updates on an interface + type: bool + prefix_suppression: + description: Hide all transit addresses on this interface + type: bool + priority: + description: Specify Router priority + type: int + protocol_shutdown: + description: Gracefully shutdown the OSPFv3 protocol + type: bool + redistribute: + description: Redistribute information from another routing Protocol + type: dict + suboptions: + application: + description: Specify application routes + type: list + elements: dict + suboptions: + id: + description: OnePK Application name + type: str + required: true + set: + description: Set application route + type: bool + metric: + description: Specify metric for redistributed routes + type: int + metric_type: + description: Specify OSPFv3 exterior metric type for redistributed routes + type: int + route_policy: + description: Apply route policy to redistribution + type: str + tag: + description: Set tag for routes redistributed into OSPFv3 + type: int + bgp: + description: Specify bgp routes + type: list + elements: dict + suboptions: + id: + description: BGP process name + type: int + required: true + set: + description: Set bgp route number + type: bool + metric: + description: Specify metric for redistributed routes + type: int + metric_type: + description: Specify OSPFv3 exterior metric type for redistributed routes + type: int + preserved_med: + description: Specify preserve med of BGP routes + type: str + route_policy: + description: Apply route policy to redistribution + type: str + tag: + description: Set tag for routes redistributed into OSPFv3 + type: int + connected: + description: Specify connected routes + type: dict + suboptions: + set: + description: Set connected route + type: bool + metric: + description: Specify metric for redistributed routes + type: int + metric_type: + description: Specify OSPFv3 exterior metric type for redistributed routes + type: int + route_policy: + description: Apply route policy to redistribution + type: str + tag: + description: Set tag for routes redistributed into OSPFv3 + type: int + eigrp: + description: Specify eigrp routes + type: list + elements: dict + suboptions: + id: + description: EIGRP process name + type: int + required: true + set: + description: Set bgp route number + type: bool + match: + description: Redistribution of EIGRP routes + type: str + choices: ["external", "internal"] + metric: + description: Specify metric for redistributed routes + type: int + metric_type: + description: Specify OSPFv3 exterior metric type for redistributed routes + type: int + route_policy: + description: Apply route policy to redistribution + type: str + tag: + description: Set tag for routes redistributed into OSPFv3 + type: int + isis: + description: Specify IS-IS routes + type: list + elements: dict + suboptions: + id: + description: IS-IS name + type: str + required: true + set: + description: Set IS-IS route number + type: bool + level: + description: Specify IS-IS level routes + type: str + choices: ["level-1", "level-1-2", "level-2"] + metric: + description: Specify metric for redistributed routes + type: int + metric_type: + description: Specify OSPFv3 exterior metric type for redistributed routes + type: int + route_policy: + description: Apply route policy to redistribution + type: str + tag: + description: Set tag for routes redistributed into OSPFv3 + type: int + mobile: + description: Specify mobile routes + type: dict + suboptions: + set: + description: Set mobile route number + type: bool + metric: + description: Specify metric for redistributed routes + type: int + metric_type: + description: Specify OSPFv3 exterior metric type for redistributed routes + type: int + route_policy: + description: Apply route policy to redistribution + type: str + tag: + description: Set tag for routes redistributed into OSPFv3 + type: int + ospfv3: + description: Specify ospfv3 routes + type: list + elements: dict + suboptions: + id: + description: OSPFv3 process name + type: str + required: true + set: + description: Set ospfv3 route number + type: bool + match: + description: Redistribution of OSPFv3 routes + type: dict + suboptions: + external: + description: Redistribute OSPFv3 external routes + type: int + choices: ["1", "2"] + nssa_external: + description: Redistribute NSSA OSPFv3 external routes + type: int + choices: ["1", "2"] + internal: + description: Redistribute OSPFv3 internal routes + type: bool + metric: + description: Specify metric for redistributed routes + type: int + metric_type: + description: Specify OSPFv3 exterior metric type for redistributed routes + type: int + route_policy: + description: Apply route policy to redistribution + type: str + tag: + description: Set tag for routes redistributed into OSPFv3 + type: int + static: + description: Specify static routes + type: dict + suboptions: + set: + description: Set static route + type: bool + metric: + description: Specify metric for redistributed routes + type: int + metric_type: + description: Specify OSPFv3 exterior metric type for redistributed routes + type: int + route_policy: + description: Apply route policy to redistribution + type: str + tag: + description: Set tag for routes redistributed into OSPFv3 + type: int + subscriber: + description: Specify subscriber routes + type: dict + suboptions: + set: + description: Set static route + type: bool + metric: + description: Specify metric for redistributed routes + type: int + metric_type: + description: Specify OSPFv3 exterior metric type for redistributed routes + type: int + route_policy: + description: Apply route policy to redistribution + type: str + tag: + description: Set tag for routes redistributed into OSPFv3 + type: int + retransmit_interval: + description: Delay between LSA retransmissions + type: int + router_id: + description: ospfv3 router-id in IPv4 address format (A.B.C.D) + type: str + spf_prefix_priority: + description: Specify SPF configuration + type: dict + suboptions: + disable: + description: Disable SPF prefix priority + type: bool + route_policy: + description: Specify the route-policy to prioritize route install + type: list + elements: dict + suboptions: + name: + description: Specify name of the policy + type: str + value: + description: Specify parameter values for the policy () + type: str + stub_router: + description: Enter stub router configuration submode + type: dict + suboptions: + router_lsa: + description: Modify self originated router LSAs + type: dict + suboptions: + advertise_with: + description: Advertise LSAs with specified type + type: str + choices: ["max-metric", "r-bit", "v6-bit"] + always: + description: Force ospfv3 stub router mode unconditionally + type: bool + external_lsa: + description: Override External LSA metric in stub router mode + type: dict + suboptions: + set: + description: Set external lsa + type: bool + metric: + description: Metric to use while in stub router mode + type: int + include_stub: + description: Set maximum metric for stub links in stub router mode + type: bool + on_proc_migration: + description: Enter stub router mode on ospfv3 process migration + type: int + on_proc_restart: + description: Enter stub router mode on ospfv3 process restart + type: int + on_startup: + description: Enter stub router mode on startup + type: dict + suboptions: + time: + description: Time in seconds to stay in stub router mode + type: int + wait_for_bgp: + description: Exit stub router mode when BGP converges + type: bool + on_switchover: + description: Enter stub router mode on RP switchover + type: int + summary_lsa: + description: Override Summary LSA metric in stub router mode + type: dict + suboptions: + set: + description: Enable summary LSA + type: bool + metric: + description: Metric to use while in stub router mode + type: int + summary_prefix: + description: Configure IP address summaries + type: list + elements: dict + suboptions: + prefix: + description: IP summary address/mask (A.B.C.D/prefix) + type: str + required: True + not_advertise: + description: Suppress routes that match the specified prefix/mask pair + type: bool + tag: + description: Set tag + type: int + timers: + description: Adjust routing timers + type: dict + suboptions: + lsa_arrival: + description: Specify LSA arrival timers + type: int + pacing: + description: Specify pacing timers + type: dict + suboptions: + flood: + description: Flood pacing timer + type: int + lsa_group: + description: LSA group pacing timer + type: int + retransmission: + description: LSA group pacing timer + type: int + throttle: + description: Adjust throttle timers + type: dict + suboptions: + lsa: + description: Specify LSA throttle timers + type: dict + suboptions: + all_lsa_initial: + description: Delay to generate first occurrence of LSA in milliseconds + type: int + all_lsa_minimum: + description: Minimum delay between originating the same LSA in milliseconds + type: int + spf: + description: Specify SPF throttle timers + type: dict + suboptions: + spf_initial: + description: Delay to generate first occurrence of SPF in ms + type: int + spf_minimum: + description: Minimum delay between originating the same SPF in ms + type: int + trace: + description: Specify OSPF tracing options + type: dict + suboptions: + size: + description: Delete existing buffer and create one with N entries + type: str + value: + description: Specify trace entry + type: int + transmit_delay: + description: Estimated time needed to send link-state update packet + type: int + state: + description: + - The state the configuration should be left in + type: str + choices: + - merged + - replaced + - overridden + - deleted + - gathered + - rendered + - parsed + default: merged +""" +EXAMPLES = """ +# Using merged + +# Before state: +# ------------- +# +# RP/0/RP0/CPU0:anton#show running-config router ospfv3 +# Thu Jun 11 15:54:44.569 UTC +# % No such configuration item(s) +# + +- name: Merge provided OSPFv3 configuration with the existing configuration + cisco.iosxr.iosxr_ospfv3: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - process_id: 26 + authentication: + disable: true + - process_id: 10 + areas: + - area_id: 11 + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: 30 + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + packet_size: 577 + priority: 1 + router_id: '2.2.2.2' + demand_circuit: true + mtu_ignore: true + state: merged + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "before": {} +# +# "commands": [ +# "router ospfv3 10", +# "area 11 default-cost 5", +# "area 11 cost 11", +# "area 22 default-cost 6", +# "router ospfv3 26", +# "authentication disable", +# "router ospfv3 27", +# "area 10 hello-interval 2", +# "router ospfv3 30", +# "cost 2", +# "priority 1", +# "default-metric 10", +# "router-id 2.2.2.2", +# "demand-circuit", +# "packet-size 577", +# "transmit-delay 2", +# "dead-interval 2", +# "hello-interval 1", +# "retransmit-interval 2", +# "mtu-ignore", +# "area 11 default-cost 5", +# "area 22 default-cost 6" +# ] +# +# "after": { +# "processes": [ +# { +# "areas": [ +# { +# "area_id": "11", +# "cost": 11, +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "process_id": "10" +# }, +# { +# "authentication": { +# "disable": true +# }, +# "process_id": "26" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "hello_interval": 2 +# } +# ], +# "process_id": "27" +# }, +# { +# "areas": [ +# { +# "area_id": "11", +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "cost": 2, +# "dead_interval": 2, +# "default_metric": 10, +# "demand_circuit": true, +# "hello_interval": 1, +# "mtu_ignore": true, +# "packet_size": 577, +# "priority": 1, +# "process_id": "30", +# "retransmit_interval": 2, +# "router_id": "2.2.2.2", +# "transmit_delay": 2 +# } +# ] +# } +# +# +# ------------ +# After state +# ------------ +# +# RP/0/RP0/CPU0:anton#show running-config router ospfv3 +# router ospfv3 10 +# area 11 +# cost 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# router ospfv3 26 +# authentication disable +# ! +# router ospfv3 27 +# area 10 +# hello-interval 2 +# ! +# area 20 +# ! +# area 30 +# ! +# ! +# router ospfv3 30 +# cost 2 +# priority 1 +# mtu-ignore +# packet-size 577 +# dead-interval 2 +# retransmit-interval 2 +# demand-circuit +# hello-interval 1 +# transmit-delay 2 +# router-id 2.2.2.2 +# default-metric 10 +# area 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# router ospfv3 10 +# area 11 +# cost 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# router ospfv3 26 +# authentication disable +# ! +# router ospfv3 27 +# area 10 +# hello-interval 2 +# ! +# area 20 +# ! +# area 30 +# ! +# ! +# router ospfv3 30 +# cost 2 +# priority 1 +# mtu-ignore +# packet-size 577 +# dead-interval 2 +# retransmit-interval 2 +# demand-circuit +# hello-interval 1 +# transmit-delay 2 +# router-id 2.2.2.2 +# default-metric 10 +# area 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! + + + +# Using replaced +# +# ------------ +# Before state +# ------------ +# +# +# RP/0/RP0/CPU0:anton#show running-config router ospf +# router ospfv3 10 +# area 11 +# cost 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# router ospfv3 26 +# authentication disable +# ! +# router ospfv3 27 +# area 10 +# hello-interval 2 +# ! +# area 20 +# ! +# area 30 +# ! +# ! +# router ospfv3 30 +# cost 2 +# priority 1 +# mtu-ignore +# packet-size 577 +# dead-interval 2 +# retransmit-interval 2 +# demand-circuit +# hello-interval 1 +# transmit-delay 2 +# router-id 2.2.2.2 +# default-metric 10 +# area 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# router ospfv3 10 +# area 11 +# cost 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# router ospfv3 26 +# authentication disable +# ! +# router ospfv3 27 +# area 10 +# hello-interval 2 +# ! +# area 20 +# ! +# area 30 +# ! +# ! +# router ospfv3 30 +# cost 2 +# priority 1 +# mtu-ignore +# packet-size 577 +# dead-interval 2 +# retransmit-interval 2 +# demand-circuit +# hello-interval 1 +# transmit-delay 2 +# router-id 2.2.2.2 +# default-metric 10 +# area 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! + +- name: Replace OSPFv3 routes configurations from the device + cisco.iosxr.iosxr_ospfv3: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - area_id: 20 + cost: 2 + default_cost: 2 + - process_id: 26 + authentication: + disable: true + state: replaced + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "before": { +# "processes": [ +# { +# "areas": [ +# { +# "area_id": "11", +# "cost": 11, +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "process_id": "10" +# }, +# { +# "authentication": { +# "disable": true +# }, +# "process_id": "26" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "hello_interval": 2 +# } +# ], +# "process_id": "27" +# }, +# { +# "areas": [ +# { +# "area_id": "11", +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "cost": 2, +# "dead_interval": 2, +# "default_metric": 10, +# "demand_circuit": true, +# "hello_interval": 1, +# "mtu_ignore": true, +# "packet_size": 577, +# "priority": 1, +# "process_id": "30", +# "retransmit_interval": 2, +# "router_id": "2.2.2.2", +# "transmit_delay": 2 +# } +# ] +# } +# +# "commands": [ +# "router ospfv3 27", +# "area 20 default-cost 2", +# "area 20 cost 2" +# ] +# +# "after": { +# "processes": [ +# { +# "areas": [ +# { +# "area_id": "11", +# "cost": 11, +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "process_id": "10" +# }, +# { +# "authentication": { +# "disable": true +# }, +# "process_id": "26" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "hello_interval": 2 +# }, +# { +# "area_id": "20", +# "cost": 2, +# "default_cost": 2 +# } +# ], +# "process_id": "27" +# }, +# { +# "areas": [ +# { +# "area_id": "11", +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "cost": 2, +# "dead_interval": 2, +# "default_metric": 10, +# "demand_circuit": true, +# "hello_interval": 1, +# "mtu_ignore": true, +# "packet_size": 577, +# "priority": 1, +# "process_id": "30", +# "retransmit_interval": 2, +# "router_id": "2.2.2.2", +# "transmit_delay": 2 +# } +# ] +# } +# +# +# ----------- +# After state +# ----------- +# +# RP/0/RP0/CPU0:anton(config)#do show running-config router ospfv3 +# router ospfv3 10 +# area 11 +# cost 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# router ospfv3 26 +# authentication disable +# ! +# router ospfv3 27 +# area 10 +# hello-interval 2 +# ! +# area 20 +# cost 2 +# default-cost 2 +# ! +# area 30 +# ! +# ! +# router ospfv3 30 +# cost 2 +# priority 1 +# mtu-ignore +# packet-size 577 +# dead-interval 2 +# retransmit-interval 2 +# demand-circuit +# hello-interval 1 +# transmit-delay 2 +# router-id 2.2.2.2 +# default-metric 10 +# area 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! + + +- name: Override existing OSPFv3 configurations from the device + cisco.iosxr.iosxr_ospfv3: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + authentication: + disable: true + - area_id: 20 + cost: 2 + default_cost: 2 + authentication: + disable: true + - process_id: 26 + areas: + - area_id: 10 + hello_interval: 2 + authentication: + disable: true + state: overridden + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "before": { +# "processes": [ +# { +# "areas": [ +# { +# "area_id": "11", +# "cost": 11, +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "process_id": "10" +# }, +# { +# "authentication": { +# "disable": true +# }, +# "process_id": "26" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "hello_interval": 2 +# }, +# { +# "area_id": "20", +# "cost": 2, +# "default_cost": 2 +# } +# ], +# "process_id": "27" +# }, +# { +# "areas": [ +# { +# "area_id": "11", +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "cost": 2, +# "dead_interval": 2, +# "default_metric": 10, +# "demand_circuit": true, +# "hello_interval": 1, +# "mtu_ignore": true, +# "packet_size": 577, +# "priority": 1, +# "process_id": "30", +# "retransmit_interval": 2, +# "router_id": "2.2.2.2", +# "transmit_delay": 2 +# } +# ] +# } +# +# "commands": [ +# "router ospfv3 10", +# "no area 11 default-cost 5", +# "no area 11 cost 11", +# "no area 22 default-cost 6", +# "router ospfv3 30", +# "no cost 2", +# "no priority 1", +# "no default-metric 10", +# "no router-id 2.2.2.2", +# "no demand-circuit", +# "no packet-size 577", +# "no transmit-delay 2", +# "no dead-interval 2", +# "no hello-interval 1", +# "no retransmit-interval 2", +# "no mtu-ignore", +# "no area 11 default-cost 5", +# "no area 22 default-cost 6", +# "router ospfv3 26", +# "area 10 hello-interval 4" +# ] +# +# "after": { +# "processes": [ +# { +# "process_id": "10" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "hello_interval": 4 +# } +# ], +# "authentication": { +# "disable": true +# }, +# "process_id": "26" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "hello_interval": 2 +# }, +# { +# "area_id": "20", +# "cost": 2, +# "default_cost": 2 +# } +# ], +# "process_id": "27" +# }, +# { +# "process_id": "30" +# } +# ] +# } +# +# +# ----------- +# After state +# ----------- +# +# RP/0/RP0/CPU0:anton#show running-config router ospfv3 +# router ospfv3 10 +# area 11 +# ! +# area 22 +# ! +# ! +# router ospfv3 26 +# authentication disable +# area 10 +# hello-interval 4 +# ! +# ! +# router ospfv3 27 +# area 10 +# hello-interval 2 +# ! +# area 20 +# cost 2 +# default-cost 2 +# ! +# area 30 +# ! +# ! +# router ospfv3 30 +# area 11 +# ! +# area 22 +# ! +# ! + + + +# Using deleted +# +# ------------ +# Before state +# ------------ +# +# +# RP/0/RP0/CPU0:anton#show running-config router ospfv3 +# router ospfv3 10 +# area 11 +# ! +# area 22 +# ! +# ! +# router ospfv3 26 +# authentication disable +# area 10 +# hello-interval 4 +# ! +# ! +# router ospfv3 27 +# area 10 +# hello-interval 2 +# ! +# area 20 +# cost 2 +# default-cost 2 +# ! +# area 30 +# ! +# ! +# router ospfv3 30 +# area 11 +# ! +# area 22 +# ! +# ! + +- name: Deleted existing OSPFv3 configurations from the device + cisco.iosxr.iosxr_ospfv3: + config: + processes: + - process_id: '10' + - process_id: '26' + - process_id: '27' + - process_id: '30' + state: deleted + +# +# +# ------------------------ +# Module Execution Result +# ------------------------ +# +# "before": { +# "processes": [ +# { +# "process_id": "10" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "hello_interval": 4 +# } +# ], +# "authentication": { +# "disable": true +# }, +# "process_id": "26" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "hello_interval": 2 +# }, +# { +# "area_id": "20", +# "cost": 2, +# "default_cost": 2 +# } +# ], +# "process_id": "27" +# }, +# { +# "process_id": "30" +# } +# ] +# }, +# +# "commands": [ +# "router ospfv3 26", +# "no authentication disable", +# "no area 10 hello-interval 4", +# "router ospfv3 27", +# "no area 10 hello-interval 2", +# "no area 20 default-cost 2", +# "no area 20 cost 2" +# ] +# +# "after": { +# "processes": [ +# { +# "process_id": "10" +# }, +# { +# "process_id": "26" +# }, +# { +# "process_id": "27" +# }, +# { +# "process_id": "30" +# } +# ] +# } +# +# +# ----------- +# After state +# ----------- +# +# RP/0/RP0/CPU0:anton(config)#show running-config router ospfv3 +# router ospfv3 10 +# ! +# router ospfv3 26 +# ! +# router ospfv3 27 +# ! +# router ospfv3 30 +# ! + + +# Using parsed +# parsed.cfg +# ------------ +# router ospfv3 10 +# area 11 +# cost 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# router ospfv3 26 +# authentication disable +# ! +# router ospfv3 27 +# area 10 +# hello-interval 2 +# ! +# ! +# router ospfv3 30 +# router-id 2.2.2.2 +# cost 2 +# packet-size 577 +# priority 1 +# mtu-ignore +# dead-interval 2 +# retransmit-interval 2 +# demand-circuit +# hello-interval 1 +# transmit-delay 2 +# default-metric 10 +# area 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +- name: Parsed the device configuration to get output commands + cisco.iosxr.iosxr_ospfv3: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# +# "parsed": { +# "processes": [ +# { +# "areas": [ +# { +# "area_id": "11", +# "cost": 11, +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "process_id": "10" +# }, +# { +# "authentication": { +# "disable": true +# }, +# "process_id": "26" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "hello_interval": 2 +# } +# ], +# "process_id": "27" +# }, +# { +# "areas": [ +# { +# "area_id": "11", +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "cost": 2, +# "dead_interval": 2, +# "default_metric": 10, +# "demand_circuit": true, +# "hello_interval": 1, +# "mtu_ignore": true, +# "packet_size": 577, +# "priority": 1, +# "process_id": "30", +# "retransmit_interval": 2, +# "router_id": "2.2.2.2", +# "transmit_delay": 2 +# } +# ] +# } +# +# Using rendered +# +# +- name: Render the commands for provided configuration + cisco.iosxr.iosxr_ospfv3: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - process_id: 26 + authentication: + disable: true + - process_id: 10 + areas: + - area_id: 11 + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: 30 + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + packet_size: 577 + priority: 1 + router_id: '2.2.2.2' + demand_circuit: true + mtu_ignore: true + state: rendered + +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# +# "rendered": [ +# "router ospfv3 27", +# "area 10 hello-interval 2", +# "router ospfv3 26", +# "authentication disable", +# "router ospfv3 10", +# "area 11 default-cost 5", +# "area 11 cost 11", +# "area 22 default-cost 6", +# "router ospfv3 30", +# "cost 2", +# "priority 1", +# "default-metric 10", +# "router-id 2.2.2.2", +# "demand-circuit", +# "packet-size 577", +# "transmit-delay 2", +# "dead-interval 2", +# "hello-interval 1", +# "retransmit-interval 2", +# "mtu-ignore", +# "area 11 default-cost 5", +# "area 22 default-cost 6" +# ] + + +# Using gathered +# +# Before state: +# ------------- +# +# RP/0/RP0/CPU0:anton#show running-config router ospf +# router ospfv3 10 +# area 11 +# cost 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! +# router ospfv3 26 +# authentication disable +# area 10 +# ! +# ! +# router ospfv3 27 +# area 10 +# hello-interval 2 +# ! +# area 20 +# ! +# area 30 +# ! +# ! +# router ospfv3 30 +# cost 2 +# priority 1 +# mtu-ignore +# packet-size 577 +# dead-interval 2 +# retransmit-interval 2 +# demand-circuit +# hello-interval 1 +# transmit-delay 2 +# router-id 2.2.2.2 +# default-metric 10 +# area 11 +# default-cost 5 +# ! +# area 22 +# default-cost 6 +# ! +# ! + +- name: Gather ospfv3 routes configuration + cisco.iosxr.iosxr_ospfv3: + state: gathered +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# "gathered": { +# "processes": [ +# { +# "areas": [ +# { +# "area_id": "11", +# "cost": 11, +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "process_id": "10" +# }, +# { +# "authentication": { +# "disable": true +# }, +# "process_id": "26" +# }, +# { +# "areas": [ +# { +# "area_id": "10", +# "hello_interval": 2 +# } +# ], +# "process_id": "27" +# }, +# { +# "areas": [ +# { +# "area_id": "11", +# "default_cost": 5 +# }, +# { +# "area_id": "22", +# "default_cost": 6 +# } +# ], +# "cost": 2, +# "dead_interval": 2, +# "default_metric": 10, +# "demand_circuit": true, +# "hello_interval": 1, +# "mtu_ignore": true, +# "packet_size": 577, +# "priority": 1, +# "process_id": "30", +# "retransmit_interval": 2, +# "router_id": "2.2.2.2", +# "transmit_delay": 2 +# } +# ] +# } +# +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.ospfv3.ospfv3 import ( + Ospfv3Args, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.ospfv3.ospfv3 import ( + Ospfv3, +) + + +def main(): + """ + Main entry point for module execution + + :returns: the result form module invocation + """ + module = AnsibleModule( + argument_spec=Ospfv3Args.argument_spec, + mutually_exclusive=[["config", "running_config"]], + required_if=[ + ["state", "merged", ["config"]], + ["state", "replaced", ["config"]], + ["state", "overridden", ["config"]], + ["state", "rendered", ["config"]], + ["state", "parsed", ["running_config"]], + ], + supports_check_mode=True, + ) + + result = Ospfv3(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_static_routes.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_static_routes.py new file mode 100644 index 00000000..238582d2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_static_routes.py @@ -0,0 +1,854 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# + +""" +The module file for iosxr_static_routes +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_static_routes +short_description: Static routes resource module +description: +- This module manages static routes on devices running Cisco IOS-XR. +version_added: 1.0.0 +author: Nilashish Chakraborty (@NilashishC) +options: + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the IOS-XR device + by executing the command B(show running-config router static). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. + type: str + config: + description: A dictionary of static route options. + type: list + elements: dict + suboptions: + vrf: + description: + - The VRF to which the static route(s) belong. + type: str + address_families: + description: A dictionary specifying the address family to which the static + route(s) belong. + type: list + elements: dict + suboptions: + afi: + description: + - Specifies the top level address family indicator. + type: str + choices: + - ipv4 + - ipv6 + required: true + safi: + description: + - Specifies the subsequent address family indicator. + type: str + choices: + - unicast + - multicast + required: true + routes: + description: A dictionary that specifies the static route configurations. + elements: dict + type: list + suboptions: + dest: + description: + - An IPv4 or IPv6 address in CIDR notation that specifies the destination + network for the static route. + type: str + required: true + next_hops: + description: + - Next hops to the specified destination. + type: list + elements: dict + suboptions: + forward_router_address: + description: + - The IP address of the next hop that can be used to reach the + destination network. + type: str + interface: + description: + - The interface to use to reach the destination. + type: str + dest_vrf: + description: + - The destination VRF. + type: str + admin_distance: + description: + - The administrative distance for this static route. + - Refer to vendor documentation for valid values. + type: int + metric: + description: + - Specifes the metric for this static route. + - Refer to vendor documentation for valid values. + type: int + description: + description: + - Specifies the description for this static route. + type: str + vrflabel: + description: + - Specifies the VRF label for this static route. + - Refer to vendor documentation for valid values. + type: int + tag: + description: + - Specifies a numeric tag for this static route. + - Refer to vendor documentation for valid values. + type: int + track: + description: + - Specifies the object to be tracked. + - This enables object tracking for static routes. + type: str + tunnel_id: + description: + - Specifies a tunnel id for the route. + - Refer to vendor documentation for valid values. + type: int + state: + description: + - The state the configuration should be left in. + type: str + choices: + - merged + - replaced + - overridden + - deleted + - gathered + - rendered + - parsed + default: merged + +""" +EXAMPLES = """ + +# Using merged + +# Before state +# ------------- +# RP/0/RP0/CPU0:ios#show running-config router static +# Sat Feb 22 07:46:30.089 UTC +# % No such configuration item(s) +# +- name: Merge the provided configuration with the exisiting running configuration + cisco.iosxr.iosxr_static_routes: + config: + - address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.16/28 + next_hops: + - forward_router_address: 192.0.2.10 + interface: FastEthernet0/0/0/1 + description: LAB + metric: 120 + tag: 10 + + - interface: FastEthernet0/0/0/5 + track: ip_sla_1 + + - dest: 192.0.2.32/28 + next_hops: + - forward_router_address: 192.0.2.11 + admin_distance: 100 + + - afi: ipv6 + safi: unicast + routes: + - dest: 2001:db8:1000::/36 + next_hops: + - interface: FastEthernet0/0/0/7 + description: DC + + - interface: FastEthernet0/0/0/8 + forward_router_address: 2001:db8:2000:2::1 + + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.12 + description: DEV + dest_vrf: test_1 + + - dest: 192.0.2.80/28 + next_hops: + - interface: FastEthernet0/0/0/2 + forward_router_address: 192.0.2.14 + dest_vrf: test_1 + track: ip_sla_2 + vrflabel: 124 + state: merged + +# After state +# ------------- +# RP/0/RP0/CPU0:ios#show running-config router static +# Sat Feb 22 07:49:11.754 UTC +# router static +# address-family ipv4 unicast +# 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 +# 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 +# 192.0.2.32/28 192.0.2.11 100 +# ! +# address-family ipv6 unicast +# 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC +# 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 +# ! +# vrf DEV_SITE +# address-family ipv4 unicast +# 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV +# 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 +# ! +# ! +# ! + +# Using merged to update existing static routes + +# Before state +# ------------- +# RP/0/RP0/CPU0:ios#show running-config router static +# Sat Feb 22 07:49:11.754 UTC +# router static +# address-family ipv4 unicast +# 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 +# 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 +# 192.0.2.32/28 192.0.2.11 100 +# ! +# address-family ipv6 unicast +# 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC +# 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 +# ! +# vrf DEV_SITE +# address-family ipv4 unicast +# 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV +# 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 +# ! +# ! +# ! + +- name: Update existing static routes configuration using merged + cisco.iosxr.iosxr_static_routes: + config: + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.12 + vrflabel: 2301 + dest_vrf: test_1 + + - dest: 192.0.2.80/28 + next_hops: + - interface: FastEthernet0/0/0/2 + forward_router_address: 192.0.2.14 + dest_vrf: test_1 + description: rt_test_1 + state: merged + +# After state +# ------------- +# RP/0/RP0/CPU0:ios#show running-config router static +# Sat Feb 22 07:49:11.754 UTC +# router static +# address-family ipv4 unicast +# 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 +# 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 +# 192.0.2.32/28 192.0.2.11 100 +# ! +# address-family ipv6 unicast +# 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC +# 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 +# ! +# vrf DEV_SITE +# address-family ipv4 unicast +# 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV vrflabel 2301 +# 192.0.2.80/28 vrf test_1 192.0.2.14 FastEthernet0/0/0/2 description rt_test_1 track ip_sla_2 vrflabel 124 +# ! +# ! +# ! + +# Using replaced to replace all next hop entries for a single destination network + +# Before state +# -------------- + +# RP/0/RP0/CPU0:ios#sh running-config router static +# Sat Feb 22 07:59:08.669 UTC +# router static +# address-family ipv4 unicast +# 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 +# 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 +# 192.0.2.32/28 192.0.2.11 100 +# ! +# address-family ipv6 unicast +# 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC +# 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 +# ! +# vrf DEV_SITE +# address-family ipv4 unicast +# 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV +# 192.0.2.48/28 GigabitEthernet0/0/0/1 192.0.3.24 vrflabel 2302 +# 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 +# ! +# ! +# ! + +- name: Replace device configurations of static routes with provided configurations + cisco.iosxr.iosxr_static_routes: + config: + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.15 + interface: FastEthernet0/0/0/3 + description: DEV_NEW + dest_vrf: dev_test_2 + state: replaced + +# After state +# ------------ +# RP/0/RP0/CPU0:ios#sh running-config router static +# Sat Feb 22 08:04:07.085 UTC +# router static +# address-family ipv4 unicast +# 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 +# 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 +# 192.0.2.32/28 192.0.2.11 100 +# ! +# address-family ipv6 unicast +# 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC +# 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 +# ! +# vrf DEV_SITE +# address-family ipv4 unicast +# 192.0.2.48/28 vrf dev_test_2 FastEthernet0/0/0/3 192.0.2.15 description DEV_NEW +# 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 +# ! +# ! +# ! + +# Using overridden to override all static route entries on the device + +# Before state +# ------------- +# RP/0/RP0/CPU0:ios#sh running-config router static +# Sat Feb 22 07:59:08.669 UTC +# router static +# address-family ipv4 unicast +# 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 +# 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 +# 192.0.2.32/28 192.0.2.11 100 +# ! +# address-family ipv6 unicast +# 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC +# 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 +# ! +# vrf DEV_SITE +# address-family ipv4 unicast +# 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV +# 192.0.2.48/28 GigabitEthernet0/0/0/1 192.0.3.24 vrflabel 2302 +# 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 +# ! +# ! +# ! + +- name: Overridde all static routes configuration with provided configuration + cisco.iosxr.iosxr_static_routes: + config: + - vrf: DEV_NEW + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.15 + interface: FastEthernet0/0/0/3 + description: DEV1 + - afi: ipv6 + safi: unicast + routes: + - dest: 2001:db8:3000::/36 + next_hops: + - interface: FastEthernet0/0/0/4 + forward_router_address: 2001:db8:2000:2::2 + description: PROD1 + track: ip_sla_1 + state: overridden + +# After state +# ------------- +# RP/0/RP0/CPU0:ios#sh running-config router static +# Sat Feb 22 08:07:41.516 UTC +# router static +# vrf DEV_NEW +# address-family ipv4 unicast +# 192.0.2.48/28 FastEthernet0/0/0/3 192.0.2.15 description DEV1 +# ! +# address-family ipv6 unicast +# 2001:db8:3000::/36 FastEthernet0/0/0/4 2001:db8:2000:2::2 description PROD1 track ip_sla_1 +# ! +# ! +# ! + +# Using deleted to delete all destination network entries under a single AFI + +# Before state +# ------------- +# RP/0/RP0/CPU0:ios#sh running-config router static +# Sat Feb 22 07:59:08.669 UTC +# router static +# address-family ipv4 unicast +# 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 +# 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 +# 192.0.2.32/28 192.0.2.11 100 +# ! +# address-family ipv6 unicast +# 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC +# 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 +# ! +# vrf DEV_SITE +# address-family ipv4 unicast +# 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV +# 192.0.2.48/28 GigabitEthernet0/0/0/1 192.0.3.24 vrflabel 2302 +# 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 +# ! +# ! +# ! + +- name: Delete all destination network entries under a single AFI + cisco.iosxr.iosxr_static_routes: + config: + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + state: deleted + +# After state +# ------------ + +# RP/0/RP0/CPU0:ios#sh running-config router static +# Sat Feb 22 08:16:41.464 UTC +# router static +# address-family ipv4 unicast +# 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 +# 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 +# 192.0.2.32/28 192.0.2.11 100 +# ! +# address-family ipv6 unicast +# 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC +# 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 +# ! +# vrf DEV_SITE +# ! +# ! + +# Using deleted to remove all static route entries from the device + +# Before state +# ------------- +# RP/0/RP0/CPU0:ios#sh running-config router static +# Sat Feb 22 07:59:08.669 UTC +# router static +# address-family ipv4 unicast +# 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 +# 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 +# 192.0.2.32/28 192.0.2.11 100 +# ! +# address-family ipv6 unicast +# 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC +# 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 +# ! +# vrf DEV_SITE +# address-family ipv4 unicast +# 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV +# 192.0.2.48/28 GigabitEthernet0/0/0/1 192.0.3.24 vrflabel 2302 +# 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 +# ! +# ! +# ! + +- name: Delete static routes configuration + cisco.iosxr.iosxr_static_routes: + state: deleted + +# After state +# ------------ +# RP/0/RP0/CPU0:ios#sh running-config router static +# Sat Feb 22 08:50:43.038 UTC +# % No such configuration item(s) + +# Using gathered to gather static route facts from the device + +- name: Gather static routes facts from the device using iosxr_static_routes module + cisco.iosxr.iosxr_static_routes: + state: gathered + +# Task output (redacted) +# ----------------------- +# "gathered": [ +# { +# "address_families": [ +# { +# "afi": "ipv4", +# "routes": [ +# { +# "dest": "192.0.2.16/28", +# "next_hops": [ +# { +# "description": "LAB", +# "forward_router_address": "192.0.2.10", +# "interface": "FastEthernet0/0/0/1", +# "metric": 120, +# "tag": 10 +# }, +# { +# "interface": "FastEthernet0/0/0/5", +# "track": "ip_sla_1" +# } +# ] +# }, +# { +# "dest": "192.0.2.32/28", +# "next_hops": [ +# { +# "admin_distance": 100, +# "forward_router_address": "192.0.2.11" +# } +# ] +# } +# ], +# "safi": "unicast" +# }, +# { +# "afi": "ipv6", +# "routes": [ +# { +# "dest": "2001:db8:1000::/36", +# "next_hops": [ +# { +# "description": "DC", +# "interface": "FastEthernet0/0/0/7" +# }, +# { +# "forward_router_address": "2001:db8:2000:2::1", +# "interface": "FastEthernet0/0/0/8" +# } +# ] +# } +# ], +# "safi": "unicast" +# } +# ] +# }, +# { +# "address_families": [ +# { +# "afi": "ipv4", +# "routes": [ +# { +# "dest": "192.0.2.48/28", +# "next_hops": [ +# { +# "description": "DEV", +# "dest_vrf": "test_1", +# "forward_router_address": "192.0.2.12" +# }, +# { +# "forward_router_address": "192.0.3.24", +# "interface": "GigabitEthernet0/0/0/1", +# "vrflabel": 2302 +# } +# ] +# }, +# { +# "dest": "192.0.2.80/28", +# "next_hops": [ +# { +# "dest_vrf": "test_1", +# "forward_router_address": "192.0.2.14", +# "interface": "FastEthernet0/0/0/2", +# "track": "ip_sla_2", +# "vrflabel": 124 +# } +# ] +# } +# ], +# "safi": "unicast" +# } +# ], +# "vrf": "DEV_SITE" +# } +# ] + +# Using rendered + +- name: Render platform specific commands (without connecting to the device) + cisco.iosxr.iosxr_static_routes: + config: + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.12 + description: DEV + dest_vrf: test_1 + + - dest: 192.0.2.80/28 + next_hops: + - interface: FastEthernet0/0/0/2 + forward_router_address: 192.0.2.14 + dest_vrf: test_1 + track: ip_sla_2 + vrflabel: 124 + +# Task Output (redacted) +# ----------------------- +# "rendered": [ +# "router static"s, +# "vrf DEV_SITE", +# "address-family ipv4 unicast", +# "192.0.2.48/28 vrf test_1 192.0.2.12 description DEV", +# "192.0.2.80/28 vrf test_1 192.0.2.14 FastEthernet0/0/0/2 track ip_sla_2 vrflabel 124" + +# Using parsed + +# parsed.cfg +# ------------ +# Fri Nov 29 21:10:41.896 UTC +# router static +# address-family ipv4 unicast +# 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 +# 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 +# 192.0.2.32/28 192.0.2.11 100 +# ! +# address-family ipv6 unicast +# 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC +# 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 +# ! +# vrf DEV_SITE +# address-family ipv4 unicast +# 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV +# 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 +# ! +# ! +# ! + +- name: Use parsed state to convert externally supplied device specific static routes + commands to structured format + cisco.iosxr.iosxr_static_routes: + running_config: "{{ lookup('file', '../../fixtures/parsed.cfg') }}" + state: parsed + +# Task output (redacted) +# ----------------------- +# "parsed": [ +# { +# "address_families": [ +# { +# "afi": "ipv4", +# "routes": [ +# { +# "dest": "192.0.2.16/28", +# "next_hops": [ +# { +# "description": "LAB", +# "forward_router_address": "192.0.2.10", +# "interface": "FastEthernet0/0/0/1", +# "metric": 120, +# "tag": 10 +# }, +# { +# "interface": "FastEthernet0/0/0/5", +# "track": "ip_sla_1" +# } +# ] +# }, +# { +# "dest": "192.0.2.32/28", +# "next_hops": [ +# { +# "admin_distance": 100, +# "forward_router_address": "192.0.2.11" +# } +# ] +# } +# ], +# "safi": "unicast" +# }, +# { +# "afi": "ipv6", +# "routes": [ +# { +# "dest": "2001:db8:1000::/36", +# "next_hops": [ +# { +# "description": "DC", +# "interface": "FastEthernet0/0/0/7" +# }, +# { +# "forward_router_address": "2001:db8:2000:2::1", +# "interface": "FastEthernet0/0/0/8" +# } +# ] +# } +# ], +# "safi": "unicast" +# } +# ] +# }, +# { +# "address_families": [ +# { +# "afi": "ipv4", +# "routes": [ +# { +# "dest": "192.0.2.48/28", +# "next_hops": [ +# { +# "description": "DEV", +# "dest_vrf": "test_1", +# "forward_router_address": "192.0.2.12" +# } +# ] +# }, +# { +# "dest": "192.0.2.80/28", +# "next_hops": [ +# { +# "dest_vrf": "test_1", +# "forward_router_address": "192.0.2.14", +# "interface": "FastEthernet0/0/0/2", +# "track": "ip_sla_2", +# "vrflabel": 124 +# } +# ] +# } +# ], +# "safi": "unicast" +# } +# ], +# "vrf": "DEV_SITE" +# } +# ] +# } +""" +RETURN = """ +before: + description: The configuration prior to the model invocation. + returned: always + type: list + sample: > + The configuration returned will always be in the same format + of the parameters above. +after: + description: The resulting configuration model invocation. + returned: when changed + type: list + sample: > + The configuration returned will always be in the same format + of the parameters above. +commands: + description: The set of commands pushed to the remote device. + returned: always + type: list + sample: + - router static + - vrf dev_site + - address-family ipv4 unicast + - 192.0.2.48/28 192.0.2.12 FastEthernet0/0/0/1 track ip_sla_10 description dev1 + - address-family ipv6 unicast + - no 2001:db8:1000::/36 + - 2001:db8:3000::/36 2001:db8:2000:2::2 FastEthernet0/0/0/4 track ip_sla_11 description prod1 +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.static_routes.static_routes import ( + Static_routesArgs, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.static_routes.static_routes import ( + Static_routes, +) + + +def main(): + """ + Main entry point for module execution + + :returns: the result form module invocation + """ + required_if = [ + ("state", "merged", ("config",)), + ("state", "replaced", ("config",)), + ("state", "overridden", ("config",)), + ("state", "parsed", ("running_config",)), + ] + mutually_exclusive = [("config", "running_config")] + + module = AnsibleModule( + argument_spec=Static_routesArgs.argument_spec, + required_if=required_if, + mutually_exclusive=mutually_exclusive, + supports_check_mode=True, + ) + + result = Static_routes(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_system.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_system.py new file mode 100644 index 00000000..4e9ccc6f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_system.py @@ -0,0 +1,943 @@ +#!/usr/bin/python +# +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_system +author: +- Peter Sprygada (@privateip) +- Kedar Kekan (@kedarX) +short_description: Manage the system attributes on Cisco IOS XR devices +description: +- This module provides declarative management of node system attributes on Cisco IOS + XR devices. It provides an option to configure host system parameters or remove + those parameters from the device active configuration. +version_added: 1.0.0 +requirements: +- ncclient >= 0.5.3 when using netconf +- lxml >= 4.1.1 when using netconf +extends_documentation_fragment: +- cisco.iosxr.iosxr +notes: +- This module works with connection C(network_cli) and C(netconf). See L(the IOS-XR + Platform Options,../network/user_guide/platform_iosxr.html). +- Tested against IOS XRv 6.1.3 +- name-servers I(state=absent) operation with C(netconf) transport is a success, but + with rpc-error. This is due to XR platform issue. Recommended to use I(ignore_errors) + option with the task as a workaround. +options: + hostname: + description: + - Configure the device hostname parameter. This option takes an ASCII string value. + type: str + vrf: + description: + - VRF name for domain services + type: str + default: "default" + domain_name: + description: + - Configure the IP domain name on the remote device to the provided value. Value + should be in the dotted name form and will be appended to the C(hostname) to + create a fully-qualified domain name. + type: str + domain_search: + description: + - Provides the list of domain suffixes to append to the hostname for the purpose + of doing name resolution. This argument accepts a list of names and will be + reconciled with the current active configuration on the running node. + type: list + elements: str + lookup_source: + description: + - The C(lookup_source) argument provides one or more source interfaces to use + for performing DNS lookups. The interface provided in C(lookup_source) must + be a valid interface configured on the device. + type: str + lookup_enabled: + description: + - Provides administrative control for enabling or disabling DNS lookups. When + this argument is set to True, lookups are performed and when it is set to False, + lookups are not performed. + type: bool + default: true + name_servers: + description: + - The C(name_serves) argument accepts a list of DNS name servers by way of either + FQDN or IP address to use to perform name resolution lookups. This argument + accepts wither a list of DNS servers See examples. + type: list + elements: str + state: + description: + - State of the configuration values in the device's current active configuration. When + set to I(present), the values should be configured in the device active configuration + and when set to I(absent) the values should not be in the device active configuration + default: present + choices: + - present + - absent + type: str +""" + +EXAMPLES = """ +- name: configure hostname and domain-name (default vrf=default) + cisco.iosxr.iosxr_system: + hostname: iosxr01 + domain_name: test.example.com + domain_search: + - ansible.com + - redhat.com + - cisco.com +- name: remove configuration + cisco.iosxr.iosxr_system: + hostname: iosxr01 + domain_name: test.example.com + domain_search: + - ansible.com + - redhat.com + - cisco.com + state: absent +- name: configure hostname and domain-name with vrf + cisco.iosxr.iosxr_system: + hostname: iosxr01 + vrf: nondefault + domain_name: test.example.com + domain_search: + - ansible.com + - redhat.com + - cisco.com +- name: configure DNS lookup sources + cisco.iosxr.iosxr_system: + lookup_source: MgmtEth0/0/CPU0/0 + lookup_enabled: true +- name: configure name servers + cisco.iosxr.iosxr_system: + name_servers: + - 8.8.8.8 + - 8.8.4.4 +""" + +RETURN = """ +commands: + description: The list of configuration mode commands to send to the device + returned: always + type: list + sample: + - hostname iosxr01 + - ip domain-name test.example.com +xml: + description: NetConf rpc xml sent to device with transport C(netconf) + returned: always (empty list when no xml rpc to send) + type: list + sample: + - ' + + + + default + + + 0 + redhat.com + + + + + + ' +""" + +import re +import collections + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + get_config, + load_config, + etree_findall, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + is_cliconf, + is_netconf, + etree_find, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + iosxr_argument_spec, + build_xml, +) + + +def diff_list(want, have): + adds = set(want).difference(have) + removes = set(have).difference(want) + return (adds, removes) + + +class ConfigBase(object): + def __init__(self, module): + self._module = module + self._result = {"changed": False, "warnings": []} + self._want = dict() + self._have = dict() + + def map_params_to_obj(self): + self._want.update( + { + "hostname": self._module.params["hostname"], + "vrf": self._module.params["vrf"], + "domain_name": self._module.params["domain_name"], + "domain_search": self._module.params["domain_search"], + "lookup_source": self._module.params["lookup_source"], + "lookup_enabled": self._module.params["lookup_enabled"], + "name_servers": self._module.params["name_servers"], + } + ) + + +class CliConfiguration(ConfigBase): + def __init__(self, module): + super(CliConfiguration, self).__init__(module) + + def map_obj_to_commands(self): + commands = list() + state = self._module.params["state"] + + def needs_update(x): + return self._want.get(x) and ( + self._want.get(x) != self._have.get(x) + ) + + if state == "absent": + if self._have["hostname"] != "ios": + commands.append("no hostname") + if self._have["domain_name"]: + commands.append("no domain name") + if self._have["lookup_source"]: + commands.append( + "no domain lookup source-interface {0!s}".format( + self._have["lookup_source"] + ) + ) + if not self._have["lookup_enabled"]: + commands.append("no domain lookup disable") + for item in self._have["name_servers"]: + commands.append("no domain name-server {0!s}".format(item)) + for item in self._have["domain_search"]: + commands.append("no domain list {0!s}".format(item)) + + elif state == "present": + if needs_update("hostname"): + commands.append( + "hostname {0!s}".format(self._want["hostname"]) + ) + + if needs_update("domain_name"): + commands.append( + "domain name {0!s}".format(self._want["domain_name"]) + ) + + if needs_update("lookup_source"): + commands.append( + "domain lookup source-interface {0!s}".format( + self._want["lookup_source"] + ) + ) + + cmd = None + if ( + not self._want["lookup_enabled"] + and self._have["lookup_enabled"] + ): + cmd = "domain lookup disable" + elif ( + self._want["lookup_enabled"] + and not self._have["lookup_enabled"] + ): + cmd = "no domain lookup disable" + if cmd is not None: + commands.append(cmd) + + if self._want["name_servers"] is not None: + adds, removes = diff_list( + self._want["name_servers"], self._have["name_servers"] + ) + for item in adds: + commands.append("domain name-server {0!s}".format(item)) + for item in removes: + commands.append("no domain name-server {0!s}".format(item)) + + if self._want["domain_search"] is not None: + adds, removes = diff_list( + self._want["domain_search"], self._have["domain_search"] + ) + for item in adds: + commands.append("domain list {0!s}".format(item)) + for item in removes: + commands.append("no domain list {0!s}".format(item)) + + self._result["commands"] = [] + if commands: + commit = not self._module.check_mode + diff = load_config(self._module, commands, commit=commit) + if diff: + self._result["diff"] = dict(prepared=diff) + + self._result["commands"] = commands + self._result["changed"] = True + + def parse_hostname(self, config): + match = re.search(r"^hostname (\S+)", config, re.M) + if match: + return match.group(1) + + def parse_domain_name(self, config): + match = re.search(r"^domain name (\S+)", config, re.M) + if match: + return match.group(1) + + def parse_lookup_source(self, config): + match = re.search( + r"^domain lookup source-interface (\S+)", config, re.M + ) + if match: + return match.group(1) + + def map_config_to_obj(self): + config = get_config(self._module) + self._have.update( + { + "hostname": self.parse_hostname(config), + "domain_name": self.parse_domain_name(config), + "domain_search": re.findall( + r"^domain list (\S+)", config, re.M + ), + "lookup_source": self.parse_lookup_source(config), + "lookup_enabled": "domain lookup disable" not in config, + "name_servers": re.findall( + r"^domain name-server (\S+)", config, re.M + ), + } + ) + + def run(self): + self.map_params_to_obj() + self.map_config_to_obj() + self.map_obj_to_commands() + + return self._result + + +class NCConfiguration(ConfigBase): + def __init__(self, module): + super(NCConfiguration, self).__init__(module) + self._system_meta = collections.OrderedDict() + self._system_domain_meta = collections.OrderedDict() + self._system_server_meta = collections.OrderedDict() + self._hostname_meta = collections.OrderedDict() + self._lookup_source_meta = collections.OrderedDict() + self._lookup_meta = collections.OrderedDict() + + def map_obj_to_xml_rpc(self): + self._system_meta.update( + [ + ( + "vrfs", + { + "xpath": "ip-domain/vrfs", + "tag": True, + "operation": "edit", + }, + ), + ( + "vrf", + { + "xpath": "ip-domain/vrfs/vrf", + "tag": True, + "operation": "edit", + }, + ), + ( + "a:vrf", + { + "xpath": "ip-domain/vrfs/vrf/vrf-name", + "operation": "edit", + }, + ), + ( + "a:domain_name", + { + "xpath": "ip-domain/vrfs/vrf/name", + "operation": "edit", + "attrib": "operation", + }, + ), + ] + ) + + self._system_domain_meta.update( + [ + ( + "vrfs", + { + "xpath": "ip-domain/vrfs", + "tag": True, + "operation": "edit", + }, + ), + ( + "vrf", + { + "xpath": "ip-domain/vrfs/vrf", + "tag": True, + "operation": "edit", + }, + ), + ( + "a:vrf", + { + "xpath": "ip-domain/vrfs/vrf/vrf-name", + "operation": "edit", + }, + ), + ( + "lists", + { + "xpath": "ip-domain/vrfs/vrf/lists", + "tag": True, + "operation": "edit", + }, + ), + ( + "list", + { + "xpath": "ip-domain/vrfs/vrf/lists/list", + "tag": True, + "operation": "edit", + "attrib": "operation", + }, + ), + ( + "a:order", + { + "xpath": "ip-domain/vrfs/vrf/lists/list/order", + "operation": "edit", + }, + ), + ( + "a:domain_search", + { + "xpath": "ip-domain/vrfs/vrf/lists/list/list-name", + "operation": "edit", + }, + ), + ] + ) + + self._system_server_meta.update( + [ + ( + "vrfs", + { + "xpath": "ip-domain/vrfs", + "tag": True, + "operation": "edit", + }, + ), + ( + "vrf", + { + "xpath": "ip-domain/vrfs/vrf", + "tag": True, + "operation": "edit", + }, + ), + ( + "a:vrf", + { + "xpath": "ip-domain/vrfs/vrf/vrf-name", + "operation": "edit", + }, + ), + ( + "servers", + { + "xpath": "ip-domain/vrfs/vrf/servers", + "tag": True, + "operation": "edit", + }, + ), + ( + "server", + { + "xpath": "ip-domain/vrfs/vrf/servers/server", + "tag": True, + "operation": "edit", + "attrib": "operation", + }, + ), + ( + "a:order", + { + "xpath": "ip-domain/vrfs/vrf/servers/server/order", + "operation": "edit", + }, + ), + ( + "a:name_servers", + { + "xpath": "ip-domain/vrfs/vrf/servers/server/server-address", + "operation": "edit", + }, + ), + ] + ) + + self._hostname_meta.update( + [ + ( + "a:hostname", + { + "xpath": "host-names/host-name", + "operation": "edit", + "attrib": "operation", + }, + ) + ] + ) + + self._lookup_source_meta.update( + [ + ( + "vrfs", + { + "xpath": "ip-domain/vrfs", + "tag": True, + "operation": "edit", + }, + ), + ( + "vrf", + { + "xpath": "ip-domain/vrfs/vrf", + "tag": True, + "operation": "edit", + }, + ), + ( + "a:vrf", + { + "xpath": "ip-domain/vrfs/vrf/vrf-name", + "operation": "edit", + }, + ), + ( + "a:lookup_source", + { + "xpath": "ip-domain/vrfs/vrf/source-interface", + "operation": "edit", + "attrib": "operation", + }, + ), + ] + ) + + self._lookup_meta.update( + [ + ( + "vrfs", + { + "xpath": "ip-domain/vrfs", + "tag": True, + "operation": "edit", + }, + ), + ( + "vrf", + { + "xpath": "ip-domain/vrfs/vrf", + "tag": True, + "operation": "edit", + }, + ), + ( + "a:vrf", + { + "xpath": "ip-domain/vrfs/vrf/vrf-name", + "operation": "edit", + }, + ), + ( + "lookup", + { + "xpath": "ip-domain/vrfs/vrf/lookup", + "tag": True, + "operation": "edit", + "attrib": "operation", + }, + ), + ] + ) + + state = self._module.params["state"] + _get_filter = build_xml("ip-domain", opcode="filter") + running = get_config( + self._module, source="running", config_filter=_get_filter + ) + _get_filter = build_xml("host-names", opcode="filter") + hostname_runn = get_config( + self._module, source="running", config_filter=_get_filter + ) + + hostname_ele = etree_find(hostname_runn, "host-name") + hostname = hostname_ele.text if hostname_ele is not None else None + + vrf_ele = etree_findall(running, "vrf") + vrf_map = {} + for vrf in vrf_ele: + name_server_list = list() + domain_list = list() + vrf_name_ele = etree_find(vrf, "vrf-name") + vrf_name = vrf_name_ele.text if vrf_name_ele is not None else None + + domain_name_ele = etree_find(vrf, "name") + domain_name = ( + domain_name_ele.text if domain_name_ele is not None else None + ) + + domain_ele = etree_findall(vrf, "list-name") + for domain in domain_ele: + domain_list.append(domain.text) + + server_ele = etree_findall(vrf, "server-address") + for server in server_ele: + name_server_list.append(server.text) + + lookup_source_ele = etree_find(vrf, "source-interface") + lookup_source = ( + lookup_source_ele.text + if lookup_source_ele is not None + else None + ) + + lookup_enabled = ( + False if etree_find(vrf, "lookup") is not None else True + ) + + vrf_map[vrf_name] = { + "domain_name": domain_name, + "domain_search": domain_list, + "name_servers": name_server_list, + "lookup_source": lookup_source, + "lookup_enabled": lookup_enabled, + } + + opcode = None + hostname_param = {} + lookup_param = {} + system_param = {} + sys_server_params = list() + sys_domain_params = list() + add_domain_params = list() + del_domain_params = list() + add_server_params = list() + del_server_params = list() + lookup_source_params = {} + + try: + sys_node = vrf_map[self._want["vrf"]] + except KeyError: + sys_node = { + "domain_name": None, + "domain_search": [], + "name_servers": [], + "lookup_source": None, + "lookup_enabled": True, + } + + if state == "absent": + opcode = "delete" + + def needs_update(x): + return ( + self._want[x] is not None and self._want[x] == sys_node[x] + ) + + if needs_update("domain_name"): + system_param = { + "vrf": self._want["vrf"], + "domain_name": self._want["domain_name"], + } + + if needs_update("hostname"): + hostname_param = {"hostname": hostname} + + if ( + not self._want["lookup_enabled"] + and not sys_node["lookup_enabled"] + ): + lookup_param["vrf"] = self._want["vrf"] + + if needs_update("lookup_source"): + lookup_source_params["vrf"] = self._want["vrf"] + lookup_source_params["lookup_source"] = self._want[ + "lookup_source" + ] + + if self._want["domain_search"]: + domain_param = {} + domain_param["domain_name"] = self._want["domain_name"] + domain_param["vrf"] = self._want["vrf"] + domain_param["order"] = "0" + for domain in self._want["domain_search"]: + if domain in sys_node["domain_search"]: + domain_param["domain_search"] = domain + sys_domain_params.append(domain_param.copy()) + + if self._want["name_servers"]: + server_param = {} + server_param["vrf"] = self._want["vrf"] + server_param["order"] = "0" + for server in self._want["name_servers"]: + if server in sys_node["name_servers"]: + server_param["name_servers"] = server + sys_server_params.append(server_param.copy()) + + elif state == "present": + opcode = "merge" + + def needs_update(x): + return self._want[x] is not None and ( + sys_node[x] is None + or ( + sys_node[x] is not None + and self._want[x] != sys_node[x] + ) + ) + + if needs_update("domain_name"): + system_param = { + "vrf": self._want["vrf"], + "domain_name": self._want["domain_name"], + } + + if ( + self._want["hostname"] is not None + and self._want["hostname"] != hostname + ): + hostname_param = {"hostname": self._want["hostname"]} + + if not self._want["lookup_enabled"] and sys_node["lookup_enabled"]: + lookup_param["vrf"] = self._want["vrf"] + + if needs_update("lookup_source"): + lookup_source_params["vrf"] = self._want["vrf"] + lookup_source_params["lookup_source"] = self._want[ + "lookup_source" + ] + + if self._want["domain_search"]: + domain_adds, domain_removes = diff_list( + self._want["domain_search"], sys_node["domain_search"] + ) + domain_param = {} + domain_param["domain_name"] = self._want["domain_name"] + domain_param["vrf"] = self._want["vrf"] + domain_param["order"] = "0" + for domain in domain_adds: + if domain not in sys_node["domain_search"]: + domain_param["domain_search"] = domain + add_domain_params.append(domain_param.copy()) + for domain in domain_removes: + if domain in sys_node["domain_search"]: + domain_param["domain_search"] = domain + del_domain_params.append(domain_param.copy()) + + if self._want["name_servers"]: + server_adds, server_removes = diff_list( + self._want["name_servers"], sys_node["name_servers"] + ) + server_param = {} + server_param["vrf"] = self._want["vrf"] + server_param["order"] = "0" + for domain in server_adds: + if domain not in sys_node["name_servers"]: + server_param["name_servers"] = domain + add_server_params.append(server_param.copy()) + for domain in server_removes: + if domain in sys_node["name_servers"]: + server_param["name_servers"] = domain + del_server_params.append(server_param.copy()) + + self._result["xml"] = [] + _edit_filter_list = list() + if opcode: + if hostname_param: + _edit_filter_list.append( + build_xml( + "host-names", + xmap=self._hostname_meta, + params=hostname_param, + opcode=opcode, + ) + ) + + if system_param: + _edit_filter_list.append( + build_xml( + "ip-domain", + xmap=self._system_meta, + params=system_param, + opcode=opcode, + ) + ) + + if lookup_source_params: + _edit_filter_list.append( + build_xml( + "ip-domain", + xmap=self._lookup_source_meta, + params=lookup_source_params, + opcode=opcode, + ) + ) + if lookup_param: + _edit_filter_list.append( + build_xml( + "ip-domain", + xmap=self._lookup_meta, + params=lookup_param, + opcode=opcode, + ) + ) + + if opcode == "delete": + if sys_domain_params: + _edit_filter_list.append( + build_xml( + "ip-domain", + xmap=self._system_domain_meta, + params=sys_domain_params, + opcode=opcode, + ) + ) + if sys_server_params: + _edit_filter_list.append( + build_xml( + "ip-domain", + xmap=self._system_server_meta, + params=sys_server_params, + opcode=opcode, + ) + ) + if self._want["vrf"] != "default": + self._result["warnings"] = [ + "name-servers delete operation with non-default vrf is a success, " + "but with rpc-error. Recommended to use 'ignore_errors' option with the task as a workaround" + ] + elif opcode == "merge": + if add_domain_params: + _edit_filter_list.append( + build_xml( + "ip-domain", + xmap=self._system_domain_meta, + params=add_domain_params, + opcode=opcode, + ) + ) + if del_domain_params: + _edit_filter_list.append( + build_xml( + "ip-domain", + xmap=self._system_domain_meta, + params=del_domain_params, + opcode="delete", + ) + ) + + if add_server_params: + _edit_filter_list.append( + build_xml( + "ip-domain", + xmap=self._system_server_meta, + params=add_server_params, + opcode=opcode, + ) + ) + if del_server_params: + _edit_filter_list.append( + build_xml( + "ip-domain", + xmap=self._system_server_meta, + params=del_server_params, + opcode="delete", + ) + ) + + diff = None + if _edit_filter_list: + commit = not self._module.check_mode + diff = load_config( + self._module, + _edit_filter_list, + commit=commit, + running=running, + nc_get_filter=_get_filter, + ) + + if diff: + if self._module._diff: + self._result["diff"] = dict(prepared=diff) + + self._result["xml"] = _edit_filter_list + self._result["changed"] = True + + def run(self): + self.map_params_to_obj() + self.map_obj_to_xml_rpc() + + return self._result + + +def main(): + """ Main entry point for Ansible module execution + """ + argument_spec = dict( + hostname=dict(type="str"), + vrf=dict(type="str", default="default"), + domain_name=dict(type="str"), + domain_search=dict(type="list", elements="str"), + name_servers=dict(type="list", elements="str"), + lookup_source=dict(type="str"), + lookup_enabled=dict(type="bool", default=True), + state=dict(choices=["present", "absent"], default="present"), + ) + + argument_spec.update(iosxr_argument_spec) + + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + config_object = None + if is_cliconf(module): + # Commenting the below cliconf deprecation support call for Ansible 2.9 as it'll be continued to be supported + # module.deprecate("cli support for 'iosxr_interface' is deprecated. Use transport netconf instead", + # version='2.9') + config_object = CliConfiguration(module) + elif is_netconf(module): + config_object = NCConfiguration(module) + + result = None + if config_object: + result = config_object.run() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_user.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_user.py new file mode 100644 index 00000000..e1c39905 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/modules/iosxr_user.py @@ -0,0 +1,973 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2017, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: iosxr_user +author: +- Trishna Guha (@trishnaguha) +- Sebastiaan van Doesselaar (@sebasdoes) +- Kedar Kekan (@kedarX) +short_description: Manage the aggregate of local users on Cisco IOS XR device +description: +- This module provides declarative management of the local usernames configured on + network devices. It allows playbooks to manage either individual usernames or the + aggregate of usernames in the current running config. It also supports purging usernames + from the configuration that are not explicitly defined. +version_added: 1.0.0 +extends_documentation_fragment: +- cisco.iosxr.iosxr +notes: +- This module works with connection C(network_cli) and C(netconf). See L(the IOS-XR + Platform Options,../network/user_guide/platform_iosxr.html). +- Tested against IOS XRv 6.1.3 +options: + aggregate: + description: + - The set of username objects to be configured on the remote Cisco IOS XR device. + The list entries can either be the username or a hash of username and properties. + This argument is mutually exclusive with the C(name) argument. + aliases: + - users + - collection + type: list + elements: dict + suboptions: + name: + description: + - The username to be configured on the Cisco IOS XR device. This argument accepts + a string value and is mutually exclusive with the C(aggregate) argument. Please + note that this option is not same as C(provider username). + type: str + required: true + configured_password: + description: + - The password to be configured on the Cisco IOS XR device. The password needs + to be provided in clear text. Password is encrypted on the device when used + with I(cli) and by Ansible when used with I(netconf) using the same MD5 hash + technique with salt size of 3. Please note that this option is not same as C(provider + password). + type: str + update_password: + description: + - Since passwords are encrypted in the device running config, this argument will + instruct the module when to change the password. When set to C(always), the + password will always be updated in the device and when set to C(on_create) the + password will be updated only if the username is created. + type: str + choices: + - on_create + - always + group: + description: + - Configures the group for the username in the device running configuration. The + argument accepts a string value defining the group name. This argument does + not check if the group has been configured on the device. + type: str + aliases: + - role + groups: + description: + - Configures the groups for the username in the device running configuration. + The argument accepts a list of group names. This argument does not check if + the group has been configured on the device. It is similar to the aggregate + command for usernames, but lets you configure multiple groups for the user(s). + type: list + elements: str + admin: + description: + - Enters into administration configuration mode for making config changes to the + device. + - Applicable only when using network_cli transport + type: bool + state: + description: + - Configures the state of the username definition as it relates to the device + operational configuration. When set to I(present), the username(s) should be + configured in the device active configuration and when set to I(absent) the + username(s) should not be in the device active configuration + type: str + choices: + - present + - absent + public_key: + description: + - Configures the contents of the public keyfile to upload to the IOS-XR node. + This enables users to login using the accompanying private key. IOS-XR only + accepts base64 decoded files, so this will be decoded and uploaded to the node. + Do note that this requires an OpenSSL public key file, PuTTy generated files + will not work! Mutually exclusive with public_key_contents. If used with multiple + users in aggregates, then the same key file is used for all users. + type: str + public_key_contents: + description: + - Configures the contents of the public keyfile to upload to the IOS-XR node. + This enables users to login using the accompanying private key. IOS-XR only + accepts base64 decoded files, so this will be decoded and uploaded to the node. + Do note that this requires an OpenSSL public key file, PuTTy generated files + will not work! Mutually exclusive with public_key.If used with multiple users + in aggregates, then the same key file is used for all users. + type: str + name: + description: + - The username to be configured on the Cisco IOS XR device. This argument accepts + a string value and is mutually exclusive with the C(aggregate) argument. Please + note that this option is not same as C(provider username). + type: str + configured_password: + description: + - The password to be configured on the Cisco IOS XR device. The password needs + to be provided in clear text. Password is encrypted on the device when used + with I(cli) and by Ansible when used with I(netconf) using the same MD5 hash + technique with salt size of 3. Please note that this option is not same as C(provider + password). + type: str + update_password: + description: + - Since passwords are encrypted in the device running config, this argument will + instruct the module when to change the password. When set to C(always), the + password will always be updated in the device and when set to C(on_create) the + password will be updated only if the username is created. + type: str + default: always + choices: + - on_create + - always + group: + description: + - Configures the group for the username in the device running configuration. The + argument accepts a string value defining the group name. This argument does + not check if the group has been configured on the device. + type: str + aliases: + - role + groups: + description: + - Configures the groups for the username in the device running configuration. + The argument accepts a list of group names. This argument does not check if + the group has been configured on the device. It is similar to the aggregate + command for usernames, but lets you configure multiple groups for the user(s). + type: list + elements: str + purge: + description: + - Instructs the module to consider the resource definition absolute. It will remove + any previously configured usernames on the device with the exception of the + `admin` user and the current defined set of users. + type: bool + default: false + admin: + description: + - Enters into administration configuration mode for making config changes to the + device. + - Applicable only when using network_cli transport + type: bool + default: false + state: + description: + - Configures the state of the username definition as it relates to the device + operational configuration. When set to I(present), the username(s) should be + configured in the device active configuration and when set to I(absent) the + username(s) should not be in the device active configuration + type: str + default: present + choices: + - present + - absent + public_key: + description: + - Configures the contents of the public keyfile to upload to the IOS-XR node. + This enables users to login using the accompanying private key. IOS-XR only + accepts base64 decoded files, so this will be decoded and uploaded to the node. + Do note that this requires an OpenSSL public key file, PuTTy generated files + will not work! Mutually exclusive with public_key_contents. If used with multiple + users in aggregates, then the same key file is used for all users. + type: str + public_key_contents: + description: + - Configures the contents of the public keyfile to upload to the IOS-XR node. + This enables users to login using the accompanying private key. IOS-XR only + accepts base64 decoded files, so this will be decoded and uploaded to the node. + Do note that this requires an OpenSSL public key file, PuTTy generated files + will not work! Mutually exclusive with public_key.If used with multiple users + in aggregates, then the same key file is used for all users. + type: str + +requirements: +- ncclient >= 0.5.3 when using netconf +- lxml >= 4.1.1 when using netconf +- base64 when using I(public_key_contents) or I(public_key) +- paramiko when using I(public_key_contents) or I(public_key) +""" + +EXAMPLES = """ +- name: create a new user + cisco.iosxr.iosxr_user: + name: ansible + configured_password: mypassword + state: present +- name: create a new user in admin configuration mode + cisco.iosxr.iosxr_user: + name: ansible + configured_password: mypassword + admin: true + state: present +- name: remove all users except admin + cisco.iosxr.iosxr_user: + purge: true +- name: set multiple users to group sys-admin + cisco.iosxr.iosxr_user: + aggregate: + - name: netop + - name: netend + group: sysadmin + state: present +- name: set multiple users to multiple groups + cisco.iosxr.iosxr_user: + aggregate: + - name: netop + - name: netend + groups: + - sysadmin + - root-system + state: present +- name: Change Password for User netop + cisco.iosxr.iosxr_user: + name: netop + configured_password: '{{ new_password }}' + update_password: always + state: present +- name: Add private key authentication for user netop + cisco.iosxr.iosxr_user: + name: netop + state: present + public_key_contents: "{{ lookup('file', '/home/netop/.ssh/id_rsa.pub' }}" +""" + +RETURN = """ +commands: + description: The list of configuration mode commands to send to the device + returned: always + type: list + sample: + - username ansible secret password group sysadmin + - username admin secret admin +xml: + description: NetConf rpc xml sent to device with transport C(netconf) + returned: always (empty list when no xml rpc to send) + type: list + sample: + - ' + + + + test7 + + + sysadmin + + + $1$ZsXC$zZ50wqhDC543ZWQkkAHLW0 + + + + ' +""" + +import os +from functools import partial +from copy import deepcopy +import collections + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.compat.paramiko import paramiko +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + remove_default_spec, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + get_config, + load_config, + is_netconf, + is_cliconf, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + iosxr_argument_spec, + build_xml, + etree_findall, +) + +try: + from base64 import b64decode + + HAS_B64 = True +except ImportError: + HAS_B64 = False + + +class PublicKeyManager(object): + def __init__(self, module, result): + self._module = module + self._result = result + + def convert_key_to_base64(self): + """ IOS-XR only accepts base64 decoded files, this converts the public key to a temp file. + """ + if self._module.params["aggregate"]: + name = "aggregate" + else: + name = self._module.params["name"] + + if self._module.params["public_key_contents"]: + key = self._module.params["public_key_contents"] + elif self._module.params["public_key"]: + readfile = open(self._module.params["public_key"], "r") + key = readfile.read() + splitfile = key.split()[1] + + base64key = b64decode(splitfile) + base64file = open("/tmp/publickey_%s.b64" % (name), "wb") + base64file.write(base64key) + base64file.close() + + return "/tmp/publickey_%s.b64" % (name) + + def copy_key_to_node(self, base64keyfile): + """ Copy key to IOS-XR node. We use SFTP because older IOS-XR versions don't handle SCP very well. + """ + provider = self._module.params.get("provider") or {} + node = provider.get("host") + if node is None: + return False + + user = provider.get("username") + if user is None: + return False + + password = provider.get("password") + ssh_keyfile = provider.get("ssh_keyfile") + + if self._module.params["aggregate"]: + name = "aggregate" + else: + name = self._module.params["name"] + + src = base64keyfile + dst = "/harddisk:/publickey_%s.b64" % (name) + + ssh = paramiko.SSHClient() + ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + if not ssh_keyfile: + ssh.connect(node, username=user, password=password) + else: + ssh.connect(node, username=user, allow_agent=True) + sftp = ssh.open_sftp() + sftp.put(src, dst) + sftp.close() + ssh.close() + + def addremovekey(self, command): + """ Add or remove key based on command + """ + provider = self._module.params.get("provider") or {} + node = provider.get("host") + if node is None: + return False + + user = provider.get("username") + if user is None: + return False + + password = provider.get("password") + ssh_keyfile = provider.get("ssh_keyfile") + + ssh = paramiko.SSHClient() + ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + if not ssh_keyfile: + ssh.connect(node, username=user, password=password) + else: + ssh.connect(node, username=user, allow_agent=True) + ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command( + "%s \r" % (command) + ) + readmsg = ssh_stdout.read( + 100 + ) # We need to read a bit to actually apply for some reason + if ( + ("already" in readmsg) + or ("removed" in readmsg) + or ("really" in readmsg) + ): + ssh_stdin.write("yes\r") + ssh_stdout.read( + 1 + ) # We need to read a bit to actually apply for some reason + ssh.close() + + return readmsg + + def run(self): + if self._module.params["state"] == "present": + if not self._module.check_mode: + key = self.convert_key_to_base64() + copykeys = self.copy_key_to_node(key) + if copykeys is False: + self._result["warnings"].append( + "Please set up your provider before running this playbook" + ) + + if self._module.params["aggregate"]: + for user in self._module.params["aggregate"]: + cmdtodo = ( + "admin crypto key import authentication rsa username %s harddisk:/publickey_aggregate.b64" + % (user) + ) + addremove = self.addremovekey(cmdtodo) + if addremove is False: + self._result["warnings"].append( + "Please set up your provider before running this playbook" + ) + else: + cmdtodo = ( + "admin crypto key import authentication rsa username %s harddisk:/publickey_%s.b64" + % ( + self._module.params["name"], + self._module.params["name"], + ) + ) + addremove = self.addremovekey(cmdtodo) + if addremove is False: + self._result["warnings"].append( + "Please set up your provider before running this playbook" + ) + elif self._module.params["state"] == "absent": + if not self._module.check_mode: + if self._module.params["aggregate"]: + for user in self._module.params["aggregate"]: + cmdtodo = ( + "admin crypto key zeroize authentication rsa username %s" + % (user) + ) + addremove = self.addremovekey(cmdtodo) + if addremove is False: + self._result["warnings"].append( + "Please set up your provider before running this playbook" + ) + else: + cmdtodo = ( + "admin crypto key zeroize authentication rsa username %s" + % (self._module.params["name"]) + ) + addremove = self.addremovekey(cmdtodo) + if addremove is False: + self._result["warnings"].append( + "Please set up your provider before running this playbook" + ) + elif self._module.params["purge"] is True: + if not self._module.check_mode: + cmdtodo = "admin crypto key zeroize authentication rsa all" + addremove = self.addremovekey(cmdtodo) + if addremove is False: + self._result["warnings"].append( + "Please set up your provider before running this playbook" + ) + + return self._result + + +def search_obj_in_list(name, lst): + for o in lst: + if o["name"] == name: + return o + + return None + + +class ConfigBase(object): + def __init__(self, module, result, flag=None): + self._module = module + self._result = result + self._want = list() + self._have = list() + + def get_param_value(self, key, item): + # if key doesn't exist in the item, get it from module.params + if not item.get(key): + value = self._module.params[key] + + # if key does exist, do a type check on it to validate it + else: + value_type = self._module.argument_spec[key].get("type", "str") + type_checker = self._module._CHECK_ARGUMENT_TYPES_DISPATCHER[ + value_type + ] + type_checker(item[key]) + value = item[key] + + # validate the param value (if validator func exists) + validator = globals().get("validate_%s" % key) + if all((value, validator)): + validator(value, self._module) + + return value + + def map_params_to_obj(self): + users = self._module.params["aggregate"] + + aggregate = list() + if not users: + if ( + not self._module.params["name"] + and self._module.params["purge"] + ): + pass + elif not self._module.params["name"]: + self._module.fail_json(msg="username is required") + else: + aggregate = [{"name": self._module.params["name"]}] + else: + for item in users: + if not isinstance(item, dict): + aggregate.append({"name": item}) + elif "name" not in item: + self._module.fail_json(msg="name is required") + else: + aggregate.append(item) + + for item in aggregate: + get_value = partial(self.get_param_value, item=item) + item["configured_password"] = get_value("configured_password") + item["group"] = get_value("group") + item["groups"] = get_value("groups") + item["state"] = get_value("state") + self._want.append(item) + + +class CliConfiguration(ConfigBase): + def __init__(self, module, result): + super(CliConfiguration, self).__init__(module, result) + + def map_config_to_obj(self): + data = get_config(self._module, config_filter="username") + users = data.strip().rstrip("!").split("!") + + for user in users: + user_config = user.strip().splitlines() + + name = user_config[0].strip().split()[1] + group = None + + if len(user_config) > 1: + group_or_secret = user_config[1].strip().split() + if group_or_secret[0] == "group": + group = group_or_secret[1] + + obj = { + "name": name, + "state": "present", + "configured_password": None, + "group": group, + } + self._have.append(obj) + + def map_obj_to_commands(self): + commands = list() + + for w in self._want: + name = w["name"] + state = w["state"] + + obj_in_have = search_obj_in_list(name, self._have) + + if state == "absent" and obj_in_have: + commands.append("no username " + name) + elif state == "present" and not obj_in_have: + user_cmd = "username " + name + commands.append(user_cmd) + + if w["configured_password"]: + commands.append( + user_cmd + " secret " + w["configured_password"] + ) + if w["group"]: + commands.append(user_cmd + " group " + w["group"]) + elif w["groups"]: + for group in w["groups"]: + commands.append(user_cmd + " group " + group) + + elif state == "present" and obj_in_have: + user_cmd = "username " + name + + if ( + self._module.params["update_password"] == "always" + and w["configured_password"] + ): + commands.append( + user_cmd + " secret " + w["configured_password"] + ) + if w["group"] and w["group"] != obj_in_have["group"]: + commands.append(user_cmd + " group " + w["group"]) + elif w["groups"]: + for group in w["groups"]: + commands.append(user_cmd + " group " + group) + + if self._module.params["purge"]: + want_users = [x["name"] for x in self._want] + have_users = [x["name"] for x in self._have] + for item in set(have_users).difference(set(want_users)): + if item != "admin": + commands.append("no username %s" % item) + + if "no username admin" in commands: + self._module.fail_json(msg="cannot delete the `admin` account") + + self._result["commands"] = [] + if commands: + commit = not self._module.check_mode + admin = self._module.params["admin"] + diff = load_config( + self._module, commands, commit=commit, admin=admin + ) + if diff: + self._result["diff"] = dict(prepared=diff) + + self._result["commands"] = commands + self._result["changed"] = True + + def run(self): + self.map_params_to_obj() + self.map_config_to_obj() + self.map_obj_to_commands() + + return self._result + + +class NCConfiguration(ConfigBase): + def __init__(self, module, result): + super(NCConfiguration, self).__init__(module, result) + self._locald_meta = collections.OrderedDict() + self._locald_group_meta = collections.OrderedDict() + + def generate_md5_hash(self, arg): + """ + Generate MD5 hash with randomly generated salt size of 3. + :param arg: + :return passwd: + """ + cmd = "openssl passwd -salt `openssl rand -base64 3` -1 " + return os.popen(cmd + arg).readlines()[0].strip() + + def map_obj_to_xml_rpc(self): + self._locald_meta.update( + [ + ( + "aaa_locald", + {"xpath": "aaa/usernames", "tag": True, "ns": True}, + ), + ( + "username", + { + "xpath": "aaa/usernames/username", + "tag": True, + "attrib": "operation", + }, + ), + ("a:name", {"xpath": "aaa/usernames/username/name"}), + ( + "a:configured_password", + { + "xpath": "aaa/usernames/username/secret", + "operation": "edit", + }, + ), + ] + ) + + self._locald_group_meta.update( + [ + ( + "aaa_locald", + {"xpath": "aaa/usernames", "tag": True, "ns": True}, + ), + ( + "username", + { + "xpath": "aaa/usernames/username", + "tag": True, + "attrib": "operation", + }, + ), + ("a:name", {"xpath": "aaa/usernames/username/name"}), + ( + "usergroups", + { + "xpath": "aaa/usernames/username/usergroup-under-usernames", + "tag": True, + "operation": "edit", + }, + ), + ( + "usergroup", + { + "xpath": "aaa/usernames/username/usergroup-under-usernames/usergroup-under-username", + "tag": True, + "operation": "edit", + }, + ), + ( + "a:group", + { + "xpath": "aaa/usernames/username/usergroup-under-usernames/usergroup-under-username/name", + "operation": "edit", + }, + ), + ] + ) + + state = self._module.params["state"] + _get_filter = build_xml("aaa", opcode="filter") + running = get_config( + self._module, source="running", config_filter=_get_filter + ) + + elements = etree_findall(running, "username") + users = list() + for element in elements: + name_list = etree_findall(element, "name") + users.append(name_list[0].text) + list_size = len(name_list) + if list_size == 1: + self._have.append( + {"name": name_list[0].text, "group": None, "groups": None} + ) + elif list_size == 2: + self._have.append( + { + "name": name_list[0].text, + "group": name_list[1].text, + "groups": None, + } + ) + elif list_size > 2: + name_iter = iter(name_list) + next(name_iter) + tmp_list = list() + for name in name_iter: + tmp_list.append(name.text) + + self._have.append( + { + "name": name_list[0].text, + "group": None, + "groups": tmp_list, + } + ) + + locald_params = list() + locald_group_params = list() + opcode = None + + if state == "absent": + opcode = "delete" + for want_item in self._want: + if want_item["name"] in users: + want_item["configured_password"] = None + locald_params.append(want_item) + elif state == "present": + opcode = "merge" + for want_item in self._want: + if want_item["name"] not in users: + want_item["configured_password"] = self.generate_md5_hash( + want_item["configured_password"] + ) + locald_params.append(want_item) + + if want_item["group"] is not None: + locald_group_params.append(want_item) + if want_item["groups"] is not None: + for group in want_item["groups"]: + want_item["group"] = group + locald_group_params.append(want_item.copy()) + else: + if ( + self._module.params["update_password"] == "always" + and want_item["configured_password"] is not None + ): + want_item[ + "configured_password" + ] = self.generate_md5_hash( + want_item["configured_password"] + ) + locald_params.append(want_item) + else: + want_item["configured_password"] = None + + obj_in_have = search_obj_in_list( + want_item["name"], self._have + ) + if ( + want_item["group"] is not None + and want_item["group"] != obj_in_have["group"] + ): + locald_group_params.append(want_item) + elif want_item["groups"] is not None: + for group in want_item["groups"]: + want_item["group"] = group + locald_group_params.append(want_item.copy()) + + purge_params = list() + if self._module.params["purge"]: + want_users = [x["name"] for x in self._want] + have_users = [x["name"] for x in self._have] + for item in set(have_users).difference(set(want_users)): + if item != "admin": + purge_params.append({"name": item}) + + self._result["xml"] = [] + _edit_filter_list = list() + if opcode is not None: + if locald_params: + _edit_filter_list.append( + build_xml( + "aaa", + xmap=self._locald_meta, + params=locald_params, + opcode=opcode, + ) + ) + + if locald_group_params: + _edit_filter_list.append( + build_xml( + "aaa", + xmap=self._locald_group_meta, + params=locald_group_params, + opcode=opcode, + ) + ) + + if purge_params: + _edit_filter_list.append( + build_xml( + "aaa", + xmap=self._locald_meta, + params=purge_params, + opcode="delete", + ) + ) + + diff = None + if _edit_filter_list: + commit = not self._module.check_mode + diff = load_config( + self._module, + _edit_filter_list, + commit=commit, + running=running, + nc_get_filter=_get_filter, + ) + + if diff: + if self._module._diff: + self._result["diff"] = dict(prepared=diff) + + self._result["xml"] = _edit_filter_list + self._result["changed"] = True + + def run(self): + self.map_params_to_obj() + self.map_obj_to_xml_rpc() + + return self._result + + +def main(): + """ main entry point for module execution + """ + element_spec = dict( + name=dict(type="str"), + configured_password=dict(type="str", no_log=True), + update_password=dict( + type="str", default="always", choices=["on_create", "always"] + ), + admin=dict(type="bool", default=False), + public_key=dict(type="str"), + public_key_contents=dict(type="str"), + group=dict(type="str", aliases=["role"]), + groups=dict(type="list", elements="str"), + state=dict( + type="str", default="present", choices=["present", "absent"] + ), + ) + aggregate_spec = deepcopy(element_spec) + aggregate_spec["name"] = dict(required=True) + + # remove default in aggregate spec, to handle common arguments + remove_default_spec(aggregate_spec) + + mutually_exclusive = [ + ("name", "aggregate"), + ("public_key", "public_key_contents"), + ("group", "groups"), + ] + + argument_spec = dict( + aggregate=dict( + type="list", + elements="dict", + options=aggregate_spec, + aliases=["users", "collection"], + ), + purge=dict(type="bool", default=False), + ) + + argument_spec.update(element_spec) + argument_spec.update(iosxr_argument_spec) + + module = AnsibleModule( + argument_spec=argument_spec, + mutually_exclusive=mutually_exclusive, + supports_check_mode=True, + ) + + if module.params["public_key_contents"] or module.params["public_key"]: + if not HAS_B64: + module.fail_json( + msg="library base64 is required but does not appear to be " + "installed. It can be installed using `pip install base64`" + ) + if paramiko is None: + module.fail_json( + msg="library paramiko is required but does not appear to be " + "installed. It can be installed using `pip install paramiko`" + ) + + result = {"changed": False, "warnings": []} + + config_object = None + if is_cliconf(module): + # Commenting the below cliconf deprecation support call for Ansible 2.9 as it'll be continued to be supported + # module.deprecate("cli support for 'iosxr_interface' is deprecated. Use transport netconf instead", + # version='2.9') + config_object = CliConfiguration(module, result) + elif is_netconf(module): + config_object = NCConfiguration(module, result) + + if config_object: + result = config_object.run() + + if module.params["public_key_contents"] or module.params["public_key"]: + pubkey_object = PublicKeyManager(module, result) + result = pubkey_object.run() + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/netconf/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/netconf/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/netconf/iosxr.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/netconf/iosxr.py new file mode 100644 index 00000000..6e9255e0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/netconf/iosxr.py @@ -0,0 +1,297 @@ +# +# (c) 2017 Red Hat Inc. +# (c) 2017 Kedar Kekan (kkekan@redhat.com) +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . +# +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +author: Ansible Networking Team +netconf: iosxr +short_description: Use iosxr netconf plugin to run netconf commands on Cisco IOSXR + platform +description: +- This iosxr plugin provides low level abstraction apis for sending and receiving + netconf commands from Cisco iosxr network devices. +version_added: 1.0.0 +options: + ncclient_device_handler: + type: str + default: iosxr + description: + - Specifies the ncclient device handler name for Cisco iosxr network os. To identify + the ncclient device handler name refer ncclient library documentation. +""" + +import json +import re +import collections + +from ansible.module_utils._text import to_native, to_text +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + remove_namespaces, +) +from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( + build_xml, + etree_find, +) +from ansible.errors import AnsibleConnectionFailure +from ansible.plugins.netconf import NetconfBase, ensure_ncclient + +try: + from ncclient import manager + from ncclient.operations import RPCError + from ncclient.transport.errors import SSHUnknownHostError + from ncclient.xml_ import to_xml + + HAS_NCCLIENT = True +except ( + ImportError, + AttributeError, +): # paramiko and gssapi are incompatible and raise AttributeError not ImportError + HAS_NCCLIENT = False + + +class Netconf(NetconfBase): + def get_device_info(self): + device_info = {} + device_info["network_os"] = "iosxr" + install_meta = collections.OrderedDict() + install_meta.update( + [ + ( + "boot-variables", + {"xpath": "install/boot-variables", "tag": True}, + ), + ( + "boot-variable", + { + "xpath": "install/boot-variables/boot-variable", + "tag": True, + "lead": True, + }, + ), + ("software", {"xpath": "install/software", "tag": True}), + ( + "alias-devices", + {"xpath": "install/software/alias-devices", "tag": True}, + ), + ( + "alias-device", + { + "xpath": "install/software/alias-devices/alias-device", + "tag": True, + }, + ), + ( + "m:device-name", + { + "xpath": "install/software/alias-devices/alias-device/device-name", + "value": "disk0:", + }, + ), + ] + ) + + install_filter = build_xml("install", install_meta, opcode="filter") + try: + reply = self.get(install_filter) + resp = remove_namespaces( + re.sub(r'<\?xml version="1.0" encoding="UTF-8"\?>', "", reply) + ) + ele_boot_variable = etree_find(resp, "boot-variable/boot-variable") + if ele_boot_variable is not None: + device_info["network_os_image"] = re.split( + "[:|,]", ele_boot_variable.text + )[1] + ele_package_name = etree_find(reply, "package-name") + if ele_package_name is not None: + device_info["network_os_package"] = ele_package_name.text + device_info["network_os_version"] = re.split( + "-", ele_package_name.text + )[-1] + + hostname_filter = build_xml("host-names", opcode="filter") + reply = self.get(hostname_filter) + resp = remove_namespaces( + re.sub(r'<\?xml version="1.0" encoding="UTF-8"\?>', "", reply) + ) + hostname_ele = etree_find(resp.strip(), "host-name") + device_info["network_os_hostname"] = ( + hostname_ele.text if hostname_ele is not None else None + ) + except Exception as exc: + self._connection.queue_message( + "vvvv", "Fail to retrieve device info %s" % exc + ) + return device_info + + def get_capabilities(self): + result = dict() + result["rpc"] = self.get_base_rpc() + result["network_api"] = "netconf" + result["device_info"] = self.get_device_info() + result["server_capabilities"] = list(self.m.server_capabilities) + result["client_capabilities"] = list(self.m.client_capabilities) + result["session_id"] = self.m.session_id + result["device_operations"] = self.get_device_operations( + result["server_capabilities"] + ) + return json.dumps(result) + + @staticmethod + @ensure_ncclient + def guess_network_os(obj): + """ + Guess the remote network os name + :param obj: Netconf connection class object + :return: Network OS name + """ + try: + m = manager.connect( + host=obj._play_context.remote_addr, + port=obj._play_context.port or 830, + username=obj._play_context.remote_user, + password=obj._play_context.password, + key_filename=obj.key_filename, + hostkey_verify=obj.get_option("host_key_checking"), + look_for_keys=obj.get_option("look_for_keys"), + allow_agent=obj._play_context.allow_agent, + timeout=obj.get_option("persistent_connect_timeout"), + # We need to pass in the path to the ssh_config file when guessing + # the network_os so that a jumphost is correctly used if defined + ssh_config=obj._ssh_config, + ) + except SSHUnknownHostError as exc: + raise AnsibleConnectionFailure(to_native(exc)) + + guessed_os = None + for c in m.server_capabilities: + if re.search("IOS-XR", c): + guessed_os = "iosxr" + break + + m.close_session() + return guessed_os + + # TODO: change .xml to .data_xml, when ncclient supports data_xml on all platforms + def get(self, filter=None, remove_ns=False): + if isinstance(filter, list): + filter = tuple(filter) + try: + resp = self.m.get(filter=filter) + if remove_ns: + response = remove_namespaces(resp) + else: + response = ( + resp.data_xml if hasattr(resp, "data_xml") else resp.xml + ) + return response + except RPCError as exc: + raise Exception(to_xml(exc.xml)) + + def get_config(self, source=None, filter=None, remove_ns=False): + if isinstance(filter, list): + filter = tuple(filter) + try: + resp = self.m.get_config(source=source, filter=filter) + if remove_ns: + response = remove_namespaces(resp) + else: + response = ( + resp.data_xml if hasattr(resp, "data_xml") else resp.xml + ) + return response + except RPCError as exc: + raise Exception(to_xml(exc.xml)) + + def edit_config( + self, + config=None, + format="xml", + target="candidate", + default_operation=None, + test_option=None, + error_option=None, + remove_ns=False, + ): + if config is None: + raise ValueError("config value must be provided") + try: + resp = self.m.edit_config( + config, + format=format, + target=target, + default_operation=default_operation, + test_option=test_option, + error_option=error_option, + ) + if remove_ns: + response = remove_namespaces(resp) + else: + response = ( + resp.data_xml if hasattr(resp, "data_xml") else resp.xml + ) + return response + except RPCError as exc: + raise Exception(to_xml(exc.xml)) + + def commit( + self, confirmed=False, timeout=None, persist=None, remove_ns=False + ): + timeout = to_text(timeout, errors="surrogate_or_strict") + try: + resp = self.m.commit( + confirmed=confirmed, timeout=timeout, persist=persist + ) + if remove_ns: + response = remove_namespaces(resp) + else: + response = ( + resp.data_xml if hasattr(resp, "data_xml") else resp.xml + ) + return response + except RPCError as exc: + raise Exception(to_xml(exc.xml)) + + def validate(self, source="candidate", remove_ns=False): + try: + resp = self.m.validate(source=source) + if remove_ns: + response = remove_namespaces(resp) + else: + response = ( + resp.data_xml if hasattr(resp, "data_xml") else resp.xml + ) + return response + except RPCError as exc: + raise Exception(to_xml(exc.xml)) + + def discard_changes(self, remove_ns=False): + try: + resp = self.m.discard_changes() + if remove_ns: + response = remove_namespaces(resp) + else: + response = ( + resp.data_xml if hasattr(resp, "data_xml") else resp.xml + ) + return response + except RPCError as exc: + raise Exception(to_xml(exc.xml)) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/terminal/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/terminal/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/terminal/iosxr.py b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/terminal/iosxr.py new file mode 100644 index 00000000..89a7fd15 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/plugins/terminal/iosxr.py @@ -0,0 +1,57 @@ +# +# (c) 2016 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . +# +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import re + +from ansible.plugins.terminal import TerminalBase +from ansible.errors import AnsibleConnectionFailure + + +class TerminalModule(TerminalBase): + + terminal_stdout_re = [ + re.compile(br"[\r\n]*[\w+\-\.:\/\[\]]+(?:\([^\)]+\)){,3}(?:>|#) ?$"), + re.compile(br"]]>]]>[\r\n]?"), + ] + + terminal_stderr_re = [ + re.compile(br"% ?Error"), + re.compile(br"% ?Bad secret"), + re.compile(br"% ?This command is not authorized"), + re.compile(br"invalid input", re.I), + re.compile(br"(?:incomplete|ambiguous) command", re.I), + re.compile(br"(? '3.5' +flake8 +mock +pexpect +pytest-xdist +yamllint +coverage==4.5.4 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/.gitignore b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/.gitignore new file mode 100644 index 00000000..ea1472ec --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/.gitignore @@ -0,0 +1 @@ +output/ diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/network-integration.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/network-integration.cfg new file mode 100644 index 00000000..d12c1efe --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/network-integration.cfg @@ -0,0 +1,4 @@ +[persistent_connection] +command_timeout = 100 +connect_timeout = 100 +connect_retry_timeout = 100 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/target-prefixes.network b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/target-prefixes.network new file mode 100644 index 00000000..97a9d298 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/target-prefixes.network @@ -0,0 +1 @@ +iosxr \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tasks/cli.yaml new file mode 100644 index 00000000..f622cf94 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tasks/cli.yaml @@ -0,0 +1,20 @@ +--- +- name: Collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + delegate_to: localhost + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/_populate.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/_populate.yaml new file mode 100644 index 00000000..85fe0a12 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/_populate.yaml @@ -0,0 +1,18 @@ +--- +- name: Populate the device with ACLs + cisco.iosxr.iosxr_config: + lines: "ipv4 access-list acl_1\n10 permit ipv4 any any\nipv4 access-list acl_2\n\ + 10 permit ipv4 any any\nipv4 access-list acl_3\n10 permit ipv4 any any\nipv6\ + \ access-list acl6_1\n10 permit ipv6 any any\nipv6 access-list acl6_2\n10\ + \ permit ipv6 any any\nipv6 access-list acl6_3\n10 permit ipv6 any any\n" + +- name: Setup ACL interfaces configuration for GigabitEthernet0/0/0/0 + cisco.iosxr.iosxr_config: + lines: "ipv4 access-group acl_1 ingress\nipv4 access-group acl_2 egress\nipv6\ + \ access-group acl6_1 ingress\nipv6 access-group acl6_2 egress\n" + parents: interface GigabitEthernet0/0/0/0 + +- name: Setup ACL interfaces configuration for GigabitEthernet0/0/0/1 + cisco.iosxr.iosxr_config: + lines: ipv4 access-group acl_1 egress + parents: interface GigabitEthernet0/0/0/1 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/_remove_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/_remove_config.yaml new file mode 100644 index 00000000..830213fc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/_remove_config.yaml @@ -0,0 +1,27 @@ +--- +- name: Remove/Default Resources + vars: + lines: "default interface GigabitEthernet0/0/0/0\ndefault interface GigabitEthernet0/0/0/1\n\ + no ipv4 access-list acl_1\nno ipv4 access-list acl_2\nno ipv6 access-list\ + \ acl6_1\nno ipv6 access-list acl6_2\nno ipv6 access-list acl6_3\n" + ansible.netcommon.cli_config: + config: '{{ lines }}' + +- name: Initialize interfaces + loop: + - interface GigabitEthernet0/0/0/0 + - interface GigabitEthernet0/0/0/1 + cisco.iosxr.iosxr_config: + lines: shutdown + parents: '{{ item }}' + +- name: Remove unwanted interfaces from config + loop: + - 0/0/0/2 + - 0/0/0/3 + - 0/0/0/4 + - 0/0/0/5 + ignore_errors: true + cisco.iosxr.iosxr_config: + lines: + - no interface GigabitEthernet{{ item }} diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/deleted.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/deleted.yaml new file mode 100644 index 00000000..0481e755 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/deleted.yaml @@ -0,0 +1,33 @@ +--- +- debug: + msg: Start iosxr_acl_interfaces deleted integration tests ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate.yaml + +- block: + - name: Delete ACL attributes of GigabitEthernet0/0/0/1 + register: result + cisco.iosxr.iosxr_acl_interfaces: &id001 + config: + - name: GigabitEthernet0/0/0/1 + state: deleted + + - assert: + that: + - "'interface GigabitEthernet0/0/0/1' in result.commands" + - "'no ipv4 access-group acl_1 egress' in result.commands" + - result.commands|length == 2 + + - name: Delete ACL attributes of GigabitEthernet0/0/0/1 (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_acl_interfaces: *id001 + + - assert: + that: + - result.changed == False + - result.commands|length == 0 + always: + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/deleted_all.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/deleted_all.yaml new file mode 100644 index 00000000..f980a08f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/deleted_all.yaml @@ -0,0 +1,52 @@ +--- +- debug: + msg: Start iosxr_acl_interfaces deleted integration tests ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate.yaml + +- block: + + - name: Delete all ACL interfaces configuration from the device + register: result + cisco.iosxr.iosxr_acl_interfaces: &id001 + state: deleted + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that the correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that the after dicts were correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Delete ACL attributes of all interfaces (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_acl_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == false + - result.commands|length == 0 + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/empty_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/empty_config.yaml new file mode 100644 index 00000000..fe75770e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/empty_config.yaml @@ -0,0 +1,60 @@ +--- +- debug: + msg: START iosxr_acl_interfaces empty_config integration tests on connection={{ + ansible_connection }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_acl_interfaces: + config: + state: merged + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state merged' + +- name: Replaced with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_acl_interfaces: + config: + state: replaced + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Overridden with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_acl_interfaces: + config: + state: overridden + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state overridden' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_acl_interfaces: + config: + state: rendered + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state rendered' + +- name: Parsed with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_acl_interfaces: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/fixtures/parsed.cfg new file mode 100644 index 00000000..81823360 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/fixtures/parsed.cfg @@ -0,0 +1,14 @@ +interface MgmtEth0/0/CPU0/0 + ipv4 address dhcp +! +interface GigabitEthernet0/0/0/0 + shutdown + ipv4 access-group acl_1 ingress + ipv4 access-group acl_2 egress + ipv6 access-group acl6_1 ingress + ipv6 access-group acl6_2 egress +! +interface GigabitEthernet0/0/0/1 + shutdown + ipv4 access-group acl_1 egress +! \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/gathered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/gathered.yaml new file mode 100644 index 00000000..d6404ef3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/gathered.yaml @@ -0,0 +1,63 @@ +--- +- debug: + msg: START iosxr_acl_interfaces gathered integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- name: Populate the device with ACLs + cisco.iosxr.iosxr_config: + lines: "ipv4 access-list acl_1\n10 permit ipv4 any any\nipv4 access-list acl_2\n\ + 10 permit ipv4 any any\nipv6 access-list acl6_1\n10 permit ipv6 any any\n\ + ipv6 access-list acl6_2\n10 permit ipv6 any any\n" + +- block: + + - name: Merge the provided configuration with the existing running configuration + register: result + cisco.iosxr.iosxr_acl_interfaces: + config: + + - name: GigabitEthernet0/0/0/0 + access_groups: + + - afi: ipv4 + acls: + + - name: acl_1 + direction: in + + - name: acl_2 + direction: out + + - afi: ipv6 + acls: + + - name: acl6_1 + direction: in + + - name: acl6_2 + direction: out + + - name: GigabitEthernet0/0/0/1 + access_groups: + + - afi: ipv4 + acls: + + - name: acl_1 + direction: out + state: merged + + - name: Gather ACL interfaces facts using gathered state + register: result + cisco.iosxr.iosxr_acl_interfaces: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ merged['after'] | symmetric_difference(result['gathered']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/merged.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/merged.yaml new file mode 100644 index 00000000..44b134cf --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/merged.yaml @@ -0,0 +1,132 @@ +--- +- debug: + msg: START iosxr_acl_interfaces merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- name: Populate the device with ACLs + cisco.iosxr.iosxr_config: + lines: "ipv4 access-list acl_1\n10 permit ipv4 any any\nipv4 access-list acl_2\n\ + 10 permit ipv4 any any\nipv6 access-list acl6_1\n10 permit ipv6 any any\n\ + ipv6 access-list acl6_2\n10 permit ipv6 any any\n" + +- block: + + - name: Merge the provided configuration with the existing running configuration + register: result + cisco.iosxr.iosxr_acl_interfaces: &id001 + config: + + - name: GigabitEthernet0/0/0/0 + access_groups: + + - afi: ipv4 + acls: + + - name: acl_1 + direction: in + + - name: acl_2 + direction: out + + - afi: ipv6 + acls: + + - name: acl6_1 + direction: in + + - name: acl6_2 + direction: out + + - name: GigabitEthernet0/0/0/1 + access_groups: + + - afi: ipv4 + acls: + + - name: acl_1 + direction: out + state: merged + + - name: Assert that before dicts were correctly generated + assert: + that: "{{ merged['before'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that after dicts was correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_acl_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dicts were correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Update acl_interfaces configuration using merged + register: result + cisco.iosxr.iosxr_acl_interfaces: &id002 + config: + + - name: GigabitEthernet0/0/0/1 + access_groups: + + - afi: ipv4 + acls: + + - name: acl_2 + direction: out + + - name: acl_1 + direction: in + state: merged + + - name: Assert that before dicts were correctly generated + assert: + that: "{{ merged['update_before'] | symmetric_difference(result['before'])\ + \ |length == 0 }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['update_commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that after dicts was correctly generated + assert: + that: + - "{{ merged['update_after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Update acl_interfaces configuration using merged (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_acl_interfaces: *id002 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/overridden.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/overridden.yaml new file mode 100644 index 00000000..27a48689 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/overridden.yaml @@ -0,0 +1,78 @@ +--- +- debug: + msg: START iosxr_acl_interfaces overridden integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate.yaml + +- block: + + - name: Overridde all interface ACL configuration with provided configuration + register: result + cisco.iosxr.iosxr_acl_interfaces: &id001 + config: + + - name: GigabitEthernet0/0/0/0 + access_groups: + + - afi: ipv6 + acls: + + - name: acl6_3 + direction: in + + - name: GigabitEthernet0/0/0/1 + access_groups: + + - afi: ipv4 + acls: + + - name: acl_2 + direction: in + + - afi: ipv6 + acls: + + - name: acl6_3 + direction: out + state: overridden + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Overridde all interface ACL configuration with provided configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_acl_interfaces: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/parsed.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/parsed.yaml new file mode 100644 index 00000000..3edc6faf --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/parsed.yaml @@ -0,0 +1,16 @@ +--- +- debug: + msg: START iosxr_acl_interfaces parsed integration tests on connection={{ ansible_connection + }} + +- name: Parse externally provided ACL interfaces config to agnostic model + register: result + cisco.iosxr.iosxr_acl_interfaces: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['parsed']) |length ==\ + \ 0 }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/rendered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/rendered.yaml new file mode 100644 index 00000000..f67d4520 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/rendered.yaml @@ -0,0 +1,46 @@ +--- +- debug: + msg: START iosxr_acl_interfaces rendered integration tests on connection={{ + ansible_connection }} + +- name: Render platform specific commands from task input using rendered state + register: result + cisco.iosxr.iosxr_acl_interfaces: + config: + + - name: GigabitEthernet0/0/0/0 + access_groups: + + - afi: ipv4 + acls: + + - name: acl_1 + direction: in + + - name: acl_2 + direction: out + + - afi: ipv6 + acls: + + - name: acl6_1 + direction: in + + - name: acl6_2 + direction: out + + - name: GigabitEthernet0/0/0/1 + access_groups: + + - afi: ipv4 + acls: + + - name: acl_1 + direction: out + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['rendered']) |length\ + \ == 0 }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/replaced.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/replaced.yaml new file mode 100644 index 00000000..4881afc5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/replaced.yaml @@ -0,0 +1,63 @@ +--- +- debug: + msg: START iosxr_acl_interfaces replaced integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate.yaml + +- block: + + - name: Replace device configurations of listed interface with provided configurations + register: result + cisco.iosxr.iosxr_acl_interfaces: &id001 + config: + + - name: GigabitEthernet0/0/0/0 + access_groups: + + - afi: ipv6 + acls: + + - name: acl6_3 + direction: in + state: replaced + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Replace device configurations of listed interfaces with provided configurarions + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_acl_interfaces: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/rtt.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/rtt.yaml new file mode 100644 index 00000000..8ee32f7b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/tests/cli/rtt.yaml @@ -0,0 +1,114 @@ +--- +- debug: + msg: START iosxr_acl_interfaces round trip integration tests on connection={{ + ansible_connection }} + +- block: + + - include_tasks: _remove_config.yaml + + - name: Populate the device with ACLs + cisco.iosxr.iosxr_config: + lines: "ipv4 access-list acl_1\n10 permit ipv4 any any\nipv4 access-list\ + \ acl_2\n10 permit ipv4 any any\nipv4 access-list acl_3\n10 permit ipv4\ + \ any any\nipv6 access-list acl6_1\n10 permit ipv6 any any\nipv6 access-list\ + \ acl6_2\n10 permit ipv6 any any\nipv6 access-list acl6_3\n10 permit ipv6\ + \ any any\n" + + - name: Apply the provided configuration (base config) + cisco.iosxr.iosxr_acl_interfaces: + config: + + - name: GigabitEthernet0/0/0/0 + access_groups: + + - afi: ipv4 + acls: + + - name: acl_1 + direction: in + + - name: acl_2 + direction: out + + - afi: ipv6 + acls: + + - name: acl6_1 + direction: in + + - name: acl6_2 + direction: out + + - name: GigabitEthernet0/0/0/1 + access_groups: + + - afi: ipv4 + acls: + + - name: acl_1 + direction: out + state: merged + + - name: Gather interfaces facts + cisco.iosxr.iosxr_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - acl_interfaces + + - name: Apply the provided configuration (config to be reverted) + register: result + cisco.iosxr.iosxr_acl_interfaces: + config: + + - name: GigabitEthernet0/0/0/1 + access_groups: + + - afi: ipv4 + acls: + + - name: acl_1 + direction: in + + - name: acl_2 + direction: out + + - afi: ipv6 + acls: + + - name: acl6_1 + direction: in + + - name: acl6_2 + direction: out + + - name: GigabitEthernet0/0/0/0 + access_groups: + + - afi: ipv4 + acls: + + - name: acl_1 + direction: out + state: overridden + + - name: Assert that changes were applied + assert: + that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Revert back to base config using facts round trip + register: revert + cisco.iosxr.iosxr_acl_interfaces: + config: "{{ ansible_facts['network_resources']['acl_interfaces'] }}" + state: overridden + + - name: Assert that config was reverted + assert: + that: "{{ merged['after'] | symmetric_difference(revert['after']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/vars/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/vars/main.yaml new file mode 100644 index 00000000..c96adb12 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acl_interfaces/vars/main.yaml @@ -0,0 +1,172 @@ +--- +merged: + before: + - name: MgmtEth0/0/CPU0/0 + - name: GigabitEthernet0/0/0/0 + - name: GigabitEthernet0/0/0/1 + commands: + - interface GigabitEthernet0/0/0/0 + - ipv4 access-group acl_1 ingress + - ipv4 access-group acl_2 egress + - ipv6 access-group acl6_1 ingress + - ipv6 access-group acl6_2 egress + - interface GigabitEthernet0/0/0/1 + - ipv4 access-group acl_1 egress + update_commands: + - interface GigabitEthernet0/0/0/1 + - ipv4 access-group acl_2 egress + - ipv4 access-group acl_1 ingress + after: + - name: MgmtEth0/0/CPU0/0 + - name: GigabitEthernet0/0/0/0 + access_groups: + - acls: + - name: acl_1 + direction: in + - name: acl_2 + direction: out + afi: ipv4 + - acls: + - name: acl6_1 + direction: in + - name: acl6_2 + direction: out + afi: ipv6 + - name: GigabitEthernet0/0/0/1 + access_groups: + - acls: + - name: acl_1 + direction: out + afi: ipv4 + update_before: + - name: MgmtEth0/0/CPU0/0 + - access_groups: + - acls: + - direction: in + name: acl_1 + - direction: out + name: acl_2 + afi: ipv4 + - acls: + - direction: in + name: acl6_1 + - direction: out + name: acl6_2 + afi: ipv6 + name: GigabitEthernet0/0/0/0 + - access_groups: + - acls: + - direction: out + name: acl_1 + afi: ipv4 + name: GigabitEthernet0/0/0/1 + update_after: + - name: MgmtEth0/0/CPU0/0 + - access_groups: + - acls: + - direction: in + name: acl_1 + - direction: out + name: acl_2 + afi: ipv4 + - acls: + - direction: in + name: acl6_1 + - direction: out + name: acl6_2 + afi: ipv6 + name: GigabitEthernet0/0/0/0 + - access_groups: + - acls: + - direction: in + name: acl_1 + - direction: out + name: acl_2 + afi: ipv4 + name: GigabitEthernet0/0/0/1 +replaced: + commands: + - interface GigabitEthernet0/0/0/0 + - no ipv4 access-group acl_1 ingress + - no ipv4 access-group acl_2 egress + - no ipv6 access-group acl6_2 egress + - ipv6 access-group acl6_3 ingress + after: + - name: MgmtEth0/0/CPU0/0 + - name: GigabitEthernet0/0/0/0 + access_groups: + - afi: ipv6 + acls: + - name: acl6_3 + direction: in + - name: GigabitEthernet0/0/0/1 + access_groups: + - acls: + - name: acl_1 + direction: out + afi: ipv4 +overridden: + commands: + - interface GigabitEthernet0/0/0/0 + - no ipv4 access-group acl_1 ingress + - no ipv4 access-group acl_2 egress + - no ipv6 access-group acl6_2 egress + - ipv6 access-group acl6_3 ingress + - interface GigabitEthernet0/0/0/1 + - no ipv4 access-group acl_1 egress + - ipv4 access-group acl_2 ingress + - ipv6 access-group acl6_3 egress + after: + - name: MgmtEth0/0/CPU0/0 + - name: GigabitEthernet0/0/0/0 + access_groups: + - afi: ipv6 + acls: + - name: acl6_3 + direction: in + - name: GigabitEthernet0/0/0/1 + access_groups: + - acls: + - name: acl_2 + direction: in + afi: ipv4 + - acls: + - name: acl6_3 + direction: out + afi: ipv6 +deleted: + commands: + - interface GigabitEthernet0/0/0/0 + - no ipv4 access-group acl_1 ingress + - no ipv4 access-group acl_2 egress + - no ipv6 access-group acl6_1 ingress + - no ipv6 access-group acl6_2 egress + - interface GigabitEthernet0/0/0/1 + - no ipv4 access-group acl_1 egress + after: + - name: MgmtEth0/0/CPU0/0 + - name: GigabitEthernet0/0/0/0 + - name: GigabitEthernet0/0/0/1 +round_trip: + after: + - name: MgmtEth0/0/CPU0/0 + - access_groups: + - acls: + - direction: out + name: acl_1 + afi: ipv4 + name: GigabitEthernet0/0/0/0 + - access_groups: + - acls: + - direction: in + name: acl_1 + - direction: out + name: acl_2 + afi: ipv4 + - acls: + - direction: in + name: acl6_1 + - direction: out + name: acl6_2 + afi: ipv6 + name: GigabitEthernet0/0/0/1 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tasks/cli.yaml new file mode 100644 index 00000000..f622cf94 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tasks/cli.yaml @@ -0,0 +1,20 @@ +--- +- name: Collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + delegate_to: localhost + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/_populate_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/_populate_config.yaml new file mode 100644 index 00000000..0f840b45 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/_populate_config.yaml @@ -0,0 +1,9 @@ +--- +- name: Setup + cisco.iosxr.iosxr_config: + lines: "ipv6 access-list acl6_1\n10 deny tcp 2001:db8:1234::/48 range ftp telnet\ + \ any syn ttl range 180 250 authen routing log\n20 permit icmpv6 any any router-advertisement\ + \ precedence network destopts\nipv4 access-list acl_1\n16 remark TEST_ACL_1_REMARK\n\ + 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst\n23\ + \ deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12\nipv4\ + \ access-list acl_2\n10 remark TEST_ACL_2_REMARK" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/_remove_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/_remove_config.yaml new file mode 100644 index 00000000..42a59d70 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/_remove_config.yaml @@ -0,0 +1,9 @@ +--- +- name: Remove ACLs + vars: + lines: "no ipv4 access-list acl_1\nno ipv4 access-list acl_2\nno ipv4 access-list\ + \ acl_3\nno ipv4 access-list acl_3\nno ipv6 access-list acl6_1\nno ipv6 access-list\ + \ acl6_2\nno ipv6 access-list acl6_3\n" + ignore_errors: true + ansible.netcommon.cli_config: + config: '{{ lines }}' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/deleted.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/deleted.yaml new file mode 100644 index 00000000..25bca57b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/deleted.yaml @@ -0,0 +1,100 @@ +--- +- debug: + msg: Start iosxr_lag_interfaces deleted integration tests ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + - name: Delete a single ACL + register: result + cisco.iosxr.iosxr_acls: &id002 + config: + + - afi: ipv6 + acls: + + - name: acl6_1 + state: deleted + + - assert: + that: + - '"no ipv6 access-list acl6_1" in result.commands' + - result.commands|length == 1 + + - name: Delete a single ACL (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_acls: *id002 + + - name: Assert that the previous task was idempotent + assert: &id003 + that: + - result.changed == false + - result.commands|length == 0 + + - name: Delete all ACLs under one AFI + register: result + cisco.iosxr.iosxr_acls: &id004 + config: + + - afi: ipv4 + state: deleted + + - assert: + that: + - '"no ipv4 access-list acl_1" in result.commands' + - '"no ipv4 access-list acl_2" in result.commands' + - result.commands|length == 2 + + - name: Delete all ACLs under one AFI (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_acls: *id004 + + - name: Assert that the previous task was idempotent + assert: *id003 + + - include_tasks: _populate_config.yaml + + - name: Delete all ACLs from the device + register: result + cisco.iosxr.iosxr_acls: &id005 + state: deleted + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that the correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that the after dicts were correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Delete all ACLs from the device (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_acls: *id005 + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == false + - result.commands|length == 0 + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/empty_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/empty_config.yaml new file mode 100644 index 00000000..311c5a08 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/empty_config.yaml @@ -0,0 +1,60 @@ +--- +- debug: + msg: START iosxr_acls empty_config integration tests on connection={{ ansible_connection + }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_acls: + config: + state: merged + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state merged' + +- name: Replaced with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_acls: + config: + state: replaced + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Overridden with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_acls: + config: + state: overridden + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state overridden' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_acls: + config: + state: rendered + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state rendered' + +- name: Parsed with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_acls: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/fixtures/parsed.cfg new file mode 100644 index 00000000..31155e23 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/fixtures/parsed.cfg @@ -0,0 +1,8 @@ +ipv4 access-list acl_1 + 10 remark TEST_ACL_2_REMARK +ipv4 access-list acl_2 + 11 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 authen routing log + 21 permit icmpv6 any any router-advertisement precedence network packet-length eq 576 destopts +ipv6 access-list acl6_1 + 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log + 20 permit icmpv6 any any router-advertisement precedence network packet-length eq 576 destopts diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/gathered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/gathered.yaml new file mode 100644 index 00000000..ca4d0ffb --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/gathered.yaml @@ -0,0 +1,23 @@ +--- +- debug: + msg: START iosxr_acls gathered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Gather ACL interfaces facts using gathered state + register: result + cisco.iosxr.iosxr_acls: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ merged['after'] | symmetric_difference(result['gathered']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/merged.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/merged.yaml new file mode 100644 index 00000000..cdc39ae0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/merged.yaml @@ -0,0 +1,186 @@ +--- +- debug: + msg: START iosxr_acls merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + cisco.iosxr.iosxr_acls: &id001 + config: + + - afi: ipv6 + acls: + + - name: acl6_1 + aces: + + - sequence: 10 + grant: deny + protocol: tcp + source: + prefix: 2001:db8:1234::/48 + port_protocol: + range: + start: ftp + end: telnet + destination: + any: true + protocol_options: + tcp: + syn: true + ttl: + range: + start: 180 + end: 250 + routing: true + authen: true + log: true + + - sequence: 20 + grant: permit + protocol: icmpv6 + source: + any: true + destination: + any: true + protocol_options: + icmpv6: + router_advertisement: true + precedence: network + destopts: true + + - afi: ipv4 + acls: + + - name: acl_1 + aces: + + - sequence: 16 + remark: TEST_ACL_1_REMARK + + - sequence: 21 + grant: permit + protocol: tcp + source: + host: 192.0.2.10 + port_protocol: + range: + start: pop3 + end: 121 + destination: + address: 198.51.100.0 + wildcard_bits: 0.0.0.15 + protocol_options: + tcp: + rst: true + + - sequence: 23 + grant: deny + protocol: icmp + source: + any: true + destination: + prefix: 198.51.100.0/28 + protocol_options: + icmp: + reassembly_timeout: true + dscp: + lt: af12 + + - name: acl_2 + aces: + + - sequence: 10 + remark: TEST_ACL_2_REMARK + state: merged + + - name: Assert that before dicts were correctly generated + assert: + that: "{{ merged['before'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that after dicts was correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_acls: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dicts were correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Update existing ACEs + register: result + cisco.iosxr.iosxr_acls: &id002 + config: + + - afi: ipv4 + acls: + + - name: acl_1 + aces: + + - sequence: 21 + source: + prefix: 198.51.100.32/28 + port_protocol: + range: + start: pop3 + end: 121 + protocol_options: + tcp: + syn: true + + - sequence: 23 + protocol_options: + icmp: + router_advertisement: true + dscp: + eq: af23 + state: merged + + - name: Assert that the correct set of commands were generated + assert: + that: + - '"ipv4 access-list acl_1" in result.commands' + - '"21 permit tcp 198.51.100.32 0.0.0.15 range pop3 121 198.51.100.0 0.0.0.15 + syn" in result.commands' + - '"23 deny icmp any 198.51.100.0 0.0.0.15 router-advertisement dscp eq + af23" in result.commands' + - result.commands|length == 3 + + - name: Update existing ACEs (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_acls: *id002 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/overridden.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/overridden.yaml new file mode 100644 index 00000000..884bb9c3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/overridden.yaml @@ -0,0 +1,79 @@ +--- +- debug: + msg: START iosxr_acls overridden integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Overridde all ACLs configuration with provided configuration + register: result + cisco.iosxr.iosxr_acls: &id001 + config: + + - afi: ipv4 + acls: + + - name: acl_1 + aces: + + - sequence: 10 + grant: permit + source: + any: true + destination: + any: true + protocol: tcp + + - name: acl_2 + aces: + + - sequence: 20 + grant: permit + source: + any: true + destination: + any: true + protocol: igmp + state: overridden + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Overridde all interface LAG interface configuration with provided configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_acls: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/parsed.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/parsed.yaml new file mode 100644 index 00000000..4a046ade --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/parsed.yaml @@ -0,0 +1,15 @@ +--- +- debug: + msg: START iosxr_acls parsed integration tests on connection={{ ansible_connection + }} + +- name: Parse externally provided ACL config to agnostic model + register: result + cisco.iosxr.iosxr_acls: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ parsed | symmetric_difference(result['parsed']) |length == 0 }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/rendered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/rendered.yaml new file mode 100644 index 00000000..976a1627 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/rendered.yaml @@ -0,0 +1,101 @@ +--- +- debug: + msg: START iosxr_acls rendered integration tests on connection={{ ansible_connection + }} + +- name: Render platform specific commands from task input using rendered state + register: result + cisco.iosxr.iosxr_acls: + config: + + - afi: ipv6 + acls: + + - name: acl6_1 + aces: + + - sequence: 10 + grant: deny + protocol: tcp + source: + prefix: 2001:db8:1234::/48 + port_protocol: + range: + start: ftp + end: telnet + destination: + any: true + protocol_options: + tcp: + syn: true + ttl: + range: + start: 180 + end: 250 + routing: true + authen: true + log: true + + - sequence: 20 + grant: permit + protocol: icmpv6 + source: + any: true + destination: + any: true + protocol_options: + icmpv6: + router_advertisement: true + precedence: network + destopts: true + + - afi: ipv4 + acls: + + - name: acl_1 + aces: + + - sequence: 16 + remark: TEST_ACL_1_REMARK + + - sequence: 21 + grant: permit + protocol: tcp + source: + host: 192.0.2.10 + port_protocol: + range: + start: pop3 + end: 121 + destination: + address: 198.51.100.0 + wildcard_bits: 0.0.0.15 + protocol_options: + tcp: + rst: true + + - sequence: 23 + grant: deny + protocol: icmp + source: + any: true + destination: + prefix: 198.51.100.0/28 + protocol_options: + icmp: + reassembly_timeout: true + dscp: + lt: af12 + + - name: acl_2 + aces: + + - sequence: 10 + remark: TEST_ACL_2_REMARK + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['rendered']) |length\ + \ == 0 }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/replaced.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/replaced.yaml new file mode 100644 index 00000000..fb6b6230 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/replaced.yaml @@ -0,0 +1,78 @@ +--- +- debug: + msg: START iosxr_acl_interfaces replaced integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Replace device configurations of listed ACL with provided configurations + register: result + cisco.iosxr.iosxr_acls: &id001 + config: + + - afi: ipv4 + acls: + + - name: acl_2 + aces: + + - sequence: 11 + grant: permit + protocol: igmp + source: + host: 198.51.100.130 + destination: + any: true + ttl: + eq: 100 + + - sequence: 12 + grant: deny + source: + any: true + destination: + any: true + protocol: icmp + state: replaced + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Replace device configurations of listed interfaces with provided configurarions + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_acls: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/rtt.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/rtt.yaml new file mode 100644 index 00000000..68ead0b1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/tests/cli/rtt.yaml @@ -0,0 +1,96 @@ +--- +- debug: + msg: START iosxr_acls round trip integration tests on connection={{ ansible_connection + }} + +- block: + + - include_tasks: _remove_config.yaml + + - name: Apply the provided configuration (base config) + register: base_config + cisco.iosxr.iosxr_acls: + config: + + - afi: ipv4 + acls: + + - name: acl_2 + aces: + + - sequence: 11 + grant: permit + protocol: igmp + source: + host: 198.51.100.130 + destination: + any: true + ttl: + eq: 100 + + - sequence: 12 + grant: deny + source: + any: true + destination: + any: true + protocol: icmp + state: merged + + - name: Gather interfaces facts + cisco.iosxr.iosxr_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - acls + + - name: Apply the provided configuration (config to be reverted) + register: result + cisco.iosxr.iosxr_acls: + config: + + - afi: ipv4 + acls: + + - name: acl_1 + aces: + + - sequence: 10 + grant: permit + source: + any: true + destination: + any: true + protocol: tcp + + - name: acl_2 + aces: + + - sequence: 20 + grant: permit + source: + any: true + destination: + any: true + protocol: igmp + state: overridden + + - name: Assert that changes were applied + assert: + that: "{{ overridden['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Revert back to base config using facts round trip + register: revert + cisco.iosxr.iosxr_acls: + config: "{{ ansible_facts['network_resources']['acls'] }}" + state: overridden + + - name: Assert that config was reverted + assert: + that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/vars/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/vars/main.yaml new file mode 100644 index 00000000..86b2569d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_acls/vars/main.yaml @@ -0,0 +1,317 @@ +--- +merged: + before: [] + commands: + - ipv6 access-list acl6_1 + - 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 authen + routing log + - 20 permit icmpv6 any any router-advertisement precedence network destopts + - ipv4 access-list acl_1 + - 16 remark TEST_ACL_1_REMARK + - 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst + - 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 + - ipv4 access-list acl_2 + - 10 remark TEST_ACL_2_REMARK + after: + - acls: + - aces: + - remark: TEST_ACL_1_REMARK + sequence: 16 + - destination: + address: 198.51.100.0 + wildcard_bits: 0.0.0.15 + grant: permit + protocol: tcp + protocol_options: + tcp: + rst: true + sequence: 21 + source: + host: 192.0.2.10 + port_protocol: + range: + end: '121' + start: pop3 + - destination: + address: 198.51.100.0 + wildcard_bits: 0.0.0.15 + dscp: + lt: af12 + grant: deny + protocol: icmp + protocol_options: + icmp: + reassembly_timeout: true + sequence: 23 + source: + any: true + name: acl_1 + - aces: + - remark: TEST_ACL_2_REMARK + sequence: 10 + name: acl_2 + afi: ipv4 + - acls: + - aces: + - authen: true + destination: + any: true + grant: deny + log: true + protocol: tcp + protocol_options: + tcp: + syn: true + routing: true + sequence: 10 + source: + port_protocol: + range: + end: telnet + start: ftp + prefix: 2001:db8:1234::/48 + ttl: + range: + end: 250 + start: 180 + - destination: + any: true + destopts: true + grant: permit + precedence: network + protocol: icmpv6 + protocol_options: + icmpv6: + router_advertisement: true + sequence: 20 + source: + any: true + name: acl6_1 + afi: ipv6 +replaced: + commands: + - ipv4 access-list acl_2 + - no 10 + - 11 permit igmp host 198.51.100.130 any ttl eq 100 + - 12 deny icmp any any + after: + - acls: + - aces: + - remark: TEST_ACL_1_REMARK + sequence: 16 + - destination: + address: 198.51.100.0 + wildcard_bits: 0.0.0.15 + grant: permit + protocol: tcp + protocol_options: + tcp: + rst: true + sequence: 21 + source: + host: 192.0.2.10 + port_protocol: + range: + end: '121' + start: pop3 + - destination: + address: 198.51.100.0 + wildcard_bits: 0.0.0.15 + dscp: + lt: af12 + grant: deny + protocol: icmp + protocol_options: + icmp: + reassembly_timeout: true + sequence: 23 + source: + any: true + name: acl_1 + - aces: + - destination: + any: true + grant: permit + protocol: igmp + sequence: 11 + source: + host: 198.51.100.130 + ttl: + eq: 100 + - destination: + any: true + grant: deny + protocol: icmp + sequence: 12 + source: + any: true + name: acl_2 + afi: ipv4 + - acls: + - aces: + - authen: true + destination: + any: true + grant: deny + log: true + protocol: tcp + protocol_options: + tcp: + syn: true + routing: true + sequence: 10 + source: + port_protocol: + range: + end: telnet + start: ftp + prefix: 2001:db8:1234::/48 + ttl: + range: + end: 250 + start: 180 + - destination: + any: true + destopts: true + grant: permit + precedence: network + protocol: icmpv6 + protocol_options: + icmpv6: + router_advertisement: true + sequence: 20 + source: + any: true + name: acl6_1 + afi: ipv6 +overridden: + commands: + - no ipv6 access-list acl6_1 + - ipv4 access-list acl_1 + - no 16 + - no 21 + - no 23 + - 10 permit tcp any any + - ipv4 access-list acl_2 + - no 10 + - 20 permit igmp any any + after: + - acls: + - aces: + - destination: + any: true + grant: permit + protocol: tcp + sequence: 10 + source: + any: true + name: acl_1 + - aces: + - destination: + any: true + grant: permit + protocol: igmp + sequence: 20 + source: + any: true + name: acl_2 + afi: ipv4 +deleted: + commands: + - no ipv4 access-list acl_1 + - no ipv4 access-list acl_2 + - no ipv6 access-list acl6_1 + after: [] +parsed: + - acls: + - aces: + - remark: TEST_ACL_2_REMARK + sequence: 10 + name: acl_1 + - aces: + - authen: true + destination: + any: true + grant: deny + log: true + protocol: tcp + protocol_options: + tcp: + syn: true + routing: true + sequence: 11 + source: + port_protocol: + range: + end: telnet + start: ftp + prefix: 2001:db8:1234::/48 + ttl: + range: + end: 250 + start: 180 + - destination: + any: true + destopts: true + grant: permit + packet_length: + eq: 576 + precedence: network + protocol: icmpv6 + protocol_options: + icmpv6: + router_advertisement: true + sequence: 21 + source: + any: true + name: acl_2 + afi: ipv4 + - acls: + - aces: + - authen: true + destination: + any: true + grant: deny + log: true + protocol: tcp + protocol_options: + tcp: + syn: true + routing: true + sequence: 10 + source: + port_protocol: + range: + end: telnet + start: ftp + prefix: 2001:db8:1234::/48 + ttl: + range: + end: 250 + start: 180 + - destination: + any: true + destopts: true + grant: permit + packet_length: + eq: 576 + precedence: network + protocol: icmpv6 + protocol_options: + icmpv6: + router_advertisement: true + sequence: 20 + source: + any: true + name: acl6_1 + afi: ipv6 +round_trip: + after: + - members: + - member: GigabitEthernet0/0/0/8 + mode: passive + - member: GigabitEthernet0/0/0/9 + mode: active + name: Bundle-Ether10 + - mode: active + name: Bundle-Ether11 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/meta/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/meta/main.yaml new file mode 100644 index 00000000..be631e5d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_iosxr_tests diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tasks/cli.yaml new file mode 100644 index 00000000..8f7b62f9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tasks/cli.yaml @@ -0,0 +1,18 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tasks/main.yaml new file mode 100644 index 00000000..5d082a6f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tasks/main.yaml @@ -0,0 +1,3 @@ +--- +- include: cli.yaml +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tasks/netconf.yaml new file mode 100644 index 00000000..7579953a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tasks/netconf.yaml @@ -0,0 +1,26 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test cases (connection=ansible.netcommon.netconf) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.netconf' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - netconf + +- name: run test case (connection=local) + include: '{{ test_case_to_run }} ansible_connection=local' + with_first_found: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/cli/basic-login.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/cli/basic-login.yaml new file mode 100644 index 00000000..82f48d6b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/cli/basic-login.yaml @@ -0,0 +1,36 @@ +--- +- name: setup - remove login + cisco.iosxr.iosxr_banner: + banner: login + provider: '{{ cli }}' + state: absent + +- name: Set login + register: result + cisco.iosxr.iosxr_banner: + banner: login + text: "@this is my login banner\nthat has a multiline\nstring\n@" + provider: '{{ cli }}' + state: present + +- debug: + msg: '{{ result }}' + +- assert: + that: + - result.changed == true + - "'this is my login banner' in result.commands[0]" + - "'that has a multiline' in result.commands[0]" + +- name: Set login again (idempotent) + register: result + cisco.iosxr.iosxr_banner: + banner: login + text: "@this is my login banner\nthat has a multiline\nstring\n@" + provider: '{{ cli }}' + state: present + +- assert: + that: + - result.changed == false + - result.commands | length == 0 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/cli/basic-motd.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/cli/basic-motd.yaml new file mode 100644 index 00000000..1b442c0d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/cli/basic-motd.yaml @@ -0,0 +1,36 @@ +--- +- name: setup - remove motd + cisco.iosxr.iosxr_banner: + banner: motd + state: absent + provider: '{{ cli }}' + +- name: Set motd + register: result + cisco.iosxr.iosxr_banner: + banner: motd + text: "@this is my motd banner\nthat has a multiline\nstring\n@" + provider: '{{ cli }}' + state: present + +- debug: + msg: '{{ result }}' + +- assert: + that: + - result.changed == true + - "'this is my motd banner' in result.commands[0]" + - "'that has a multiline' in result.commands[0]" + +- name: Set motd again (idempotent) + register: result + cisco.iosxr.iosxr_banner: + banner: motd + text: "@this is my motd banner\nthat has a multiline\nstring\n@" + provider: '{{ cli }}' + state: present + +- assert: + that: + - result.changed == false + - result.commands | length == 0 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/cli/basic-no-login.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/cli/basic-no-login.yaml new file mode 100644 index 00000000..0274ca26 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/cli/basic-no-login.yaml @@ -0,0 +1,34 @@ +--- +- name: Setup + cisco.iosxr.iosxr_banner: + banner: login + text: "@Junk login banner\nover multiple lines\n@" + provider: '{{ cli }}' + state: present + +- name: remove login + register: result + cisco.iosxr.iosxr_banner: + banner: login + state: absent + provider: '{{ cli }}' + +- debug: + msg: '{{ result }}' + +- assert: + that: + - result.changed == true + - "'no banner login' in result.commands[0]" + +- name: remove login (idempotent) + register: result + cisco.iosxr.iosxr_banner: + banner: login + state: absent + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + - result.commands | length == 0 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/netconf/basic-login.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/netconf/basic-login.yaml new file mode 100644 index 00000000..057a1ab9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/netconf/basic-login.yaml @@ -0,0 +1,36 @@ +--- +- name: setup - remove login + cisco.iosxr.iosxr_banner: + banner: login + provider: '{{ netconf }}' + state: absent + +- name: Set login + register: result + cisco.iosxr.iosxr_banner: + banner: login + text: "@this is my login banner\nthat has a multiline\nstring\n@" + provider: '{{ netconf }}' + state: present + +- debug: + msg: '{{ result }}' + +- assert: + that: + - result.changed == true + - "'this is my login banner' in result.xml" + - "'that has a multiline' in result.xml" + +- name: Set login again (idempotent) + register: result + cisco.iosxr.iosxr_banner: + banner: login + text: "@this is my login banner\nthat has a multiline\nstring\n@" + provider: '{{ netconf }}' + state: present + +- assert: + that: + - result.changed == false + - result.xml | length == 0 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/netconf/basic-motd.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/netconf/basic-motd.yaml new file mode 100644 index 00000000..52bd3a76 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/netconf/basic-motd.yaml @@ -0,0 +1,36 @@ +--- +- name: setup - remove motd + cisco.iosxr.iosxr_banner: + banner: motd + state: absent + provider: '{{ netconf }}' + +- name: Set motd + register: result + cisco.iosxr.iosxr_banner: + banner: motd + text: "@this is my motd banner\nthat has a multiline\nstring\n@" + provider: '{{ netconf }}' + state: present + +- debug: + msg: '{{ result }}' + +- assert: + that: + - result.changed == true + - "'this is my motd banner' in result.xml" + - "'that has a multiline' in result.xml" + +- name: Set motd again (idempotent) + register: result + cisco.iosxr.iosxr_banner: + banner: motd + text: "@this is my motd banner\nthat has a multiline\nstring\n@" + provider: '{{ netconf }}' + state: present + +- assert: + that: + - result.changed == false + - result.xml | length == 0 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/netconf/basic-no-login.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/netconf/basic-no-login.yaml new file mode 100644 index 00000000..72d125d9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_banner/tests/netconf/basic-no-login.yaml @@ -0,0 +1,34 @@ +--- +- name: Setup + cisco.iosxr.iosxr_banner: + banner: login + text: "@Junk login banner\nover multiple lines\n@" + provider: '{{ netconf }}' + state: present + +- name: remove login + register: result + cisco.iosxr.iosxr_banner: + banner: login + state: absent + provider: '{{ netconf }}' + +- debug: + msg: '{{ result }}' + +- assert: + that: + - result.changed == true + - "'xc:operation=\"delete\"' in result.xml" + +- name: remove login (idempotent) + register: result + cisco.iosxr.iosxr_banner: + banner: login + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.xml | length == 0 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/meta/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/meta/main.yaml new file mode 100644 index 00000000..be631e5d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_iosxr_tests diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/tasks/cli.yaml new file mode 100644 index 00000000..163934f5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/tasks/cli.yaml @@ -0,0 +1,16 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/tests/cli/basic.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/tests/cli/basic.yaml new file mode 100644 index 00000000..dc2b4c44 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_bgp/tests/cli/basic.yaml @@ -0,0 +1,256 @@ +--- +- debug: msg="START iosxr cli/iosxr_bgp.yaml on connection={{ ansible_connection + }}" + +- name: Check IOS-XR version + register: facts + cisco.iosxr.iosxr_facts: + gather_subset: default + +- block: + + - name: Clear existing BGP config + ignore_errors: true + cisco.iosxr.iosxr_bgp: + operation: delete + + - name: Configure BGP with AS 64496 and a router-id + register: result + cisco.iosxr.iosxr_bgp: &id001 + operation: merge + config: + bgp_as: 64496 + router_id: 192.0.2.2 + + - assert: + that: + - result.changed == true + - "'router bgp 64496' in result.commands" + - "'bgp router-id 192.0.2.2' in result.commands" + + - name: Configure BGP with AS 64496 and a router-id (idempotent) + register: result + cisco.iosxr.iosxr_bgp: *id001 + + - assert: + that: + - result.changed == false + + - name: Configure BGP neighbors + register: result + cisco.iosxr.iosxr_bgp: &id002 + operation: merge + config: + bgp_as: 64496 + neighbors: + + - neighbor: 192.0.2.10 + remote_as: 64496 + description: IBGP_NBR_1 + advertisement_interval: 120 + timers: + keepalive: 300 + holdtime: 360 + + - neighbor: 192.0.2.15 + remote_as: 64496 + description: IBGP_NBR_2 + tcp_mss: 1500 + + - assert: + that: + - result.changed == true + - "'router bgp 64496' in result.commands" + - "'neighbor 192.0.2.10' in result.commands" + - "'remote-as 64496' in result.commands" + - "'description IBGP_NBR_1' in result.commands" + - "'timers 300 360' in result.commands" + - "'advertisement-interval 120' in result.commands" + - "'neighbor 192.0.2.15' in result.commands" + - "'remote-as 64496' in result.commands" + - "'description IBGP_NBR_2' in result.commands" + - "'tcp mss 1500' in result.commands" + + - name: Configure BGP neighbors (idempotent) + register: result + cisco.iosxr.iosxr_bgp: *id002 + + - assert: + that: + - result.changed == false + + - name: Configure BGP neighbors with operation replace + register: result + cisco.iosxr.iosxr_bgp: &id003 + operation: replace + config: + bgp_as: 64496 + neighbors: + + - neighbor: 192.0.2.15 + remote_as: 64496 + description: IBGP_NBR_2 + tcp_mss: 1500 + + - neighbor: 203.0.113.10 + remote_as: 64511 + description: EBGP_NBR_1 + + - assert: + that: + - result.changed == true + - "'neighbor 203.0.113.10' in result.commands" + - "'remote-as 64511' in result.commands" + - "'description EBGP_NBR_1' in result.commands" + - "'no neighbor 192.0.2.10' in result.commands" + + - name: Configure BGP neighbors with operation replace (idempotent) + register: result + cisco.iosxr.iosxr_bgp: *id003 + + - assert: + that: + - result.changed == false + + - name: create route-policy as prerequisite for BGP configuration + register: result + cisco.iosxr.iosxr_config: + lines: + - no route-policy RMAP_1 + - route-policy RMAP_1 + - exit + + - name: Configure networks under address family + register: result + cisco.iosxr.iosxr_bgp: &id004 + operation: merge + config: + bgp_as: 64496 + address_family: + + - afi: ipv4 + networks: + + - prefix: 198.51.100.48 + masklen: 28 + route_map: RMAP_1 + + - prefix: 192.0.2.64 + masklen: 27 + + - prefix: 203.0.113.160 + masklen: 27 + + - afi: ipv4 + safi: multicast + networks: + + - prefix: 198.51.100.64 + masklen: 28 + + - assert: + that: + - result.changed == true + - "'router bgp 64496' in result.commands" + - "'address-family ipv4 unicast' in result.commands" + - "'network 198.51.100.48/28 route-policy RMAP_1' in result.commands" + - "'network 192.0.2.64/27' in result.commands" + - "'network 203.0.113.160/27' in result.commands" + - "'address-family ipv4 multicast' in result.commands" + - "'network 198.51.100.64/28' in result.commands" + + - name: Configure networks under address family (idempotent) + register: result + cisco.iosxr.iosxr_bgp: *id004 + + - assert: + that: + - result.changed == false + + - name: Configure networks under address family with operation replace + register: result + cisco.iosxr.iosxr_bgp: &id005 + operation: replace + config: + bgp_as: 64496 + address_family: + + - afi: ipv4 + safi: unicast + networks: + + - prefix: 198.51.100.80 + masklen: 28 + + - prefix: 192.0.2.64 + masklen: 27 + + - prefix: 203.0.113.192 + masklen: 27 + + - afi: ipv4 + safi: multicast + networks: + + - prefix: 198.51.100.64 + masklen: 28 + + - assert: + that: + - result.changed == true + - '"router bgp 64496" in result.commands' + - '"address-family ipv4 unicast" in result.commands' + - '"network 198.51.100.80/28" in result.commands' + - '"network 203.0.113.192/27" in result.commands' + - '"no network 198.51.100.48/28" in result.commands' + - '"no network 203.0.113.160/27" in result.commands' + + - name: Configure networks under address family with operation replace (idempotent) + register: result + cisco.iosxr.iosxr_bgp: *id005 + + - assert: + that: + - result.changed == false + + - name: Override all the exisiting BGP config + register: result + cisco.iosxr.iosxr_bgp: + operation: override + config: + bgp_as: 64497 + router_id: 192.0.2.10 + log_neighbor_changes: true + + - assert: + that: + - result.changed == true + - "'router bgp 64497' in result.commands" + - "'bgp router-id 192.0.2.10' in result.commands" + - "'bgp log neighbor changes detail' in result.commands" + + - name: Teardown + register: result + cisco.iosxr.iosxr_bgp: &id006 + operation: delete + + - assert: + that: + - result.changed == true + - "'no router bgp 64497' in result.commands" + + - name: Teardown again (idempotent) + register: result + cisco.iosxr.iosxr_bgp: *id006 + + - assert: + that: + - result.changed == false + + - name: delete route-policy configures as prerequisite for BGP configuration + (teardown) + cisco.iosxr.iosxr_config: + lines: no route-policy RMAP_1 + when: facts['ansible_facts']['ansible_net_version'].split('[')[0] == '6.1.3' + +- debug: msg="END iosxr cli/iosxr_bgp.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/meta/main.yml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/meta/main.yml new file mode 100644 index 00000000..be631e5d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_iosxr_tests diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tasks/cli.yaml new file mode 100644 index 00000000..163934f5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tasks/cli.yaml @@ -0,0 +1,16 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/bad_operator.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/bad_operator.yaml new file mode 100644 index 00000000..8831d890 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/bad_operator.yaml @@ -0,0 +1,20 @@ +--- +- debug: msg="START cli/bad_operator.yaml on connection={{ ansible_connection }}" + +- name: test bad operator + register: result + ignore_errors: true + cisco.iosxr.iosxr_command: + commands: + - show version + - show interfaces GigabitEthernet 0/0 + wait_for: + + - "result[0] contains 'Description: Foo'" + +- assert: + that: + - result.failed == true + - result.msg is defined + +- debug: msg="END cli/bad_operator.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/cli_command.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/cli_command.yaml new file mode 100644 index 00000000..496478fb --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/cli_command.yaml @@ -0,0 +1,45 @@ +--- +- debug: + msg: START cli/cli_command.yaml on connection={{ ansible_connection }} + +- name: get output for single command + register: result + ansible.netcommon.cli_command: + command: show version + +- assert: + that: + - result.changed == false + - result.stdout is defined + +- name: send invalid command + register: result + ignore_errors: true + ansible.netcommon.cli_command: + command: show foo + +- assert: + that: + - result.failed == true + - result.msg is defined + +- name: delete config file on disk to prevent failure of copy task for duplicate + ignore_errors: true + ansible.netcommon.cli_command: + command: delete harddisk:ansible_tmp.txt + prompt: Delete harddisk\:/?ansible_tmp\.txt\[confirm\] + answer: '' + +- name: Run command with prompt + register: result + ansible.netcommon.cli_command: + command: copy running-config harddisk:ansible_tmp.txt + prompt: 'Destination file name \(control-c to abort\)\: \[\/ansible_tmp.txt\]\?' + answer: ansible_tmp.txt + +- assert: + that: + - result.stdout is defined + - "'ansible_tmp' in result.stdout" + +- debug: msg="END cli/cli_command.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/contains.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/contains.yaml new file mode 100644 index 00000000..c36ea300 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/contains.yaml @@ -0,0 +1,19 @@ +--- +- debug: msg="START cli/contains.yaml on connection={{ ansible_connection }}" + +- name: test contains operator + register: result + cisco.iosxr.iosxr_command: + commands: + - show version + - show interfaces Loopback 888 + wait_for: + - result[0] contains 'Cisco IOS XR Software' + - result[1] contains 'Hardware is Loopback interface' + +- assert: + that: + - result.changed == false + - result.stdout is defined + +- debug: msg="END cli/contains.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/invalid.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/invalid.yaml new file mode 100644 index 00000000..585dd24e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/invalid.yaml @@ -0,0 +1,32 @@ +--- +- debug: msg="START cli/invalid.yaml on connection={{ ansible_connection }}" + +- name: run invalid command + register: result + ignore_errors: true + cisco.iosxr.iosxr_command: + commands: + command: show foo + prompt: fooprompt + answer: "yes" + +- assert: + that: + - result.failed + +- name: run commands that include invalid command + register: result + ignore_errors: true + cisco.iosxr.iosxr_command: + commands: + - show version + + - command: show foo + prompt: fooprompt + answer: "yes" + +- assert: + that: + - result.failed + +- debug: msg="END cli/invalid.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/output.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/output.yaml new file mode 100644 index 00000000..468b556f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/output.yaml @@ -0,0 +1,28 @@ +--- +- debug: msg="START cli/output.yaml on connection={{ ansible_connection }}" + +- name: get output for single command + register: result + cisco.iosxr.iosxr_command: + commands: + - show version + +- assert: + that: + - result.changed == false + - result.stdout is defined + +- name: get output for multiple commands + register: result + cisco.iosxr.iosxr_command: + commands: + - show version + - show interfaces + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout | length == 2 + +- debug: msg="END cli/output.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/prompt.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/prompt.yaml new file mode 100644 index 00000000..4a82d0d0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/prompt.yaml @@ -0,0 +1,28 @@ +--- +- debug: + msg: START cli/prompt.yaml on connection={{ ansible_connection }} + +- name: delete config file on disk to prevent failure of copy task for duplicate + ignore_errors: true + cisco.iosxr.iosxr_command: + commands: + + - command: delete harddisk:ansible_tmp.txt + prompt: Delete harddisk\:/?ansible_tmp\.txt\[confirm\] + answer: '' + +- name: copy + register: result + cisco.iosxr.iosxr_command: + commands: + + - command: copy running-config harddisk:ansible_tmp.txt + prompt: 'Destination file name \(control-c to abort\)\: \[\/ansible_tmp.txt\]\?' + answer: ansible_tmp.txt + +- assert: + that: + - result.stdout is defined + - "'ansible_tmp' in result.stdout[0]" + +- debug: msg="END cli/prompt.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/timeout.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/timeout.yaml new file mode 100644 index 00000000..374271d3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_command/tests/cli/timeout.yaml @@ -0,0 +1,18 @@ +--- +- debug: msg="START cli/timeout.yaml on connection={{ ansible_connection }}" + +- name: test bad condition + register: result + ignore_errors: true + cisco.iosxr.iosxr_command: + commands: + - show version + wait_for: + - result[0] contains bad_value_string + +- assert: + that: + - result.failed == true + - result.msg is defined + +- debug: msg="END cli/timeout.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/fixtures/config_add_interface.txt b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/fixtures/config_add_interface.txt new file mode 100644 index 00000000..4aca2814 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/fixtures/config_add_interface.txt @@ -0,0 +1,35 @@ +hostname iosxr01 +line default + transport input ssh +! +interface Loopback888 + description test for ansible + shutdown +! +interface MgmtEth0/0/CPU0/0 + ipv4 address dhcp +! +interface preconfigure GigabitEthernet0/0/0/3 + description test-interface-3 + mtu 256 + speed 100 + duplex full +! +interface GigabitEthernet0/0/0/0 + shutdown +! +interface GigabitEthernet0/0/0/1 + shutdown +! +router static + address-family ipv4 unicast + 0.0.0.0/0 10.0.2.2 + ! +! +netconf-yang agent + ssh +! +ssh server v2 +ssh server netconf vrf default +! +end diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/fixtures/config_del_interface.txt b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/fixtures/config_del_interface.txt new file mode 100644 index 00000000..a35e4da7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/fixtures/config_del_interface.txt @@ -0,0 +1,29 @@ +hostname iosxr01 +line default + transport input ssh +! +interface Loopback888 + description test for ansible + shutdown +! +interface MgmtEth0/0/CPU0/0 + ipv4 address dhcp +! +interface GigabitEthernet0/0/0/0 + shutdown +! +interface GigabitEthernet0/0/0/1 + shutdown +! +router static + address-family ipv4 unicast + 0.0.0.0/0 10.0.2.2 + ! +! +netconf-yang agent + ssh +! +ssh server v2 +ssh server netconf vrf default +! +end diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/meta/main.yml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/meta/main.yml new file mode 100644 index 00000000..be631e5d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_iosxr_tests diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tasks/cli.yaml new file mode 100644 index 00000000..8f7b62f9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tasks/cli.yaml @@ -0,0 +1,18 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tasks/cli_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tasks/cli_config.yaml new file mode 100644 index 00000000..6edbb8f3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tasks/cli_config.yaml @@ -0,0 +1,18 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli_config' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tasks/main.yaml new file mode 100644 index 00000000..5604e9eb --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tasks/main.yaml @@ -0,0 +1,6 @@ +--- +- include: cli.yaml +- include: cli_config.yaml + +- include: redirection.yaml + when: ansible_version.full is version('2.10.0', '>=') diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tasks/redirection.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tasks/redirection.yaml new file mode 100644 index 00000000..6282ad40 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tasks/redirection.yaml @@ -0,0 +1,16 @@ +--- +- name: collect all redirection cli test cases + find: + paths: '{{ role_path }}/tests/redirection' + patterns: '{{ testcase }}.yaml' + register: shortname_test_cases + delegate_to: localhost + +- name: set test_items for redirection + set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/change_prefix_set.j2 b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/change_prefix_set.j2 new file mode 100644 index 00000000..572d15bf --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/change_prefix_set.j2 @@ -0,0 +1,7 @@ +prefix-set ebpg_filter + 192.168.0.0/16 ge 15 le 30 +end-set + +interface Loopback999 + description this is a test interface for prefix-set + diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/config.j2 b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/config.j2 new file mode 100644 index 00000000..06f98488 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/config.j2 @@ -0,0 +1,4 @@ +interface Loopback999 + description this is a test + shutdown + diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/configuration.j2 b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/configuration.j2 new file mode 100644 index 00000000..73c98879 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/configuration.j2 @@ -0,0 +1,3 @@ +interface Loopback888 + description test for ansible automation + shutdown diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/init_prefix_set.j2 b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/init_prefix_set.j2 new file mode 100644 index 00000000..d1170b02 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/init_prefix_set.j2 @@ -0,0 +1,3 @@ +prefix-set ebpg_filter + 192.168.0.0/16 ge 17 le 30 +end-set diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/route_policy.j2 b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/route_policy.j2 new file mode 100644 index 00000000..ecc68e81 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/route_policy.j2 @@ -0,0 +1,121 @@ +router ospf 1 + area 0 +! +prefix-set EBGP-PEER-BOGONS + 0.0.0.0/0, + 0.0.0.0/8 le 32, + 10.0.0.0/8 le 32, + 127.0.0.0/8 le 32, + 169.254.0.0/16 le 32, + 172.16.0.0/12 le 32, + 192.0.0.0/24 le 32, + 192.0.2.0/24 le 32, + 192.168.0.0/16 le 32, + 198.18.0.0/15 le 32, + 224.0.0.0/4 le 32, + 240.0.0.0/4 le 32 +end-set +! +prefix-set cust-ddos-DDOS +end-set +! +prefix-set cust-no-export +end-set +! +prefix-set acme_DC_Internal + 137.1.0.0/16, + 137.1.16.0/24, + 137.1.18.0/24, + 137.1.20.0/24, + 137.1.22.0/24, + 137.1.23.0/24, + 137.1.24.0/24, + 137.1.29.0/24, + 137.1.30.0/24, + 137.1.31.0/24, + 137.1.32.0/21, + 137.1.40.0/22, + 209.1.0.0/16 +end-set +! +as-path-set EBGP-PEER-AS16509-403-PERMIT-PATHS + ios-regex '^11164_8075_', + ios-regex '^11164_16509$', + ios-regex '^1116_16509_[0-9]+$', + ios-regex '^8075_', + ios-regex '^16509$', + ios-regex '^16509_[0-9]+$' +end-set +! +community-set cust-announce + 1525:65298, + 1525:65436, + 1525:65438, + 1525:65439, + 1525:65498, + 1525:65511, + 1523:65418, + 1523:65436, + 1523:65438 +end-set +! +community-set cust-no-export + 1525:65439, + 1525:65511, + 1525:65535 +end-set +! + +route-policy POLICY2 +end-policy +! +route-policy cust2bgp + set origin igp + set next-hop 137.1.16.12 +end-policy +! +rd-set ebpg-1 +end-set +! +rd-set EBGP_INCOMING_RD_SET + 172.16.0.0/16:*, + 172.17.0.0/16:100, + 192:*, + 192:100 +end-set +! +extcommunity-set rt EBGP_INCOMIG_RT_SET + 10:615, + 10:6150, + 15.15.15.15:15 +end-set +! +extcommunity-set rt ebpg-1 +end-set +! +route-policy static-to-bgp + if destination in cust-no-export then + apply cust2bgp + set community cust-no-export additive + elseif destination in cust-announce then + apply cust2bgp + set community cust-announce additive + elseif destination in cust-announce-backup then + apply cust2bgp + set local-preference 100 + set weight 0 + set community cust-announce additive + elseif destination in cust-no-export-backup then + apply cust2bgp + set local-preference 98 + set weight 0 + set community cust-no-export additive + else + drop + endif +end-policy +! +class-map match-any data + match precedence ipv4 0 1 + end-class-map +! diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/route_policy_change.j2 b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/route_policy_change.j2 new file mode 100644 index 00000000..45448bae --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/route_policy_change.j2 @@ -0,0 +1,65 @@ +prefix-set EBGP-PEER-BOGONS + 192.0.2.0/24 le 32, + 192.168.0.0/16 le 32, + 198.18.0.0/16 le 32, + 224.0.0.0/4 le 32, + 240.0.0.0/4 le 32 +end-set +! +as-path-set EBGP-PEER-AS16509-403-PERMIT-PATHS + ios-regex '^11164_8075_', + ios-regex '^1164_16509$', + ios-regex '^1116_16409_[0-9]+$', + ios-regex '^8075_' +end-set +! +community-set cust-announce + 1525:65298, + 1525:6546, + 1525:6438, + 1525:65439, + 1525:65498 +end-set +! +rd-set EBGP_INCOMING_RD_SET + 172.16.0.0/16:*, + 172.14.0.0/16:100, + 192:*, + 192:100 +end-set +! +extcommunity-set rt EBGP_INCOMIG_RT_SET + 10:615, + 10:6120, + 15.15.15.15:15 +end-set +! +route-policy POLICY2 +end-policy +! +route-policy static-to-bgp + if destination in cust-no-export then + apply cust2bgp + set community cust-no-export additive + elseif destination in cust-announce then + apply cust2bgp + set community cust-announce additive + elseif destination in cust-announce-backup then + apply cust2bgp + set local-preference 100 + set weight 23 + set community cust-announce additive + elseif destination in cust-no-export-backup then + apply cust2bgp + set local-preference 98 + set weight 0 + set community cust-no-export additive + else + drop + endif +end-policy +! +class-map match-any data + match precedence ipv4 0 1 2 + end-class-map +! diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/route_policy_clean.j2 b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/route_policy_clean.j2 new file mode 100644 index 00000000..08ba7686 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/basic/route_policy_clean.j2 @@ -0,0 +1,32 @@ +no router ospf 1 +! +no prefix-set EBGP-PEER-BOGONS +! +no prefix-set cust-ddos-DDOS +! +no prefix-set cust-no-export +! +no prefix-set acme_DC_Internal +! +no as-path-set EBGP-PEER-AS16509-403-PERMIT-PATHS +! +no community-set cust-announce +! +no community-set cust-no-export +! +no rd-set ebpg-1 +! +no rd-set EBGP_INCOMING_RD_SET +! +no extcommunity-set rt EBGP_INCOMIG_RT_SET +! +no extcommunity-set rt ebpg-1 +! +no route-policy POLICY2 +! +no route-policy cust2bgp +! +no route-policy static-to-bgp +! +no class-map match-any data +! diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/defaults/config.j2 b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/defaults/config.j2 new file mode 100644 index 00000000..1d4d9da8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/templates/defaults/config.j2 @@ -0,0 +1,4 @@ +interface Loopback999 + description this is a test + no shutdown + diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/backup.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/backup.yaml new file mode 100644 index 00000000..f1c1a89c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/backup.yaml @@ -0,0 +1,124 @@ +--- +- debug: msg="START cli/backup.yaml on connection={{ ansible_connection }}" + +- name: setup + cisco.iosxr.iosxr_config: + commands: + - no description + - no shutdown + parents: + - interface Loopback999 + match: none + +- name: collect any backup files + find: + paths: '{{ role_path }}/backup' + pattern: '{{ inventory_hostname_short }}_config*' + connection: local + register: backup_files + +- name: delete backup files + file: + path: '{{ item.path }}' + state: absent + with_items: '{{backup_files.files|default([])}}' + +- name: configure device with config + register: result + cisco.iosxr.iosxr_config: + src: basic/config.j2 + backup: true + +- assert: + that: + - result.changed == true + - result.updates is not defined + +- name: collect any backup files + find: + paths: '{{ role_path }}/backup' + pattern: '{{ inventory_hostname_short }}_config*' + connection: local + register: backup_files + +- assert: + that: + - backup_files.files is defined + +- name: delete configurable backup file path + file: + path: '{{ item }}' + state: absent + with_items: + - '{{ role_path }}/backup_test_dir/' + - '{{ role_path }}/backup/backup.cfg' + +- name: take configuration backup in custom filename and directory path + become: true + register: result + cisco.iosxr.iosxr_config: + backup: true + backup_options: + filename: backup.cfg + dir_path: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' + +- assert: + that: + - result.changed == true + +- name: check if the backup file-1 exist + find: + paths: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup.cfg' + register: backup_file + connection: local + +- assert: + that: + - backup_file.files is defined + +- name: take configuration backup in custom filename + become: true + register: result + cisco.iosxr.iosxr_config: + backup: true + backup_options: + filename: backup.cfg + +- assert: + that: + - result.changed == true + +- name: check if the backup file-2 exist + find: + paths: '{{ role_path }}/backup/backup.cfg' + register: backup_file + connection: local + +- assert: + that: + - backup_file.files is defined + +- name: take configuration backup in custom path and default filename + become: true + register: result + cisco.iosxr.iosxr_config: + backup: true + backup_options: + dir_path: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' + +- assert: + that: + - result.changed == true + +- name: check if the backup file-3 exist + find: + paths: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' + pattern: '{{ inventory_hostname_short }}_config*' + register: backup_file + connection: local + +- assert: + that: + - backup_file.files is defined + +- debug: msg="END cli/backup.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml new file mode 100644 index 00000000..39232f8b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml @@ -0,0 +1,28 @@ +--- +- debug: msg="START cli/comment-too-long.yaml on connection={{ ansible_connection + }}" + +- name: setup + cisco.iosxr.iosxr_config: + commands: + - no description + - no shutdown + parents: + - interface Loopback999 + match: none + +- name: Commit message too long + register: result + ignore_errors: true + cisco.iosxr.iosxr_config: + src: basic/config.j2 + comment: this is a really long message aaaaabbbbbbcdde end-of-message + +- assert: + that: + - result.changed == false + - result.updates is not defined + - "'comment argument cannot be more than 60 characters' in result.msg" + +- debug: msg="END cli/comment-too-long.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/comment.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/comment.yaml new file mode 100644 index 00000000..a75784f8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/comment.yaml @@ -0,0 +1,36 @@ +--- +- debug: msg="START cli/comment.yaml on connection={{ ansible_connection }}" + +- name: setup + cisco.iosxr.iosxr_config: + commands: + - no description + - no shutdown + parents: + - interface Loopback999 + match: none + +- name: configure device with comment + register: result + cisco.iosxr.iosxr_config: + src: basic/config.j2 + comment: this is sensible commit message + exclusive: true + +- assert: + that: + - result.changed == true + - result.updates is not defined + +- name: check device with config + register: result + cisco.iosxr.iosxr_config: + src: basic/config.j2 + exclusive: true + +- assert: + that: + - result.changed == false + - result.updates is not defined + +- debug: msg="END cli/comment.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/commit_label.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/commit_label.yaml new file mode 100644 index 00000000..73f9924e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/commit_label.yaml @@ -0,0 +1,70 @@ +--- +- debug: msg="START cli/commit_label.yaml on connection={{ ansible_connection }}" + +- name: setup + cisco.iosxr.iosxr_config: + commands: + - no description + - no shutdown + parents: + - interface Loopback999 + match: none + +- name: get a unique and valid label + set_fact: + label: ansible_{{ 1001 | random | to_uuid | truncate(20, true, '_') }} + +- name: configure device with a label and a comment + register: result + cisco.iosxr.iosxr_config: + src: basic/config.j2 + comment: this is sensible commit message + label: '{{ label }}' + +- assert: + that: + - result.changed == true + +- name: setup + cisco.iosxr.iosxr_config: + commands: + - no description + - no shutdown + parents: + - interface Loopback999 + match: none + +- name: Try to commit with old label, fail with a msg that label is alreay used + register: result + ignore_errors: true + cisco.iosxr.iosxr_config: + src: basic/config.j2 + label: '{{ label }}' + +- assert: + that: + - result.changed == false + - "'already used' in result.msg" + +- name: setup + cisco.iosxr.iosxr_config: + commands: + - no description + - no shutdown + parents: + - interface Loopback999 + match: none + +- name: Try to commit with invalid chars($) in label + register: result + ignore_errors: true + cisco.iosxr.iosxr_config: + src: basic/config.j2 + label: ansible_iosxr_config_$ + +- assert: + that: + - result.changed == false + - "'only contain alphabets' in result.msg" + +- debug: msg="END cli/commit_label.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/misplaced_sublevel.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/misplaced_sublevel.yaml new file mode 100644 index 00000000..3776cc52 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/misplaced_sublevel.yaml @@ -0,0 +1,29 @@ +--- +- debug: msg="START cli/misplaced_sublevel.yaml on connection={{ ansible_connection + }}" + +- name: setup + ignore_errors: true + cisco.iosxr.iosxr_config: + src: basic/init_prefix_set.j2 + +- name: Change prefix-set and new command after prefix-set + register: result + cisco.iosxr.iosxr_config: + src: basic/change_prefix_set.j2 + +- assert: + that: + - result.changed == true + +- name: Play same config again to verify no diff in prefix-set also works + register: result + cisco.iosxr.iosxr_config: + src: basic/change_prefix_set.j2 + +- assert: + that: + - result.changed == false + +- debug: msg="END cli/misplaced_sublevel.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/prefix_set_remark.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/prefix_set_remark.yaml new file mode 100644 index 00000000..48884a95 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/prefix_set_remark.yaml @@ -0,0 +1,29 @@ +--- +- debug: msg="START cli/prefix_set_remark.yaml on connection={{ ansible_connection }}" + +- name: pre-setup cleanup + cisco.iosxr.iosxr_config: + commands: + - no prefix-set test_set + +- name: setup + register: result + cisco.iosxr.iosxr_config: + lines: + - '#testremark' + - 192.168.1.0/20 le 24 + - end-set + parents: prefix-set test_set + +- assert: + that: + - result.changed == true + - "'#testremark' in result.commands" + +- name: post-setup cleanup + cisco.iosxr.iosxr_config: + commands: + - no prefix-set test_set + + +- debug: msg="END cli/prefix_set_remark.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/replace_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/replace_config.yaml new file mode 100644 index 00000000..4ce326a2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/replace_config.yaml @@ -0,0 +1,44 @@ +--- +- debug: msg="START cli/replace_config.yaml on connection={{ ansible_connection + }}" + +- name: setup + cisco.iosxr.iosxr_config: + commands: + - no interface GigabitEthernet0/0/0/3 + +- name: replace config (add preconfigured interface) + register: result + cisco.iosxr.iosxr_config: &id001 + src: '{{ role_path }}/fixtures/config_add_interface.txt' + replace: config + +- assert: + that: + - '"load harddisk:/ansible_config.txt" in result.commands' + +- name: replace config (add preconfigured interface)(idempotence) + register: result + cisco.iosxr.iosxr_config: *id001 + +- assert: &id003 + that: + - result.changed == false + +- name: replace config (del preconfigured interface) + register: result + cisco.iosxr.iosxr_config: &id002 + src: '{{ role_path }}/fixtures/config_del_interface.txt' + replace: config + +- assert: + that: + - '"load harddisk:/ansible_config.txt" in result.commands' + +- name: replace config (del preconfigured interface)(idempotence) + register: result + cisco.iosxr.iosxr_config: *id002 + +- assert: *id003 + +- debug: msg="END cli/replace_config.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/route_policy.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/route_policy.yaml new file mode 100644 index 00000000..a3cb79aa --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/route_policy.yaml @@ -0,0 +1,53 @@ +--- +- debug: msg="START cli/route_policy.yaml on connection={{ ansible_connection }}" + +- name: Cleanup + cisco.iosxr.iosxr_config: + src: basic/route_policy_clean.j2 + +- name: config setup route-policy/prefix-set/as-path-set/community-set + register: result + cisco.iosxr.iosxr_config: + src: basic/route_policy.j2 + +- assert: + that: + - result.changed == true + +- name: Configure same route-policy/prefix-set ... verify change=0 + register: result + cisco.iosxr.iosxr_config: + src: basic/route_policy.j2 + +- assert: + that: + - result.changed == false + +- name: Do a change in multi-sublevel route-policy/prefix-set/community-set + register: result + cisco.iosxr.iosxr_config: + src: basic/route_policy_change.j2 + +- assert: + that: + - result.changed == true + +- name: Configure same route-policy/prefix-set ... verify change=0 + register: result + cisco.iosxr.iosxr_config: + src: basic/route_policy_change.j2 + +- assert: + that: + - result.changed == false + +- name: Cleanup + register: result + cisco.iosxr.iosxr_config: + src: basic/route_policy_clean.j2 + +- assert: + that: + - result.changed == true + +- debug: msg="END cli/route_policy.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_basic.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_basic.yaml new file mode 100644 index 00000000..34a6a430 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_basic.yaml @@ -0,0 +1,33 @@ +--- +- debug: msg="START cli/src_basic.yaml on connection={{ ansible_connection }}" + +- name: setup + cisco.iosxr.iosxr_config: + commands: + - no description + - no shutdown + parents: + - interface Loopback999 + match: none + +- name: configure device with config + register: result + cisco.iosxr.iosxr_config: + src: basic/config.j2 + +- assert: + that: + - result.changed == true + - result.updates is not defined + +- name: check device with config + register: result + cisco.iosxr.iosxr_config: + src: basic/config.j2 + +- assert: + that: + - result.changed == false + - result.updates is not defined + +- debug: msg="END cli/src_basic.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_invalid.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_invalid.yaml new file mode 100644 index 00000000..688f5e13 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_invalid.yaml @@ -0,0 +1,16 @@ +--- +- debug: msg="START cli/src_invalid.yaml on connection={{ ansible_connection }}" + +- name: configure with invalid src + register: result + ignore_errors: true + cisco.iosxr.iosxr_config: + src: basic/foobar.j2 + +- assert: + that: + - result.changed == false + - result.failed == true + - result.msg == 'path specified in src not found' + +- debug: msg="END cli/src_invalid.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_match_none.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_match_none.yaml new file mode 100644 index 00000000..298136ad --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_match_none.yaml @@ -0,0 +1,35 @@ +--- +- debug: msg="START cli/src_match_none.yaml on connection={{ ansible_connection + }}" + +- name: setup + cisco.iosxr.iosxr_config: + commands: + - no description + - no shutdown + parents: + - interface Loopback999 + match: none + +- name: configure device with config + register: result + cisco.iosxr.iosxr_config: + src: basic/config.j2 + match: none + +- assert: + that: + - result.changed == true + - result.updates is not defined + +- name: check device with config + register: result + cisco.iosxr.iosxr_config: + src: basic/config.j2 + +- assert: + that: + - result.changed == false + - result.updates is not defined + +- debug: msg="END cli/src_match_none.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel.yaml new file mode 100644 index 00000000..f01a525b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel.yaml @@ -0,0 +1,43 @@ +--- +- debug: msg="START cli/sublevel.yaml on connection={{ ansible_connection }}" + +- name: setup + ignore_errors: true + cisco.iosxr.iosxr_config: + commands: + - no ipv4 access-list test + match: none + +- name: configure sub level command + register: result + cisco.iosxr.iosxr_config: + commands: + - 10 permit ipv4 any any log + parents: + - ipv4 access-list test + +- assert: + that: + - result.changed == true + - "'ipv4 access-list test' in result.commands" + - "'10 permit ipv4 any any log' in result.commands" + +- name: configure sub level command idempotent check + register: result + cisco.iosxr.iosxr_config: + commands: + - 10 permit ipv4 any any log + parents: + - ipv4 access-list test + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.iosxr.iosxr_config: + commands: + - no ipv4 access-list test + match: none + +- debug: msg="END cli/sublevel.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel_block.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel_block.yaml new file mode 100644 index 00000000..1c0a84e9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel_block.yaml @@ -0,0 +1,60 @@ +--- +- debug: msg="START cli/sublevel_block.yaml on connection={{ ansible_connection + }}" + +- name: setup + cisco.iosxr.iosxr_config: + commands: + - 10 permit ipv4 host 192.0.2.1 any log + - 20 permit ipv4 host 192.0.2.2 any log + - 30 permit ipv4 host 192.0.2.3 any log + parents: + - ipv4 access-list test + before: + - no ipv4 access-list test + match: none + +- name: configure sub level command using block resplace + register: result + cisco.iosxr.iosxr_config: + commands: + - 10 permit ipv4 host 192.0.2.1 any log + - 20 permit ipv4 host 192.0.2.2 any log + - 30 permit ipv4 host 192.0.2.3 any log + - 40 permit ipv4 host 192.0.2.4 any log + parents: + - ipv4 access-list test + replace: block + +- assert: + that: + - result.changed == true + - "'ipv4 access-list test' in result.commands" + - "'10 permit ipv4 host 192.0.2.1 any log' in result.commands" + - "'20 permit ipv4 host 192.0.2.2 any log' in result.commands" + - "'30 permit ipv4 host 192.0.2.3 any log' in result.commands" + - "'40 permit ipv4 host 192.0.2.4 any log' in result.commands" + +- name: check sub level command using block replace + register: result + cisco.iosxr.iosxr_config: + commands: + - 10 permit ipv4 host 192.0.2.1 any log + - 20 permit ipv4 host 192.0.2.2 any log + - 30 permit ipv4 host 192.0.2.3 any log + - 40 permit ipv4 host 192.0.2.4 any log + parents: + - ipv4 access-list test + replace: block + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.iosxr.iosxr_config: + commands: + - no ipv4 access-list test + match: none + +- debug: msg="END cli/sublevel_block.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel_exact.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel_exact.yaml new file mode 100644 index 00000000..29648c9a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel_exact.yaml @@ -0,0 +1,64 @@ +--- +- debug: msg="START cli/sublevel_exact.yaml on connection={{ ansible_connection + }}" + +- name: setup + cisco.iosxr.iosxr_config: + commands: + - 10 permit ipv4 host 192.0.2.1 any log + - 20 permit ipv4 host 192.0.2.2 any log + - 30 permit ipv4 host 192.0.2.3 any log + - 40 permit ipv4 host 192.0.2.4 any log + - 50 permit ipv4 host 192.0.2.5 any log + parents: + - ipv4 access-list test + before: + - no ipv4 access-list test + match: none + +- name: configure sub level command using exact match + register: result + cisco.iosxr.iosxr_config: + commands: + - 10 permit ipv4 host 192.0.2.1 any log + - 20 permit ipv4 host 192.0.2.2 any log + - 30 permit ipv4 host 192.0.2.3 any log + - 40 permit ipv4 host 192.0.2.4 any log + parents: + - ipv4 access-list test + match: exact + +- assert: + that: + - result.changed == true + - "'ipv4 access-list test' in result.commands" + - "'10 permit ipv4 host 192.0.2.1 any log' in result.commands" + - "'20 permit ipv4 host 192.0.2.2 any log' in result.commands" + - "'30 permit ipv4 host 192.0.2.3 any log' in result.commands" + - "'40 permit ipv4 host 192.0.2.4 any log' in result.commands" + - "'50 permit ipv4 host 192.0.2.5 any log' not in result.commands" + +- name: check sub level command using exact match + register: result + cisco.iosxr.iosxr_config: + commands: + - 10 permit ipv4 host 192.0.2.1 any log + - 20 permit ipv4 host 192.0.2.2 any log + - 30 permit ipv4 host 192.0.2.3 any log + - 40 permit ipv4 host 192.0.2.4 any log + - 50 permit ipv4 host 192.0.2.5 any log + parents: + - ipv4 access-list test + match: exact + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.iosxr.iosxr_config: + commands: + - no ipv4 access-list test + match: none + +- debug: msg="END cli/sublevel_exact.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel_strict.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel_strict.yaml new file mode 100644 index 00000000..0ed1155e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel_strict.yaml @@ -0,0 +1,66 @@ +--- +- debug: msg="START cli/sublevel_strict.yaml on connection={{ ansible_connection + }}" + +- name: setup + cisco.iosxr.iosxr_config: + commands: + - 10 permit ipv4 host 192.0.2.1 any log + - 20 permit ipv4 host 192.0.2.3 any log + - 30 permit ipv4 host 192.0.2.2 any log + - 40 permit ipv4 host 192.0.2.4 any log + - 50 permit ipv4 host 192.0.2.5 any log + parents: + - ipv4 access-list test + before: + - no ipv4 access-list test + match: none + +- name: configure sub level command using strict match + register: result + cisco.iosxr.iosxr_config: + commands: + - 10 permit ipv4 host 192.0.2.1 any log + - 20 permit ipv4 host 192.0.2.2 any log + - 30 permit ipv4 host 192.0.2.3 any log + - 40 permit ipv4 host 192.0.2.4 any log + parents: + - ipv4 access-list test + before: + - no ipv4 access-list test + match: strict + replace: block + +- assert: + that: + - result.changed == true + - "'ipv4 access-list test' in result.commands" + - "'10 permit ipv4 host 192.0.2.1 any log' in result.commands" + - "'20 permit ipv4 host 192.0.2.2 any log' in result.commands" + - "'30 permit ipv4 host 192.0.2.3 any log' in result.commands" + - "'40 permit ipv4 host 192.0.2.4 any log' in result.commands" + - "'50 permit ipv4 host 192.0.2.5 any log' not in result.commands" + +- name: check sub level command using strict match + register: result + cisco.iosxr.iosxr_config: + commands: + - 10 permit ipv4 host 192.0.2.1 any log + - 20 permit ipv4 host 192.0.2.2 any log + - 30 permit ipv4 host 192.0.2.3 any log + - 40 permit ipv4 host 192.0.2.4 any log + parents: + - ipv4 access-list test + match: strict + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.iosxr.iosxr_config: + commands: + - no ipv4 access-list test + match: none + +- debug: msg="END cli/sublevel_strict.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel_strict_mul_parents.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel_strict_mul_parents.yaml new file mode 100644 index 00000000..e7dc8a4d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/sublevel_strict_mul_parents.yaml @@ -0,0 +1,75 @@ +--- +- debug: msg="START cli/sublevel_strict_mul_parents.yaml on connection={{ ansible_connection + }}" + +- name: setup + cisco.iosxr.iosxr_config: + lines: + - class-map match-any c1 + - match precedence 7 + - policy-map p1 + - class c1 + - set precedence 2 + before: + - no policy-map p1 + - no class-map match-any c1 + match: none + +- name: configure sub level command using strict match + register: result + cisco.iosxr.iosxr_config: + lines: + - set precedence 5 + - police rate percent 10 + parents: + - policy-map p1 + - class c1 + match: strict + +- assert: + that: + - result.changed == true + - "'set precedence 5' in result.commands" + - "'police rate percent 10' in result.commands" + +- name: change sub level command order and config with strict match + register: result + cisco.iosxr.iosxr_config: + lines: + - police rate percent 10 + - set precedence 5 + parents: + - policy-map p1 + - class c1 + match: strict + +- assert: + that: + - result.changed == true + - "'set precedence 5' in result.commands" + - "'police rate percent 10' in result.commands" + +- name: Config sub level command with strict match (Idempotency) + register: result + cisco.iosxr.iosxr_config: + lines: + - set precedence 5 + - police rate percent 10 + parents: + - policy-map p1 + - class c1 + match: strict + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.iosxr.iosxr_config: + lines: + - no policy-map p1 + - no class-map match-any c1 + match: none + +- debug: msg="END cli/sublevel_strict_mul_parents.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/toplevel.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/toplevel.yaml new file mode 100644 index 00000000..eb7d8185 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/toplevel.yaml @@ -0,0 +1,37 @@ +--- +- debug: msg="START cli/toplevel.yaml on connection={{ ansible_connection }}" + +- name: setup + cisco.iosxr.iosxr_config: + commands: + - hostname {{ inventory_hostname_short }} + match: none + +- name: configure top level command + register: result + cisco.iosxr.iosxr_config: + commands: + - hostname foo + +- assert: + that: + - result.changed == true + - "'hostname foo' in result.commands" + +- name: configure top level command idempotent check + register: result + cisco.iosxr.iosxr_config: + commands: + - hostname foo + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.iosxr.iosxr_config: + commands: + - hostname {{ inventory_hostname_short }} + match: none + +- debug: msg="END cli/toplevel.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/toplevel_after.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/toplevel_after.yaml new file mode 100644 index 00000000..73a2a17b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/toplevel_after.yaml @@ -0,0 +1,45 @@ +--- +- debug: msg="START cli/toplevel_after.yaml on connection={{ ansible_connection + }}" + +- name: setup + cisco.iosxr.iosxr_config: + commands: + - no cdp + - hostname {{ inventory_hostname_short }} + match: none + +- name: configure top level command with before + register: result + cisco.iosxr.iosxr_config: + commands: + - hostname foo + after: + - cdp + +- assert: + that: + - result.changed == true + - "'hostname foo' in result.commands" + - "'cdp' in result.commands" + +- name: configure top level command with before idempotent check + register: result + cisco.iosxr.iosxr_config: + commands: + - hostname foo + after: + - no cdp + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.iosxr.iosxr_config: + commands: + - no cdp + - hostname {{ inventory_hostname_short }} + match: none + +- debug: msg="END cli/toplevel_after.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/toplevel_before.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/toplevel_before.yaml new file mode 100644 index 00000000..70ac2462 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/toplevel_before.yaml @@ -0,0 +1,45 @@ +--- +- debug: msg="START cli/toplevel_before.yaml on connection={{ ansible_connection + }}" + +- name: setup + cisco.iosxr.iosxr_config: + commands: + - no cdp + - hostname {{ inventory_hostname_short }} + match: none + +- name: configure top level command with before + register: result + cisco.iosxr.iosxr_config: + commands: + - hostname foo + before: + - cdp + +- assert: + that: + - result.changed == true + - "'hostname foo' in result.commands" + - "'cdp' in result.commands" + +- name: configure top level command with before idempotent check + register: result + cisco.iosxr.iosxr_config: + commands: + - hostname foo + before: + - cdp + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.iosxr.iosxr_config: + commands: + - no cdp + - hostname {{ inventory_hostname_short }} + match: none + +- debug: msg="END cli/toplevel_before.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/toplevel_nonidempotent.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/toplevel_nonidempotent.yaml new file mode 100644 index 00000000..a6c2a1ff --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/toplevel_nonidempotent.yaml @@ -0,0 +1,44 @@ +--- +- debug: msg="START cli/toplevel_nonidempotent.yaml on connection={{ ansible_connection + }}" + +- name: setup + cisco.iosxr.iosxr_config: + commands: + - hostname {{ inventory_hostname_short }} + match: none + +- name: configure top level command + register: result + cisco.iosxr.iosxr_config: + commands: + - banner motd "hello world" + - hostname foo + match: strict + +- assert: + that: + - result.changed == true + - "'hostname foo' in result.commands" + - "'banner motd \"hello world\"' in result.commands" + +- name: configure top level command idempotent check + register: result + cisco.iosxr.iosxr_config: + commands: + - banner motd "hello world" + - hostname foo + match: strict + +- assert: + that: + - result.changed == true + +- name: teardown + cisco.iosxr.iosxr_config: + commands: + - hostname {{ inventory_hostname_short }} + match: none + +- debug: msg="END cli/toplevel_nonidempotent.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli_config/cli_backup.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli_config/cli_backup.yaml new file mode 100644 index 00000000..3880a040 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli_config/cli_backup.yaml @@ -0,0 +1,114 @@ +--- +- debug: msg="END cli_config/backup.yaml on connection={{ ansible_connection }}" + +- name: delete configurable backup file path + file: + path: '{{ item }}' + state: absent + with_items: + - '{{ role_path }}/backup_test_dir/' + - '{{ role_path }}/backup/backup.cfg' + +- name: collect any backup files + find: + paths: '{{ role_path }}/backup' + pattern: '{{ inventory_hostname_short }}_config*' + register: backup_files + connection: local + +- name: delete backup files + file: + path: '{{ item.path }}' + state: absent + with_items: '{{backup_files.files|default([])}}' + +- name: take config backup + become: true + register: result + ansible.netcommon.cli_config: + backup: true + +- assert: + that: + - result.changed == true + +- name: collect any backup files + find: + paths: '{{ role_path }}/backup' + pattern: '{{ inventory_hostname_short }}_config*' + register: backup_files + connection: local + +- assert: + that: + - backup_files.files is defined + +- name: take configuration backup in custom filename and directory path + become: true + register: result + ansible.netcommon.cli_config: + backup: true + backup_options: + filename: backup.cfg + dir_path: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' + +- assert: + that: + - result.changed == true + +- name: check if the backup file-1 exist + find: + paths: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup.cfg' + register: backup_file + connection: local + +- assert: + that: + - backup_file.files is defined + +- name: take configuration backup in custom filename + become: true + register: result + ansible.netcommon.cli_config: + backup: true + backup_options: + filename: backup.cfg + +- assert: + that: + - result.changed == true + +- name: check if the backup file-2 exist + find: + paths: '{{ role_path }}/backup/backup.cfg' + register: backup_file + connection: local + +- assert: + that: + - backup_file.files is defined + +- name: take configuration backup in custom path and default filename + become: true + register: result + ansible.netcommon.cli_config: + backup: true + backup_options: + dir_path: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' + +- assert: + that: + - result.changed == true + +- name: check if the backup file-3 exist + find: + paths: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' + pattern: '{{ inventory_hostname_short }}_config*' + register: backup_file + connection: local + +- assert: + that: + - backup_file.files is defined + +- debug: msg="END cli_config/backup.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli_config/cli_basic.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli_config/cli_basic.yaml new file mode 100644 index 00000000..21c0db45 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli_config/cli_basic.yaml @@ -0,0 +1,32 @@ +--- +- debug: msg="START cli_config/cli_basic.yaml on connection={{ ansible_connection + }}" + +- name: setup + become: true + ansible.netcommon.cli_config: &id002 + config: "interface Loopback999\n no description\n no shutdown\n" + +- name: configure device with config + register: result + become: true + ansible.netcommon.cli_config: &id001 + config: "{{ lookup('template', 'basic/config.j2') }}" + +- assert: + that: + - result.changed == true + +- name: Idempotence + register: result + ansible.netcommon.cli_config: *id001 + +- assert: + that: + - result.changed == false + +- name: teardown + ansible.netcommon.cli_config: *id002 + +- debug: msg="END cli_config/cli_basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/redirection/shortname.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/redirection/shortname.yaml new file mode 100644 index 00000000..d1c67fe2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/redirection/shortname.yaml @@ -0,0 +1,37 @@ +--- +- debug: msg="START redirection/shortname.yaml on connection={{ ansible_connection }}" + +- name: Use src with module alias + register: result + cisco.iosxr.config: + src: basic/configuration.j2 + +- assert: + that: + # make sure that the template content was read and not the path + - result.changed == true + - '"description test for ansible automation" in result.diff["prepared"]' + +- name: use module alias to take configuration backup + register: result + cisco.iosxr.config: + backup: true + backup_options: + filename: backup_with_alias.cfg + dir_path: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' + +- assert: + that: + - result.changed == true + +- name: check if the backup file-4 exist + find: + paths: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup_with_alias.cfg' + register: backup_file + connection: local + +- assert: + that: + - backup_file.files is defined + +- debug: msg="END redirection/shortname.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/meta/main.yml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/meta/main.yml new file mode 100644 index 00000000..be631e5d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_iosxr_tests diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tasks/cli.yaml new file mode 100644 index 00000000..163934f5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tasks/cli.yaml @@ -0,0 +1,16 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tests/cli/all_facts.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tests/cli/all_facts.yaml new file mode 100644 index 00000000..d41e7ae2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tests/cli/all_facts.yaml @@ -0,0 +1,21 @@ +--- +- debug: msg="START cli/all_facts.yaml on connection={{ ansible_connection }}" + +- name: test getting all facts + register: result + cisco.iosxr.iosxr_facts: + gather_subset: + - all + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + - "'config' in result.ansible_facts.ansible_net_gather_subset" + - "'hardware' in result.ansible_facts.ansible_net_gather_subset" + - "'default' in result.ansible_facts.ansible_net_gather_subset" + - "'interfaces' in result.ansible_facts.ansible_net_gather_subset" + - result.ansible_facts.ansible_net_model == 'IOS XRv' + - result.ansible_facts.ansible_net_filesystems is defined + +- debug: msg="END cli/all_facts.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tests/cli/default_facts.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tests/cli/default_facts.yaml new file mode 100644 index 00000000..7f472779 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tests/cli/default_facts.yaml @@ -0,0 +1,21 @@ +--- +- debug: msg="START cli/default_facts.yaml on connection={{ ansible_connection }}" + +- name: test getting default facts + register: result + cisco.iosxr.iosxr_facts: + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + - "'hardware' in result.ansible_facts.ansible_net_gather_subset" + - "'default' in result.ansible_facts.ansible_net_gather_subset" + - "'interfaces' in result.ansible_facts.ansible_net_gather_subset" + - result.ansible_facts.ansible_net_filesystems is defined + - "'config' not in result.ansible_facts.ansible_net_gather_subset" + - result.ansible_facts.ansible_net_filesystems is defined + - result.ansible_facts.ansible_net_interfaces | length > 1 + - result.ansible_facts.ansible_net_config is not defined + +- debug: msg="END cli/default.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tests/cli/invalid_subset.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tests/cli/invalid_subset.yaml new file mode 100644 index 00000000..9deb3b13 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tests/cli/invalid_subset.yaml @@ -0,0 +1,36 @@ +--- +- debug: msg="START cli/invalid_subset.yaml on connection={{ ansible_connection + }}" + +- name: test invalid subset (foobar) + register: result + ignore_errors: true + cisco.iosxr.iosxr_facts: + gather_subset: + - foobar + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + - result.failed == true + - result.msg == 'Subset must be one of [config, default, hardware, interfaces], + got foobar' + +- name: test subset specified multiple times + register: result + ignore_errors: true + cisco.iosxr.iosxr_facts: + gather_subset: + - '!hardware' + - hardware + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + - result.failed == true + - result.msg == 'Bad subset' + ignore_errors: true + +- debug: msg="END cli/invalid_subset.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tests/cli/not_hardware.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tests/cli/not_hardware.yaml new file mode 100644 index 00000000..2f8e9679 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_facts/tests/cli/not_hardware.yaml @@ -0,0 +1,23 @@ +--- +- debug: msg="START cli/not_hardware_facts.yaml on connection={{ ansible_connection + }}" + +- name: test not hardware + register: result + cisco.iosxr.iosxr_facts: + gather_subset: + - '!hardware' + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + - "'config' in result.ansible_facts.ansible_net_gather_subset" + - "'default' in result.ansible_facts.ansible_net_gather_subset" + - "'interfaces' in result.ansible_facts.ansible_net_gather_subset" + - "'hardware' not in result.ansible_facts.ansible_net_gather_subset" + - result.ansible_facts.ansible_net_interfaces | length > 1 + - result.ansible_facts.ansible_net_filesystems is not defined + +- debug: msg="END cli/not_hardware_facts.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/meta/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/meta/main.yaml new file mode 100644 index 00000000..be631e5d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_iosxr_tests diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tasks/cli.yaml new file mode 100644 index 00000000..8f7b62f9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tasks/cli.yaml @@ -0,0 +1,18 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tasks/main.yaml new file mode 100644 index 00000000..5d082a6f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tasks/main.yaml @@ -0,0 +1,3 @@ +--- +- include: cli.yaml +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tasks/netconf.yaml new file mode 100644 index 00000000..e4754dcb --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tasks/netconf.yaml @@ -0,0 +1,26 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test cases (connection=ansible.netcommon.netconf) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.netconf' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - netconf + +- name: run test case (connection=local) + include: '{{ test_case_to_run }} ansible_connection=local' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/cli/basic.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/cli/basic.yaml new file mode 100644 index 00000000..c075035c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/cli/basic.yaml @@ -0,0 +1,296 @@ +--- +- debug: msg="START iosxr_interface cli/basic.yaml on connection={{ ansible_connection + }}" + +- name: Setup interface + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/2 + state: absent + provider: '{{ cli }}' + +- name: Confgure interface + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/2 + description: test-interface-initial + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"interface GigabitEthernet0/0/0/2 description test-interface-initial" in + result.commands' + +- name: Confgure interface (idempotent) + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/2 + description: test-interface-initial + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + +- name: Confgure interface parameters + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/2 + description: test-interface + speed: 100 + duplex: half + mtu: 512 + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"interface GigabitEthernet0/0/0/2 description test-interface" in result.commands' + - '"interface GigabitEthernet0/0/0/2 speed 100" in result.commands' + - '"interface GigabitEthernet0/0/0/2 duplex half" in result.commands' + - '"interface GigabitEthernet0/0/0/2 mtu 512" in result.commands' + +- name: Change interface parameters + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/2 + description: test-interface-1 + speed: 10 + duplex: full + mtu: 256 + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"interface GigabitEthernet0/0/0/2 description test-interface-1" in result.commands' + - '"interface GigabitEthernet0/0/0/2 speed 10" in result.commands' + - '"interface GigabitEthernet0/0/0/2 duplex full" in result.commands' + - '"interface GigabitEthernet0/0/0/2 mtu 256" in result.commands' + +- name: Change interface parameters (idempotent) + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/2 + description: test-interface-1 + speed: 10 + duplex: full + mtu: 256 + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + +- name: Disable interface + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/2 + enabled: false + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"interface GigabitEthernet0/0/0/2 shutdown" in result.commands' + +- name: Enable interface + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/2 + enabled: true + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"no interface GigabitEthernet0/0/0/2 shutdown" in result.commands' + +- name: Confgure second interface (setup) + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/3 + description: test-interface-initial + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"interface GigabitEthernet0/0/0/3 description test-interface-initial" in + result.commands' + +- name: Delete interface aggregate (setup) + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/3 + + - name: GigabitEthernet0/0/0/2 + state: absent + provider: '{{ cli }}' + +- name: Add interface aggregate + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/3 + mtu: 256 + description: test-interface-1 + + - name: GigabitEthernet0/0/0/2 + mtu: 516 + description: test-interface-2 + speed: 100 + duplex: full + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"interface GigabitEthernet0/0/0/3 speed 100" in result.commands' + - '"interface GigabitEthernet0/0/0/3 description test-interface-1" in result.commands' + - '"interface GigabitEthernet0/0/0/3 duplex full" in result.commands' + - '"interface GigabitEthernet0/0/0/3 mtu 256" in result.commands' + - '"interface GigabitEthernet0/0/0/2 speed 100" in result.commands' + - '"interface GigabitEthernet0/0/0/2 description test-interface-2" in result.commands' + - '"interface GigabitEthernet0/0/0/2 duplex full" in result.commands' + - '"interface GigabitEthernet0/0/0/2 mtu 516" in result.commands' + +- name: Add interface aggregate (idempotent) + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/3 + mtu: 256 + description: test-interface-1 + + - name: GigabitEthernet0/0/0/2 + mtu: 516 + description: test-interface-2 + speed: 100 + duplex: full + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + +- name: Disable interface aggregate + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/3 + + - name: GigabitEthernet0/0/0/2 + enabled: false + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"interface GigabitEthernet0/0/0/3 shutdown" in result.commands' + - '"interface GigabitEthernet0/0/0/2 shutdown" in result.commands' + +- name: Enable interface aggregate + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/3 + + - name: GigabitEthernet0/0/0/2 + enabled: true + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"no interface GigabitEthernet0/0/0/3 shutdown" in result.commands' + - '"no interface GigabitEthernet0/0/0/2 shutdown" in result.commands' + +- name: interface aggregate (setup) + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/4 + + - name: GigabitEthernet0/0/0/5 + description: test-interface-initial + provider: '{{ cli }}' + +- name: Create interface aggregate + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/4 + description: test_interface_1 + + - name: GigabitEthernet0/0/0/5 + description: test_interface_2 + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"interface GigabitEthernet0/0/0/4 description test_interface_1" in result.commands' + - '"interface GigabitEthernet0/0/0/5 description test_interface_2" in result.commands' + +- name: Delete interface aggregate + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/2 + + - name: GigabitEthernet0/0/0/3 + + - name: GigabitEthernet0/0/0/4 + + - name: GigabitEthernet0/0/0/5 + state: absent + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"no interface GigabitEthernet0/0/0/4" in result.commands' + - '"no interface GigabitEthernet0/0/0/5" in result.commands' + +- name: Delete interface aggregate (idempotent) + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/2 + + - name: GigabitEthernet0/0/0/3 + + - name: GigabitEthernet0/0/0/4 + + - name: GigabitEthernet0/0/0/5 + state: absent + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + +- debug: msg="END iosxr_interface cli/basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/cli/intent.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/cli/intent.yaml new file mode 100644 index 00000000..0ec81ba1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/cli/intent.yaml @@ -0,0 +1,80 @@ +--- +- debug: msg="START iosxr_interface cli/intent.yaml on connection={{ ansible_connection + }}" + +- name: Setup (interface is up) + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + description: test_interface_1 + enabled: true + state: present + provider: '{{ cli }}' + +- name: Check intent arguments + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + state: up + delay: 20 + provider: '{{ cli }}' + +- assert: + that: + - result.failed == false + +- name: Check intent arguments (failed condition) + ignore_errors: true + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + state: down + provider: '{{ cli }}' + +- assert: + that: + - result.failed == true + - "'state eq(down)' in result.failed_conditions" + +- name: Config + intent + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + enabled: false + state: down + delay: 20 + provider: '{{ cli }}' + +- assert: + that: + - result.failed == false + +- name: Config + intent (fail) + ignore_errors: true + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + enabled: false + state: up + provider: '{{ cli }}' + +- assert: + that: + - result.failed == true + - "'state eq(up)' in result.failed_conditions" + +- name: Aggregate config + intent (pass) + ignore_errors: true + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/1 + enabled: true + state: up + delay: 20 + provider: '{{ cli }}' + +- assert: + that: + - result.failed == false diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/cli/net_interface.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/cli/net_interface.yaml new file mode 100644 index 00000000..7ac652cb --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/cli/net_interface.yaml @@ -0,0 +1,53 @@ +--- +- debug: msg="START iosxr cli/net_interface.yaml on connection={{ ansible_connection + }}" + +- name: Setup interface + register: result + ansible.netcommon.net_interface: + name: GigabitEthernet0/0/0/2 + state: absent + provider: '{{ cli }}' + +- name: Confgure interface using platform agnostic module + register: result + ansible.netcommon.net_interface: + name: GigabitEthernet0/0/0/2 + description: test-interface-initial + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"interface GigabitEthernet0/0/0/2 description test-interface-initial" in + result.commands' + +- name: Confgure interface parameters using platform agnostic module + register: result + ansible.netcommon.net_interface: + name: GigabitEthernet0/0/0/2 + description: test-interface + speed: 100 + duplex: half + mtu: 512 + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"interface GigabitEthernet0/0/0/2 description test-interface" in result.commands' + - '"interface GigabitEthernet0/0/0/2 speed 100" in result.commands' + - '"interface GigabitEthernet0/0/0/2 duplex half" in result.commands' + - '"interface GigabitEthernet0/0/0/2 mtu 512" in result.commands' + +- name: Teardown interface + register: result + ansible.netcommon.net_interface: + name: GigabitEthernet0/0/0/2 + state: absent + provider: '{{ cli }}' + +- debug: msg="END iosxr cli/net_interface.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/netconf/basic.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/netconf/basic.yaml new file mode 100644 index 00000000..4731525d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/netconf/basic.yaml @@ -0,0 +1,308 @@ +--- +- debug: msg="START iosxr_interface netconf/basic.yaml" + +- name: Setup interface + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/0 + + - name: GigabitEthernet0/0/0/1 + state: absent + provider: '{{ netconf }}' + +- name: Confgure interface + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + description: test-interface-initial + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"GigabitEthernet0/0/0/1" in result.xml[0]' + +- name: Confgure interface (idempotent) + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + description: test-interface-initial + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Confgure interface parameters + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + description: test-interface + speed: 100 + duplex: half + mtu: 512 + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"GigabitEthernet0/0/0/1" in result.xml[0]' + - '"test-interface" in result.xml[0]' + - '"100" in result.xml[0]' + - '"512" in result.xml[0]' + +- name: Change interface parameters + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + description: test-interface-1 + speed: 10 + duplex: full + mtu: 256 + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"GigabitEthernet0/0/0/1" in result.xml[0]' + - '"test-interface-1" in result.xml[0]' + - '"10" in result.xml[0]' + - '"256" in result.xml[0]' + +- name: Change interface parameters (idempotent) + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + description: test-interface-1 + speed: 10 + duplex: full + mtu: 256 + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Disable interface + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + enabled: false + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + +- name: Enable interface + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + enabled: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + +- name: Confgure second interface (setup) + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/0 + description: test-interface-initial + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"GigabitEthernet0/0/0/0" in result.xml[0]' + +- name: Delete interface aggregate (setup) + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/0 + + - name: GigabitEthernet0/0/0/1 + state: absent + provider: '{{ netconf }}' + +- name: Add interface aggregate + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/0 + mtu: 256 + description: test-interface-1 + + - name: GigabitEthernet0/0/0/1 + mtu: 516 + description: test-interface-2 + speed: 100 + duplex: full + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"GigabitEthernet0/0/0/1" in result.xml[0]' + - '"GigabitEthernet0/0/0/0" in result.xml[0]' + +- name: Add interface aggregate (idempotent) + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/0 + mtu: 256 + description: test-interface-1 + + - name: GigabitEthernet0/0/0/1 + mtu: 516 + description: test-interface-2 + speed: 100 + duplex: full + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Disable interface aggregate + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/0 + + - name: GigabitEthernet0/0/0/1 + enabled: false + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + +- name: Disable interface aggregate (idempotent) + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/0 + + - name: GigabitEthernet0/0/0/1 + enabled: false + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Enable interface aggregate + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/0 + + - name: GigabitEthernet0/0/0/1 + enabled: true + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + +- name: Enable interface aggregate + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/0 + + - name: GigabitEthernet0/0/0/1 + enabled: true + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: interface aggregate (setup) + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/0 + + - name: GigabitEthernet0/0/0/1 + description: test-interface-initial + provider: '{{ netconf }}' + +- name: Create interface aggregate + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/0 + description: test_interface_1 + + - name: GigabitEthernet0/0/0/1 + description: test_interface_2 + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"GigabitEthernet0/0/0/0" in result.xml[0]' + - '"GigabitEthernet0/0/0/1" in result.xml[0]' + - '"test_interface_1" in result.xml[0]' + - '"test_interface_2" in result.xml[0]' + +- name: Delete interface aggregate + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/0 + + - name: GigabitEthernet0/0/0/1 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + +- name: Delete interface aggregate (idempotent) + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/0 + + - name: GigabitEthernet0/0/0/1 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- debug: msg="END iosxr_interface netconf/basic.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/netconf/intent.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/netconf/intent.yaml new file mode 100644 index 00000000..0a269cd1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/netconf/intent.yaml @@ -0,0 +1,79 @@ +--- +- debug: msg="START iosxr_interface netconf/intent.yaml" + +- name: Setup (interface is up) + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + description: test_interface_1 + enabled: true + state: present + provider: '{{ netconf }}' + +- name: Check intent arguments + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + state: up + delay: 10 + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == false + +- name: Check intent arguments (failed condition) + ignore_errors: true + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + state: down + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == true + - "'state eq(down)' in result.failed_conditions" + +- name: Config + intent + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + enabled: false + state: down + delay: 10 + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == false + +- name: Config + intent (fail) + ignore_errors: true + register: result + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + enabled: false + state: up + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == true + - "'state eq(up)' in result.failed_conditions" + +- name: Aggregate config + intent (pass) + ignore_errors: true + register: result + cisco.iosxr.iosxr_interface: + aggregate: + + - name: GigabitEthernet0/0/0/1 + enabled: true + state: up + delay: 10 + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == false diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/netconf/net_interface.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/netconf/net_interface.yaml new file mode 100644 index 00000000..9257dac3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interface/tests/netconf/net_interface.yaml @@ -0,0 +1,45 @@ +--- +- debug: msg="START iosxr netconf/net_interface.yaml on connection={{ ansible_connection + }}" + +- name: Setup interface + register: result + ansible.netcommon.net_interface: + name: GigabitEthernet0/0/0/1 + state: absent + provider: '{{ netconf }}' + +- name: Confgure interface using platform agnostic module + register: result + ansible.netcommon.net_interface: + name: GigabitEthernet0/0/0/1 + description: test-interface-initial + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"GigabitEthernet0/0/0/1" in result.xml[0]' + +- name: Confgure interface parameters using platform agnostic module + register: result + ansible.netcommon.net_interface: + name: GigabitEthernet0/0/0/1 + description: test-interface + speed: 100 + duplex: half + mtu: 512 + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"GigabitEthernet0/0/0/1" in result.xml[0]' + - '"test-interface" in result.xml[0]' + - '"100" in result.xml[0]' + - '"512" in result.xml[0]' + +- debug: msg="END iosxr netconf/net_interface.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/meta/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/meta/main.yaml new file mode 100644 index 00000000..23d65c7e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/meta/main.yaml @@ -0,0 +1,2 @@ +--- +dependencies: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tasks/cli.yaml new file mode 100644 index 00000000..f622cf94 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tasks/cli.yaml @@ -0,0 +1,20 @@ +--- +- name: Collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + delegate_to: localhost + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/_populate_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/_populate_config.yaml new file mode 100644 index 00000000..ae8935a1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/_populate_config.yaml @@ -0,0 +1,8 @@ +--- +- name: Populate Config + vars: + lines: "interface GigabitEthernet 0/0/0/0\ndescription this is interface0\n\ + mtu 65\nspeed 10\nno shutdown\ninterface GigabitEthernet 0/0/0/1\ndescription\ + \ this is interface1\nmtu 65\nspeed 10\nno shutdown\n" + ansible.netcommon.cli_config: + config: '{{ lines }}' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/_remove_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/_remove_config.yaml new file mode 100644 index 00000000..08046d69 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/_remove_config.yaml @@ -0,0 +1,18 @@ +--- +- name: Remove Config + vars: + lines: "interface loopback888\nno description\nno shutdown\ninterface loopback999\n\ + no description\nno shutdown\n" + ansible.netcommon.cli_config: + config: '{{ lines }}' + +- name: Remove interfaces from config before actual testing + loop: + - GigabitEthernet 0/0/0/0 + - GigabitEthernet 0/0/0/1 + - GigabitEthernet 0/0/0/2 + - GigabitEthernet 0/0/0/3 + ignore_errors: true + cisco.iosxr.iosxr_config: + lines: + - no interface {{ item }} diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/deleted.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/deleted.yaml new file mode 100644 index 00000000..94c2607e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/deleted.yaml @@ -0,0 +1,45 @@ +--- +- debug: + msg: Start Deleted integration state for iosxr_interfaces ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Delete attributes of all configured interfaces + register: result + cisco.iosxr.iosxr_interfaces: &id001 + state: deleted + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |\ + \ length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ deleted['before'] | symmetric_difference(result['before']) | length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['after']) | length\ + \ == 0 }}" + + - name: Delete attributes of all configured interfaces (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/empty_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/empty_config.yaml new file mode 100644 index 00000000..9eeffb56 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/empty_config.yaml @@ -0,0 +1,60 @@ +--- +- debug: + msg: START iosxr_interfaces empty_config integration tests on connection={{ + ansible_connection }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_interfaces: + config: + state: merged + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state merged' + +- name: Replaced with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_interfaces: + config: + state: replaced + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Overridden with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_interfaces: + config: + state: overridden + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state overridden' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_interfaces: + config: + state: rendered + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state rendered' + +- name: Parsed with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_interfaces: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/fixtures/parsed.cfg new file mode 100644 index 00000000..08619b40 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/fixtures/parsed.cfg @@ -0,0 +1,19 @@ +interface Loopback888 + description test for ansible + shutdown +! +interface MgmtEth0/0/CPU0/0 + ipv4 address 10.8.38.70 255.255.255.0 +! +interface GigabitEthernet0/0/0/0 + description Configured and Merged by Ansible-Network + mtu 110 + ipv4 address 172.31.1.1 255.255.255.0 + duplex half +! +interface GigabitEthernet0/0/0/3 + shutdown +! +interface GigabitEthernet0/0/0/4 + shutdown +! diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/gathered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/gathered.yaml new file mode 100644 index 00000000..607041bd --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/gathered.yaml @@ -0,0 +1,42 @@ +--- +- debug: + msg: START iosxr_interfaces gathered integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Merge provided configuration with device configuration + register: result + cisco.iosxr.iosxr_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + description: This interface is Configured and Merged by Ansible-Network + mtu: 110 + enabled: true + duplex: half + + - name: GigabitEthernet0/0/0/1 + description: Configured and Merged by Ansible-Network + mtu: 2800 + enabled: false + speed: 100 + duplex: full + state: merged + + - name: Gather interfaces facts using gathered state + register: result + cisco.iosxr.iosxr_interfaces: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ gathered['after'] | symmetric_difference(result['gathered']) |length\ + \ == 0 }}" + + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/merged.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/merged.yaml new file mode 100644 index 00000000..10aa7090 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/merged.yaml @@ -0,0 +1,59 @@ +--- +- debug: + msg: START Merged iosxr_interfaces state for integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Merge provided configuration with device configuration + register: result + cisco.iosxr.iosxr_interfaces: &id001 + config: + + - name: GigabitEthernet0/0/0/0 + description: Configured and Merged by Ansible-Network + mtu: 110 + enabled: true + duplex: half + + - name: GigabitEthernet0/0/0/1 + description: Configured and Merged by Ansible-Network + mtu: 2800 + enabled: false + speed: 100 + duplex: full + state: merged + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['commands']) |\ + \ length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ merged['before'] | symmetric_difference(result['before']) | length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['after']) | length\ + \ == 0 }}" + + - name: Merge provided configuration with device configuration (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/overridden.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/overridden.yaml new file mode 100644 index 00000000..8c44ce17 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/overridden.yaml @@ -0,0 +1,54 @@ +--- +- debug: + msg: START Overridden iosxr_interfaces state for integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Override device configuration of all interfaces with provided configuration + register: result + cisco.iosxr.iosxr_interfaces: &id001 + config: + + - name: GigabitEthernet0/0/0/1 + description: Configured and Overridden by Ansible-Network + enabled: false + duplex: full + mtu: 2000 + speed: 100 + state: overridden + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ + \ | length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ overridden['before'] | symmetric_difference(result['before']) |\ + \ length == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['after']) | length\ + \ == 0 }}" + + - name: Override device configuration of all interfaces with provided configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_interfaces: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/parsed.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/parsed.yaml new file mode 100644 index 00000000..cffa8232 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/parsed.yaml @@ -0,0 +1,16 @@ +--- +- debug: + msg: START iosxr_interfaces parsed integration tests on connection={{ ansible_connection + }} + +- name: Parse externally provided interfaces config to agnostic model + register: result + cisco.iosxr.iosxr_interfaces: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length ==\ + \ 0 }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/rendered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/rendered.yaml new file mode 100644 index 00000000..8a076f9b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/rendered.yaml @@ -0,0 +1,29 @@ +--- +- debug: + msg: START iosxr_interfaces rendered integration tests on connection={{ + ansible_connection }} + +- name: Render platform specific commands from task input using rendered state + register: result + cisco.iosxr.iosxr_interfaces: + config: + + - name: GigabitEthernet0/0/0/0 + description: Configured and Merged by Ansible-Network + mtu: 110 + enabled: true + duplex: half + + - name: GigabitEthernet0/0/0/1 + description: Configured and Merged by Ansible-Network + mtu: 2800 + enabled: false + speed: 100 + duplex: full + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length\ + \ == 0 }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/replaced.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/replaced.yaml new file mode 100644 index 00000000..ff0f9753 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/tests/cli/replaced.yaml @@ -0,0 +1,55 @@ +--- +- debug: + msg: START Replaced iosxr_interfaces state for integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Replaces device configuration of listed interfaces with provided configuration + register: result + cisco.iosxr.iosxr_interfaces: &id001 + config: + + - name: GigabitEthernet0/0/0/0 + description: Configured and Replaced by Ansible-Network + mtu: 110 + + - name: GigabitEthernet0/0/0/1 + description: Configured and Replaced by Ansible-Network + speed: 100 + state: replaced + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ + \ | length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ replaced['before'] | symmetric_difference(result['before']) | length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['after']) | length\ + \ == 0 }}" + + - name: Replaces device configuration of listed interfaces with provided configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_interfaces: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/vars/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/vars/main.yaml new file mode 100644 index 00000000..5f1088d6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_interfaces/vars/main.yaml @@ -0,0 +1,196 @@ +--- +merged: + before: + - enabled: true + name: Loopback888 + - enabled: true + name: Loopback999 + - description: this is interface0 + enabled: true + mtu: 65 + name: GigabitEthernet0/0/0/0 + speed: 10 + - description: this is interface1 + enabled: true + mtu: 65 + name: GigabitEthernet0/0/0/1 + speed: 10 + commands: + - interface GigabitEthernet0/0/0/0 + - description Configured and Merged by Ansible-Network + - mtu 110 + - duplex half + - interface GigabitEthernet0/0/0/1 + - description Configured and Merged by Ansible-Network + - mtu 2800 + - speed 100 + - duplex full + - shutdown + after: + - enabled: true + name: Loopback888 + - enabled: true + name: Loopback999 + - description: Configured and Merged by Ansible-Network + duplex: half + enabled: true + mtu: 110 + name: GigabitEthernet0/0/0/0 + speed: 10 + - description: Configured and Merged by Ansible-Network + duplex: full + enabled: false + mtu: 2800 + name: GigabitEthernet0/0/0/1 + speed: 100 +parsed: + after: + - description: test for ansible + enabled: false + name: Loopback888 + - description: Configured and Merged by Ansible-Network + duplex: half + enabled: true + mtu: 110 + name: GigabitEthernet0/0/0/0 + - enabled: false + name: GigabitEthernet0/0/0/3 + - enabled: false + name: GigabitEthernet0/0/0/4 +replaced: + before: + - enabled: true + name: Loopback888 + - enabled: true + name: Loopback999 + - description: this is interface0 + enabled: true + mtu: 65 + name: GigabitEthernet0/0/0/0 + speed: 10 + - description: this is interface1 + enabled: true + mtu: 65 + name: GigabitEthernet0/0/0/1 + speed: 10 + commands: + - interface GigabitEthernet0/0/0/0 + - no speed + - description Configured and Replaced by Ansible-Network + - mtu 110 + - interface GigabitEthernet0/0/0/1 + - no mtu + - description Configured and Replaced by Ansible-Network + - speed 100 + after: + - enabled: true + name: Loopback888 + - enabled: true + name: Loopback999 + - description: Configured and Replaced by Ansible-Network + enabled: true + mtu: 110 + name: GigabitEthernet0/0/0/0 + - description: Configured and Replaced by Ansible-Network + enabled: true + name: GigabitEthernet0/0/0/1 + speed: 100 +rendered: + commands: + - interface GigabitEthernet0/0/0/0 + - description Configured and Merged by Ansible-Network + - mtu 110 + - duplex half + - no shutdown + - interface GigabitEthernet0/0/0/1 + - description Configured and Merged by Ansible-Network + - mtu 2800 + - speed 100 + - duplex full + - shutdown +overridden: + before: + - enabled: true + name: Loopback888 + - enabled: true + name: Loopback999 + - description: this is interface0 + enabled: true + mtu: 65 + name: GigabitEthernet0/0/0/0 + speed: 10 + - description: this is interface1 + enabled: true + mtu: 65 + name: GigabitEthernet0/0/0/1 + speed: 10 + commands: + - interface GigabitEthernet0/0/0/0 + - no description + - no speed + - no mtu + - interface GigabitEthernet0/0/0/1 + - description Configured and Overridden by Ansible-Network + - mtu 2000 + - duplex full + - speed 100 + - shutdown + after: + - enabled: true + name: Loopback888 + - enabled: true + name: Loopback999 + - description: Configured and Overridden by Ansible-Network + duplex: full + enabled: false + mtu: 2000 + name: GigabitEthernet0/0/0/1 + speed: 100 +gathered: + after: + - enabled: true + name: Loopback888 + - enabled: true + name: Loopback999 + - description: This interface is Configured and Merged by Ansible-Network + duplex: half + enabled: true + mtu: 110 + name: GigabitEthernet0/0/0/0 + speed: 10 + - description: Configured and Merged by Ansible-Network + duplex: full + enabled: false + mtu: 2800 + name: GigabitEthernet0/0/0/1 + speed: 100 +deleted: + before: + - enabled: true + name: Loopback888 + - enabled: true + name: Loopback999 + - description: this is interface0 + enabled: true + mtu: 65 + name: GigabitEthernet0/0/0/0 + speed: 10 + - description: this is interface1 + enabled: true + mtu: 65 + name: GigabitEthernet0/0/0/1 + speed: 10 + commands: + - interface GigabitEthernet0/0/0/0 + - no description + - no speed + - no mtu + - interface GigabitEthernet0/0/0/1 + - no description + - no speed + - no mtu + after: + - enabled: true + name: Loopback888 + - enabled: true + name: Loopback999 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/meta/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/meta/main.yaml new file mode 100644 index 00000000..23d65c7e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/meta/main.yaml @@ -0,0 +1,2 @@ +--- +dependencies: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tasks/cli.yaml new file mode 100644 index 00000000..f622cf94 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tasks/cli.yaml @@ -0,0 +1,20 @@ +--- +- name: Collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + delegate_to: localhost + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/_populate_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/_populate_config.yaml new file mode 100644 index 00000000..0d451071 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/_populate_config.yaml @@ -0,0 +1,9 @@ +--- +- name: Populate Config + vars: + lines: "interface GigabitEthernet 0/0/0/1\ndot1q native vlan 10\nl2transport\ + \ l2protocol cdp forward\nl2transport propagate remote-status\ninterface GigabitEthernet\ + \ 0/0/0/4\ndot1q native vlan 20\nl2transport l2protocol vtp tunnel\ninterface\ + \ GigabitEthernet 0/0/0/3.900\ndot1q vlan 40 60\n" + ansible.netcommon.cli_config: + config: '{{ lines }}' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/_remove_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/_remove_config.yaml new file mode 100644 index 00000000..ac4b7a65 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/_remove_config.yaml @@ -0,0 +1,8 @@ +--- +- name: Remove Config + vars: + lines: "interface GigabitEthernet 0/0/0/1\nno dot1q native vlan\nno l2transport\n\ + no interface GigabitEthernet 0/0/0/2\nno interface GigabitEthernet 0/0/0/3\n\ + no interface GigabitEthernet 0/0/0/3.900\nno interface GigabitEthernet 0/0/0/4\n" + ansible.netcommon.cli_config: + config: '{{ lines }}' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/deleted.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/deleted.yaml new file mode 100644 index 00000000..41d20e08 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/deleted.yaml @@ -0,0 +1,45 @@ +--- +- debug: + msg: Start Deleted integration state for ios_l2_interfaces ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Delete L2 interfaces attributes of all configured interfaces + register: result + cisco.iosxr.iosxr_l2_interfaces: &id001 + state: deleted + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |\ + \ length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ deleted['before'] | symmetric_difference(result['before']) | length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['after']) | length\ + \ == 0 }}" + + - name: Delete L2 interfaces attributes of all configured interfaces (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_l2_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/empty_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/empty_config.yaml new file mode 100644 index 00000000..23ce54bd --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/empty_config.yaml @@ -0,0 +1,60 @@ +--- +- debug: + msg: START iosxr_l2_interfaces empty_config integration tests on connection={{ + ansible_connection }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_l2_interfaces: + config: + state: merged + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state merged' + +- name: Replaced with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_l2_interfaces: + config: + state: replaced + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Overridden with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_l2_interfaces: + config: + state: overridden + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state overridden' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_l2_interfaces: + config: + state: rendered + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state rendered' + +- name: Parsed with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_l2_interfaces: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/fixtures/parsed.cfg new file mode 100644 index 00000000..129742c7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/fixtures/parsed.cfg @@ -0,0 +1,31 @@ +interface Loopback888 + description test for ansible + shutdown +! +interface MgmtEth0/0/CPU0/0 + ipv4 address 10.8.38.70 255.255.255.0 +! +interface GigabitEthernet0/0/0/0 + description Configured and Merged by Ansible-Network + mtu 110 + ipv4 address 172.31.1.1 255.255.255.0 + duplex half +! +interface GigabitEthernet0/0/0/1 + dot1q native vlan 10 + l2transport + l2protocol cdp forward + l2protocol pvst tunnel + propagate remote-status + ! +! +interface GigabitEthernet0/0/0/3 + shutdown +! +interface GigabitEthernet0/0/0/3.900 + encapsulation dot1q 20 second-dot1q 40 +! +interface GigabitEthernet0/0/0/4 + shutdown + dot1q native vlan 40 +! diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/gathered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/gathered.yaml new file mode 100644 index 00000000..974ca3d2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/gathered.yaml @@ -0,0 +1,45 @@ +--- +- debug: + msg: START iosxr_l2_interfaces gathered integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge the provided configuration with the existing running configuration + register: result + cisco.iosxr.iosxr_l2_interfaces: + config: + + - name: GigabitEthernet0/0/0/1 + native_vlan: 10 + l2transport: true + l2protocol: + + - pvst: tunnel + + - cdp: forward + propagate: true + + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - 40 + + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + state: merged + + - name: Gather l2 interfaces facts using gathered state + register: result + cisco.iosxr.iosxr_l2_interfaces: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ merged['after'] | symmetric_difference(result['gathered']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/merged.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/merged.yaml new file mode 100644 index 00000000..89765611 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/merged.yaml @@ -0,0 +1,62 @@ +--- +- debug: + msg: START Merged ios_l2_interfaces state for integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge provided L2 configuration with device configuration + register: result + cisco.iosxr.iosxr_l2_interfaces: &id001 + config: + + - name: GigabitEthernet0/0/0/1 + native_vlan: 10 + l2transport: true + l2protocol: + + - pvst: tunnel + + - cdp: forward + propagate: true + + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - 40 + + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + state: merged + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['commands']) |\ + \ length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ merged['before'] | symmetric_difference(result['before']) | length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['after']) | length\ + \ == 0 }}" + + - name: Merge provided L2 configuration with device configuration (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_l2_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/overridden.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/overridden.yaml new file mode 100644 index 00000000..46529a50 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/overridden.yaml @@ -0,0 +1,59 @@ +--- +- debug: + msg: START Overridden ios_l2_interfaces state for integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Override device L2 configuration of all interfaces with provided configuration + register: result + cisco.iosxr.iosxr_l2_interfaces: &id001 + config: + + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + l2transport: true + l2protocol: + + - stp: forward + + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - 40 + state: overridden + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ + \ | length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ overridden['before'] | symmetric_difference(result['before']) |\ + \ length == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['after']) | length\ + \ == 0 }}" + + - name: Override device L2 configuration of all interfaces with provided configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_l2_interfaces: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/parsed.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/parsed.yaml new file mode 100644 index 00000000..3c66ac27 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/parsed.yaml @@ -0,0 +1,16 @@ +--- +- debug: + msg: START iosxr_l2_interfaces parsed integration tests on connection={{ ansible_connection + }} + +- name: Parse externally provided L2 interfaces config to agnostic model + register: result + cisco.iosxr.iosxr_l2_interfaces: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length ==\ + \ 0 }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/rendered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/rendered.yaml new file mode 100644 index 00000000..57f0cb61 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/rendered.yaml @@ -0,0 +1,34 @@ +--- +- debug: + msg: START iosxr_l2_interfaces rendered integration tests on connection={{ + ansible_connection }} + +- name: Render platform specific commands from task input using rendered state + register: result + cisco.iosxr.iosxr_l2_interfaces: + config: + + - name: GigabitEthernet0/0/0/1 + native_vlan: 10 + l2transport: true + l2protocol: + + - pvst: tunnel + + - cdp: forward + propagate: true + + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - 40 + + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['rendered']) |length\ + \ == 0 }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/replaced.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/replaced.yaml new file mode 100644 index 00000000..fcc40107 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/tests/cli/replaced.yaml @@ -0,0 +1,55 @@ +--- +- debug: + msg: START Replaced ios_l2_interfaces state for integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Replaces device L2 configuration of listed interfaces with provided + configuration + register: result + cisco.iosxr.iosxr_l2_interfaces: &id001 + config: + + - name: GigabitEthernet0/0/0/1 + native_vlan: 40 + l2transport: true + l2protocol: + + - vtp: tunnel + state: replaced + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ + \ | length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ replaced['before'] | symmetric_difference(result['before']) | length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['after']) | length\ + \ == 0 }}" + + - name: Replaces device L2 configuration of listed interfaces with provided + configuration (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_l2_interfaces: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/vars/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/vars/main.yaml new file mode 100644 index 00000000..481495f3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l2_interfaces/vars/main.yaml @@ -0,0 +1,147 @@ +--- +merged: + before: [] + commands: + - interface GigabitEthernet0/0/0/1 + - dot1q native vlan 10 + - l2transport l2protocol pvst tunnel + - l2transport l2protocol cdp forward + - l2transport propagate remote-status + - interface GigabitEthernet0/0/0/3.900 + - dot1q vlan 20 40 + - interface GigabitEthernet0/0/0/4 + - dot1q native vlan 40 + after: + - l2protocol: + - cdp: forward + - pvst: tunnel + l2transport: true + name: GigabitEthernet0/0/0/1 + native_vlan: 10 + propagate: true + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - 40 + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 +replaced: + before: + - l2protocol: + - cdp: forward + l2transport: true + name: GigabitEthernet0/0/0/1 + native_vlan: 10 + propagate: true + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 40 + - 60 + - l2protocol: + - vtp: tunnel + l2transport: true + name: GigabitEthernet0/0/0/4 + native_vlan: 20 + commands: + - interface GigabitEthernet0/0/0/1 + - no l2transport + - dot1q native vlan 40 + - l2transport l2protocol vtp tunnel + after: + - l2protocol: + - vtp: tunnel + l2transport: true + name: GigabitEthernet0/0/0/1 + native_vlan: 40 + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 40 + - 60 + - l2protocol: + - vtp: tunnel + l2transport: true + name: GigabitEthernet0/0/0/4 + native_vlan: 20 +overridden: + before: + - l2protocol: + - cdp: forward + l2transport: true + name: GigabitEthernet0/0/0/1 + native_vlan: 10 + propagate: true + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 40 + - 60 + - l2protocol: + - vtp: tunnel + l2transport: true + name: GigabitEthernet0/0/0/4 + native_vlan: 20 + commands: + - interface GigabitEthernet0/0/0/1 + - no dot1q native vlan + - no l2transport + - interface GigabitEthernet0/0/0/3.900 + - dot1q vlan 20 40 + - interface GigabitEthernet0/0/0/4 + - no l2transport + - dot1q native vlan 40 + - l2transport l2protocol stp forward + after: + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - 40 + - l2protocol: + - stp: forward + l2transport: true + name: GigabitEthernet0/0/0/4 + native_vlan: 40 +parsed: + after: + - name: GigabitEthernet0/0/0/0 + - l2protocol: + - cdp: forward + - pvst: tunnel + native_vlan: 10 + l2transport: true + name: GigabitEthernet0/0/0/1 + propagate: true + - name: GigabitEthernet0/0/0/3 + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - 40 + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 +deleted: + before: + - l2protocol: + - cdp: forward + l2transport: true + name: GigabitEthernet0/0/0/1 + native_vlan: 10 + propagate: true + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 40 + - 60 + - l2protocol: + - vtp: tunnel + l2transport: true + name: GigabitEthernet0/0/0/4 + native_vlan: 20 + commands: + - interface GigabitEthernet0/0/0/1 + - no dot1q native vlan + - no l2transport + - interface GigabitEthernet0/0/0/3.900 + - no encapsulation dot1q + - interface GigabitEthernet0/0/0/4 + - no dot1q native vlan + - no l2transport + after: + - name: GigabitEthernet0/0/0/4 + - name: GigabitEthernet0/0/0/3.900 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/meta/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/meta/main.yaml new file mode 100644 index 00000000..23d65c7e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/meta/main.yaml @@ -0,0 +1,2 @@ +--- +dependencies: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tasks/cli.yaml new file mode 100644 index 00000000..f622cf94 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tasks/cli.yaml @@ -0,0 +1,20 @@ +--- +- name: Collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + delegate_to: localhost + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/_populate_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/_populate_config.yaml new file mode 100644 index 00000000..1dad55ad --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/_populate_config.yaml @@ -0,0 +1,8 @@ +--- +- name: Populate Config + vars: + lines: "interface GigabitEthernet 0/0/0/0\nipv4 address 198.51.100.1 255.255.255.0\n\ + ipv6 address 2001:db8::/32\ninterface GigabitEthernet 0/0/0/1\nipv4 address\ + \ 192.0.2.1 255.255.255.0\nipv4 address 192.0.2.2 255.255.255.0 secondary\n" + ansible.netcommon.cli_config: + config: '{{ lines }}' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/_remove_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/_remove_config.yaml new file mode 100644 index 00000000..d99f4db7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/_remove_config.yaml @@ -0,0 +1,7 @@ +--- +- name: Remove Config + vars: + lines: "interface GigabitEthernet 0/0/0/0\nno ipv4 address\nno ipv6 address\n\ + interface GigabitEthernet 0/0/0/1\nno ipv4 address\nno ipv6 address\n" + ansible.netcommon.cli_config: + config: '{{ lines }}' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/deleted.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/deleted.yaml new file mode 100644 index 00000000..777596cd --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/deleted.yaml @@ -0,0 +1,50 @@ +--- +- debug: + msg: Start Deleted integration state for iosxr_l3_interfaces ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Delete attributes of all configured interfaces + register: result + cisco.iosxr.iosxr_l3_interfaces: &id001 + config: + + - name: GigabitEthernet0/0/0/0 + + - name: GigabitEthernet0/0/0/1 + state: deleted + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |\ + \ length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ deleted['before'] | symmetric_difference(result['before']) | length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['after']) | length\ + \ == 0 }}" + + - name: Delete attributes of all configured interfaces (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_l3_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/empty_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/empty_config.yaml new file mode 100644 index 00000000..1ae1f2d8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/empty_config.yaml @@ -0,0 +1,60 @@ +--- +- debug: + msg: START iosxr_l3_interfaces empty_config integration tests on connection={{ + ansible_connection }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_l3_interfaces: + config: + state: merged + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state merged' + +- name: Replaced with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_l3_interfaces: + config: + state: replaced + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Overridden with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_l3_interfaces: + config: + state: overridden + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state overridden' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_l3_interfaces: + config: + state: rendered + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state rendered' + +- name: Parsed with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_l3_interfaces: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/fixtures/parsed.cfg new file mode 100644 index 00000000..d4fac24a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/fixtures/parsed.cfg @@ -0,0 +1,31 @@ +interface Loopback888 + description test for ansible + shutdown +! +interface MgmtEth0/0/CPU0/0 + ipv4 address 10.8.38.70 255.255.255.0 +! +interface GigabitEthernet0/0/0/0 + description Configured and Merged by Ansible-Network + mtu 66 + ipv4 address 192.0.2.1 255.255.255.0 + ipv4 address 192.0.2.2 255.255.255.0 secondary + ipv6 address 2001:db8:0:3::/64 + duplex half +! +interface GigabitEthernet0/0/0/1 + description Configured and Merged by Ansible-Network + mtu 66 + speed 100 + duplex full + dot1q native vlan 10 + l2transport + l2protocol cdp forward + l2protocol pvst tunnel + propagate remote-status + ! +! +interface GigabitEthernet0/0/0/3 + ipv4 address 192.0.22.1 255.255.255.0 + ipv4 address 192.0.23.1 255.255.255.0 +! diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/gathered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/gathered.yaml new file mode 100644 index 00000000..11284fb5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/gathered.yaml @@ -0,0 +1,43 @@ +--- +- debug: + msg: START iosxr_l3_interfaces gathered integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Gather the provided configuration with the existing running configuration + register: result + cisco.iosxr.iosxr_l3_interfaces: + config: + + - name: GigabitEthernet0/0/0/0 + ipv4: + + - address: 198.51.100.1/24 + + - name: GigabitEthernet0/0/0/1 + ipv6: + + - address: 2001:db8:0:3::/64 + ipv4: + + - address: 192.0.2.1/24 + + - address: 192.0.2.2/24 + secondary: true + state: merged + + - name: Gather L3 interfaces facts using gathered state + register: result + cisco.iosxr.iosxr_l3_interfaces: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ merged['after'] | symmetric_difference(result['gathered']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/merged.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/merged.yaml new file mode 100644 index 00000000..593acf32 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/merged.yaml @@ -0,0 +1,60 @@ +--- +- debug: + msg: START Merged iosxr_l3_interfaces state for integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge provided configuration with device configuration + register: result + cisco.iosxr.iosxr_l3_interfaces: &id001 + config: + + - name: GigabitEthernet0/0/0/0 + ipv4: + + - address: 198.51.100.1/24 + + - name: GigabitEthernet0/0/0/1 + ipv6: + + - address: 2001:db8:0:3::/64 + ipv4: + + - address: 192.0.2.1/24 + + - address: 192.0.2.2/24 + secondary: true + state: merged + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['commands']) |\ + \ length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ merged['before'] | symmetric_difference(result['before']) | length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['after']) | length\ + \ == 0 }}" + + - name: Merge provided configuration with device configuration (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_l3_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/overridden.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/overridden.yaml new file mode 100644 index 00000000..38dd93e3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/overridden.yaml @@ -0,0 +1,55 @@ +--- +- debug: + msg: START Overridden iosxr_l3_interfaces state for integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Override device configuration of all interfaces with provided configuration + register: result + cisco.iosxr.iosxr_l3_interfaces: &id001 + config: + + - name: GigabitEthernet0/0/0/1 + ipv4: + + - address: 198.51.102.1/24 + ipv6: + + - address: 2001:db8:1::/64 + state: overridden + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ + \ | length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ overridden['before'] | symmetric_difference(result['before']) |\ + \ length == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['after']) | length\ + \ == 0 }}" + + - name: Override device configuration of all interfaces with provided configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_l3_interfaces: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/parsed.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/parsed.yaml new file mode 100644 index 00000000..9a4776b6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/parsed.yaml @@ -0,0 +1,16 @@ +--- +- debug: + msg: START iosxr_l3_interfaces parsed integration tests on connection={{ ansible_connection + }} + +- name: Parse externally provided L3 interfaces config to agnostic model + register: result + cisco.iosxr.iosxr_l3_interfaces: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length ==\ + \ 0 }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/rendered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/rendered.yaml new file mode 100644 index 00000000..03a330f5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/rendered.yaml @@ -0,0 +1,32 @@ +--- +- debug: + msg: START iosxr_l3_interfaces rendered integration tests on connection={{ + ansible_connection }} + +- name: Render platform specific commands from task input using rendered state + register: result + cisco.iosxr.iosxr_l3_interfaces: + config: + + - name: GigabitEthernet0/0/0/0 + ipv4: + + - address: 198.51.100.1/24 + + - name: GigabitEthernet0/0/0/1 + ipv6: + + - address: 2001:db8:0:3::/64 + ipv4: + + - address: 192.0.2.1/24 + + - address: 192.0.2.2/24 + secondary: true + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length\ + \ == 0 }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/replaced.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/replaced.yaml new file mode 100644 index 00000000..f14e68a0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/replaced.yaml @@ -0,0 +1,55 @@ +--- +- debug: + msg: START Replaced iosxr_l3_interfaces state for integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Replaces device configuration of listed interfaces with provided configuration + register: result + cisco.iosxr.iosxr_l3_interfaces: &id001 + config: + + - name: GigabitEthernet0/0/0/0 + ipv4: + + - address: 203.0.113.27/24 + + - address: 203.0.114.1/24 + secondary: true + state: replaced + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ + \ | length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ replaced['before'] | symmetric_difference(result['before']) | length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['after']) | length\ + \ == 0 }}" + + - name: Replaces device configuration of listed interfaces with provided configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_l3_interfaces: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/rtt.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/rtt.yaml new file mode 100644 index 00000000..eea8ba23 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/tests/cli/rtt.yaml @@ -0,0 +1,47 @@ +--- +- debug: + msg: START iosxr_l3_interfaces round trip integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Round Trip test by applying the provided configuration (base config) + register: base_config + cisco.iosxr.iosxr_l3_interfaces: + config: + + - name: GigabitEthernet0/0/0/0 + ipv4: + + - address: 198.51.100.1/24 + + - name: GigabitEthernet0/0/0/1 + ipv6: + + - address: 2001:db8:0:3::/64 + ipv4: + + - address: 192.0.2.1/24 + + - secondary: true + address: 192.0.2.2/24 + state: merged + + - name: Gather interfaces facts + register: l3facts_config + cisco.iosxr.iosxr_facts: + gather_subset: + - default + gather_network_resources: + - l3_interfaces + + - name: Apply config from l3_interfaces facts generated (IDEMPOTENT) + cisco.iosxr.iosxr_l3_interfaces: + config: "{{ l3facts_config['ansible_facts']['ansible_network_resources']['l3_interfaces']\ + \ }}" + state: merged + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/vars/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/vars/main.yaml new file mode 100644 index 00000000..c144276d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_l3_interfaces/vars/main.yaml @@ -0,0 +1,133 @@ +--- +merged: + before: + - name: Loopback888 + - name: Loopback999 + commands: + - interface GigabitEthernet0/0/0/0 + - ipv4 address 198.51.100.1 255.255.255.0 + - interface GigabitEthernet0/0/0/1 + - ipv4 address 192.0.2.2 255.255.255.0 secondary + - ipv4 address 192.0.2.1 255.255.255.0 + - ipv6 address 2001:db8:0:3::/64 + after: + - name: Loopback888 + - name: Loopback999 + - ipv4: + - address: 198.51.100.1 255.255.255.0 + name: GigabitEthernet0/0/0/0 + - ipv4: + - address: 192.0.2.1 255.255.255.0 + - address: 192.0.2.2 255.255.255.0 + secondary: true + ipv6: + - address: 2001:db8:0:3::/64 + name: GigabitEthernet0/0/0/1 +replaced: + before: + - name: Loopback888 + - name: Loopback999 + - ipv4: + - address: 198.51.100.1 255.255.255.0 + ipv6: + - address: 2001:db8::/32 + name: GigabitEthernet0/0/0/0 + - ipv4: + - address: 192.0.2.1 255.255.255.0 + - address: 192.0.2.2 255.255.255.0 + secondary: true + name: GigabitEthernet0/0/0/1 + commands: + - interface GigabitEthernet0/0/0/0 + - no ipv6 address + - ipv4 address 203.0.113.27 255.255.255.0 + - ipv4 address 203.0.114.1 255.255.255.0 secondary + after: + - name: Loopback888 + - name: Loopback999 + - ipv4: + - address: 203.0.113.27 255.255.255.0 + - address: 203.0.114.1 255.255.255.0 + secondary: true + name: GigabitEthernet0/0/0/0 + - ipv4: + - address: 192.0.2.1 255.255.255.0 + - address: 192.0.2.2 255.255.255.0 + secondary: true + name: GigabitEthernet0/0/0/1 +overridden: + before: + - name: Loopback888 + - name: Loopback999 + - ipv4: + - address: 198.51.100.1 255.255.255.0 + ipv6: + - address: 2001:db8::/32 + name: GigabitEthernet0/0/0/0 + - ipv4: + - address: 192.0.2.1 255.255.255.0 + - address: 192.0.2.2 255.255.255.0 + secondary: true + name: GigabitEthernet0/0/0/1 + commands: + - interface GigabitEthernet0/0/0/0 + - no ipv4 address + - no ipv6 address + - interface GigabitEthernet0/0/0/1 + - no ipv4 address + - ipv4 address 198.51.102.1 255.255.255.0 + - ipv6 address 2001:db8:1::/64 + after: + - name: Loopback888 + - name: Loopback999 + - ipv4: + - address: 198.51.102.1 255.255.255.0 + ipv6: + - address: 2001:db8:1::/64 + name: GigabitEthernet0/0/0/1 +rendered: + commands: + - interface GigabitEthernet0/0/0/0 + - ipv4 address 198.51.100.1 255.255.255.0 + - interface GigabitEthernet0/0/0/1 + - ipv4 address 192.0.2.2 255.255.255.0 secondary + - ipv4 address 192.0.2.1 255.255.255.0 + - ipv6 address 2001:db8:0:3::/64 +parsed: + after: + - name: Loopback888 + - ipv6: + - address: 2001:db8:0:3::/64 + ipv4: + - address: 192.0.2.1 255.255.255.0 + - address: 192.0.2.2 255.255.255.0 + secondary: true + name: GigabitEthernet0/0/0/0 + - name: GigabitEthernet0/0/0/1 + - ipv4: + - address: 192.0.22.1 255.255.255.0 + - address: 192.0.23.1 255.255.255.0 + name: GigabitEthernet0/0/0/3 +deleted: + before: + - name: Loopback888 + - name: Loopback999 + - ipv4: + - address: 198.51.100.1 255.255.255.0 + ipv6: + - address: 2001:db8::/32 + name: GigabitEthernet0/0/0/0 + - ipv4: + - address: 192.0.2.1 255.255.255.0 + - address: 192.0.2.2 255.255.255.0 + secondary: true + name: GigabitEthernet0/0/0/1 + commands: + - interface GigabitEthernet0/0/0/0 + - no ipv4 address + - no ipv6 address + - interface GigabitEthernet0/0/0/1 + - no ipv4 address + after: + - name: Loopback888 + - name: Loopback999 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tasks/cli.yaml new file mode 100644 index 00000000..f622cf94 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tasks/cli.yaml @@ -0,0 +1,20 @@ +--- +- name: Collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + delegate_to: localhost + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/_populate.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/_populate.yaml new file mode 100644 index 00000000..f93c2307 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/_populate.yaml @@ -0,0 +1,6 @@ +--- +- name: Setup + vars: + lines: "lacp system priority 12\nlacp system mac 00c1.4c00.bd16\n" + ansible.netcommon.cli_config: + config: '{{ lines }}' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/_remove_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/_remove_config.yaml new file mode 100644 index 00000000..a8234e82 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/_remove_config.yaml @@ -0,0 +1,6 @@ +--- +- name: Remove Config + vars: + lines: "no lacp system priority\nno lacp system mac\n" + ansible.netcommon.cli_config: + config: '{{ lines }}' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/deleted.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/deleted.yaml new file mode 100644 index 00000000..f8824124 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/deleted.yaml @@ -0,0 +1,48 @@ +--- +- debug: + msg: Start iosxr_lacp deleted integration tests ansible_connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate.yaml + +- block: + + - name: Delete LACP attributes + register: result + cisco.iosxr.iosxr_lacp: &id001 + state: deleted + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ populate == result['before'] }}" + + - name: Assert that the correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that the after dicts were correctly generated + assert: + that: + - "{{ deleted['after'] == result['after'] }}" + + - name: Delete attributes of given interfaces (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lacp: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == false + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ deleted['after'] == result['before'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/empty_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/empty_config.yaml new file mode 100644 index 00000000..66504e22 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/empty_config.yaml @@ -0,0 +1,49 @@ +--- +- debug: + msg: START iosxr_lacp empty_config integration tests on connection={{ + ansible_connection }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lacp: + config: + state: merged + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state merged' + +- name: Replaced with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lacp: + config: + state: replaced + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lacp: + config: + state: rendered + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state rendered' + +- name: Parsed with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lacp: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/fixtures/parsed.cfg new file mode 100644 index 00000000..5b16c0e8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/fixtures/parsed.cfg @@ -0,0 +1,2 @@ +lacp system mac 00c1.4c00.bd15 +lacp system priority 11 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/gathered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/gathered.yaml new file mode 100644 index 00000000..2d952cf2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/gathered.yaml @@ -0,0 +1,30 @@ +--- +- debug: + msg: START iosxr_lacp gathered integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Gather the provided configuration with the existing running configuration + register: result + cisco.iosxr.iosxr_lacp: + config: + system: + priority: 11 + mac: + address: 00c1.4c00.bd15 + state: merged + + - name: Gather LACP facts using gathered state + register: result + cisco.iosxr.iosxr_lacp: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ merged['after'] == result['gathered'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/merged.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/merged.yaml new file mode 100644 index 00000000..33859d9f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/merged.yaml @@ -0,0 +1,51 @@ +--- +- debug: + msg: START iosxr_lacp merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + cisco.iosxr.iosxr_lacp: &id001 + config: + system: + priority: 11 + mac: + address: 00c1.4c00.bd15 + state: merged + + - name: Assert that before dicts were correctly generated + assert: + that: "{{ merged['before'] == result['before'] }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that after dicts was correctly generated + assert: + that: + - "{{ merged['after'] == result['after'] }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lacp: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + + - name: Assert that before dicts were correctly generated + assert: + that: + - "{{ merged['after'] == result['before']}}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/parsed.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/parsed.yaml new file mode 100644 index 00000000..5e530a2e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/parsed.yaml @@ -0,0 +1,15 @@ +--- +- debug: + msg: START iosxr_lacp parsed integration tests on connection={{ ansible_connection + }} + +- name: Parse externally provided LACP config to agnostic model + register: result + cisco.iosxr.iosxr_lacp: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ parsed['after'] == result['parsed'] }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/rendered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/rendered.yaml new file mode 100644 index 00000000..ce760898 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/rendered.yaml @@ -0,0 +1,20 @@ +--- +- debug: + msg: START iosxr_lacp rendered integration tests on connection={{ + ansible_connection }} + +- name: Render platform specific commands from task input using rendered state + register: result + cisco.iosxr.iosxr_lacp: + config: + system: + priority: 11 + mac: + address: 00c1.4c00.bd15 + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length\ + \ == 0 }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/replaced.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/replaced.yaml new file mode 100644 index 00000000..6076b5cd --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/replaced.yaml @@ -0,0 +1,52 @@ +--- +- debug: + msg: START iosxr_lacp replaced integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate.yaml + +- block: + + - name: Replace LACP configuration with provided configurations + register: result + cisco.iosxr.iosxr_lacp: &id001 + config: + system: + priority: 11 + state: replaced + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ populate == result['before'] }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ replaced['after'] == result['after'] }}" + + - name: Replace device configurations of listed interfaces with provided configurarions + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lacp: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ replaced['after'] == result['before'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/rtt.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/rtt.yaml new file mode 100644 index 00000000..88e1de92 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/tests/cli/rtt.yaml @@ -0,0 +1,53 @@ +--- +- debug: + msg: START isoxr_lacp round trip integration tests on connection={{ ansible_connection + }} + +- block: + + - include_tasks: _remove_config.yaml + + - name: Apply the provided configuration (base config) + register: base_config + cisco.iosxr.iosxr_lacp: + config: + system: + priority: 15 + mac: + address: 00c1.4c00.bd16 + state: merged + + - name: Gather interfaces facts + cisco.iosxr.iosxr_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - lacp + + - name: Apply the provided configuration (config to be reverted) + register: result + cisco.iosxr.iosxr_lacp: + config: + system: + priority: 10 + mac: + address: 00c1.4c00.bd10 + state: merged + + - name: Assert that changes were applied + assert: + that: "{{ round_trip['after'] == result['after'] }}" + + - name: Revert back to base config using facts round trip + register: revert + cisco.iosxr.iosxr_lacp: + config: "{{ ansible_facts['network_resources']['lacp'] }}" + state: replaced + + - name: Assert that config was reverted + assert: + that: "{{ base_config['after'] == revert['after'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/vars/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/vars/main.yaml new file mode 100644 index 00000000..dc7a5246 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp/vars/main.yaml @@ -0,0 +1,44 @@ +--- +merged: + before: {} + commands: + - lacp system priority 11 + - lacp system mac 00c1.4c00.bd15 + after: + system: + priority: 11 + mac: + address: 00c1.4c00.bd15 +populate: + system: + priority: 12 + mac: + address: 00c1.4c00.bd16 +replaced: + commands: + - no lacp system mac + - lacp system priority 11 + after: + system: + priority: 11 +rendered: + commands: + - lacp system priority 11 + - lacp system mac 00c1.4c00.bd15 +parsed: + after: + system: + priority: 11 + mac: + address: 00c1.4c00.bd15 +deleted: + commands: + - no lacp system priority + - no lacp system mac + after: {} +round_trip: + after: + system: + priority: 10 + mac: + address: 00c1.4c00.bd10 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tasks/cli.yaml new file mode 100644 index 00000000..f622cf94 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tasks/cli.yaml @@ -0,0 +1,20 @@ +--- +- name: Collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + delegate_to: localhost + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/_populate.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/_populate.yaml new file mode 100644 index 00000000..86d3e64e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/_populate.yaml @@ -0,0 +1,26 @@ +--- +- name: Setup Bundle-Ether10 + cisco.iosxr.iosxr_config: + lines: + - lacp churn logging actor + - lacp switchover suppress-flaps 500 + - lacp collector-max-delay 100 + parents: interface Bundle-Ether10 + +- name: Setup Bundle-Ether11 + cisco.iosxr.iosxr_config: + lines: + - lacp system mac 00c2.4c00.bd15 + parents: interface Bundle-Ether11 + +- name: Setup GigE0 + cisco.iosxr.iosxr_config: + lines: + - lacp period 100 + parents: interface GigabitEthernet0/0/0/0 + +- name: Setup GigE1 + cisco.iosxr.iosxr_config: + lines: + - lacp period 200 + parents: interface GigabitEthernet0/0/0/1 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/_remove_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/_remove_config.yaml new file mode 100644 index 00000000..8d3c4fcb --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/_remove_config.yaml @@ -0,0 +1,28 @@ +--- +- name: Remove Bundles + vars: + lines: "no interface Bundle-Ether10\nno interface Bundle-Ether11\nno interface\ + \ Bundle-Ether12\n" + ansible.netcommon.cli_config: + config: '{{ lines }}' + +- name: Remove LACP interface config + loop: + - 0/0/0/0 + - 0/0/0/1 + cisco.iosxr.iosxr_config: + lines: + - no lacp period + - shutdown + parents: interface GigabitEthernet{{ item }} + +- name: Remove unwanted interfaces from config + loop: + - 0/0/0/2 + - 0/0/0/3 + - 0/0/0/4 + - 0/0/0/5 + ignore_errors: true + cisco.iosxr.iosxr_config: + lines: + - no interface GigabitEthernet{{ item }} diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/deleted.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/deleted.yaml new file mode 100644 index 00000000..cb3daa43 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/deleted.yaml @@ -0,0 +1,51 @@ +--- +- debug: + msg: Start iosxr_lacp_interfaces deleted integration tests ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate.yaml + +- block: + + - name: Delete LACP attributes of all interfaces + register: result + cisco.iosxr.iosxr_lacp_interfaces: &id001 + state: deleted + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" + + - name: Assert that the correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that the after dicts were correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Delete LACP attributes of all interfaces (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lacp_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == false + - result.commands|length == 0 + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/empty_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/empty_config.yaml new file mode 100644 index 00000000..166f5943 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/empty_config.yaml @@ -0,0 +1,60 @@ +--- +- debug: + msg: START iosxr_lacp_interfaces empty_config integration tests on connection={{ + ansible_connection }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lacp_interfaces: + config: + state: merged + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state merged' + +- name: Replaced with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lacp_interfaces: + config: + state: replaced + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Overridden with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lacp_interfaces: + config: + state: overridden + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state overridden' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lacp_interfaces: + config: + state: rendered + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state rendered' + +- name: Parsed with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lacp_interfaces: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/fixtures/parsed.cfg new file mode 100644 index 00000000..0595831e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/fixtures/parsed.cfg @@ -0,0 +1,14 @@ +interface Bundle-Ether10 + lacp churn logging actor + lacp switchover suppress-flaps 500 + lacp collector-max-delay 100 +! +interface Bundle-Ether11 + lacp system mac 00c2.4c00.bd15 +! +interface MgmtEth0/0/CPU0/0 + ipv4 address 192.0.2.11 255.255.255.0 +! +interface GigabitEthernet0/0/0/1 + lacp period 200 +! diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/gathered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/gathered.yaml new file mode 100644 index 00000000..adc671e9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/gathered.yaml @@ -0,0 +1,39 @@ +--- +- debug: + msg: START iosxr_lacp_interfaces gathered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + cisco.iosxr.iosxr_lacp_interfaces: + config: + + - name: Bundle-Ether10 + churn_logging: actor + collector_max_delay: 100 + switchover_suppress_flaps: 500 + + - name: Bundle-Ether11 + system: + mac: 00c2.4c00.bd15 + + - name: GigabitEthernet0/0/0/1 + period: 100 + state: merged + + - name: Gather interfaces facts using gathered state + register: result + cisco.iosxr.iosxr_lacp_interfaces: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ merged['after'] | symmetric_difference(result['gathered']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/merged.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/merged.yaml new file mode 100644 index 00000000..5642722c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/merged.yaml @@ -0,0 +1,63 @@ +--- +- debug: + msg: START iosxr_lacp_interfaces merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + cisco.iosxr.iosxr_lacp_interfaces: &id001 + config: + + - name: Bundle-Ether10 + churn_logging: actor + collector_max_delay: 100 + switchover_suppress_flaps: 500 + + - name: Bundle-Ether11 + system: + mac: 00c2.4c00.bd15 + + - name: GigabitEthernet0/0/0/1 + period: 100 + state: merged + + - name: Assert that before dicts were correctly generated + assert: + that: "{{ merged['before'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that after dicts was correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lacp_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dicts were correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/overridden.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/overridden.yaml new file mode 100644 index 00000000..b83726ed --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/overridden.yaml @@ -0,0 +1,61 @@ +--- +- debug: + msg: START iosxr_lacp_interfaces overridden integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate.yaml + +- block: + + - name: Overridde all interface LACP configuration with provided configuration + register: result + cisco.iosxr.iosxr_lacp_interfaces: &id001 + config: + + - name: Bundle-Ether12 + churn_logging: both + collector_max_delay: 100 + switchover_suppress_flaps: 500 + + - name: GigabitEthernet0/0/0/1 + period: 300 + state: overridden + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Overridde all interface LACP configuration with provided configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lacp_interfaces: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/parsed.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/parsed.yaml new file mode 100644 index 00000000..10f6c447 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/parsed.yaml @@ -0,0 +1,15 @@ +--- +- debug: + msg: START iosxr_lacp_interfaces parsed integration tests on connection={{ ansible_connection + }} + +- name: Parse externally provided LACP config to agnostic model + register: result + cisco.iosxr.iosxr_lacp_interfaces: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ parsed['after'] == result['parsed'] }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/rendered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/rendered.yaml new file mode 100644 index 00000000..7f259f30 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/rendered.yaml @@ -0,0 +1,27 @@ +--- +- debug: + msg: START iosxr_lacp_interfaces rendered integration tests on connection={{ + ansible_connection }} + +- name: Render platform specific commands from task input using rendered state + register: result + cisco.iosxr.iosxr_lacp_interfaces: + config: + - name: Bundle-Ether10 + churn_logging: actor + collector_max_delay: 100 + switchover_suppress_flaps: 500 + + - name: Bundle-Ether11 + system: + mac: 00c2.4c00.bd15 + + - name: GigabitEthernet0/0/0/1 + period: 200 + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length\ + \ == 0 }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/replaced.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/replaced.yaml new file mode 100644 index 00000000..d0f25d10 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/replaced.yaml @@ -0,0 +1,59 @@ +--- +- debug: + msg: START iosxr_lacp_interfaces replaced integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate.yaml + +- block: + + - name: Replace device configurations of listed interfaces with provided configurations + register: result + cisco.iosxr.iosxr_lacp_interfaces: &id001 + config: + + - name: Bundle-Ether10 + churn_logging: partner + + - name: GigabitEthernet0/0/0/1 + period: 300 + state: replaced + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Replace device configurations of listed interfaces with provided configurarions + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lacp_interfaces: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/rtt.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/rtt.yaml new file mode 100644 index 00000000..41315301 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/tests/cli/rtt.yaml @@ -0,0 +1,66 @@ +--- +- debug: + msg: START isoxr_lacp_interfaces round trip integration tests on connection={{ + ansible_connection }} + +- block: + + - include_tasks: _remove_config.yaml + + - name: Apply the provided configuration (base config) + register: base_config + cisco.iosxr.iosxr_lacp_interfaces: + config: + + - name: Bundle-Ether10 + churn_logging: actor + collector_max_delay: 200 + + - name: Bundle-Ether11 + period: 100 + + - name: GigabitEthernet0/0/0/0 + period: 200 + state: merged + + - name: Gather interfaces facts + cisco.iosxr.iosxr_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - lacp_interfaces + + - name: Apply the provided configuration (config to be reverted) + register: result + cisco.iosxr.iosxr_lacp_interfaces: + config: + + - name: Bundle-Ether10 + churn_logging: partner + + - name: Bundle-Ether11 + period: 200 + + - name: GigabitEthernet0/0/0/0 + period: 300 + state: overridden + + - name: Assert that changes were applied + assert: + that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Revert back to base config using facts round trip + register: revert + cisco.iosxr.iosxr_lacp_interfaces: + config: "{{ ansible_facts['network_resources']['lacp_interfaces'] }}" + state: overridden + + - name: Assert that config was reverted + assert: + that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/vars/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/vars/main.yaml new file mode 100644 index 00000000..1f1f5cf9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lacp_interfaces/vars/main.yaml @@ -0,0 +1,130 @@ +--- +merged: + before: + - name: GigabitEthernet0/0/0/0 + - name: GigabitEthernet0/0/0/1 + commands: + - interface Bundle-Ether10 + - lacp churn logging actor + - lacp switchover suppress-flaps 500 + - lacp collector-max-delay 100 + - interface Bundle-Ether11 + - lacp system mac 00c2.4c00.bd15 + - interface GigabitEthernet0/0/0/1 + - lacp period 100 + after: + - name: Bundle-Ether10 + churn_logging: actor + switchover_suppress_flaps: 500 + collector_max_delay: 100 + - name: Bundle-Ether11 + system: + mac: 00c2.4c00.bd15 + - name: GigabitEthernet0/0/0/0 + - name: GigabitEthernet0/0/0/1 + period: 100 +populate: + - name: Bundle-Ether10 + churn_logging: actor + switchover_suppress_flaps: 500 + collector_max_delay: 100 + - name: Bundle-Ether11 + system: + mac: 00c2.4c00.bd15 + - name: GigabitEthernet0/0/0/0 + period: 100 + - name: GigabitEthernet0/0/0/1 + period: 200 +replaced: + commands: + - interface Bundle-Ether10 + - no lacp switchover suppress-flaps 500 + - no lacp collector-max-delay 100 + - lacp churn logging partner + - interface GigabitEthernet0/0/0/1 + - lacp period 300 + after: + - name: Bundle-Ether10 + churn_logging: partner + - name: Bundle-Ether11 + system: + mac: 00c2.4c00.bd15 + - name: GigabitEthernet0/0/0/0 + period: 100 + - name: GigabitEthernet0/0/0/1 + period: 300 +overridden: + commands: + - interface Bundle-Ether10 + - no lacp switchover suppress-flaps 500 + - no lacp collector-max-delay 100 + - no lacp churn logging actor + - interface Bundle-Ether11 + - no lacp system mac 00c2.4c00.bd15 + - interface GigabitEthernet0/0/0/0 + - no lacp period 100 + - interface Bundle-Ether12 + - lacp churn logging both + - lacp collector-max-delay 100 + - lacp switchover suppress-flaps 500 + - interface GigabitEthernet0/0/0/1 + - lacp period 300 + after: + - name: Bundle-Ether10 + - name: Bundle-Ether11 + - name: Bundle-Ether12 + churn_logging: both + collector_max_delay: 100 + switchover_suppress_flaps: 500 + - name: GigabitEthernet0/0/0/0 + - name: GigabitEthernet0/0/0/1 + period: 300 +deleted: + commands: + - interface Bundle-Ether10 + - no lacp switchover suppress-flaps 500 + - no lacp collector-max-delay 100 + - no lacp churn logging actor + - interface Bundle-Ether11 + - no lacp system mac 00c2.4c00.bd15 + - interface GigabitEthernet0/0/0/0 + - no lacp period 100 + - interface GigabitEthernet0/0/0/1 + - no lacp period 200 + after: + - name: Bundle-Ether10 + - name: Bundle-Ether11 + - name: GigabitEthernet0/0/0/0 + - name: GigabitEthernet0/0/0/1 +round_trip: + after: + - name: Bundle-Ether10 + churn_logging: partner + - name: Bundle-Ether11 + period: 200 + - name: GigabitEthernet0/0/0/0 + period: 300 + - name: GigabitEthernet0/0/0/1 +parsed: + after: + - name: Bundle-Ether10 + churn_logging: actor + collector_max_delay: 100 + switchover_suppress_flaps: 500 + + - name: Bundle-Ether11 + system: + mac: 00c2.4c00.bd15 + + - name: GigabitEthernet0/0/0/1 + period: 200 +rendered: + commands: + - "interface Bundle-Ether10" + - "lacp churn logging actor" + - "lacp switchover suppress-flaps 500" + - "lacp collector-max-delay 100" + - "interface Bundle-Ether11" + - "lacp system mac 00c2.4c00.bd15" + - "interface GigabitEthernet0/0/0/1" + - "lacp period 200" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tasks/cli.yaml new file mode 100644 index 00000000..f622cf94 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tasks/cli.yaml @@ -0,0 +1,20 @@ +--- +- name: Collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + delegate_to: localhost + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/_populate_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/_populate_config.yaml new file mode 100644 index 00000000..37982f9a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/_populate_config.yaml @@ -0,0 +1,29 @@ +--- +- name: Setup + cisco.iosxr.iosxr_lag_interfaces: + config: + + - name: Bundle-Ether10 + mode: active + members: + + - member: GigabitEthernet0/0/0/0 + mode: inherit + + - member: GigabitEthernet0/0/0/1 + mode: passive + load_balancing_hash: src-ip + links: + max_active: 10 + min_active: 2 + + - name: Bundle-Ether11 + load_balancing_hash: dst-ip + members: + + - member: GigabitEthernet0/0/0/8 + mode: passive + + - member: GigabitEthernet0/0/0/9 + mode: passive + state: merged diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/_remove_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/_remove_config.yaml new file mode 100644 index 00000000..e9566f34 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/_remove_config.yaml @@ -0,0 +1,32 @@ +--- +- name: Remove Bundles + vars: + lines: "no interface Bundle-Ether10\nno interface Bundle-Ether11\nno interface\ + \ Bundle-Ether12\n" + ignore_errors: true + ansible.netcommon.cli_config: + config: '{{ lines }}' + +- name: Remove LAG interface config + loop: + - 0/0/0/0 + - 0/0/0/1 + - 0/0/0/2 + - 0/0/0/8 + - 0/0/0/9 + ignore_errors: true + cisco.iosxr.iosxr_config: + lines: + - no bundle id + - shutdown + parents: interface GigabitEthernet{{ item }} + +- name: Remove unwanted interfaces from config + loop: + - 0/0/0/2 + - 0/0/0/8 + - 0/0/0/9 + ignore_errors: true + cisco.iosxr.iosxr_config: + lines: + - no interface GigabitEthernet{{ item }} diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/deleted.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/deleted.yaml new file mode 100644 index 00000000..6aed8ce5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/deleted.yaml @@ -0,0 +1,52 @@ +--- +- debug: + msg: Start iosxr_lag_interfaces deleted integration tests ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Delete LAG interfaces configuration + register: result + cisco.iosxr.iosxr_lag_interfaces: &id001 + state: deleted + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that the correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that the after dicts were correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Delete LACP attributes of all interfaces (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lag_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == false + - result.commands|length == 0 + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/empty_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/empty_config.yaml new file mode 100644 index 00000000..5992de5b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/empty_config.yaml @@ -0,0 +1,60 @@ +--- +- debug: + msg: START iosxr_lag_interfaces empty_config integration tests on connection={{ + ansible_connection }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lag_interfaces: + config: + state: merged + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state merged' + +- name: Replaced with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lag_interfaces: + config: + state: replaced + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Overridden with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lag_interfaces: + config: + state: overridden + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state overridden' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lag_interfaces: + config: + state: rendered + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state rendered' + +- name: Parsed with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lag_interfaces: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/fixtures/parsed.cfg new file mode 100644 index 00000000..a67b7f9a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/fixtures/parsed.cfg @@ -0,0 +1,33 @@ +interface Bundle-Ether10 + lacp mode active + bundle load-balancing hash src-ip + bundle maximum-active links 5 + bundle minimum-active links 2 +! +interface Bundle-Ether12 + bundle load-balancing hash dst-ip +! +interface Loopback888 + description test for ansible + shutdown +! +interface MgmtEth0/0/CPU0/0 + ipv4 address 192.0.2.11 255.255.255.0 +! +interface GigabitEthernet0/0/0/1 + description 'GigabitEthernet - 1" + bundle id 10 mode inherit +! +interface GigabitEthernet0/0/0/2 + description "GigabitEthernet - 2" + bundle id 12 mode passive +! +interface GigabitEthernet0/0/0/3 + description "GigabitEthernet - 3" + bundle id 10 mode inherit +! +interface GigabitEthernet0/0/0/4 + description "GigabitEthernet - 4" + bundle id 12 mode passive +! + diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/gathered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/gathered.yaml new file mode 100644 index 00000000..50c13507 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/gathered.yaml @@ -0,0 +1,49 @@ +--- +- debug: + msg: START iosxr_lag_interfaces gathered integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Gather the provided configuration with the existing running configuration + register: result + cisco.iosxr.iosxr_lag_interfaces: + config: + - name: Bundle-Ether10 + mode: active + members: + + - member: GigabitEthernet0/0/0/0 + mode: inherit + + - member: GigabitEthernet0/0/0/1 + mode: passive + load_balancing_hash: src-ip + links: + max_active: 10 + min_active: 2 + + - name: Bundle-Ether11 + load_balancing_hash: dst-ip + members: + + - member: GigabitEthernet0/0/0/8 + mode: passive + + - member: GigabitEthernet0/0/0/9 + mode: passive + state: merged + + - name: Gather LACP facts using gathered state + register: result + cisco.iosxr.iosxr_lag_interfaces: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ merged['after'] == result['gathered'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/merged.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/merged.yaml new file mode 100644 index 00000000..73aee044 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/merged.yaml @@ -0,0 +1,75 @@ +--- +- debug: + msg: START iosxr_lag_interfaces merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + cisco.iosxr.iosxr_lag_interfaces: &id001 + config: + + - name: Bundle-Ether10 + mode: active + members: + + - member: GigabitEthernet0/0/0/0 + mode: inherit + + - member: GigabitEthernet0/0/0/1 + mode: passive + load_balancing_hash: src-ip + links: + max_active: 10 + min_active: 2 + + - name: Bundle-Ether11 + load_balancing_hash: dst-ip + members: + + - member: GigabitEthernet0/0/0/8 + mode: passive + + - member: GigabitEthernet0/0/0/9 + mode: passive + state: merged + + - name: Assert that before dicts were correctly generated + assert: + that: "{{ merged['before'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that after dicts was correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lag_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dicts were correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/overridden.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/overridden.yaml new file mode 100644 index 00000000..0c6ac8c3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/overridden.yaml @@ -0,0 +1,68 @@ +--- +- debug: + msg: START iosxr_lag_interfaces overridden integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Overridde all LAG interface configuration with provided configuration + register: result + cisco.iosxr.iosxr_lag_interfaces: &id001 + config: + + - name: Bundle-Ether11 + mode: active + members: + + - member: GigabitEthernet0/0/0/0 + mode: active + + - member: GigabitEthernet0/0/0/1 + mode: active + load_balancing_hash: src-ip + links: + max_active: 10 + min_active: 5 + state: overridden + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Overridde all interface LAG interface configuration with provided configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lag_interfaces: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/parsed.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/parsed.yaml new file mode 100644 index 00000000..310c4d79 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/parsed.yaml @@ -0,0 +1,15 @@ +--- +- debug: + msg: START iosxr_lag_interfaces parsed integration tests on connection={{ ansible_connection + }} + +- name: Parse externally provided lag interfaces config to agnostic model + register: result + cisco.iosxr.iosxr_lag_interfaces: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ parsed['after'] == result['parsed'] }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/rendered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/rendered.yaml new file mode 100644 index 00000000..cec9e7db --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/rendered.yaml @@ -0,0 +1,34 @@ +--- +- debug: + msg: START iosxr_lag_interfaces rendered integration tests on connection={{ + ansible_connection }} + +- name: Render platform specific commands from task input using rendered state + register: result + cisco.iosxr.iosxr_lag_interfaces: + config: + - name: Bundle-Ether10 + members: + - member: GigabitEthernet0/0/0/1 + mode: inherit + - member: GigabitEthernet0/0/0/3 + mode: inherit + mode: active + links: + max_active: 5 + min_active: 2 + load_balancing_hash: src-ip + + - name: Bundle-Ether12 + members: + - member: GigabitEthernet0/0/0/2 + mode: passive + - member: GigabitEthernet0/0/0/4 + mode: passive + load_balancing_hash: dst-ip + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - rendered['commands'].sort() == result['rendered'].sort() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/replaced.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/replaced.yaml new file mode 100644 index 00000000..2f8ad1e7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/replaced.yaml @@ -0,0 +1,65 @@ +--- +- debug: + msg: START iosxr_lag_interfaces replaced integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Replace device configurations of listed interfaces with provided configurations + register: result + cisco.iosxr.iosxr_lag_interfaces: &id001 + config: + + - name: Bundle-Ether10 + mode: passive + members: + + - member: GigabitEthernet0/0/0/0 + mode: passive + load_balancing_hash: dst-ip + + - name: Bundle-Ether12 + mode: active + state: replaced + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Replace device configurations of listed interfaces with provided configurarions + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lag_interfaces: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/rtt.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/rtt.yaml new file mode 100644 index 00000000..0be9e147 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/tests/cli/rtt.yaml @@ -0,0 +1,71 @@ +--- +- debug: + msg: START isoxr_lag_interfaces round trip integration tests on connection={{ + ansible_connection }} + +- block: + + - include_tasks: _remove_config.yaml + + - name: Apply the provided configuration (base config) + register: base_config + cisco.iosxr.iosxr_lag_interfaces: + config: + + - name: Bundle-Ether10 + members: + + - member: GigabitEthernet0/0/0/1 + mode: passive + links: + max_active: 10 + min_active: 2 + + - name: Bundle-Ether11 + mode: passive + state: merged + + - name: Gather interfaces facts + cisco.iosxr.iosxr_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - lag_interfaces + + - name: Apply the provided configuration (config to be reverted) + register: result + cisco.iosxr.iosxr_lag_interfaces: + config: + + - name: Bundle-Ether10 + members: + + - member: GigabitEthernet0/0/0/9 + mode: active + + - member: GigabitEthernet0/0/0/8 + mode: passive + + - name: Bundle-Ether11 + mode: active + state: overridden + + - name: Assert that changes were applied + assert: + that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Revert back to base config using facts round trip + register: revert + cisco.iosxr.iosxr_lag_interfaces: + config: "{{ ansible_facts['network_resources']['lag_interfaces'] }}" + state: overridden + + - name: Assert that config was reverted + assert: + that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/vars/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/vars/main.yaml new file mode 100644 index 00000000..5f4c7722 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lag_interfaces/vars/main.yaml @@ -0,0 +1,181 @@ +--- +merged: + before: [] + commands: + - interface Bundle-Ether10 + - bundle load-balancing hash src-ip + - bundle minimum-active links 2 + - bundle maximum-active links 10 + - lacp mode active + - interface GigabitEthernet0/0/0/1 + - bundle id 10 mode passive + - interface GigabitEthernet0/0/0/0 + - bundle id 10 mode inherit + - interface Bundle-Ether11 + - bundle load-balancing hash dst-ip + - interface GigabitEthernet0/0/0/8 + - bundle id 11 mode passive + - interface GigabitEthernet0/0/0/9 + - bundle id 11 mode passive + after: + - name: Bundle-Ether10 + links: + max_active: 10 + min_active: 2 + load_balancing_hash: src-ip + members: + - member: GigabitEthernet0/0/0/0 + mode: inherit + - member: GigabitEthernet0/0/0/1 + mode: passive + mode: active + - name: Bundle-Ether11 + load_balancing_hash: dst-ip + members: + - member: GigabitEthernet0/0/0/8 + mode: passive + - member: GigabitEthernet0/0/0/9 + mode: passive +replaced: + commands: + - interface Bundle-Ether10 + - no bundle maximum-active links 10 + - no bundle minimum-active links 2 + - bundle load-balancing hash dst-ip + - lacp mode passive + - interface GigabitEthernet0/0/0/1 + - no bundle id + - interface GigabitEthernet0/0/0/0 + - bundle id 10 mode passive + - interface Bundle-Ether12 + - lacp mode active + after: + - load_balancing_hash: dst-ip + members: + - member: GigabitEthernet0/0/0/0 + mode: passive + mode: passive + name: Bundle-Ether10 + - load_balancing_hash: dst-ip + members: + - member: GigabitEthernet0/0/0/8 + mode: passive + - member: GigabitEthernet0/0/0/9 + mode: passive + name: Bundle-Ether11 + - mode: active + name: Bundle-Ether12 +overridden: + commands: + - interface Bundle-Ether10 + - no bundle maximum-active links 10 + - no bundle minimum-active links 2 + - no bundle load-balancing hash src-ip + - no lacp mode active + - interface GigabitEthernet0/0/0/0 + - no bundle id + - interface GigabitEthernet0/0/0/1 + - no bundle id + - interface Bundle-Ether11 + - bundle load-balancing hash src-ip + - bundle minimum-active links 5 + - bundle maximum-active links 10 + - lacp mode active + - interface GigabitEthernet0/0/0/8 + - no bundle id + - interface GigabitEthernet0/0/0/9 + - no bundle id + - interface GigabitEthernet0/0/0/0 + - bundle id 11 mode active + - interface GigabitEthernet0/0/0/1 + - bundle id 11 mode active + after: + - name: Bundle-Ether10 + - links: + max_active: 10 + min_active: 5 + load_balancing_hash: src-ip + members: + - member: GigabitEthernet0/0/0/0 + mode: active + - member: GigabitEthernet0/0/0/1 + mode: active + mode: active + name: Bundle-Ether11 +deleted: + commands: + - interface Bundle-Ether10 + - no bundle maximum-active links 10 + - no bundle minimum-active links 2 + - no bundle load-balancing hash src-ip + - no lacp mode active + - interface GigabitEthernet0/0/0/0 + - no bundle id + - interface GigabitEthernet0/0/0/1 + - no bundle id + - interface Bundle-Ether11 + - no bundle load-balancing hash dst-ip + - interface GigabitEthernet0/0/0/8 + - no bundle id + - interface GigabitEthernet0/0/0/9 + - no bundle id + after: + - name: Bundle-Ether10 + - name: Bundle-Ether11 +round_trip: + after: + - members: + - member: GigabitEthernet0/0/0/8 + mode: passive + - member: GigabitEthernet0/0/0/9 + mode: active + name: Bundle-Ether10 + - mode: active + name: Bundle-Ether11 +rendered: + commands: + - "interface Bundle-Ether10" + - "lacp mode active" + - "bundle load-balancing hash src-ip" + - "bundle maximum-active links 5" + - "bundle minimum-active links 2" + - "interface Bundle-Ether12" + - "bundle load-balancing hash dst-ip" + - "interface Loopback888" + - "description test for ansible" + - "shutdown" + - "interface MgmtEth0/0/CPU0/0" + - "ipv4 address 192.0.2.11 255.255.255.0" + - "interface GigabitEthernet0/0/0/1" + - "description 'GigabitEthernet - 1'" + - "bundle id 10 mode inherit" + - "interface GigabitEthernet0/0/0/2" + - "description 'GigabitEthernet - 2'" + - "bundle id 12 mode passive" + - "interface GigabitEthernet0/0/0/3" + - "description 'GigabitEthernet - 3'" + - "bundle id 10 mode inherit" + - "interface GigabitEthernet0/0/0/4" + - "description 'GigabitEthernet - 4'" + - "bundle id 12 mode passive" +parsed: + after: + - name: Bundle-Ether10 + members: + - member: GigabitEthernet0/0/0/1 + mode: inherit + - member: GigabitEthernet0/0/0/3 + mode: inherit + mode: active + links: + max_active: 5 + min_active: 2 + load_balancing_hash: src-ip + + - name: Bundle-Ether12 + members: + - member: GigabitEthernet0/0/0/2 + mode: passive + - member: GigabitEthernet0/0/0/4 + mode: passive + load_balancing_hash: dst-ip diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tasks/cli.yaml new file mode 100644 index 00000000..f622cf94 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tasks/cli.yaml @@ -0,0 +1,20 @@ +--- +- name: Collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + delegate_to: localhost + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/_populate.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/_populate.yaml new file mode 100644 index 00000000..3f44e711 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/_populate.yaml @@ -0,0 +1,8 @@ +--- +- name: Setup + vars: + lines: "lldp reinit 2\nlldp holdtime 100\nlldp timer 3000\nlldp subinterfaces\ + \ enable\nlldp tlv-select system-description disable\nlldp tlv-select management-address\ + \ disable\n" + ansible.netcommon.cli_config: + config: '{{ lines }}' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/_remove_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/_remove_config.yaml new file mode 100644 index 00000000..34140d91 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/_remove_config.yaml @@ -0,0 +1,6 @@ +--- +- name: Remove Config + vars: + lines: "no lldp\n" + ansible.netcommon.cli_config: + config: '{{ lines }}' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/deleted.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/deleted.yaml new file mode 100644 index 00000000..5a53c74b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/deleted.yaml @@ -0,0 +1,48 @@ +--- +- debug: + msg: Start iosxr_lldp_global deleted integration tests ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate.yaml + +- block: + + - name: Delete global LLDP attributes + register: result + cisco.iosxr.iosxr_lldp_global: &id001 + state: deleted + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ merged['after'] == result['before'] }}" + + - name: Assert that the correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that the after dicts were correctly generated + assert: + that: + - "{{ deleted['after'] == result['after'] }}" + + - name: Delete attributes of given interfaces (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lldp_global: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == false + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ deleted['after'] == result['before'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/empty_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/empty_config.yaml new file mode 100644 index 00000000..8043e582 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/empty_config.yaml @@ -0,0 +1,49 @@ +--- +- debug: + msg: START iosxr_lldp_global empty_config integration tests on connection={{ + ansible_connection }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lldp_global: + config: + state: merged + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state merged' + +- name: Replaced with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lldp_global: + config: + state: replaced + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lldp_global: + config: + state: rendered + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state rendered' + +- name: Parsed with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lldp_global: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/fixtures/parsed.cfg new file mode 100644 index 00000000..9e05883e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/fixtures/parsed.cfg @@ -0,0 +1,11 @@ +lldp + timer 3000 + reinit 2 + subinterfaces enable + holdtime 100 + tlv-select + management-address disable + system-description disable + ! +! + diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/gathered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/gathered.yaml new file mode 100644 index 00000000..5c02e7e8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/gathered.yaml @@ -0,0 +1,34 @@ +--- +- debug: + msg: START iosxr_lldp_global gathered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + cisco.iosxr.iosxr_lldp_global: + config: + holdtime: 100 + reinit: 2 + timer: 3000 + subinterfaces: true + tlv_select: + management_address: false + system_description: false + state: merged + + - name: Gather interfaces facts using gathered state + register: result + cisco.iosxr.iosxr_lldp_global: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: merged['after'] == result['gathered'] + + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/merged.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/merged.yaml new file mode 100644 index 00000000..37effc81 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/merged.yaml @@ -0,0 +1,54 @@ +--- +- debug: + msg: START iosxr_lldp_global merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + cisco.iosxr.iosxr_lldp_global: &id001 + config: + holdtime: 100 + reinit: 2 + timer: 3000 + subinterfaces: true + tlv_select: + management_address: false + system_description: false + state: merged + + - name: Assert that before dicts were correctly generated + assert: + that: "{{ merged['before'] == result['before'] }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that after dicts was correctly generated + assert: + that: + - "{{ merged['after'] == result['after'] }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lldp_global: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + + - name: Assert that before dicts were correctly generated + assert: + that: + - "{{ merged['after'] == result['before']}}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/parsed.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/parsed.yaml new file mode 100644 index 00000000..c2e76075 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/parsed.yaml @@ -0,0 +1,15 @@ +--- +- debug: + msg: START iosxr_lldp_global parsed integration tests on connection={{ ansible_connection + }} + +- name: Parse externally provided LACP config to agnostic model + register: result + cisco.iosxr.iosxr_lldp_global: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ parsed['after'] == result['parsed'] }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/rendered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/rendered.yaml new file mode 100644 index 00000000..0eff0cdc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/rendered.yaml @@ -0,0 +1,23 @@ +--- +- debug: + msg: START iosxr_lldp_global rendered integration tests on connection={{ ansible_connection + }} + +- name: Render platform specific commands from task input using rendered stateion + register: result + cisco.iosxr.iosxr_lldp_global: + config: + holdtime: 100 + reinit: 2 + timer: 3000 + subinterfaces: true + tlv_select: + management_address: false + system_description: false + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length\ + \ == 0 }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/replaced.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/replaced.yaml new file mode 100644 index 00000000..8ef44209 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/replaced.yaml @@ -0,0 +1,55 @@ +--- +- debug: + msg: START iosxr_lldp_global replaced integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate.yaml + +- block: + + - name: Replace global LLDP configuration with provided configurations + register: result + cisco.iosxr.iosxr_lldp_global: &id001 + config: + holdtime: 100 + tlv_select: + port_description: false + system_description: false + management_address: false + state: replaced + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ merged['after'] == result['before'] }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ replaced['after'] == result['after'] }}" + + - name: Replace device global LLDP configurations with provided configurarions + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lldp_global: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ replaced['after'] == result['before'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/rtt.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/rtt.yaml new file mode 100644 index 00000000..e8e99f54 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/tests/cli/rtt.yaml @@ -0,0 +1,51 @@ +--- +- debug: + msg: START isoxr_lldp_global round trip integration tests on connection={{ ansible_connection + }} + +- block: + + - include_tasks: _remove_config.yaml + + - name: Apply the provided configuration (base config) + register: base_config + cisco.iosxr.iosxr_lldp_global: + config: + holdtime: 200 + timer: 500 + state: merged + + - name: Gather interfaces facts + cisco.iosxr.iosxr_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - lldp_global + + - name: Apply the provided configuration (config to be reverted) + register: result + cisco.iosxr.iosxr_lldp_global: + config: + holdtime: 200 + reinit: 4 + subinterfaces: true + timer: 3000 + state: merged + + - name: Assert that changes were applied + assert: + that: "{{ round_trip['after'] == result['after'] }}" + + - name: Revert back to base config using facts round trip + register: revert + cisco.iosxr.iosxr_lldp_global: + config: "{{ ansible_facts['network_resources']['lldp_global'] }}" + state: replaced + + - name: Assert that config was reverted + assert: + that: "{{ base_config['after'] == revert['after'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/vars/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/vars/main.yaml new file mode 100644 index 00000000..8d6f0928 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_global/vars/main.yaml @@ -0,0 +1,63 @@ +--- +merged: + before: {} + commands: + - lldp reinit 2 + - lldp holdtime 100 + - lldp timer 3000 + - lldp subinterfaces enable + - lldp tlv-select system-description disable + - lldp tlv-select management-address disable + after: + holdtime: 100 + reinit: 2 + subinterfaces: true + timer: 3000 + tlv_select: + management_address: false + system_description: false +replaced: + commands: + - no lldp reinit 2 + - no lldp subinterfaces enable + - no lldp timer 3000 + - lldp tlv-select port-description disable + after: + holdtime: 100 + tlv_select: + management_address: false + port_description: false + system_description: false +deleted: + commands: + - no lldp holdtime 100 + - no lldp reinit 2 + - no lldp subinterfaces enable + - no lldp timer 3000 + - no lldp tlv-select management-address disable + - no lldp tlv-select system-description disable + after: {} +round_trip: + after: + holdtime: 200 + reinit: 4 + subinterfaces: true + timer: 3000 + +parsed: + after: + holdtime: 100 + reinit: 2 + timer: 3000 + subinterfaces: true + tlv_select: + management_address: false + system_description: false +rendered: + commands: + - "lldp subinterfaces enable" + - "lldp holdtime 100" + - "lldp reinit 2" + - "lldp tlv-select system-description disable" + - "lldp tlv-select management-address disable" + - "lldp timer 3000" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tasks/cli.yaml new file mode 100644 index 00000000..f622cf94 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tasks/cli.yaml @@ -0,0 +1,20 @@ +--- +- name: Collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + delegate_to: localhost + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/_populate.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/_populate.yaml new file mode 100644 index 00000000..e499c1bd --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/_populate.yaml @@ -0,0 +1,12 @@ +--- +- name: Setup GigE1 + cisco.iosxr.iosxr_config: + lines: + - lldp receive disable + parents: interface GigabitEthernet0/0/0/1 + +- name: Setup GigE0 + cisco.iosxr.iosxr_config: + lines: + - lldp transmit disable + parents: interface GigabitEthernet0/0/0/0 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/_remove_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/_remove_config.yaml new file mode 100644 index 00000000..004cdb88 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/_remove_config.yaml @@ -0,0 +1,22 @@ +--- +- name: Remove LLDP interface config + loop: + - 0/0/0/0 + - 0/0/0/1 + ignore_errors: true + cisco.iosxr.iosxr_config: + lines: + - no lldp + - shutdown + parents: interface GigabitEthernet{{ item }} + +- name: Remove unwanted interfaces from config + loop: + - 0/0/0/2 + - 0/0/0/3 + - 0/0/0/4 + - 0/0/0/5 + ignore_errors: true + cisco.iosxr.iosxr_config: + lines: + - no interface GigabitEthernet{{ item }} diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/deleted.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/deleted.yaml new file mode 100644 index 00000000..933e188a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/deleted.yaml @@ -0,0 +1,51 @@ +--- +- debug: + msg: Start iosxr_lldp_interfaces deleted integration tests ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate.yaml + +- block: + + - name: Delete LLDP attributes of all interfaces + register: result + cisco.iosxr.iosxr_lldp_interfaces: &id001 + state: deleted + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" + + - name: Assert that the correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that the after dicts were correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Delete LACP attributes of all interfaces (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lldp_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == false + - result.commands|length == 0 + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/empty_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/empty_config.yaml new file mode 100644 index 00000000..e7fb55b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/empty_config.yaml @@ -0,0 +1,60 @@ +--- +- debug: + msg: START iosxr_lldp_interfaces empty_config integration tests on connection={{ + ansible_connection }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lldp_interfaces: + config: + state: merged + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state merged' + +- name: Replaced with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lldp_interfaces: + config: + state: replaced + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Overridden with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lldp_interfaces: + config: + state: overridden + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state overridden' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lldp_interfaces: + config: + state: rendered + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state rendered' + +- name: Parsed with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_lldp_interfaces: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/fixtures/parsed.cfg new file mode 100644 index 00000000..8fbe03d5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/fixtures/parsed.cfg @@ -0,0 +1,16 @@ +interface TenGigE0/0/0/0 + ipv4 address 192.0.2.11 255.255.255.192 +! +interface preconfigure GigabitEthernet0/0/0/1 + lldp + receive disable + destination mac-address + ieee-nearest-bridge + ! + ! +! +interface preconfigure GigabitEthernet0/0/0/2 + lldp + transmit disable + destination mac-address + ieee-nearest-non-tmpr-bridge diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/gathered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/gathered.yaml new file mode 100644 index 00000000..da2c148e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/gathered.yaml @@ -0,0 +1,33 @@ +--- +- debug: + msg: START iosxr_lldp_interfaces gathered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + cisco.iosxr.iosxr_lldp_interfaces: + config: + + - name: GigabitEthernet0/0/0/0 + transmit: false + + - name: GigabitEthernet0/0/0/1 + receive: false + state: merged + + - name: Gather interfaces facts using gathered state + register: result + cisco.iosxr.iosxr_lldp_interfaces: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ merged['after'] | symmetric_difference(result['gathered']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/merged.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/merged.yaml new file mode 100644 index 00000000..28713969 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/merged.yaml @@ -0,0 +1,57 @@ +--- +- debug: + msg: START iosxr_lldp_interfaces merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + cisco.iosxr.iosxr_lldp_interfaces: &id001 + config: + + - name: GigabitEthernet0/0/0/0 + transmit: false + + - name: GigabitEthernet0/0/0/1 + receive: false + state: merged + + - name: Assert that before dicts were correctly generated + assert: + that: "{{ merged['before'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that after dicts was correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lldp_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dicts were correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/overridden.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/overridden.yaml new file mode 100644 index 00000000..8cfb3a5d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/overridden.yaml @@ -0,0 +1,56 @@ +--- +- debug: + msg: START iosxr_lldp_interfaces overridden integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate.yaml + +- block: + + - name: Overridde all interface LLDP configuration with provided configuration + register: result + cisco.iosxr.iosxr_lldp_interfaces: &id001 + config: + + - name: GigabitEthernet0/0/0/0 + transmit: false + state: overridden + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Overridde all interface LACP configuration with provided configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lldp_interfaces: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/parsed.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/parsed.yaml new file mode 100644 index 00000000..277a2778 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/parsed.yaml @@ -0,0 +1,16 @@ +--- +- debug: + msg: START iosxr_lldp_interfaces parsed integration tests on connection={{ ansible_connection + }} + +- name: Parse externally provided Lldp interfaces config to agnostic model + register: result + cisco.iosxr.iosxr_lldp_interfaces: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ parsed['config'] | symmetric_difference(result['parsed']) |length\ + \ == 0 }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/rendered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/rendered.yaml new file mode 100644 index 00000000..c8a2c7de --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/rendered.yaml @@ -0,0 +1,27 @@ +--- +- debug: + msg: START iosxr_lldp_interfaces rendered integration tests on connection={{ ansible_connection + }} + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + cisco.iosxr.iosxr_lldp_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + destination: + mac_address: ieee-nearest-non-tmpr-bridge + transmit: false + + - name: GigabitEthernet0/0/0/2 + destination: + mac_address: ieee-nearest-bridge + receive: false + state: rendered + + - name: Assert that correct set of commands were rendered + assert: + that: + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length\ + \ == 0 }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/replaced.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/replaced.yaml new file mode 100644 index 00000000..005d14d9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/replaced.yaml @@ -0,0 +1,56 @@ +--- +- debug: + msg: START iosxr_lldp_interfaces replaced integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate.yaml + +- block: + + - name: Replace device configurations of listed interfaces with provided configurations + register: result + cisco.iosxr.iosxr_lldp_interfaces: &id001 + config: + + - name: GigabitEthernet0/0/0/1 + transmit: false + state: replaced + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Replace device configurations of listed interfaces with provided configurarions + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_lldp_interfaces: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/rtt.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/rtt.yaml new file mode 100644 index 00000000..10a31cc4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/tests/cli/rtt.yaml @@ -0,0 +1,56 @@ +--- +- debug: + msg: START iosxr_lldp_interfaces round trip integration tests on connection={{ + ansible_connection }} + +- block: + + - include_tasks: _remove_config.yaml + + - name: Apply the provided configuration (base config) + register: base_config + cisco.iosxr.iosxr_lldp_interfaces: + config: + + - name: GigabitEthernet0/0/0/0 + transmit: false + state: merged + + - name: Gather interfaces facts + cisco.iosxr.iosxr_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - lldp_interfaces + + - name: Apply the provided configuration (config to be reverted) + register: result + cisco.iosxr.iosxr_lldp_interfaces: + config: + + - name: GigabitEthernet0/0/0/0 + receive: false + + - name: GigabitEthernet0/0/0/1 + transmit: false + state: overridden + + - name: Assert that changes were applied + assert: + that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Revert back to base config using facts round trip + register: revert + cisco.iosxr.iosxr_lldp_interfaces: + config: "{{ ansible_facts['network_resources']['lldp_interfaces'] }}" + state: overridden + + - name: Assert that config was reverted + assert: + that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/vars/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/vars/main.yaml new file mode 100644 index 00000000..403548b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_lldp_interfaces/vars/main.yaml @@ -0,0 +1,73 @@ +--- +merged: + before: + - name: GigabitEthernet0/0/0/0 + - name: GigabitEthernet0/0/0/1 + commands: + - interface GigabitEthernet0/0/0/0 + - lldp transmit disable + - interface GigabitEthernet0/0/0/1 + - lldp receive disable + after: + - name: GigabitEthernet0/0/0/0 + transmit: false + - name: GigabitEthernet0/0/0/1 + receive: false +populate: + - name: GigabitEthernet0/0/0/0 + transmit: false + - name: GigabitEthernet0/0/0/1 + receive: false +replaced: + commands: + - interface GigabitEthernet0/0/0/1 + - no lldp receive disable + - lldp transmit disable + after: + - name: GigabitEthernet0/0/0/0 + transmit: false + - name: GigabitEthernet0/0/0/1 + transmit: false +overridden: + commands: + - interface GigabitEthernet0/0/0/1 + - no lldp receive disable + after: + - name: GigabitEthernet0/0/0/0 + transmit: false + - name: GigabitEthernet0/0/0/1 +deleted: + commands: + - interface GigabitEthernet0/0/0/0 + - no lldp transmit disable + - interface GigabitEthernet0/0/0/1 + - no lldp receive disable + after: + - name: GigabitEthernet0/0/0/0 + - name: GigabitEthernet0/0/0/1 +round_trip: + after: + - name: GigabitEthernet0/0/0/0 + receive: false + - name: GigabitEthernet0/0/0/1 + transmit: false +parsed: + config: + - name: TenGigE0/0/0/0 + - name: GigabitEthernet0/0/0/2 + destination: + mac_address: ieee-nearest-non-tmpr-bridge + transmit: false + + - name: GigabitEthernet0/0/0/1 + destination: + mac_address: ieee-nearest-bridge + receive: false +rendered: + commands: + - "interface GigabitEthernet0/0/0/2" + - "lldp destination mac-address ieee-nearest-non-tmpr-bridge" + - "lldp transmit disable" + - "interface GigabitEthernet0/0/0/1" + - "lldp receive disable" + - "lldp destination mac-address ieee-nearest-bridge" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/meta/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/meta/main.yaml new file mode 100644 index 00000000..be631e5d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_iosxr_tests diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/cli.yaml new file mode 100644 index 00000000..3358b7af --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/cli.yaml @@ -0,0 +1,21 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - network_cli + +- name: reset connection + meta: reset_connection diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/main.yaml new file mode 100644 index 00000000..5d082a6f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/main.yaml @@ -0,0 +1,3 @@ +--- +- include: cli.yaml +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/netconf.yaml new file mode 100644 index 00000000..cdbe47e3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/netconf.yaml @@ -0,0 +1,29 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.netconf) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.netconf' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - netconf + +- name: run test case (connection=local) + include: '{{ test_case_to_run }} ansible_connection=local' + with_first_found: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local + +- name: reset connection + meta: reset_connection diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/cli/basic.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/cli/basic.yaml new file mode 100644 index 00000000..2467557e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/cli/basic.yaml @@ -0,0 +1,161 @@ +--- +- name: remove host logging + cisco.iosxr.iosxr_logging: + dest: host + name: 172.16.0.1 + state: absent + provider: '{{ cli }}' + +- name: remove console logging + register: result + cisco.iosxr.iosxr_logging: + dest: console + state: absent + provider: '{{ cli }}' + +- name: remove buffered logging + register: result + cisco.iosxr.iosxr_logging: + dest: buffered + size: 2097155 + state: absent + provider: '{{ cli }}' + +- name: set up syslog host logging + register: result + cisco.iosxr.iosxr_logging: &id001 + dest: host + name: 172.16.0.1 + level: errors + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"logging 172.16.0.1 vrf default severity error" in result.commands' + +- name: set up syslog host logging (idempotent) + register: result + cisco.iosxr.iosxr_logging: *id001 + +- assert: &id003 + that: + - result.changed == false + +- name: delete/disable syslog host logging + register: result + cisco.iosxr.iosxr_logging: &id002 + dest: host + name: 172.16.0.1 + state: absent + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"no logging 172.16.0.1 vrf default" in result.commands' + +- name: delete/disable syslog host logging (idempotent) + register: result + cisco.iosxr.iosxr_logging: *id002 + +- assert: *id003 + +- name: add console logging with level warning + register: result + cisco.iosxr.iosxr_logging: &id004 + dest: console + level: warning + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"logging console warning" in result.commands' + +- name: console logging with level warning (idempotent) + register: result + cisco.iosxr.iosxr_logging: *id004 + +- assert: *id003 + +- name: remove console logging with level warning + register: result + cisco.iosxr.iosxr_logging: + dest: console + level: warning + state: absent + provider: '{{ cli }}' + +- assert: &id006 + that: + - result.changed == true + +- name: configure buffered logging size + register: result + cisco.iosxr.iosxr_logging: &id005 + dest: buffered + size: 4800000 + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"logging buffered 4800000" in result.commands' + +- name: configure buffered logging size (idempotence) + register: result + cisco.iosxr.iosxr_logging: *id005 + +- assert: *id003 + +- name: remove buffered logging size + register: result + cisco.iosxr.iosxr_logging: + dest: buffered + size: 4800000 + state: absent + provider: '{{ cli }}' + +- assert: *id006 + +- name: change logging parameters using aggregate + register: result + cisco.iosxr.iosxr_logging: + aggregate: + + - dest: console + level: notifications + + - dest: buffered + size: 4700000 + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"logging buffered 4700000" in result.commands' + - '"logging console notifications" in result.commands' + +- name: remove logging parameters using aggregate + register: result + cisco.iosxr.iosxr_logging: + aggregate: + + - dest: console + level: notifications + + - dest: buffered + size: 4700000 + state: absent + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"no logging console" in result.commands' + - '"no logging buffered" in result.commands' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/cli/net_logging.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/cli/net_logging.yaml new file mode 100644 index 00000000..94d057b4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/cli/net_logging.yaml @@ -0,0 +1,33 @@ +--- +- debug: msg="START iosxr cli/net_logging.yaml on connection={{ ansible_connection + }}" + +- name: Remove host logging - setup + ansible.netcommon.net_logging: + dest: host + name: 172.16.0.1 + state: absent + provider: '{{ cli }}' + +- name: Set up host logging using platform agnostic module + register: result + ansible.netcommon.net_logging: + dest: host + name: 172.16.0.1 + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"logging 172.16.0.1 vrf default severity debugging" in result.commands' + +- name: Remove host logging - teardown + ansible.netcommon.net_logging: + dest: host + name: 172.16.0.1 + state: absent + provider: '{{ cli }}' + +- debug: msg="END iosxr cli/net_logging.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/netconf/basic.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/netconf/basic.yaml new file mode 100644 index 00000000..57bc6de9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/netconf/basic.yaml @@ -0,0 +1,227 @@ +--- +- name: remove host logging + cisco.iosxr.iosxr_logging: + dest: host + name: 172.16.0.1 + state: absent + provider: '{{ netconf }}' + +- name: remove console logging + register: result + cisco.iosxr.iosxr_logging: + dest: console + level: warning + state: absent + provider: '{{ netconf }}' + +- name: remove buffered logging + register: result + cisco.iosxr.iosxr_logging: + dest: buffered + size: 2097155 + state: absent + provider: '{{ netconf }}' + +- name: set up syslog host logging + register: result + cisco.iosxr.iosxr_logging: &id001 + dest: host + name: 172.16.0.1 + level: errors + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"172.16.0.1" in result.xml[0]' + +- name: set up syslog host logging (idempotent) + register: result + cisco.iosxr.iosxr_logging: *id001 + +- assert: &id003 + that: + - result.changed == false + +- name: delete/disable syslog host logging + register: result + cisco.iosxr.iosxr_logging: &id002 + dest: host + name: 172.16.0.1 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"172.16.0.1" in result.xml[0]' + - '"delete" in result.xml[0]' + +- name: delete/disable syslog host logging (idempotent) + register: result + cisco.iosxr.iosxr_logging: *id002 + +- assert: *id003 + +- name: add console logging with level warning + register: result + cisco.iosxr.iosxr_logging: &id004 + dest: console + level: warning + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"console" in result.xml[0]' + - '"warning" in result.xml[0]' + +- name: console logging with level warning (idempotent) + register: result + cisco.iosxr.iosxr_logging: *id004 + +- assert: *id003 + +- name: remove console logging with level warning + register: result + cisco.iosxr.iosxr_logging: + dest: console + level: warning + state: absent + provider: '{{ netconf }}' + +- assert: &id006 + that: + - result.changed == true + +- name: configure buffered logging size + register: result + cisco.iosxr.iosxr_logging: &id005 + dest: buffered + size: 4800000 + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"buffered" in result.xml[0]' + - '"4800000" in result.xml[0]' + +- name: configure buffered logging size (idempotence) + register: result + cisco.iosxr.iosxr_logging: *id005 + +- assert: *id003 + +- name: remove buffered logging size + register: result + cisco.iosxr.iosxr_logging: + dest: buffered + size: 4800000 + state: absent + provider: '{{ netconf }}' + +- assert: *id006 + +- name: change logging parameters using aggregate + register: result + cisco.iosxr.iosxr_logging: + aggregate: + + - dest: console + level: notifications + + - dest: buffered + size: 4700000 + + - dest: monitor + level: alerts + + - dest: host + name: 10.10.10.1 + level: errors + + - dest: host + name: 10.10.10.2 + + - dest: file + name: file1 + size: 2048 + level: critical + + - dest: file + name: file2 + size: 2048 + + - facility: local3 + + - hostnameprefix: host3 + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"file1" in result.xml[0]' + - '"file2" in result.xml[0]' + - '"10.10.10.1" in result.xml[1]' + - '"10.10.10.2" in result.xml[1]' + - '"notice" in result.xml[2]' + - '"alert" in result.xml[3]' + - '"4700000" in result.xml[4]' + - '"debug" in result.xml[5]' + - '"local3" in result.xml[6]' + - '"host3" in result.xml[7]' + +- name: remove logging parameters using aggregate + register: result + cisco.iosxr.iosxr_logging: + aggregate: + + - dest: console + level: notifications + + - dest: buffered + size: 4700000 + + - dest: monitor + level: alerts + + - dest: host + name: 10.10.10.1 + level: errors + + - dest: host + name: 10.10.10.2 + + - dest: file + name: file1 + size: 2048 + level: critical + + - dest: file + name: file2 + size: 2048 + + - facility: local3 + + - hostnameprefix: host3 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"file1" in result.xml[0]' + - '"file2" in result.xml[0]' + - '"10.10.10.1" in result.xml[1]' + - '"10.10.10.2" in result.xml[1]' + - '"notice" in result.xml[2]' + - '"alert" in result.xml[3]' + - '"4700000" in result.xml[4]' + - '"debug" in result.xml[5]' + - '"local3" in result.xml[6]' + - '"host3" in result.xml[7]' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/meta/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/meta/main.yaml new file mode 100644 index 00000000..be631e5d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_iosxr_tests diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/tasks/cli.yaml new file mode 100644 index 00000000..163934f5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/tasks/cli.yaml @@ -0,0 +1,16 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/tests/cli/basic.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/tests/cli/basic.yaml new file mode 100644 index 00000000..1cf4a019 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_netconf/tests/cli/basic.yaml @@ -0,0 +1,72 @@ +--- +- debug: msg="START iosxr_netconf cli/basic.yaml on connection={{ ansible_connection + }}" + +- name: Disable NetConf service + cisco.iosxr.iosxr_netconf: &id003 + state: absent + +- block: + + - name: Enable Netconf service + register: result + cisco.iosxr.iosxr_netconf: + netconf_port: 830 + netconf_vrf: default + state: present + + - assert: &id001 + that: + - result.changed == true + + - name: Check idempotence of Enable Netconf service + register: result + cisco.iosxr.iosxr_netconf: + netconf_port: 830 + netconf_vrf: default + state: present + + - assert: &id002 + that: + - result.changed == false + + - name: Change Netconf port + register: result + cisco.iosxr.iosxr_netconf: + netconf_port: 9000 + state: present + + - assert: *id001 + + - name: Check idempotent of change Netconf port + register: result + cisco.iosxr.iosxr_netconf: + netconf_port: 9000 + state: present + + - assert: *id002 + + - name: Add Netconf vrf + register: result + cisco.iosxr.iosxr_netconf: + netconf_port: 9000 + netconf_vrf: new_default + state: present + + - assert: *id001 + + - name: Check idempotent of add Netconf vrf + register: result + cisco.iosxr.iosxr_netconf: + netconf_port: 9000 + netconf_vrf: new_default + state: present + + - assert: *id002 + always: + + - name: Disable Netconf service + cisco.iosxr.iosxr_netconf: *id003 + +- debug: msg="END iosxr_netconf cli/basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/fixtures/parsed.cfg new file mode 100644 index 00000000..b2677113 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/fixtures/parsed.cfg @@ -0,0 +1,51 @@ +router ospf LAB3 + area 0.0.0.3 + interface GigabitEthernet0/0/0/0 + cost 20 + authentication message-digest keychain cisco + ! + ! +! +router ospfv3 10 + area 11 + cost 11 + default-cost 5 + ! + area 22 + default-cost 6 + ! +! +router ospfv3 26 + authentication disable +! +router ospfv3 27 + area 10 + hello-interval 2 + ! +! +router ospfv3 30 + cost 2 + priority 1 + mtu-ignore + packet-size 577 + dead-interval 2 + retransmit-interval 2 + demand-circuit + hello-interval 1 + transmit-delay 2 + router-id 2.2.2.2 + default-metric 10 + area 11 + default-cost 5 + ! + area 22 + default-cost 6 + ! +! +router ospfv3 LAB3 + area 0.0.0.2 + interface GigabitEthernet0/0/0/0 + cost 30 + ! + ! +! diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tasks/cli.yaml new file mode 100644 index 00000000..f622cf94 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tasks/cli.yaml @@ -0,0 +1,20 @@ +--- +- name: Collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + delegate_to: localhost + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/_populate_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/_populate_config.yaml new file mode 100644 index 00000000..ec4c4b37 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/_populate_config.yaml @@ -0,0 +1,23 @@ +--- +- name: Setup (Populate OSPF interfaces config) + cisco.iosxr.iosxr_ospf_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.3 + cost: 20 + authentication: + message_digest: + keychain: cisco + - afi: ipv6 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.2 + cost: 30 + state: merged diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/_remove_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/_remove_config.yaml new file mode 100644 index 00000000..2ddf6416 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/_remove_config.yaml @@ -0,0 +1,12 @@ +--- +- name: Remove OSPFv3 Routes + vars: + lines: "no router ospf LAB3 \n + no router ospfv3 LAB3 \n + no router ospfv3 LAB \n + no router ospf LAB \n + no router ospf LAB1 \n + no router ospfv3 LAB1 " + ignore_errors: true + ansible.netcommon.cli_config: + config: '{{ lines }}' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/deleted.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/deleted.yaml new file mode 100644 index 00000000..20a56fcd --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/deleted.yaml @@ -0,0 +1,86 @@ +--- +- debug: + msg: Start iosxr_ospf_interfaces deleted integration tests ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Delete single ospf interface + register: result + cisco.iosxr.iosxr_ospf_interfaces: &id001 + config: + - name: GigabitEthernet0/0/0/0 + type: gigabitethernet + + state: deleted + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that the correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that the after dicts were correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Delete a single ospf process (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospf_interfaces: *id001 + + - assert: &id003 + that: + - result.changed == false + - result.commands|length == 0 + + - include_tasks: _populate_config.yaml + + - name: Delete all ospf processes + register: result + cisco.iosxr.iosxr_ospf_interfaces: &id005 + state: deleted + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that the correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that the after dicts were correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Delete all ospf processes (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospf_interfaces: *id005 + + - name: Assert that the previous task was idempotent + assert: *id003 + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ deleted['after'] == result['before'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/empty_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/empty_config.yaml new file mode 100644 index 00000000..fff02bf2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/empty_config.yaml @@ -0,0 +1,60 @@ +--- +- debug: + msg: START iosxr_ospf_interfaces empty_config integration tests on connection={{ + ansible_connection }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_ospf_interfaces: + config: + state: merged + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state merged' + +- name: Replaced with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_ospf_interfaces: + config: + state: replaced + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Parsed with empty running_config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_ospf_interfaces: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' + +- name: Overridden with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_ospf_interfaces: + config: + state: overridden + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state overridden' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_ospf_interfaces: + config: + state: rendered + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state rendered' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/gathered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/gathered.yaml new file mode 100644 index 00000000..158c7e9a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/gathered.yaml @@ -0,0 +1,25 @@ +--- +- debug: + msg: START iosxr_ospf_interfaces gathered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Gather OSPF interfaces facts from the device using iosxr_ospf_interfaces + module + register: result + cisco.iosxr.iosxr_ospf_interfaces: + state: gathered + + - assert: + that: + - "{{ merged['after'] | symmetric_difference(result['gathered']) | length\ + \ == 0 }}" + - "result.changed == false" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/merged.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/merged.yaml new file mode 100644 index 00000000..e380f704 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/merged.yaml @@ -0,0 +1,121 @@ +--- +- debug: + msg: START iosxr_ospf interfaces merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + cisco.iosxr.iosxr_ospf_interfaces: &id001 + config: + - name: GigabitEthernet0/0/0/0 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.3 + cost: 20 + authentication: + message_digest: + keychain: cisco + - afi: ipv6 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.2 + cost: 30 + state: merged + + - name: Assert that before dicts were correctly generated + assert: + that: + - "{{ merged['before'] | symmetric_difference(result['before']) | length\ + \ == 0 }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that after dicts was correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['after']) | length\ + \ == 0 }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospf_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dicts were correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) | length\ + \ == 0 }}" + + - name: Update existing configuration using merged + register: result + cisco.iosxr.iosxr_ospf_interfaces: &id002 + config: + - name: GigabitEthernet0/0/0/1 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.1 + cost: 10 + authentication: + message_digest: + keychain: lab1 + - afi: ipv6 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.4 + cost: 40 + + - name: Assert that before dicts were correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) | length\ + \ == 0 }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['update_commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that after dicts were correctly generated + assert: + that: + - "{{ merged['update_after'] | symmetric_difference(result['after']) | length\ + \ == 0 }}" + + - name: Update existing ospf interfaces configuration using merged (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospf_interfaces: *id002 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/overridden.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/overridden.yaml new file mode 100644 index 00000000..8fa3878c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/overridden.yaml @@ -0,0 +1,65 @@ +--- +- debug: + msg: START iosxr_ospf_interfaces overridden integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Overridde all ospf_interfaces configuration with provided configuration + register: result + cisco.iosxr.iosxr_ospf_interfaces: &id001 + config: + - name: GigabitEthernet0/0/0/1 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB1" + area: + area_id: 0.0.0.3 + cost: 10 + authentication: + message_digest: + keychain: iosxr + state: overridden + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before'])\ + \ |length == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Overridde all ospf_interfaces configuration with given configuration (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospf_interfaces: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['before'])\ + \ |length == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/parsed.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/parsed.yaml new file mode 100644 index 00000000..5943066b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/parsed.yaml @@ -0,0 +1,19 @@ +--- +- debug: + msg: START iosxr_ospf_interfaces parsed integration tests on connection={{ ansible_connection + }} + +- block: + + - name: Use parsed state to convert externally supplied device specific ospf_interfaces + commands to structured format + register: result + cisco.iosxr.iosxr_ospf_interfaces: + running_config: "{{ lookup('file', '../../fixtures/parsed.cfg') }}" + state: parsed + + - assert: + that: + - "{{ merged['after'] | symmetric_difference(result['parsed']) | length\ + \ == 0 }}" + - "result.changed == false" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/rendered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/rendered.yaml new file mode 100644 index 00000000..db25ec00 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/rendered.yaml @@ -0,0 +1,51 @@ +--- +- debug: + msg: START iosxr_ospf_interfaces rendered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Use rendered state to convert task input to device specific commands + register: result + cisco.iosxr.iosxr_ospf_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.3 + cost: 20 + authentication: + message_digest: + keychain: cisco + - afi: ipv6 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.2 + cost: 30 + state: rendered + + - assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['rendered'])\ + \ |length==0 }}" + - "result.changed == false" + + - name: Gather Ospf interfaces facts from the device and assert that its empty + register: result + cisco.iosxr.iosxr_ospf_interfaces: + state: gathered + + - name: Make sure that rendered task actually did not make any changes to the + device + assert: + that: "{{ result['gathered'] == [] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/replaced.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/replaced.yaml new file mode 100644 index 00000000..1527126b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/replaced.yaml @@ -0,0 +1,72 @@ +--- +- debug: + msg: START iosxr_ospf_interfaces replaced integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Replace device configurations of ospf_interfaces with provided configurations + register: result + cisco.iosxr.iosxr_ospf_interfaces: &id001 + config: + - name: GigabitEthernet0/0/0/0 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.3 + cost: 30 + authentication: + message_digest: + keychain: ciscoiosxr + - afi: ipv6 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.2 + cost: 30 + state: replaced + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before'])\ + \ |length == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Replace device configurations of listed vrfs/global entry with provided + configuration (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospf_interfaces: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['before'])\ + \ |length == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/rtt.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/rtt.yaml new file mode 100644 index 00000000..64f73189 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/tests/cli/rtt.yaml @@ -0,0 +1,79 @@ +--- +- debug: + msg: START iosxr_ospf_interfaces round trip integration tests on connection={{ + ansible_connection }} + +- block: + + - include_tasks: _remove_config.yaml + + - name: Apply the provided configuration (base config) + register: base_config + cisco.iosxr.iosxr_ospf_interfaces: + config: + - name: GigabitEthernet0/0/0/0 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.3 + cost: 20 + authentication: + message_digest: + keychain: cisco + - afi: ipv6 + processes: + - process_id: "LAB3" + area: + area_id: 0.0.0.2 + cost: 30 + state: merged + + - name: Gather ospf_interfaces facts + cisco.iosxr.iosxr_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - ospf_interfaces + + - name: Apply the provided configuration (config to be reverted) + register: result + cisco.iosxr.iosxr_ospf_interfaces: + config: + - name: GigabitEthernet0/0/0/1 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB1" + area: + area_id: 0.0.0.3 + cost: 10 + authentication: + message_digest: + keychain: iosxr + state: overridden + + - name: Assert that changes were applied + assert: + that: + - "{{ round_trip['after'] | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Revert back to base config using facts round trip + register: revert + cisco.iosxr.iosxr_ospf_interfaces: + config: "{{ ansible_facts['network_resources']['ospf_interfaces'] }}" + state: overridden + + - name: Assert that config was reverted + assert: + that: + - "{{ base_config['after'] | symmetric_difference(revert['after'])\ + \ |length == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/vars/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/vars/main.yaml new file mode 100644 index 00000000..95f5e7bf --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospf_interfaces/vars/main.yaml @@ -0,0 +1,138 @@ +--- +merged: + before: [] + commands: + - router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 cost 20 + - router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest + - router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest keychain cisco + - router ospfv3 LAB3 area 0.0.0.2 interface GigabitEthernet 0/0/0/0 cost 30 + + update_commands: + - router ospf LAB3 area 0.0.0.1 interface GigabitEthernet 0/0/0/1 cost 10 + - router ospf LAB3 area 0.0.0.1 interface GigabitEthernet 0/0/0/1 authentication message-digest + - router ospf LAB3 area 0.0.0.1 interface GigabitEthernet 0/0/0/1 authentication message-digest keychain lab1 + - router ospfv3 LAB3 area 0.0.0.4 interface GigabitEthernet 0/0/0/1 cost 40 + after: + - address_family: + - afi: ipv4 + authentication: + message_digest: + keychain: cisco + cost: 20 + processes: + - area: + area_id: 0.0.0.3 + process_id: "LAB3" + - afi: ipv6 + cost: 30 + processes: + - area: + area_id: 0.0.0.2 + process_id: "LAB3" + name: GigabitEthernet0/0/0/0 + type: gigabitethernet + + update_after: + - address_family: + - afi: ipv4 + authentication: + message_digest: + keychain: lab1 + cost: 10 + processes: + - area: + area_id: 0.0.0.1 + process_id: "LAB3" + - afi: ipv6 + cost: 40 + processes: + - area: + area_id: 0.0.0.4 + process_id: "LAB3" + name: GigabitEthernet0/0/0/1 + type: gigabitethernet + - address_family: + - afi: ipv4 + authentication: + message_digest: + keychain: cisco + cost: 20 + processes: + - area: + area_id: 0.0.0.3 + process_id: "LAB3" + - afi: ipv6 + cost: 30 + processes: + - area: + area_id: 0.0.0.2 + process_id: "LAB3" + name: GigabitEthernet0/0/0/0 + type: gigabitethernet +replaced: + commands: + - router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 cost 30 + - router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest + - router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest keychain ciscoiosxr + + after: + - address_family: + - afi: ipv4 + authentication: + message_digest: + keychain: ciscoiosxr + cost: 30 + processes: + - area: + area_id: 0.0.0.3 + process_id: "LAB3" + - afi: ipv6 + cost: 30 + processes: + - area: + area_id: 0.0.0.2 + process_id: "LAB3" + name: GigabitEthernet0/0/0/0 + type: gigabitethernet + +overridden: + commands: + - no router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 + - no router ospfv3 LAB3 area 0.0.0.2 interface GigabitEthernet 0/0/0/0 + - router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 cost 10 + - router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 authentication message-digest + - router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 authentication message-digest keychain iosxr + + after: + - address_family: + - afi: ipv4 + authentication: + message_digest: + keychain: iosxr + cost: 10 + processes: + - area: + area_id: 0.0.0.3 + process_id: "LAB1" + name: GigabitEthernet0/0/0/1 + type: gigabitethernet +deleted: + commands: + - no router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 + - no router ospfv3 LAB3 area 0.0.0.2 interface GigabitEthernet 0/0/0/0 + + after: [] +round_trip: + after: + - name: GigabitEthernet0/0/0/1 + type: gigabitethernet + address_family: + - afi: ipv4 + processes: + - process_id: "LAB1" + area: + area_id: 0.0.0.3 + cost: 10 + authentication: + message_digest: + keychain: iosxr diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/fixtures/parsed.cfg new file mode 100644 index 00000000..f3861f84 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/fixtures/parsed.cfg @@ -0,0 +1,42 @@ +Thu Jun 4 12:15:08.448 UTC +router ospf 10 + area 11 + cost 11 + default-cost 5 + ! + area 22 + default-cost 6 + ! +! +router ospf 26 + authentication message-digest keychain ansible1101pass + adjacency stagger 10 20 +! +router ospf 27 + area 10 + hello-interval 2 + ! +! +router ospf 30 + router-id 2.2.2.2 + summary-in enable + external-out disable + cost 2 + packet-size 577 + passive disable + priority 1 + mtu-ignore enable + flood-reduction disable + dead-interval 2 + retransmit-interval 2 + demand-circuit enable + hello-interval 1 + transmit-delay 2 + default-metric 10 + area 11 + default-cost 5 + ! + area 22 + default-cost 6 + ! +! diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tasks/cli.yaml new file mode 100644 index 00000000..f622cf94 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tasks/cli.yaml @@ -0,0 +1,20 @@ +--- +- name: Collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + delegate_to: localhost + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/_populate_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/_populate_config.yaml new file mode 100644 index 00000000..c7821e00 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/_populate_config.yaml @@ -0,0 +1,47 @@ +--- +- name: Setup (Populate OSPFv2 routes) + cisco.iosxr.iosxr_ospfv2: + config: + + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 + authentication: + message_digest: + keychain: 'ansible1101pass' + - process_id: 10 + areas: + - area_id: 11 + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: 30 + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + packet_size: 577 + priority: 1 + router_id: '2.2.2.2' + demand_circuit: enable + passive: disable + summary_in: enable + flood_reduction: disable + mtu_ignore: enable + external_out: disable + state: merged diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/_remove_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/_remove_config.yaml new file mode 100644 index 00000000..80a2048c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/_remove_config.yaml @@ -0,0 +1,11 @@ +--- +- name: Remove OSPFv2 Routes + vars: + lines: "no router ospf 26\n + no router ospf 27\n + no router ospf 30\n + no router ospf 10\n + " + ignore_errors: true + ansible.netcommon.cli_config: + config: '{{ lines }}' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/deleted.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/deleted.yaml new file mode 100644 index 00000000..6f69ec1d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/deleted.yaml @@ -0,0 +1,84 @@ +--- +- debug: + msg: Start iosxr_ospfv2 deleted integration tests ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Delete single ospf process network + register: result + cisco.iosxr.iosxr_ospfv2: &id001 + config: + processes: + - process_id: 10 + - process_id: 26 + - process_id: 27 + - process_id: 30 + state: deleted + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ replaced['before'] == result['before'] }}" + + - name: Assert that the correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that the after dicts were correctly generated + assert: + that: + - "{{ deleted['after'] == result['after'] }}" + + - name: Delete a single ospf process (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospfv2: *id001 + + - assert: &id003 + that: + - result.changed == false + - result.commands|length == 0 + + - include_tasks: _populate_config.yaml + + - name: Delete all ospf processes + register: result + cisco.iosxr.iosxr_ospfv2: &id005 + state: deleted + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ replaced['before'] == result['before'] }}" + + - name: Assert that the correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that the after dicts were correctly generated + assert: + that: + - "{{ deleted['after'] == result['after'] }}" + + - name: Delete all ospf processes (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospfv2: *id005 + + - name: Assert that the previous task was idempotent + assert: *id003 + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ deleted['after'] == result['before'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/empty_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/empty_config.yaml new file mode 100644 index 00000000..10b22621 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/empty_config.yaml @@ -0,0 +1,60 @@ +--- +- debug: + msg: START iosxr_ospfv2 empty_config integration tests on connection={{ + ansible_connection }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_ospfv2: + config: + state: merged + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state merged' + +- name: Replaced with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_ospfv2: + config: + state: replaced + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Parsed with empty running_config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_ospfv2: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' + +- name: Overridden with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_ospfv2: + config: + state: overridden + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state overridden' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_ospfv2: + config: + state: rendered + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state rendered' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/gathered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/gathered.yaml new file mode 100644 index 00000000..b09e2e3a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/gathered.yaml @@ -0,0 +1,22 @@ +--- +- debug: + msg: START iosxr_ospfv2 gathered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Gather static routes facts from the device using iosxr_ospfv2 + module + register: result + cisco.iosxr.iosxr_ospfv2: + state: gathered + + - assert: + that: "{{ replaced['before'] == result['gathered'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/merged.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/merged.yaml new file mode 100644 index 00000000..3d5fdfda --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/merged.yaml @@ -0,0 +1,132 @@ +--- +- debug: + msg: START iosxr_ospfv2 merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + cisco.iosxr.iosxr_ospfv2: &id001 + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 + authentication: + message_digest: + keychain: 'ansible1101pass' + - process_id: 10 + areas: + - area_id: 11 + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: 30 + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + packet_size: 577 + priority: 1 + router_id: '2.2.2.2' + demand_circuit: enable + passive: disable + summary_in: enable + flood_reduction: disable + mtu_ignore: enable + external_out: disable + state: merged + + - name: Assert that before dicts were correctly generated + assert: + that: "{{ merged['before'] == result['before'] }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that after dicts was correctly generated + assert: + that: + - "{{ merged['after'] == result['after'] }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospfv2: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dicts were correctly generated + assert: + that: + - "{{ merged['after'] == result['before'] }}" + + - name: Update existing configuration using merged + register: result + cisco.iosxr.iosxr_ospfv2: &id002 + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - area_id: 30 + dead_interval: 4 + - process_id: 26 + adjacency_stagger: + min_adjacency: 11 + max_adjacency: 21 + authentication: + message_digest: + keychain: 'ansible1101pass' + + - name: Assert that before dicts were correctly generated + assert: + that: "{{ merged['after'] == result['before'] }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['update_commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that after dicts were correctly generated + assert: + that: "{{ merged['update_after'] == result['after'] }}" + + - name: Update existing ospfv2 configuration using merged (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospfv2: *id002 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/overridden.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/overridden.yaml new file mode 100644 index 00000000..dcff31e8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/overridden.yaml @@ -0,0 +1,65 @@ +--- +- debug: + msg: START iosxr_ospfv2 overridden integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Overridde all ospfv2 configuration with provided configuration + register: result + cisco.iosxr.iosxr_ospfv2: &id001 + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - area_id: 20 + cost: 2 + default_cost: 2 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 + authentication: + message_digest: + keychain: 'ansible1101pass' + state: overridden + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ replaced['before'] == result['before'] }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ overridden['after'] == result['after'] }}" + + - name: Overridde all ospfv2 configuration with given configuration (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospfv2: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ overridden['after'] == result['before'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/parsed.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/parsed.yaml new file mode 100644 index 00000000..19efa25f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/parsed.yaml @@ -0,0 +1,16 @@ +--- +- debug: + msg: START iosxr_ospfv2 parsed integration tests on connection={{ ansible_connection + }} + +- block: + + - name: Use parsed state to convert externally supplied device specific ospfv2 + routes commands to structured format + register: result + cisco.iosxr.iosxr_ospfv2: + running_config: "{{ lookup('file', '../../fixtures/parsed.cfg') }}" + state: parsed + + - assert: + that: "{{ merged['after'] == result['parsed'] }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/rendered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/rendered.yaml new file mode 100644 index 00000000..96ee3c24 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/rendered.yaml @@ -0,0 +1,72 @@ +--- +- debug: + msg: START iosxr_ospfv2 rendered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Use rendered state to convert task input to device specific commands + register: result + cisco.iosxr.iosxr_ospfv2: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 + authentication: + message_digest: + keychain: 'ansible1101pass' + - process_id: 10 + areas: + - area_id: 11 + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: 30 + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + packet_size: 577 + priority: 1 + router_id: '2.2.2.2' + demand_circuit: enable + passive: disable + summary_in: enable + flood_reduction: disable + mtu_ignore: enable + external_out: disable + state: rendered + + - assert: + that: "{{ merged['commands'] | symmetric_difference(result['rendered'])\ + \ |length==0 }}" + + - name: Gather static routes facts from the device and assert that its empty + register: result + cisco.iosxr.iosxr_ospfv2: + state: gathered + + - name: Make sure that rendered task actually did not make any changes to the + device + assert: + that: "{{ result['gathered'] == {} }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/replaced.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/replaced.yaml new file mode 100644 index 00000000..d62e34c8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/replaced.yaml @@ -0,0 +1,66 @@ +--- +- debug: + msg: START iosxr_ospfv2 replaced integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Replace device configurations of ospfv2 routes with provided configurations + register: result + cisco.iosxr.iosxr_ospfv2: &id001 + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - area_id: 20 + cost: 2 + default_cost: 2 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 + authentication: + message_digest: + keychain: 'ansible1101pass' + state: replaced + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ replaced['before'] == result['before'] }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ replaced['after'] == result['after'] }}" + + - name: Replace device configurations of listed vrfs/global entry with provided + configuration (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospfv2: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ replaced['after'] == result['before'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/rtt.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/rtt.yaml new file mode 100644 index 00000000..a5828181 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/tests/cli/rtt.yaml @@ -0,0 +1,101 @@ +--- +- debug: + msg: START iosxr_ospfv2 round trip integration tests on connection={{ + ansible_connection }} + +- block: + + - include_tasks: _remove_config.yaml + + - name: Apply the provided configuration (base config) + register: base_config + cisco.iosxr.iosxr_ospfv2: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 + authentication: + message_digest: + keychain: 'ansible1101pass' + - process_id: 10 + areas: + - area_id: 11 + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: 30 + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + packet_size: 577 + priority: 1 + router_id: '2.2.2.2' + demand_circuit: enable + passive: disable + summary_in: enable + flood_reduction: disable + mtu_ignore: enable + external_out: disable + state: merged + + - name: Gather ospfv2 facts + cisco.iosxr.iosxr_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - ospfv2 + + - name: Apply the provided configuration (config to be reverted) + register: result + cisco.iosxr.iosxr_ospfv2: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - area_id: 20 + cost: 2 + default_cost: 2 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 + authentication: + message_digest: + keychain: 'ansible1101pass' + state: overridden + + - name: Assert that changes were applied + assert: + that: "{{ round_trip['after'] == result['after'] }}" + + - name: Revert back to base config using facts round trip + register: revert + cisco.iosxr.iosxr_ospfv2: + config: "{{ ansible_facts['network_resources']['ospfv2'] }}" + state: overridden + + - name: Assert that config was reverted + assert: + that: "{{ base_config['after'] == revert['after'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/vars/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/vars/main.yaml new file mode 100644 index 00000000..497a8c99 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv2/vars/main.yaml @@ -0,0 +1,316 @@ +--- +merged: + before: {} + commands: + - router ospf 10 + - area 11 default-cost 5 + - area 11 cost 11 + - area 22 default-cost 6 + - router ospf 27 + - area 10 hello-interval 2 + - router ospf 26 + - adjacency stagger 10 20 + - authentication message-digest keychain ansible1101pass + - router ospf 30 + - cost 2 + - passive disable + - priority 1 + - flood-reduction disable + - default-metric 10 + - router-id 2.2.2.2 + - demand-circuit enable + - packet-size 577 + - transmit-delay 2 + - summary-in enable + - external-out disable + - dead-interval 2 + - hello-interval 1 + - retransmit-interval 2 + - mtu-ignore enable + - area 11 default-cost 5 + - area 22 default-cost 6 + update_commands: + - router ospf 26 + - adjacency stagger 11 21 + - router ospf 27 + - area 30 dead-interval 4 + after: + processes: + - areas: + - area_id: "11" + cost: 11 + default_cost: 5 + - area_id: "22" + default_cost: 6 + process_id: "10" + + - adjacency_stagger: + max_adjacency: 20 + min_adjacency: 10 + authentication: + message_digest: + keychain: 'ansible1101pass' + process_id: "26" + - areas: + - area_id: "10" + hello_interval: 2 + process_id: "27" + - areas: + - area_id: "11" + default_cost: 5 + - area_id: "22" + default_cost: 6 + cost: 2 + dead_interval: 2 + default_metric: 10 + demand_circuit: "enable" + external_out: "disable" + flood_reduction: "disable" + hello_interval: 1 + mtu_ignore: "enable" + packet_size: 577 + passive: "disable" + priority: 1 + process_id: "30" + retransmit_interval: 2 + router_id: "2.2.2.2" + summary_in: "enable" + transmit_delay: 2 + + update_after: + processes: + - areas: + - area_id: "11" + cost: 11 + default_cost: 5 + - area_id: "22" + default_cost: 6 + process_id: '10' + - adjacency_stagger: + max_adjacency: 21 + min_adjacency: 11 + authentication: + message_digest: + keychain: 'ansible1101pass' + process_id: '26' + - areas: + - area_id: '10' + hello_interval: 2 + - area_id: '30' + dead_interval: 4 + process_id: '27' + - areas: + - area_id: '11' + default_cost: 5 + - area_id: '22' + default_cost: 6 + + cost: 2 + dead_interval: 2 + default_metric: 10 + demand_circuit: 'enable' + external_out: 'disable' + flood_reduction: 'disable' + hello_interval: 1 + mtu_ignore: 'enable' + packet_size: 577 + passive: 'disable' + priority: 1 + process_id: '30' + retransmit_interval: 2 + router_id: '2.2.2.2' + summary_in: 'enable' + transmit_delay: 2 +replaced: + before: + processes: + - areas: + - area_id: '11' + cost: 11 + default_cost: 5 + - area_id: '22' + default_cost: 6 + process_id: '10' + - adjacency_stagger: + max_adjacency: 20 + min_adjacency: 10 + authentication: + message_digest: + keychain: 'ansible1101pass' + process_id: '26' + - areas: + - area_id: '10' + hello_interval: 2 + process_id: '27' + - areas: + - area_id: '11' + default_cost: 5 + - area_id: '22' + default_cost: 6 + cost: 2 + dead_interval: 2 + default_metric: 10 + demand_circuit: 'enable' + external_out: 'disable' + flood_reduction: 'disable' + hello_interval: 1 + mtu_ignore: 'enable' + packet_size: 577 + passive: 'disable' + priority: 1 + process_id: '30' + retransmit_interval: 2 + router_id: '2.2.2.2' + summary_in: 'enable' + transmit_delay: 2 + + commands: + - router ospf 27 + - area 20 default-cost 2 + - area 20 cost 2 + + after: + processes: + - areas: + - area_id: '11' + cost: 11 + default_cost: 5 + - area_id: '22' + default_cost: 6 + process_id: '10' + - adjacency_stagger: + max_adjacency: 20 + min_adjacency: 10 + authentication: + message_digest: + keychain: 'ansible1101pass' + process_id: '26' + - areas: + - area_id: '10' + hello_interval: 2 + - area_id: '20' + cost: 2 + default_cost: 2 + process_id: '27' + - areas: + - area_id: '11' + default_cost: 5 + - area_id: '22' + default_cost: 6 + cost: 2 + dead_interval: 2 + default_metric: 10 + demand_circuit: 'enable' + external_out: 'disable' + flood_reduction: 'disable' + hello_interval: 1 + mtu_ignore: 'enable' + packet_size: 577 + passive: 'disable' + priority: 1 + process_id: '30' + retransmit_interval: 2 + router_id: '2.2.2.2' + summary_in: 'enable' + transmit_delay: 2 + +overridden: + commands: + - router ospf 10 + - no area 11 default-cost 5 + - no area 11 cost 11 + - no area 22 default-cost 6 + - router ospf 30 + - no cost 2 + - no passive disable + - no priority 1 + - no flood-reduction disable + - no default-metric 10 + - no router-id 2.2.2.2 + - no demand-circuit enable + - no packet-size 577 + - no transmit-delay 2 + - no summary-in enable + - no external-out disable + - no dead-interval 2 + - no hello-interval 1 + - no retransmit-interval 2 + - no mtu-ignore enable + - no area 11 default-cost 5 + - no area 22 default-cost 6 + - router ospf 27 + - area 20 default-cost 2 + - area 20 cost 2 + after: + processes: + - process_id: '10' + - adjacency_stagger: + max_adjacency: 20 + min_adjacency: 10 + authentication: + message_digest: + keychain: 'ansible1101pass' + process_id: '26' + - areas: + - area_id: '10' + hello_interval: 2 + - area_id: '20' + cost: 2 + default_cost: 2 + process_id: '27' + - process_id: '30' +deleted: + commands: + - router ospf 10 + - no area 11 default-cost 5 + - no area 11 cost 11 + - no area 22 default-cost 6 + - router ospf 26 + - no adjacency stagger 10 20 + - no authentication message-digest keychain ansible1101pass + - router ospf 27 + - no area 10 hello-interval 2 + - router ospf 30 + - no cost 2 + - no passive disable + - no priority 1 + - no flood-reduction disable + - no default-metric 10 + - no router-id 2.2.2.2 + - no demand-circuit enable + - no packet-size 577 + - no transmit-delay 2 + - no summary-in enable + - no external-out disable + - no dead-interval 2 + - no hello-interval 1 + - no retransmit-interval 2 + - no mtu-ignore enable + - no area 11 default-cost 5 + - no area 22 default-cost 6 + + after: + processes: + - process_id: '10' + - process_id: '26' + - process_id: '27' + - process_id: '30' +round_trip: + after: + processes: + - process_id: '10' + - adjacency_stagger: + max_adjacency: 20 + min_adjacency: 10 + authentication: + message_digest: + keychain: 'ansible1101pass' + process_id: '26' + - areas: + - area_id: '10' + hello_interval: 2 + - area_id: '20' + cost: 2 + default_cost: 2 + process_id: '27' + - process_id: '30' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/fixtures/parsed.cfg new file mode 100644 index 00000000..f0e69c9e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/fixtures/parsed.cfg @@ -0,0 +1,36 @@ +router ospfv3 10 + area 11 + cost 11 + default-cost 5 + ! + area 22 + default-cost 6 + ! +! +router ospfv3 26 + authentication disable +! +router ospfv3 27 + area 10 + hello-interval 2 + ! +! +router ospfv3 30 + router-id 2.2.2.2 + cost 2 + packet-size 577 + priority 1 + mtu-ignore + dead-interval 2 + retransmit-interval 2 + demand-circuit + hello-interval 1 + transmit-delay 2 + default-metric 10 + area 11 + default-cost 5 + ! + area 22 + default-cost 6 + ! +! diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tasks/cli.yaml new file mode 100644 index 00000000..f622cf94 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tasks/cli.yaml @@ -0,0 +1,20 @@ +--- +- name: Collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + delegate_to: localhost + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/_populate_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/_populate_config.yaml new file mode 100644 index 00000000..a795e39b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/_populate_config.yaml @@ -0,0 +1,39 @@ +--- +- name: Setup (Populate OSPFv3 routes) + cisco.iosxr.iosxr_ospfv3: + config: + + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - process_id: 26 + authentication: + disable: true + - process_id: 10 + areas: + - area_id: 11 + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: 30 + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + packet_size: 577 + priority: 1 + router_id: '2.2.2.2' + demand_circuit: true + mtu_ignore: true + state: merged diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/_remove_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/_remove_config.yaml new file mode 100644 index 00000000..d0632854 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/_remove_config.yaml @@ -0,0 +1,11 @@ +--- +- name: Remove OSPFv3 Routes + vars: + lines: "no router ospfv3 26\n + no router ospfv3 27\n + no router ospfv3 30\n + no router ospfv3 10\n + " + ignore_errors: true + ansible.netcommon.cli_config: + config: '{{ lines }}' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/deleted.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/deleted.yaml new file mode 100644 index 00000000..903fe46e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/deleted.yaml @@ -0,0 +1,84 @@ +--- +- debug: + msg: Start iosxr_ospfv3 deleted integration tests ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Delete single ospf process network + register: result + cisco.iosxr.iosxr_ospfv3: &id001 + config: + processes: + - process_id: 10 + - process_id: 26 + - process_id: 27 + - process_id: 30 + state: deleted + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ replaced['before'] == result['before'] }}" + + - name: Assert that the correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that the after dicts were correctly generated + assert: + that: + - "{{ deleted['after'] == result['after'] }}" + + - name: Delete a single ospf process (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospfv3: *id001 + + - assert: &id003 + that: + - result.changed == false + - result.commands|length == 0 + + - include_tasks: _populate_config.yaml + + - name: Delete all ospf processes + register: result + cisco.iosxr.iosxr_ospfv3: &id005 + state: deleted + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ replaced['before'] == result['before'] }}" + + - name: Assert that the correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that the after dicts were correctly generated + assert: + that: + - "{{ deleted['after'] == result['after'] }}" + + - name: Delete all ospf processes (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospfv3: *id005 + + - name: Assert that the previous task was idempotent + assert: *id003 + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ deleted['after'] == result['before'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/empty_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/empty_config.yaml new file mode 100644 index 00000000..6c70f61f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/empty_config.yaml @@ -0,0 +1,60 @@ +--- +- debug: + msg: START iosxr_ospfv3 empty_config integration tests on connection={{ + ansible_connection }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_ospfv3: + config: + state: merged + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state merged' + +- name: Replaced with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_ospfv3: + config: + state: replaced + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Parsed with empty running_config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_ospfv3: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' + +- name: Overridden with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_ospfv3: + config: + state: overridden + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state overridden' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_ospfv3: + config: + state: rendered + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state rendered' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/gathered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/gathered.yaml new file mode 100644 index 00000000..c9f82171 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/gathered.yaml @@ -0,0 +1,24 @@ +--- +- debug: + msg: START iosxr_ospfv3 gathered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Gather Ospfv3 facts from the device using iosxr_ospfv3 + module + register: result + cisco.iosxr.iosxr_ospfv3: + state: gathered + + - assert: + that: + - "{{ replaced['before'] == result['gathered'] }}" + - "result.changed == false" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/merged.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/merged.yaml new file mode 100644 index 00000000..a9e3667f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/merged.yaml @@ -0,0 +1,120 @@ +--- +- debug: + msg: START iosxr_ospfv3 merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + cisco.iosxr.iosxr_ospfv3: &id001 + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - process_id: 26 + authentication: + disable: true + - process_id: 10 + areas: + - area_id: 11 + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: 30 + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + packet_size: 577 + priority: 1 + router_id: '2.2.2.2' + demand_circuit: true + mtu_ignore: true + state: merged + + - name: Assert that before dicts were correctly generated + assert: + that: "{{ merged['before'] == result['before'] }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that after dicts was correctly generated + assert: + that: + - "{{ merged['after'] == result['after'] }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospfv3: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dicts were correctly generated + assert: + that: + - "{{ merged['after'] == result['before'] }}" + + - name: Update existing configuration using merged + register: result + cisco.iosxr.iosxr_ospfv3: &id002 + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - area_id: 30 + dead_interval: 4 + - process_id: 26 + authentication: + disable: true + + - name: Assert that before dicts were correctly generated + assert: + that: "{{ merged['after'] == result['before'] }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['update_commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that after dicts were correctly generated + assert: + that: "{{ merged['update_after'] == result['after'] }}" + + - name: Update existing ospfv3 configuration using merged (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospfv3: *id002 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/overridden.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/overridden.yaml new file mode 100644 index 00000000..29b01e0f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/overridden.yaml @@ -0,0 +1,61 @@ +--- +- debug: + msg: START iosxr_ospfv3 overridden integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Overridde all ospfv3 configuration with provided configuration + register: result + cisco.iosxr.iosxr_ospfv3: &id001 + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - area_id: 20 + cost: 2 + default_cost: 2 + - process_id: 26 + authentication: + disable: true + state: overridden + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ replaced['before'] == result['before'] }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ overridden['after'] == result['after'] }}" + + - name: Overridde all ospfv3 configuration with given configuration (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospfv3: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ overridden['after'] == result['before'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/parsed.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/parsed.yaml new file mode 100644 index 00000000..b1b17304 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/parsed.yaml @@ -0,0 +1,18 @@ +--- +- debug: + msg: START iosxr_ospfv3 parsed integration tests on connection={{ ansible_connection + }} + +- block: + + - name: Use parsed state to convert externally supplied device specific ospfv3 + routes commands to structured format + register: result + cisco.iosxr.iosxr_ospfv3: + running_config: "{{ lookup('file', '../../fixtures/parsed.cfg') }}" + state: parsed + + - assert: + that: + - "{{ merged['after'] == result['parsed'] }}" + - "result.changed == false" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/rendered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/rendered.yaml new file mode 100644 index 00000000..369ff70b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/rendered.yaml @@ -0,0 +1,68 @@ +--- +- debug: + msg: START iosxr_ospfv3 rendered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Use rendered state to convert task input to device specific commands + register: result + cisco.iosxr.iosxr_ospfv3: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - process_id: 26 + authentication: + disable: true + - process_id: 10 + areas: + - area_id: 11 + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: 30 + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + packet_size: 577 + priority: 1 + router_id: '2.2.2.2' + demand_circuit: true + passive: false + flood_reduction: false + mtu_ignore: true + state: rendered + + - assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['rendered'])\ + \ |length==0 }}" + - "result.changed == false" + + - name: Gather Ospfv3 facts from the device and assert that its empty + register: result + cisco.iosxr.iosxr_ospfv3: + state: gathered + + - name: Make sure that rendered task actually did not make any changes to the + device + assert: + that: "{{ result['gathered'] == {} }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/replaced.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/replaced.yaml new file mode 100644 index 00000000..efc8a099 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/replaced.yaml @@ -0,0 +1,62 @@ +--- +- debug: + msg: START iosxr_ospfv3 replaced integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Replace device configurations of ospfv3 routes with provided configurations + register: result + cisco.iosxr.iosxr_ospfv3: &id001 + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - area_id: 20 + cost: 2 + default_cost: 2 + - process_id: 26 + authentication: + disable: true + state: replaced + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ replaced['before'] == result['before'] }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ replaced['after'] == result['after'] }}" + + - name: Replace device configurations of listed vrfs/global entry with provided + configuration (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_ospfv3: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ replaced['after'] == result['before'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/rtt.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/rtt.yaml new file mode 100644 index 00000000..a507d61a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/tests/cli/rtt.yaml @@ -0,0 +1,91 @@ +--- +- debug: + msg: START iosxr_ospfv3 round trip integration tests on connection={{ + ansible_connection }} + +- block: + + - include_tasks: _remove_config.yaml + + - name: Apply the provided configuration (base config) + register: base_config + cisco.iosxr.iosxr_ospfv3: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - process_id: 26 + authentication: + disable: true + - process_id: 10 + areas: + - area_id: 11 + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: 30 + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + packet_size: 577 + priority: 1 + router_id: '2.2.2.2' + demand_circuit: true + passive: false + flood_reduction: false + mtu_ignore: true + state: merged + + - name: Gather ospfv3 facts + cisco.iosxr.iosxr_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - ospfv3 + + - name: Apply the provided configuration (config to be reverted) + register: result + cisco.iosxr.iosxr_ospfv3: + config: + processes: + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - area_id: 20 + cost: 2 + default_cost: 2 + - process_id: 26 + authentication: + disable: true + state: overridden + + - name: Assert that changes were applied + assert: + that: "{{ round_trip['after'] == result['after'] }}" + + - name: Revert back to base config using facts round trip + register: revert + cisco.iosxr.iosxr_ospfv3: + config: "{{ ansible_facts['network_resources']['ospfv3'] }}" + state: overridden + + - name: Assert that config was reverted + assert: + that: "{{ base_config['after'] == revert['after'] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/vars/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/vars/main.yaml new file mode 100644 index 00000000..06aa7812 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_ospfv3/vars/main.yaml @@ -0,0 +1,260 @@ +--- +merged: + before: {} + commands: + - router ospfv3 10 + - area 11 default-cost 5 + - area 11 cost 11 + - area 22 default-cost 6 + - router ospfv3 27 + - area 10 hello-interval 2 + - router ospfv3 26 + - authentication disable + - router ospfv3 30 + - cost 2 + - priority 1 + - default-metric 10 + - router-id 2.2.2.2 + - demand-circuit + - packet-size 577 + - transmit-delay 2 + - dead-interval 2 + - hello-interval 1 + - retransmit-interval 2 + - mtu-ignore + - area 11 default-cost 5 + - area 22 default-cost 6 + update_commands: + - router ospfv3 27 + - area 30 dead-interval 4 + after: + processes: + - areas: + - area_id: "11" + cost: 11 + default_cost: 5 + - area_id: "22" + default_cost: 6 + process_id: "10" + + - authentication: + disable: true + process_id: "26" + - areas: + - area_id: "10" + hello_interval: 2 + process_id: "27" + - areas: + - area_id: "11" + default_cost: 5 + - area_id: "22" + default_cost: 6 + cost: 2 + dead_interval: 2 + default_metric: 10 + demand_circuit: true + hello_interval: 1 + mtu_ignore: true + packet_size: 577 + priority: 1 + process_id: "30" + retransmit_interval: 2 + router_id: "2.2.2.2" + transmit_delay: 2 + + update_after: + processes: + - areas: + - area_id: "11" + cost: 11 + default_cost: 5 + - area_id: "22" + default_cost: 6 + process_id: '10' + - authentication: + disable: true + process_id: '26' + - areas: + - area_id: '10' + hello_interval: 2 + - area_id: '30' + dead_interval: 4 + process_id: '27' + - areas: + - area_id: '11' + default_cost: 5 + - area_id: '22' + default_cost: 6 + + cost: 2 + dead_interval: 2 + default_metric: 10 + demand_circuit: true + hello_interval: 1 + mtu_ignore: true + packet_size: 577 + priority: 1 + process_id: '30' + retransmit_interval: 2 + router_id: '2.2.2.2' + transmit_delay: 2 +replaced: + before: + processes: + - areas: + - area_id: '11' + cost: 11 + default_cost: 5 + - area_id: '22' + default_cost: 6 + process_id: '10' + - authentication: + disable: true + process_id: '26' + - areas: + - area_id: '10' + hello_interval: 2 + process_id: '27' + - areas: + - area_id: '11' + default_cost: 5 + - area_id: '22' + default_cost: 6 + cost: 2 + dead_interval: 2 + default_metric: 10 + demand_circuit: true + hello_interval: 1 + mtu_ignore: true + packet_size: 577 + priority: 1 + process_id: '30' + retransmit_interval: 2 + router_id: '2.2.2.2' + transmit_delay: 2 + + commands: + - router ospfv3 27 + - area 20 default-cost 2 + - area 20 cost 2 + + after: + processes: + - areas: + - area_id: '11' + cost: 11 + default_cost: 5 + - area_id: '22' + default_cost: 6 + process_id: '10' + - authentication: + disable: true + process_id: '26' + - areas: + - area_id: '10' + hello_interval: 2 + - area_id: '20' + cost: 2 + default_cost: 2 + process_id: '27' + - areas: + - area_id: '11' + default_cost: 5 + - area_id: '22' + default_cost: 6 + cost: 2 + dead_interval: 2 + default_metric: 10 + demand_circuit: true + hello_interval: 1 + mtu_ignore: true + packet_size: 577 + priority: 1 + process_id: '30' + retransmit_interval: 2 + router_id: '2.2.2.2' + transmit_delay: 2 + +overridden: + commands: + - router ospfv3 10 + - no area 11 default-cost 5 + - no area 11 cost 11 + - no area 22 default-cost 6 + - router ospfv3 30 + - no cost 2 + - no priority 1 + - no default-metric 10 + - no router-id 2.2.2.2 + - no demand-circuit + - no packet-size 577 + - no transmit-delay 2 + - no dead-interval 2 + - no hello-interval 1 + - no retransmit-interval 2 + - no mtu-ignore + - no area 11 default-cost 5 + - no area 22 default-cost 6 + - router ospfv3 27 + - area 20 default-cost 2 + - area 20 cost 2 + after: + processes: + - process_id: '10' + - authentication: + disable: true + process_id: '26' + - areas: + - area_id: '10' + hello_interval: 2 + - area_id: '20' + cost: 2 + default_cost: 2 + process_id: '27' + - process_id: '30' +deleted: + commands: + - router ospfv3 10 + - no area 11 default-cost 5 + - no area 11 cost 11 + - no area 22 default-cost 6 + - router ospfv3 26 + - no authentication disable + - router ospfv3 27 + - no area 10 hello-interval 2 + - router ospfv3 30 + - no cost 2 + - no priority 1 + - no default-metric 10 + - no router-id 2.2.2.2 + - no demand-circuit + - no packet-size 577 + - no transmit-delay 2 + - no dead-interval 2 + - no hello-interval 1 + - no retransmit-interval 2 + - no mtu-ignore + - no area 11 default-cost 5 + - no area 22 default-cost 6 + + after: + processes: + - process_id: '10' + - process_id: '26' + - process_id: '27' + - process_id: '30' +round_trip: + after: + processes: + - process_id: '10' + - authentication: + disable: true + process_id: '26' + - areas: + - area_id: '10' + hello_interval: 2 + - area_id: '20' + cost: 2 + default_cost: 2 + process_id: '27' + - process_id: '30' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/defaults/main.yaml new file mode 100644 index 00000000..9ef5ba51 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "*" +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/meta/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/meta/main.yaml new file mode 100644 index 00000000..be631e5d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_iosxr_tests diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tasks/cli.yaml new file mode 100644 index 00000000..e9103656 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tasks/cli.yaml @@ -0,0 +1,26 @@ +--- +- name: collect all cli test cases + find: + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli" + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run + tags: + - network_cli + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local" + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tasks/main.yaml new file mode 100644 index 00000000..5d082a6f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tasks/main.yaml @@ -0,0 +1,3 @@ +--- +- include: cli.yaml +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tasks/netconf.yaml new file mode 100644 index 00000000..18b257a0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tasks/netconf.yaml @@ -0,0 +1,26 @@ +--- +- name: collect all netconf test cases + find: + paths: "{{ role_path }}/tests/netconf" + patterns: "{{ testcase }}.yaml" + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test cases (connection=netconf) + include: "{{ test_case_to_run }} ansible_connection=netconf" + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run + tags: + - netconf + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local" + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/cli/common_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/cli/common_config.yaml new file mode 100644 index 00000000..9eb7f703 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/cli/common_config.yaml @@ -0,0 +1,100 @@ +--- +- debug: msg="START cli/common_config.yaml on connection={{ ansible_connection }}" + +# Sublevel / Block +- name: setup + cisco.iosxr.iosxr_config: + commands: + - 10 permit ipv4 host 192.0.2.1 any log + - 20 permit ipv4 host 192.0.2.2 any log + - 30 permit ipv4 host 192.0.2.3 any log + parents: ['ipv4 access-list test'] + before: ['no ipv4 access-list test'] + match: none + +- name: configure sub level command using block resplace + cisco.iosxr.iosxr_config: + commands: + - 10 permit ipv4 host 192.0.2.1 any log + - 20 permit ipv4 host 192.0.2.2 any log + - 30 permit ipv4 host 192.0.2.3 any log + - 40 permit ipv4 host 192.0.2.4 any log + parents: ['ipv4 access-list test'] + replace: block + register: result + +- assert: + that: + - "result.changed == true" + - "'ipv4 access-list test' in result.commands" + - "'10 permit ipv4 host 192.0.2.1 any log' in result.commands" + - "'20 permit ipv4 host 192.0.2.2 any log' in result.commands" + - "'30 permit ipv4 host 192.0.2.3 any log' in result.commands" + - "'40 permit ipv4 host 192.0.2.4 any log' in result.commands" + +- name: check sub level command using block replace + cisco.iosxr.iosxr_config: + commands: + - 10 permit ipv4 host 192.0.2.1 any log + - 20 permit ipv4 host 192.0.2.2 any log + - 30 permit ipv4 host 192.0.2.3 any log + - 40 permit ipv4 host 192.0.2.4 any log + parents: ['ipv4 access-list test'] + replace: block + register: result + +- assert: + that: + - "result.changed == false" + +- name: teardown + cisco.iosxr.iosxr_config: + commands: ['no ipv4 access-list test'] + match: none + +# diff exact, strict, line +- name: setup + cisco.iosxr.iosxr_config: + commands: + - 'hostname {{ inventory_hostname_short }}' + register: result + +- name: set hostname + cisco.iosxr.iosxr_config: + commands: + - hostname testhost + match: strict + register: result + +- cisco.iosxr.iosxr_command: + commands: + - show configuration running-config hostname + register: configured_hostname + +- assert: + that: + - "'testhost' in configured_hostname.stdout[0]" + +- name: set hostname + cisco.iosxr.iosxr_config: + commands: + - hostname testhost2 + match: exact + register: result + +- cisco.iosxr.iosxr_command: + commands: + - show configuration running-config hostname + register: configured_hostname + +- assert: + that: + - "'testhost2' in configured_hostname.stdout[0]" + +- name: teardown + cisco.iosxr.iosxr_config: + commands: + - 'hostname {{ inventory_hostname_short }}' + register: result + +- debug: msg="END cli/common_config.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/cli/common_utils.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/cli/common_utils.yaml new file mode 100644 index 00000000..e04d1a75 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/cli/common_utils.yaml @@ -0,0 +1,37 @@ +--- +- debug: msg="START iosxr cli/common_utils.yaml on connection={{ ansible_connection }}" + +# Functions used by iosxr: conditional, remove_default_spec + +# hit conditional() and remove_default_spec() +- name: Check intent arguments + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + state: up + tx_rate: ge(0) + rx_rate: ge(0) + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.failed == false" + +- name: Check intent arguments (failed condition) + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + state: down + tx_rate: gt(0) + rx_rate: lt(0) + provider: "{{ cli }}" + ignore_errors: true + register: result + +- assert: + that: + - "result.failed == true" + - "'state eq(down)' in result.failed_conditions" + - "'tx_rate gt(0)' in result.failed_conditions" + - "'rx_rate lt(0)' in result.failed_conditions" + +- debug: msg="END iosxr cli/common_utils.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/netconf/common_netconf.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/netconf/common_netconf.yaml new file mode 100644 index 00000000..79eaeea1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/netconf/common_netconf.yaml @@ -0,0 +1,53 @@ +--- +- debug: msg="START iosxr netconf/common_netconf.yaml on connection={{ ansible_connection }}" + +# hit general code +- name: setup - remove login + cisco.iosxr.iosxr_banner: + banner: login + provider: "{{ netconf }}" + state: absent + +- name: Set login + cisco.iosxr.iosxr_banner: + banner: login + text: | + this is my login banner + that has a multiline + string + provider: "{{ netconf }}" + state: present + register: result + +- debug: + msg: "{{ result }}" + +- assert: + that: + - "result.changed == true" + - "'this is my login banner' in result.xml" + - "'that has a multiline' in result.xml" + +# hit etree_findall() +- name: remove host logging + cisco.iosxr.iosxr_logging: + dest: host + name: 172.16.0.1 + state: absent + provider: "{{ netconf }}" + +- name: set up syslog host logging + cisco.iosxr.iosxr_logging: &addhostlog + dest: host + name: 172.16.0.1 + level: errors + state: present + provider: "{{ netconf }}" + register: result + +- assert: + that: + - 'result.changed == true' + - '"172.16.0.1" in result.xml[0]' + +- debug: msg="END iosxr netconf/common_netconf.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/netconf/misc_tests.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/netconf/misc_tests.yaml new file mode 100644 index 00000000..5a21fa0a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/netconf/misc_tests.yaml @@ -0,0 +1,40 @@ +--- +- debug: msg="START iosxr netconf/misc_tests.yaml on connection={{ ansible_connection }}" + + +# hit module_utils.network.iosxr -> get_oper() +- name: Setup (interface is up) + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + description: test_interface_1 + enabled: true + state: present + provider: "{{ netconf }}" + register: result + +- name: Check intent arguments + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + state: up + delay: 10 + provider: "{{ netconf }}" + register: result + +- assert: + that: + - "result.failed == false" + +- name: Check intent arguments (failed condition) + cisco.iosxr.iosxr_interface: + name: GigabitEthernet0/0/0/1 + state: down + provider: "{{ netconf }}" + ignore_errors: true + register: result + +- assert: + that: + - "result.failed == true" + - "'state eq(down)' in result.failed_conditions" + +- debug: msg="END iosxr netconf/misc_tests.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/fixtures/parsed.cfg new file mode 100644 index 00000000..35948336 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/fixtures/parsed.cfg @@ -0,0 +1,18 @@ +Fri Nov 29 21:10:41.896 UTC +router static + address-family ipv4 unicast + 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 + 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 + 192.0.2.32/28 192.0.2.11 100 + ! + address-family ipv6 unicast + 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC + 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 + ! + vrf DEV_SITE + address-family ipv4 unicast + 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV + 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 + ! + ! +! diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tasks/cli.yaml new file mode 100644 index 00000000..f622cf94 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tasks/cli.yaml @@ -0,0 +1,20 @@ +--- +- name: Collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + delegate_to: localhost + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tasks/main.yaml new file mode 100644 index 00000000..b957d2f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/_populate_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/_populate_config.yaml new file mode 100644 index 00000000..1ca3ca3e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/_populate_config.yaml @@ -0,0 +1,69 @@ +--- +- name: Setup + cisco.iosxr.iosxr_static_routes: + config: + + - address_families: + + - afi: ipv4 + safi: unicast + routes: + + - dest: 192.0.2.16/28 + next_hops: + + - forward_router_address: 192.0.2.10 + interface: FastEthernet0/0/0/1 + description: LAB + metric: 120 + tag: 10 + + - interface: FastEthernet0/0/0/5 + track: ip_sla_1 + + - dest: 192.0.2.32/28 + next_hops: + + - forward_router_address: 192.0.2.11 + admin_distance: 100 + + - afi: ipv6 + safi: unicast + routes: + + - dest: 2001:db8:1000::/36 + next_hops: + + - interface: FastEthernet0/0/0/7 + description: DC + + - interface: FastEthernet0/0/0/8 + forward_router_address: 2001:db8:2000:2::1 + + - vrf: DEV_SITE + address_families: + + - afi: ipv4 + safi: unicast + routes: + + - dest: 192.0.2.48/28 + next_hops: + + - forward_router_address: 192.0.2.12 + description: DEV + dest_vrf: test_1 + + - forward_router_address: 192.0.3.24 + interface: GigabitEthernet0/0/0/1 + vrflabel: 2302 + + - dest: 192.0.2.80/28 + next_hops: + + - interface: FastEthernet0/0/0/2 + forward_router_address: 192.0.2.14 + dest_vrf: test_1 + track: ip_sla_2 + vrflabel: 124 + state: merged diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/_remove_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/_remove_config.yaml new file mode 100644 index 00000000..f4e62ebe --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/_remove_config.yaml @@ -0,0 +1,7 @@ +--- +- name: Remove Static Routes + vars: + lines: "no router static\n" + ignore_errors: true + ansible.netcommon.cli_config: + config: '{{ lines }}' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/deleted.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/deleted.yaml new file mode 100644 index 00000000..803906c9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/deleted.yaml @@ -0,0 +1,79 @@ +--- +- debug: + msg: Start iosxr_static_routes deleted integration tests ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + - name: Delete all destination network entries under a single AFI + register: result + cisco.iosxr.iosxr_static_routes: &id004 + config: + + - vrf: DEV_SITE + address_families: + + - afi: ipv4 + safi: unicast + state: deleted + + - assert: + that: + - '"router static" in result.commands' + - '"vrf DEV_SITE" in result.commands' + - '"no address-family ipv4 unicast" in result.commands' + - result.commands|length == 3 + + - name: Delete all destination network entries under a single AFI (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_static_routes: *id004 + + - name: Assert that the previous task was idempotent + assert: &id003 + that: + - result['changed'] == false + - result.commands|length == 0 + + - include_tasks: _populate_config.yaml + + - name: Delete static routes configuration + register: result + cisco.iosxr.iosxr_static_routes: &id005 + state: deleted + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ replaced['before'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that the correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - name: Assert that the after dicts were correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Delete all static routes (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_static_routes: *id005 + + - name: Assert that the previous task was idempotent + assert: *id003 + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/empty_config.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/empty_config.yaml new file mode 100644 index 00000000..c555e8fe --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/empty_config.yaml @@ -0,0 +1,49 @@ +--- +- debug: + msg: START iosxr_static_routes empty_config integration tests on connection={{ + ansible_connection }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_static_routes: + config: + state: merged + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state merged' + +- name: Replaced with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_static_routes: + config: + state: replaced + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Overridden with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_static_routes: + config: + state: overridden + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state overridden' + +- name: Parsed with empty running_config should give appropriate error message + register: result + ignore_errors: true + cisco.iosxr.iosxr_static_routes: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/gathered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/gathered.yaml new file mode 100644 index 00000000..56211b19 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/gathered.yaml @@ -0,0 +1,23 @@ +--- +- debug: + msg: START iosxr_static_routes gathered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Gather static routes facts from the device using iosxr_static_routes + module + register: result + cisco.iosxr.iosxr_static_routes: + state: gathered + + - assert: + that: "{{ replaced['before'] | symmetric_difference(result['gathered'])\ + \ |length == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/merged.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/merged.yaml new file mode 100644 index 00000000..d5e305a2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/merged.yaml @@ -0,0 +1,167 @@ +--- +- debug: + msg: START iosxr_static_routes merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + cisco.iosxr.iosxr_static_routes: &id001 + config: + + - address_families: + + - afi: ipv4 + safi: unicast + routes: + + - dest: 192.0.2.16/28 + next_hops: + + - forward_router_address: 192.0.2.10 + interface: FastEthernet0/0/0/1 + description: LAB + metric: 120 + tag: 10 + + - interface: FastEthernet0/0/0/5 + track: ip_sla_1 + + - dest: 192.0.2.32/28 + next_hops: + + - forward_router_address: 192.0.2.11 + admin_distance: 100 + + - afi: ipv6 + safi: unicast + routes: + + - dest: 2001:db8:1000::/36 + next_hops: + + - interface: FastEthernet0/0/0/7 + description: DC + + - interface: FastEthernet0/0/0/8 + forward_router_address: 2001:db8:2000:2::1 + + - vrf: DEV_SITE + address_families: + + - afi: ipv4 + safi: unicast + routes: + + - dest: 192.0.2.48/28 + next_hops: + + - forward_router_address: 192.0.2.12 + description: DEV + dest_vrf: test_1 + + - dest: 192.0.2.80/28 + next_hops: + + - interface: FastEthernet0/0/0/2 + forward_router_address: 192.0.2.14 + dest_vrf: test_1 + track: ip_sla_2 + vrflabel: 124 + state: merged + + - name: Assert that before dicts were correctly generated + assert: + that: "{{ merged['before'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ + \ == 0 }}" + + - set_fact: + diff: "{{ merged['after'] | symmetric_difference(result['after']) }}" + + - name: Assert that after dicts was correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_static_routes: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dicts were correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Update existing configuration using merged + register: result + cisco.iosxr.iosxr_static_routes: &id002 + config: + + - vrf: DEV_SITE + address_families: + + - afi: ipv4 + safi: unicast + routes: + + - dest: 192.0.2.48/28 + next_hops: + + - forward_router_address: 192.0.2.12 + vrflabel: 2301 + dest_vrf: test_1 + + - dest: 192.0.2.80/28 + next_hops: + + - interface: FastEthernet0/0/0/2 + forward_router_address: 192.0.2.14 + dest_vrf: test_1 + description: rt_test_1 + + - name: Assert that before dicts were correctly generated + assert: + that: "{{ merged['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['update_commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that after dicts were correctly generated + assert: + that: "{{ merged['update_after'] | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Update existing static_routes configuration using merged (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_static_routes: *id002 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/overridden.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/overridden.yaml new file mode 100644 index 00000000..d9276037 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/overridden.yaml @@ -0,0 +1,79 @@ +--- +- debug: + msg: START iosxr_static_routes overridden integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Overridde all static routes configuration with provided configuration + register: result + cisco.iosxr.iosxr_static_routes: &id001 + config: + + - vrf: DEV_NEW + address_families: + + - afi: ipv4 + safi: unicast + routes: + + - dest: 192.0.2.48/28 + next_hops: + + - forward_router_address: 192.0.2.15 + interface: FastEthernet0/0/0/3 + description: DEV1 + + - afi: ipv6 + safi: unicast + routes: + + - dest: 2001:db8:3000::/36 + next_hops: + + - interface: FastEthernet0/0/0/4 + forward_router_address: 2001:db8:2000:2::2 + description: PROD1 + track: ip_sla_1 + state: overridden + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ replaced['before'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Overridde all static routes configuration with given configuration (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_static_routes: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/parsed.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/parsed.yaml new file mode 100644 index 00000000..0a4bc5c6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/parsed.yaml @@ -0,0 +1,17 @@ +--- +- debug: + msg: START iosxr_static_routes parsed integration tests on connection={{ ansible_connection + }} + +- block: + + - name: Use parsed state to convert externally supplied device specific static + routes commands to structured format + register: result + cisco.iosxr.iosxr_static_routes: + running_config: "{{ lookup('file', '../../fixtures/parsed.cfg') }}" + state: parsed + + - assert: + that: "{{ merged['after'] | symmetric_difference(result['parsed']) |length==0\ + \ }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/rendered.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/rendered.yaml new file mode 100644 index 00000000..164165f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/rendered.yaml @@ -0,0 +1,91 @@ +--- +- debug: + msg: START iosxr_static_routes rendered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Use rendered state to convert task input to device specific commands + register: result + cisco.iosxr.iosxr_static_routes: + config: + + - vrf: DEV_SITE + address_families: + + - afi: ipv4 + safi: unicast + routes: + + - dest: 192.0.2.48/28 + next_hops: + + - forward_router_address: 192.0.2.12 + description: DEV + dest_vrf: test_1 + + - dest: 192.0.2.80/28 + next_hops: + + - interface: FastEthernet0/0/0/2 + forward_router_address: 192.0.2.14 + dest_vrf: test_1 + track: ip_sla_2 + vrflabel: 124 + + - address_families: + + - afi: ipv4 + safi: unicast + routes: + + - dest: 192.0.2.16/28 + next_hops: + + - forward_router_address: 192.0.2.10 + interface: FastEthernet0/0/0/1 + description: LAB + metric: 120 + tag: 10 + + - interface: FastEthernet0/0/0/5 + track: ip_sla_1 + + - dest: 192.0.2.32/28 + next_hops: + + - forward_router_address: 192.0.2.11 + admin_distance: 100 + + - afi: ipv6 + safi: unicast + routes: + + - dest: 2001:db8:1000::/36 + next_hops: + + - interface: FastEthernet0/0/0/7 + description: DC + + - interface: FastEthernet0/0/0/8 + forward_router_address: 2001:db8:2000:2::1 + state: rendered + + - assert: + that: "{{ merged['commands'] | symmetric_difference(result['rendered'])\ + \ |length==0 }}" + + - name: Gather static routes facts from the device and assert that its empty + register: result + cisco.iosxr.iosxr_static_routes: + state: gathered + + - name: Make sure that rendered task actually did not make any changes to the + device + assert: + that: "{{ result['gathered'] == [] }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/replaced.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/replaced.yaml new file mode 100644 index 00000000..beef4034 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/replaced.yaml @@ -0,0 +1,69 @@ +--- +- debug: + msg: START iosxr_static_routes replaced integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Replace device configurations of static routes with provided configurations + register: result + cisco.iosxr.iosxr_static_routes: &id001 + config: + + - vrf: DEV_SITE + address_families: + + - afi: ipv4 + safi: unicast + routes: + + - dest: 192.0.2.48/28 + next_hops: + + - forward_router_address: 192.0.2.15 + interface: FastEthernet0/0/0/3 + description: DEV_NEW + dest_vrf: dev_test_2 + state: replaced + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ + \ |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ replaced['before'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Replace device configurations of listed vrfs/global entry with provided + configuration (IDEMPOTENT) + register: result + cisco.iosxr.iosxr_static_routes: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result['changed'] == false + - result.commands|length == 0 + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/rtt.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/rtt.yaml new file mode 100644 index 00000000..c1ddfe58 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/tests/cli/rtt.yaml @@ -0,0 +1,89 @@ +--- +- debug: + msg: START iosxr_static_routes round trip integration tests on connection={{ + ansible_connection }} + +- block: + + - include_tasks: _remove_config.yaml + + - name: Apply the provided configuration (base config) + register: base_config + cisco.iosxr.iosxr_static_routes: + config: + + - address_families: + + - afi: ipv4 + safi: unicast + routes: + + - dest: 192.0.2.48/28 + next_hops: + + - forward_router_address: 192.0.2.15 + admin_distance: 105 + track: ip_sla_2 + + - vrf: DEV_SITE + address_families: + + - afi: ipv6 + safi: unicast + routes: + + - dest: 2001:db8:3000::/36 + next_hops: + + - forward_router_address: 2001:db8:2000:2::2 + interface: FastEthernet0/0/0/11 + description: PROD1 + state: merged + + - name: Gather interfaces facts + cisco.iosxr.iosxr_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - static_routes + + - name: Apply the provided configuration (config to be reverted) + register: result + cisco.iosxr.iosxr_static_routes: + config: + + - vrf: TEST_SITE + address_families: + + - afi: ipv4 + safi: unicast + routes: + + - dest: 192.0.2.80/28 + next_hops: + + - forward_router_address: 192.0.2.12 + interface: FastEthernet0/0/0/3 + description: DEV_MOVED + dest_vrf: dev_moved + state: overridden + + - name: Assert that changes were applied + assert: + that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Revert back to base config using facts round trip + register: revert + cisco.iosxr.iosxr_static_routes: + config: "{{ ansible_facts['network_resources']['static_routes'] }}" + state: overridden + + - name: Assert that config was reverted + assert: + that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ + \ == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/vars/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/vars/main.yaml new file mode 100644 index 00000000..b12c6698 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_static_routes/vars/main.yaml @@ -0,0 +1,264 @@ +--- +merged: + before: [] + commands: + - router static + - address-family ipv4 unicast + - 192.0.2.16/28 192.0.2.10 FastEthernet0/0/0/1 description LAB metric 120 tag + 10 + - 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 + - 192.0.2.32/28 192.0.2.11 100 + - address-family ipv6 unicast + - 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC + - 2001:db8:1000::/36 2001:db8:2000:2::1 FastEthernet0/0/0/8 + - vrf DEV_SITE + - address-family ipv4 unicast + - 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV + - 192.0.2.80/28 vrf test_1 192.0.2.14 FastEthernet0/0/0/2 track ip_sla_2 vrflabel + 124 + update_commands: + - router static + - vrf DEV_SITE + - address-family ipv4 unicast + - 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV vrflabel 2301 + - 192.0.2.80/28 vrf test_1 192.0.2.14 FastEthernet0/0/0/2 description rt_test_1 + track ip_sla_2 vrflabel 124 + after: + - address_families: + - afi: ipv4 + routes: + - dest: 192.0.2.16/28 + next_hops: + - description: LAB + forward_router_address: 192.0.2.10 + interface: FastEthernet0/0/0/1 + metric: 120 + tag: 10 + - interface: FastEthernet0/0/0/5 + track: ip_sla_1 + - dest: 192.0.2.32/28 + next_hops: + - admin_distance: 100 + forward_router_address: 192.0.2.11 + safi: unicast + - afi: ipv6 + routes: + - dest: 2001:db8:1000::/36 + next_hops: + - description: DC + interface: FastEthernet0/0/0/7 + - forward_router_address: 2001:db8:2000:2::1 + interface: FastEthernet0/0/0/8 + safi: unicast + - address_families: + - afi: ipv4 + routes: + - dest: 192.0.2.48/28 + next_hops: + - description: DEV + dest_vrf: test_1 + forward_router_address: 192.0.2.12 + - dest: 192.0.2.80/28 + next_hops: + - dest_vrf: test_1 + forward_router_address: 192.0.2.14 + interface: FastEthernet0/0/0/2 + track: ip_sla_2 + vrflabel: 124 + safi: unicast + vrf: DEV_SITE + update_after: + - address_families: + - afi: ipv4 + routes: + - dest: 192.0.2.16/28 + next_hops: + - description: LAB + forward_router_address: 192.0.2.10 + interface: FastEthernet0/0/0/1 + metric: 120 + tag: 10 + - interface: FastEthernet0/0/0/5 + track: ip_sla_1 + - dest: 192.0.2.32/28 + next_hops: + - admin_distance: 100 + forward_router_address: 192.0.2.11 + safi: unicast + - afi: ipv6 + routes: + - dest: 2001:db8:1000::/36 + next_hops: + - description: DC + interface: FastEthernet0/0/0/7 + - forward_router_address: 2001:db8:2000:2::1 + interface: FastEthernet0/0/0/8 + safi: unicast + - address_families: + - afi: ipv4 + routes: + - dest: 192.0.2.48/28 + next_hops: + - description: DEV + dest_vrf: test_1 + forward_router_address: 192.0.2.12 + vrflabel: 2301 + - dest: 192.0.2.80/28 + next_hops: + - dest_vrf: test_1 + forward_router_address: 192.0.2.14 + interface: FastEthernet0/0/0/2 + track: ip_sla_2 + vrflabel: 124 + description: rt_test_1 + safi: unicast + vrf: DEV_SITE +replaced: + before: + - address_families: + - afi: ipv4 + routes: + - dest: 192.0.2.16/28 + next_hops: + - description: LAB + forward_router_address: 192.0.2.10 + interface: FastEthernet0/0/0/1 + metric: 120 + tag: 10 + - interface: FastEthernet0/0/0/5 + track: ip_sla_1 + - dest: 192.0.2.32/28 + next_hops: + - admin_distance: 100 + forward_router_address: 192.0.2.11 + safi: unicast + - afi: ipv6 + routes: + - dest: 2001:db8:1000::/36 + next_hops: + - description: DC + interface: FastEthernet0/0/0/7 + - forward_router_address: 2001:db8:2000:2::1 + interface: FastEthernet0/0/0/8 + safi: unicast + - address_families: + - afi: ipv4 + routes: + - dest: 192.0.2.48/28 + next_hops: + - description: DEV + dest_vrf: test_1 + forward_router_address: 192.0.2.12 + - forward_router_address: 192.0.3.24 + interface: GigabitEthernet0/0/0/1 + vrflabel: 2302 + - dest: 192.0.2.80/28 + next_hops: + - dest_vrf: test_1 + forward_router_address: 192.0.2.14 + interface: FastEthernet0/0/0/2 + track: ip_sla_2 + vrflabel: 124 + safi: unicast + vrf: DEV_SITE + commands: + - router static + - vrf DEV_SITE + - address-family ipv4 unicast + - no 192.0.2.48/28 192.0.3.24 GigabitEthernet0/0/0/1 + - no 192.0.2.48/28 vrf test_1 192.0.2.12 + - 192.0.2.48/28 vrf dev_test_2 192.0.2.15 FastEthernet0/0/0/3 description DEV_NEW + after: + - address_families: + - afi: ipv4 + routes: + - dest: 192.0.2.16/28 + next_hops: + - description: LAB + forward_router_address: 192.0.2.10 + interface: FastEthernet0/0/0/1 + metric: 120 + tag: 10 + - interface: FastEthernet0/0/0/5 + track: ip_sla_1 + - dest: 192.0.2.32/28 + next_hops: + - admin_distance: 100 + forward_router_address: 192.0.2.11 + safi: unicast + - afi: ipv6 + routes: + - dest: 2001:db8:1000::/36 + next_hops: + - description: DC + interface: FastEthernet0/0/0/7 + - forward_router_address: 2001:db8:2000:2::1 + interface: FastEthernet0/0/0/8 + safi: unicast + - address_families: + - afi: ipv4 + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.15 + interface: FastEthernet0/0/0/3 + description: DEV_NEW + dest_vrf: dev_test_2 + - dest: 192.0.2.80/28 + next_hops: + - dest_vrf: test_1 + forward_router_address: 192.0.2.14 + interface: FastEthernet0/0/0/2 + track: ip_sla_2 + vrflabel: 124 + safi: unicast + vrf: DEV_SITE +overridden: + commands: + - router static + - no vrf DEV_SITE + - no address-family ipv4 unicast + - no address-family ipv6 unicast + - vrf DEV_NEW + - address-family ipv4 unicast + - 192.0.2.48/28 192.0.2.15 FastEthernet0/0/0/3 description DEV1 + - address-family ipv6 unicast + - 2001:db8:3000::/36 2001:db8:2000:2::2 FastEthernet0/0/0/4 description PROD1 + track ip_sla_1 + after: + - vrf: DEV_NEW + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.15 + interface: FastEthernet0/0/0/3 + description: DEV1 + - afi: ipv6 + safi: unicast + routes: + - dest: 2001:db8:3000::/36 + next_hops: + - interface: FastEthernet0/0/0/4 + forward_router_address: 2001:db8:2000:2::2 + description: PROD1 + track: ip_sla_1 +deleted: + commands: + - no router static + after: [] +round_trip: + after: + - vrf: TEST_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.80/28 + next_hops: + - forward_router_address: 192.0.2.12 + interface: FastEthernet0/0/0/3 + description: DEV_MOVED + dest_vrf: dev_moved diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/defaults/main.yaml new file mode 100644 index 00000000..10c0fabc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: '*' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/meta/main.yml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/meta/main.yml new file mode 100644 index 00000000..be631e5d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_iosxr_tests diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tasks/cli.yaml new file mode 100644 index 00000000..9d1857ab --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tasks/cli.yaml @@ -0,0 +1,29 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - network_cli + +- name: run test case (connection=local) + include: '{{ test_case_to_run }} ansible_connection=local' + with_first_found: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local + +- name: reset connection + meta: reset_connection diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tasks/main.yaml new file mode 100644 index 00000000..5d082a6f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tasks/main.yaml @@ -0,0 +1,3 @@ +--- +- include: cli.yaml +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tasks/netconf.yaml new file mode 100644 index 00000000..e984861a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tasks/netconf.yaml @@ -0,0 +1,29 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.netconf) + include: '{{ test_case_to_run }}' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - netconf + +- name: run test case (connection=local) + include: '{{ test_case_to_run }} ansible_connection=local' + with_first_found: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local + +- name: reset connection + meta: reset_connection diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/net_system.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/net_system.yaml new file mode 100644 index 00000000..83ca4801 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/net_system.yaml @@ -0,0 +1,36 @@ +--- +- debug: msg="START iosxr cli/net_system.yaml on connection={{ ansible_connection + }}" + +- name: setup + cisco.iosxr.iosxr_config: + lines: + - no domain list ansible.com + - no domain list redhat.com + match: none + provider: '{{ cli }}' + +- name: configure domain_search using platform agnostic module + register: result + ansible.netcommon.net_system: + domain_search: + - ansible.com + - redhat.com + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - "'domain list ansible.com' in result.commands" + - "'domain list redhat.com' in result.commands" + +- name: teardown + cisco.iosxr.iosxr_config: + lines: + - no domain list ansible.com + - no domain list redhat.com + match: none + provider: '{{ cli }}' + +- debug: msg="END iosxr cli/net_system.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_domain_list.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_domain_list.yaml new file mode 100644 index 00000000..7e4f8fe3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_domain_list.yaml @@ -0,0 +1,123 @@ +--- +- debug: msg="START cli/set_domain_search.yaml on connection={{ ansible_connection + }}" + +- name: setup + cisco.iosxr.iosxr_config: + lines: + - no domain list ansible.com + - no domain list redhat.com + match: none + provider: '{{ cli }}' + +- name: configure domain_search + register: result + cisco.iosxr.iosxr_system: + domain_search: + - ansible.com + - redhat.com + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - "'domain list ansible.com' in result.commands" + - "'domain list redhat.com' in result.commands" + +- name: verify domain_search + register: result + cisco.iosxr.iosxr_system: + domain_search: + - ansible.com + - redhat.com + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + +- name: remove one entry + register: result + cisco.iosxr.iosxr_system: + domain_search: + - ansible.com + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - "'no domain list redhat.com' in result.commands" + +- name: verify remove one entry + register: result + cisco.iosxr.iosxr_system: + domain_search: + - ansible.com + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + +- name: add one entry + register: result + cisco.iosxr.iosxr_system: + domain_search: + - ansible.com + - redhat.com + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - "'domain list redhat.com' in result.commands" + +- name: verify add one entry + register: result + cisco.iosxr.iosxr_system: + domain_search: + - ansible.com + - redhat.com + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + +- name: add and remove one entry + register: result + cisco.iosxr.iosxr_system: + domain_search: + - ansible.com + - eng.ansible.com + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - "'no domain list redhat.com' in result.commands" + - "'domain list eng.ansible.com' in result.commands" + - result.commands|length == 2 + +- name: verify add and remove one entry + register: result + cisco.iosxr.iosxr_system: + domain_search: + - ansible.com + - eng.ansible.com + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.iosxr.iosxr_config: + lines: + - no domain list ansible.com + - no domain list eng.ansible.com + match: none + provider: '{{ cli }}' + +- debug: msg="END cli/set_domain_search.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_domain_name.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_domain_name.yaml new file mode 100644 index 00000000..b6e080fa --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_domain_name.yaml @@ -0,0 +1,37 @@ +--- +- debug: msg="START cli/set_domain_name.yaml on connection={{ ansible_connection + }}" + +- name: setup + cisco.iosxr.iosxr_config: + lines: no domain name + match: none + provider: '{{ cli }}' + +- name: configure domain_name + register: result + cisco.iosxr.iosxr_system: + domain_name: eng.ansible.com + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + +- name: verify domain_name + register: result + cisco.iosxr.iosxr_system: + domain_name: eng.ansible.com + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.iosxr.iosxr_config: + lines: no domain name + match: none + provider: '{{ cli }}' + +- debug: msg="END cli/set_domain_name.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_hostname.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_hostname.yaml new file mode 100644 index 00000000..a23c09d5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_hostname.yaml @@ -0,0 +1,36 @@ +--- +- debug: msg="START cli/set_hostname.yaml on connection={{ ansible_connection }}" + +- name: setup + cisco.iosxr.iosxr_config: + lines: hostname switch + match: none + provider: '{{ cli }}' + +- name: configure hostname + register: result + cisco.iosxr.iosxr_system: + hostname: foo + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + +- name: verify hostname + register: result + cisco.iosxr.iosxr_system: + hostname: foo + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.iosxr.iosxr_config: + lines: hostname {{ inventory_hostname }} + match: none + provider: '{{ cli }}' + +- debug: msg="END cli/set_hostname.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_lookup_source.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_lookup_source.yaml new file mode 100644 index 00000000..8fdf2824 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_lookup_source.yaml @@ -0,0 +1,40 @@ +--- +- debug: msg="START cli/set_lookup_source.yaml on connection={{ ansible_connection + }}" + +- name: setup + cisco.iosxr.iosxr_config: + lines: no domain lookup source-interface Loopback10 + match: none + provider: '{{ cli }}' + +- name: configure lookup_source + register: result + cisco.iosxr.iosxr_system: + lookup_source: Loopback10 + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - "'domain lookup source-interface Loopback10' in result.commands" + +- name: verify lookup_source + register: result + cisco.iosxr.iosxr_system: + lookup_source: Loopback10 + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.iosxr.iosxr_config: + lines: + - no domain lookup source-interface Loopback10 + match: none + provider: '{{ cli }}' + +- debug: msg="END cli/set_lookup_source.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_name_servers.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_name_servers.yaml new file mode 100644 index 00000000..20fd8120 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/cli/set_name_servers.yaml @@ -0,0 +1,66 @@ +--- +- debug: msg="START cli/set_name_servers.yaml on connection={{ ansible_connection + }}" + +- name: setup + cisco.iosxr.iosxr_config: + lines: + - no ip name-server 192.0.2.1 + - no ip name-server 192.0.2.2 + - no ip name-server 192.0.2.3 + match: none + provider: '{{ cli }}' + +- name: configure name_servers + register: result + cisco.iosxr.iosxr_system: + name_servers: + - 192.0.2.1 + - 192.0.2.2 + - 192.0.2.3 + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - "'domain name-server 192.0.2.1' in result.commands" + - "'domain name-server 192.0.2.2' in result.commands" + - "'domain name-server 192.0.2.3' in result.commands" + +- name: verify name_servers + register: result + cisco.iosxr.iosxr_system: + name_servers: + - 192.0.2.1 + - 192.0.2.2 + - 192.0.2.3 + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + +- name: remove one + register: result + cisco.iosxr.iosxr_system: + name_servers: + - 192.0.2.1 + - 192.0.2.2 + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - result.commands|length == 1 + - "'no domain name-server 192.0.2.3' in result.commands" + +- name: setup + cisco.iosxr.iosxr_config: + lines: + - no ip name-server 192.0.2.1 + - no ip name-server 192.0.2.2 + match: none + provider: '{{ cli }}' + +- debug: msg="END cli/set_name_servers.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_domain_list.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_domain_list.yaml new file mode 100644 index 00000000..d7e1a7b0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_domain_list.yaml @@ -0,0 +1,179 @@ +--- +- debug: + msg: START netconf/set_domain_search.yaml on connection={{ ansible_connection + }} + +- name: setup + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_config: + lines: + - no domain list ansible.com + - no domain list redhat.com + - no domain list eng.ansible.com + - no domain vrf ansiblevrf list redhat.com + - no domain vrf ansiblevrf list ansible.com + match: none + provider: '{{ cli }}' + +- name: configure domain_search + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: + domain_search: + - ansible.com + - redhat.com + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'ansible.com' in result.xml[0]" + - "'redhat.com' in result.xml[0]" + +- name: configure domain_search with vrf + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: &id001 + vrf: ansiblevrf + domain_search: + - redhat.com + - ansible.com + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'ansiblevrf' in result.xml[0]" + - "'ansible.com' in result.xml[0]" + - "'redhat.com' in result.xml[0]" + +- name: verify domain_search with vrf + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: *id001 + +- assert: + that: + - result.changed == false + +- name: delete domain_search with vrf + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: &id002 + vrf: ansiblevrf + domain_search: + - redhat.com + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'ansiblevrf' in result.xml[0]" + - "'ansible.com' in result.xml[0]" + +- name: verify delete domain_search with vrf + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: *id002 + +- assert: + that: + - result.changed == false + +- name: remove one entry + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: + domain_search: + - ansible.com + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'redhat.com' in result.xml[0]" + +- name: verify remove one entry + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: + domain_search: + - ansible.com + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: add one entry + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: + domain_search: + - ansible.com + - redhat.com + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'redhat.com' in result.xml[0]" + +- name: verify add one entry + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: + domain_search: + - ansible.com + - redhat.com + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: add and remove one entry + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: + domain_search: + - ansible.com + - eng.ansible.com + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'redhat.com' in result.xml[1]" + - "'eng.ansible.com' in result.xml[0]" + - result.xml|length == 2 + +- name: verify add and remove one entry + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: + domain_search: + - ansible.com + - eng.ansible.com + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: teardown + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_config: + lines: + - no domain list ansible.com + - no domain list redhat.com + - no domain list eng.ansible.com + - no domain vrf ansiblevrf list redhat.com + - no domain vrf ansiblevrf list ansible.com + - no domain vrf ansiblevrf list eng.ansible.com + match: none + provider: '{{ cli }}' + +- debug: + msg: END netconf/set_domain_search.yaml on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_domain_name.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_domain_name.yaml new file mode 100644 index 00000000..98508c4e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_domain_name.yaml @@ -0,0 +1,78 @@ +--- +- debug: + msg: START netconf/set_domain_name.yaml on connection={{ ansible_connection + }} + +- name: setup + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_config: + lines: + - no domain name + - no domain vrf ansiblevrf name + match: none + provider: '{{ cli }}' + +- name: configure domain_name + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: &id001 + domain_name: eng.ansible.com + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + +- name: verify domain_name + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: *id001 + +- assert: + that: + - result.changed == false + +- name: configure domain_name + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: &id002 + domain_name: eng.ansible.com + provider: '{{ netconf }}' + state: absent + +- assert: + that: + - result.changed == true + +- name: verify domain_name + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: *id002 + +- assert: + that: + - result.changed == false + +- name: configure domain_name with vrf + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: &id003 + domain_name: eng.ansible.com + vrf: ansiblevrf + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + +- name: verify domain_name with vrf + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: *id003 + +- assert: + that: + - result.changed == false + +- debug: + msg: END netconf/set_domain_name.yaml on connection={{ ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_hostname.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_hostname.yaml new file mode 100644 index 00000000..0a4b76a2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_hostname.yaml @@ -0,0 +1,45 @@ +--- +- debug: + msg: START netconf/set_hostname.yaml on connection={{ ansible_connection }} + +- block: + + - name: setup + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_config: + lines: hostname switch + match: none + provider: '{{ cli }}' + + - name: configure hostname + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: + hostname: foo + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == true + + - name: verify hostname + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: + hostname: foo + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == false + always: + + - name: teardown + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_config: + lines: hostname {{ inventory_hostname }} + match: none + provider: '{{ cli }}' + +- debug: + msg: END netconf/set_hostname.yaml on connection={{ ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_lookup_source.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_lookup_source.yaml new file mode 100644 index 00000000..2045a8dc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_lookup_source.yaml @@ -0,0 +1,162 @@ +--- +- debug: + msg: START netconf/set_lookup_source.yaml on connection={{ ansible_connection + }} + +- name: setup + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_config: + lines: + - no domain lookup source-interface Loopback10 + - no domain vrf ansiblevrf lookup source-interface Loopback10 + - no domain lookup disable + - no domain vrf ansiblevrf lookup disable + match: none + provider: '{{ cli }}' + +- name: configure lookup_source + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: &id001 + lookup_source: Loopback10 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'Loopback10' in result.xml[0]" + +- name: verify lookup_source + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: *id001 + +- assert: + that: + - result.changed == false + +- name: disable lookup + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: &id002 + lookup_enabled: false + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'lookup' in result.xml[0]" + +- name: verify disable lookup + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: *id002 + +- assert: + that: + - result.changed == false + +- name: delete lookup_source + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: &id003 + lookup_source: Loopback10 + provider: '{{ netconf }}' + state: absent + +- assert: + that: + - result.changed == true + - "'Loopback10' in result.xml[0]" + +- name: verify lookup_source + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: *id003 + +- assert: + that: + - result.changed == false + +- name: configure lookup_source with vrf + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: &id004 + lookup_source: Loopback10 + vrf: ansiblevrf + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'Loopback10' in result.xml[0]" + - "'ansiblevrf' in result.xml[0]" + +- name: verify lookup_source + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: *id004 + +- assert: + that: + - result.changed == false + +- name: disable lookup + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: &id005 + lookup_enabled: false + vrf: ansiblevrf + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'lookup' in result.xml[0]" + - "'ansiblevrf' in result.xml[0]" + +- name: verify disable lookup + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: *id005 + +- assert: + that: + - result.changed == false + +- name: delete lookup_source + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: &id006 + lookup_source: Loopback10 + vrf: ansiblevrf + provider: '{{ netconf }}' + state: absent + +- assert: + that: + - result.changed == true + - "'Loopback10' in result.xml[0]" + - "'ansiblevrf' in result.xml[0]" + +- name: verify lookup_source + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: *id006 + +- assert: + that: + - result.changed == false + +- name: teardown + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_config: + lines: + - no domain lookup disable + - no domain vrf ansiblevrf lookup disable + match: none + provider: '{{ cli }}' + +- debug: + msg: END netconf/set_lookup_source.yaml on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_name_servers.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_name_servers.yaml new file mode 100644 index 00000000..c7a788a0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_system/tests/netconf/set_name_servers.yaml @@ -0,0 +1,138 @@ +--- +- debug: + msg: START netconf/set_name_servers.yaml on connection={{ ansible_connection + }} + +- name: setup + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_config: + lines: + - no domain name-server 192.0.2.1 + - no domain name-server 192.0.2.2 + - no domain name-server 192.0.2.3 + match: none + provider: '{{ cli }}' + +- name: setup + connection: ansible.netcommon.netconf + ignore_errors: true + register: result + cisco.iosxr.iosxr_system: + vrf: ansible + name_servers: + - 192.0.2.1 + - 192.0.2.2 + - 192.0.2.3 + provider: '{{ netconf }}' + state: absent + +- name: configure name_servers + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: + name_servers: + - 192.0.2.1 + - 192.0.2.2 + - 192.0.2.3 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.xml|length == 1 + - "'192.0.2.1' in result.xml[0]" + - "'192.0.2.2' in result.xml[0]" + - "'192.0.2.3' in result.xml[0]" + +- name: verify name_servers + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: + name_servers: + - 192.0.2.1 + - 192.0.2.2 + - 192.0.2.3 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: add name servers with vrf + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: &id001 + vrf: ansible + name_servers: + - 192.0.2.1 + - 192.0.2.2 + - 192.0.2.3 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.xml|length == 1 + - "'ansible' in result.xml[0]" + - "'192.0.2.1' in result.xml[0]" + - "'192.0.2.2' in result.xml[0]" + - "'192.0.2.3' in result.xml[0]" + +- name: verify change to vrf + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: *id001 + +- assert: + that: + - result.changed == false + +- name: remove one + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_system: + name_servers: + - 192.0.2.1 + - 192.0.2.2 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.xml|length == 1 + - "'192.0.2.3' in result.xml[0]" + +- name: remove one with vrf + connection: ansible.netcommon.netconf + ignore_errors: true + register: result + cisco.iosxr.iosxr_system: + vrf: ansible + name_servers: + - 192.0.2.1 + - 192.0.2.2 + provider: '{{ netconf }}' + +- name: teardown + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_config: + lines: + - no domain name-server 192.0.2.1 + - no domain name-server 192.0.2.2 + match: none + provider: '{{ cli }}' + +- name: teardown + connection: ansible.netcommon.netconf + ignore_errors: true + register: result + cisco.iosxr.iosxr_system: + vrf: ansible + name_servers: + - 192.0.2.1 + - 192.0.2.2 + provider: '{{ netconf }}' + state: absent + +- debug: + msg: END netconf/set_name_servers.yaml on connection={{ ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/files/private b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/files/private new file mode 100644 index 00000000..bf2425bb --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/files/private @@ -0,0 +1,30 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CBC,A823A6B5ED873917 + +mLZ1xM1+xwutkRy+K/c9QsstDPQ9F6UWtDpoYyIgs7n9VgMjhIMbWQC9CkTvnFJM +ey+iwGdQZZOThwxalm+k3pMibwRjhnF+PNFhiVkzWH8/K8QvXRQiW/vYmE/QB9pY +T0IWbMcC7/ktEfQn+6GLXoe/L7yH+aNv/2Flsa2jN2cfSXpzbneUA06/LVVOw6E+ +C74NKRWUmMPA39Zd4WOeBoWUdS5Kgwl57SOtrKs1LIGh33+TPu+Go8gJ7h/t/kaN +kverVSz+0eeX+exKumejfo1UfosplRhcjRG8YgiQ8l7SN3NBF/gXiiSrH3fLwmRJ +hbokJ8TmCozrYBs1MNe3LoU2iuIqVnJ5Sd6DJELs6vCuFz+v6J/s80NaaYMlBCbB +1lahelYqoyLb4uiDd4zQSpaxzO+Cx/d50Wpee8mFxbAL/YxacOzD3b/VCBgB+AZN +TTHr1ayd+ITd8gewXAyERKWyrDcC2beJI0fOil23PYowWvEncS6I1f4hKQY28sRf +vHSbwQdltky/xiib2/feQTaMSQFvsY67uTHipMwl5wJNOKcbeqDVMWPYST3XUsBg +LRlbT+VTUEehbOJAJ6Hh7Yv4nqu7fEh95HUQK7Ed56rMLKpmdorYO49JtewkEUsj +LJn7tcxMUuOcWKHMPu6vB/63f6Ulthqp1SEG8aNBaZMuPyLWAPAJc2okOmkiSbvO +0Hxe6BtAGn2fUo2jK6E3tD/dsIR2qqMlL09FkACGT8D5Lfh5d3z+lo9DxpXl281R +ablehPyHgHcIC6cD2/7FwwjzUuyj/kYcETnMs51agcWFAXTom/ehqD+IQ8jZ73zT +5O4FFgslnNmB/vddh9PeYpjDYdR4y5xMrlMxJ+qcZuQOq7dfaiodq8oj+XPmwgxA +audX/sHMutOpmOagrsQfaQXaPqRXdQTnuwHacQfwq+tBBhrft5gwt1HE7Ir2ulwD +Q19kefchkJu/0c1cAGg1VHtQic0a6tX6PrwqZOMDfpSywcImMCF4KHgD2EC5/8h6 +tq0PqPLNcwiM2NhpypCuYmkYZ0gnJ/xAwtM85Ck9nmPFptLSd0b7YB7dtGsFYY5A +rhIcq5lZhy06/RRAPluIkniscA50iEO/EXKwzYzovBJh6jQz7oYsbEUW5kwg0gm/ +YPSa6lqv2kTpXS+UiGyeNWdUkr5DpdwKe4lrAsN94HE9/SoLgFvz0X5/WyTssSzo +IO3WfLfBc7SOkZK1ibcleIqilzd+LSoIqqGrft2yonXgJD3p9xO+Hlldczx2kHmu +z4lZBq53AkVAQ4os5L7ZRnmxoqKn2XAQRwVH3M9ZFYFEqEyDmZhlFdJSGEnKws81 +Ej48t6KWwqml02cx675bSYI22tL3+RL7AGmlC0/Xh8wIVesgulsYmnhW4BtpBYf2 +fwv5esJJMjkh2LvLNG3edYChugudeZXtcBJdNr0GYRbBAhvO25bRcr6z8nYDusKX +e/+30vATOcBO/zaOYIwDGT5ZwMQAV1aQl8HyeyYESNjb0fBXQ3OYObOrTTs8MLyC +I4b6wr1vlbN+lMOm+RIXCDgmC3COdlgCHyo3qiIu2YNYQVoNF4NN4A== +-----END RSA PRIVATE KEY----- diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/files/public.pub b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/files/public.pub new file mode 100644 index 00000000..db1847f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/files/public.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAkvLTTJdwZ0lg1cUCn13Hi3+ho2+G6/96XuAP7jA7Ghz9NPbC/eqXnjvb27BA8CxtFXYuXR5eZWSq2UN5zFcfrFb57XFxdAg2q21hGEX+FGiTUuRZh8+ByVEh0LUetFTwsEZ1iGv6GZiLBt7IJvClXbyNTJEt3DZncHfGwudyGFviV4dGrzusDAGAcoHqvD/5uXYl4PjMH9oSfraO3sG4Q7soQwxNeiM8qOLf3c1SabHBAtSewwnA0E/jhzpOLD2QUncU5s+Oa9PvEXXhGv5eZo9lp71brsgyWj32m2UuXx/n+EZg78GVJT5mFO7LG239n3gTnwkMVdr6zVBFNX5Mvw== rsa-key-20171025 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/files/public2.pub b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/files/public2.pub new file mode 100644 index 00000000..2fc64568 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/files/public2.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAhTxbibM8hKZn7xDURs15L3gkcsnpDoZ+tNm5zpP9dcboASnIyJzfC7J/RdRCQsO/pDmUY4y/tsTx18uenyfazxtNkyCHdANlp8XVF1fGNv5GM+QbsDqxe54sdG9csASX0/Ljvl538IbcLFVH0zxyKspbDOgkAkUSuKIAH5x+/GhkAoGQO2tOhYjqofNtUxLSvfRsf4Gm1M0WgdWmz3MW4NOdZhsL4S+STgRPU1jy1dKGj7BKY9cpnCWBFHa2wSaOXJEBZEKNaFVxlBBrFs5brjRQA0mVPmE+pz+/+IJeSNEEma9cXur0ONeb6OoXvkManxKfkaswT2ybOChAzJR8dQ== T-MOBILE \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/meta/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/meta/main.yaml new file mode 100644 index 00000000..be631e5d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_iosxr_tests diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tasks/cli.yaml new file mode 100644 index 00000000..36229e75 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tasks/cli.yaml @@ -0,0 +1,29 @@ +--- +- name: collect all common test cases + find: + paths: '{{ role_path }}/tests/common' + patterns: '{{ testcase }}.yaml' + register: common_test_cases + delegate_to: localhost + +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- set_fact: + test_cases: + files: '{{ common_test_cases.files }} + {{ test_cases.files }}' + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tasks/main.yaml new file mode 100644 index 00000000..5d082a6f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tasks/main.yaml @@ -0,0 +1,3 @@ +--- +- include: cli.yaml +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tasks/netconf.yaml new file mode 100644 index 00000000..49c17aff --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tasks/netconf.yaml @@ -0,0 +1,37 @@ +--- +- name: collect all common test cases + find: + paths: '{{ role_path }}/tests/common' + patterns: '{{ testcase }}.yaml' + register: common_test_cases + delegate_to: localhost + +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- set_fact: + test_cases: + files: '{{ common_test_cases.files }} + {{ test_cases.files }}' + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.netconf) + include: '{{ test_case_to_run }}' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - netconf + +- name: run test case (connection=local) + include: '{{ test_case_to_run }} ansible_connection=local' + with_first_found: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tests/cli/basic.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tests/cli/basic.yaml new file mode 100644 index 00000000..e13fc7dc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tests/cli/basic.yaml @@ -0,0 +1,182 @@ +--- +- name: Remove users prior to tests + cisco.iosxr.iosxr_config: + lines: + - no username ansibletest1 + - no username ansibletest2 + - no username ansibletest3 + provider: '{{ cli }}' + +- name: Create user (SetUp) + register: result + cisco.iosxr.iosxr_user: + name: ansibletest1 + configured_password: test + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"username" in result.commands[0]' + - '"secret" in result.commands[1]' + +- name: Create user with update_password always (not idempotent) + register: result + cisco.iosxr.iosxr_user: + name: ansibletest1 + configured_password: test + update_password: always + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"username" in result.commands[0]' + - '"secret" in result.commands[0]' + +- name: Create user again with update_password on_create (idempotent) + register: result + cisco.iosxr.iosxr_user: + name: ansibletest1 + configured_password: test + update_password: on_create + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + - result.commands | length == 0 + +- name: Modify user group + register: result + cisco.iosxr.iosxr_user: + name: ansibletest1 + configured_password: test + update_password: on_create + group: sysadmin + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"username" in result.commands[0]' + - '"group" in result.commands[0]' + +- name: Modify user group again (idempotent) + register: result + cisco.iosxr.iosxr_user: + name: ansibletest1 + configured_password: test + update_password: on_create + group: sysadmin + state: present + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + - result.commands | length == 0 + +- name: Collection of users (SetUp) + register: result + cisco.iosxr.iosxr_user: + aggregate: + + - name: ansibletest2 + + - name: ansibletest3 + configured_password: test + state: present + group: sysadmin + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"username" in result.commands[0]' + - '"secret" in result.commands[1]' + - '"group sysadmin" in result.commands[2]' + - '"username" in result.commands[3]' + - '"secret" in result.commands[4]' + - '"group sysadmin" in result.commands[5]' + +- name: Add collection of users again with update_password always (not idempotent) + register: result + cisco.iosxr.iosxr_user: + aggregate: + + - name: ansibletest2 + + - name: ansibletest3 + configured_password: test + state: present + group: sysadmin + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - '"username" in result.commands[0]' + - '"secret" in result.commands[0]' + - '"username" in result.commands[1]' + - '"secret" in result.commands[1]' + +- name: Add collection of users again with update_password on_create (idempotent) + register: result + cisco.iosxr.iosxr_user: + aggregate: + + - name: ansibletest2 + + - name: ansibletest3 + configured_password: test + update_password: on_create + state: present + group: sysadmin + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + - result.commands | length == 0 + +- name: Delete collection of users + register: result + cisco.iosxr.iosxr_user: + aggregate: + + - name: ansibletest1 + + - name: ansibletest2 + + - name: ansibletest3 + state: absent + provider: '{{ cli }}' + +- assert: + that: + - result.changed == true + - result.commands == ["no username ansibletest1", "no username ansibletest2", + "no username ansibletest3"] + +- name: Delete collection of users again (idempotent) + register: result + cisco.iosxr.iosxr_user: + aggregate: + + - name: ansibletest1 + + - name: ansibletest2 + + - name: ansibletest3 + state: absent + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + - result.commands | length == 0 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tests/common/auth.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tests/common/auth.yaml new file mode 100644 index 00000000..adfb7c9a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tests/common/auth.yaml @@ -0,0 +1,121 @@ +--- +- block: + + - name: Create user with password + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_user: + name: auth_user + state: present + configured_password: pass123 + provider: '{{ cli }}' + + - name: test login + expect: + command: ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) + }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no show version + responses: + (?i)password: pass123 + connection: ansible.netcommon.network_cli + + - name: test login with invalid password (should fail) + expect: + command: ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) + }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no show version + responses: + (?i)password: badpass + ignore_errors: true + connection: ansible.netcommon.network_cli + register: results + + - name: check that attempt failed + assert: + that: + - results.failed + + - name: create user with private key (contents input) + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_user: + name: auth_user + state: present + public_key_contents: "{{ lookup('file', \"{{ role_path }}/files/public.pub\"\ + ) }}" + provider: '{{ cli }}' + + - name: test login with private key + expect: + command: ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) + }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path + }}/files/private show version + responses: + (?i)password: pass123 + connection: ansible.netcommon.network_cli + + - name: remove user and key + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_user: + name: auth_user + provider: '{{ cli }}' + state: absent + + - name: test login with private key (should fail, no user) + expect: + command: ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) + }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path + }}/files/private show version + responses: + (?i)password: pass123 + ignore_errors: true + connection: ansible.netcommon.network_cli + register: results + + - name: create user with private key (path input) + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_user: + name: auth_user + state: present + public_key: '{{ role_path }}/files/public.pub' + provider: '{{ cli }}' + + - name: test login with private key + expect: + command: ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) + }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path + }}/files/private show version + responses: + (?i)password: pass123 + ignore_errors: true + connection: ansible.netcommon.network_cli + + - name: change private key for user + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_user: + name: auth_user + state: present + public_key_contents: "{{ lookup('file', \"{{ role_path }}/files/public2.pub\"\ + ) }}" + provider: '{{ cli }}' + + - name: test login with invalid private key (should fail) + expect: + command: ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) + }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path + }}/files/private show version + responses: + (?i)password: pass123 + ignore_errors: true + connection: ansible.netcommon.network_cli + register: results + + - name: check that attempt failed + assert: + that: + - results.failed + always: + + - name: delete user + connection: ansible.netcommon.network_cli + register: result + cisco.iosxr.iosxr_user: + name: auth_user + state: absent + provider: '{{ cli }}' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tests/netconf/basic.yaml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tests/netconf/basic.yaml new file mode 100644 index 00000000..1d4e83d9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_user/tests/netconf/basic.yaml @@ -0,0 +1,193 @@ +--- +- name: Remove users prior to tests + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_config: + lines: + - no username ansible1 + - no username ansible2 + - no username ansible3 + provider: '{{ cli }}' + +- name: Create user (SetUp) + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_user: + name: ansible1 + configured_password: password + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"ansible1" in result.xml[0]' + - '"secret" in result.xml[0]' + +- name: Create user with update_password always (not idempotent) + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_user: + name: ansible1 + configured_password: password + update_password: always + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"ansible1" in result.xml[0]' + - '"secret" in result.xml[0]' + +- name: Create user again with update_password on_create (idempotent) + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_user: + name: ansible1 + configured_password: password + update_password: on_create + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.xml | length == 0 + +- name: Modify user group + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_user: + name: ansible1 + configured_password: password + update_password: on_create + group: sysadmin + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"ansible1" in result.xml[0]' + - '"sysadmin" in result.xml[0]' + +- name: Modify user group again (idempotent) + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_user: + name: ansible1 + configured_password: password + update_password: on_create + group: sysadmin + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.xml | length == 0 + +- name: Collection of users (SetUp) + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_user: + aggregate: + + - name: ansible2 + + - name: ansible3 + configured_password: password + state: present + group: sysadmin + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"ansible2" in result.xml[0]' + - '"secret" in result.xml[0]' + - '"sysadmin" in result.xml[1]' + - '"ansible2" in result.xml[0]' + - '"secret" in result.xml[0]' + - '"sysadmin" in result.xml[1]' + +- name: Add collection of users again with update_password always (not idempotent) + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_user: + aggregate: + + - name: ansible2 + + - name: ansible3 + configured_password: password + state: present + group: sysadmin + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"ansible2" in result.xml[0]' + - '"ansible3" in result.xml[0]' + - '"secret" in result.xml[0]' + +- name: Add collection of users again with update_password on_create (idempotent) + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_user: + aggregate: + + - name: ansible2 + + - name: ansible3 + configured_password: password + update_password: on_create + state: present + group: sysadmin + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.xml | length == 0 + +- name: Delete collection of users + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_user: + aggregate: + + - name: ansible1 + + - name: ansible2 + + - name: ansible3 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - '"ansible1" in result.xml[0]' + - '"ansible2" in result.xml[0]' + - '"ansible3" in result.xml[0]' + +- name: Delete collection of users again (idempotent) + connection: ansible.netcommon.netconf + register: result + cisco.iosxr.iosxr_user: + aggregate: + + - name: ansible1 + + - name: ansible2 + + - name: ansible3 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.xml | length == 0 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/prepare_iosxr_tests/tasks/main.yml b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/prepare_iosxr_tests/tasks/main.yml new file mode 100644 index 00000000..8799387c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/prepare_iosxr_tests/tasks/main.yml @@ -0,0 +1,16 @@ +--- +- name: Ensure we have loopback 888 for testing + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_config: + src: config.j2 + +- name: Enable Netconf service + connection: ansible.netcommon.network_cli + tags: netconf + cisco.iosxr.iosxr_netconf: + netconf_port: 830 + netconf_vrf: default + state: present + +- set_fact: + shorter_hostname: '{{ inventory_hostname_short| truncate(10, True, "") }}' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/prepare_iosxr_tests/templates/config.j2 b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/prepare_iosxr_tests/templates/config.j2 new file mode 100644 index 00000000..c8eb3457 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/integration/targets/prepare_iosxr_tests/templates/config.j2 @@ -0,0 +1,4 @@ +interface Loopback888 + description test for ansible + shutdown + diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.10.txt b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.10.txt new file mode 100644 index 00000000..195b00f6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.10.txt @@ -0,0 +1 @@ +plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.9.txt b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.9.txt new file mode 100644 index 00000000..89a6aac5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.9.txt @@ -0,0 +1,3 @@ +plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local +plugins/modules/iosxr_interface.py validate-modules:deprecation-mismatch # 2.9 expects METADATA +plugins/modules/iosxr_interface.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/sanity/requirements.txt b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/sanity/requirements.txt new file mode 100644 index 00000000..3e3a9669 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/sanity/requirements.txt @@ -0,0 +1,4 @@ +packaging # needed for update-bundled and changelog +sphinx ; python_version >= '3.5' # docs build requires python 3+ +sphinx-notfound-page ; python_version >= '3.5' # docs build requires python 3+ +straight.plugin ; python_version >= '3.5' # needed for hacking/build-ansible.py which will host changelog generation and requires python 3+ diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/compat/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/compat/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/compat/builtins.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/compat/builtins.py new file mode 100644 index 00000000..bfc8adfb --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/compat/builtins.py @@ -0,0 +1,34 @@ +# (c) 2014, Toshio Kuratomi +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +# +# Compat for python2.7 +# + +# One unittest needs to import builtins via __import__() so we need to have +# the string that represents it +try: + import __builtin__ +except ImportError: + BUILTINS = "builtins" +else: + BUILTINS = "__builtin__" diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/compat/mock.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/compat/mock.py new file mode 100644 index 00000000..8d265c65 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/compat/mock.py @@ -0,0 +1,126 @@ +# (c) 2014, Toshio Kuratomi +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +""" +Compat module for Python3.x's unittest.mock module +""" +import sys +import _io + +# Python 2.7 + +# Note: Could use the pypi mock library on python3.x as well as python2.x. It +# is the same as the python3 stdlib mock library + +try: + # Allow wildcard import because we really do want to import all of mock's + # symbols into this compat shim + # pylint: disable=wildcard-import,unused-wildcard-import + from unittest.mock import * +except ImportError: + # Python 2 + # pylint: disable=wildcard-import,unused-wildcard-import + try: + from mock import * + except ImportError: + print("You need the mock library installed on python2.x to run tests") + + +# Prior to 3.4.4, mock_open cannot handle binary read_data +if sys.version_info >= (3,) and sys.version_info < (3, 4, 4): + file_spec = None + + def _iterate_read_data(read_data): + # Helper for mock_open: + # Retrieve lines from read_data via a generator so that separate calls to + # readline, read, and readlines are properly interleaved + sep = b"\n" if isinstance(read_data, bytes) else "\n" + data_as_list = [l + sep for l in read_data.split(sep)] + + if data_as_list[-1] == sep: + # If the last line ended in a newline, the list comprehension will have an + # extra entry that's just a newline. Remove this. + data_as_list = data_as_list[:-1] + else: + # If there wasn't an extra newline by itself, then the file being + # emulated doesn't have a newline to end the last line remove the + # newline that our naive format() added + data_as_list[-1] = data_as_list[-1][:-1] + + for line in data_as_list: + yield line + + def mock_open(mock=None, read_data=""): + """ + A helper function to create a mock to replace the use of `open`. It works + for `open` called directly or used as a context manager. + + The `mock` argument is the mock object to configure. If `None` (the + default) then a `MagicMock` will be created for you, with the API limited + to methods or attributes available on standard file handles. + + `read_data` is a string for the `read` methoddline`, and `readlines` of the + file handle to return. This is an empty string by default. + """ + + def _readlines_side_effect(*args, **kwargs): + if handle.readlines.return_value is not None: + return handle.readlines.return_value + return list(_data) + + def _read_side_effect(*args, **kwargs): + if handle.read.return_value is not None: + return handle.read.return_value + return type(read_data)().join(_data) + + def _readline_side_effect(): + if handle.readline.return_value is not None: + while True: + yield handle.readline.return_value + for line in _data: + yield line + + global file_spec + if file_spec is None: + file_spec = list( + set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))) + ) + + if mock is None: + mock = MagicMock(name="open", spec=open) + + handle = MagicMock(spec=file_spec) + handle.__enter__.return_value = handle + + _data = _iterate_read_data(read_data) + + handle.write.return_value = None + handle.read.return_value = None + handle.readline.return_value = None + handle.readlines.return_value = None + + handle.read.side_effect = _read_side_effect + handle.readline.side_effect = _readline_side_effect() + handle.readlines.side_effect = _readlines_side_effect + + mock.return_value = handle + return mock diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/compat/unittest.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/compat/unittest.py new file mode 100644 index 00000000..df3379b8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/compat/unittest.py @@ -0,0 +1,39 @@ +# (c) 2014, Toshio Kuratomi +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +""" +Compat module for Python2.7's unittest module +""" + +import sys + +# Allow wildcard import because we really do want to import all of +# unittests's symbols into this compat shim +# pylint: disable=wildcard-import,unused-wildcard-import +if sys.version_info < (2, 7): + try: + # Need unittest2 on python2.6 + from unittest2 import * + except ImportError: + print("You need unittest2 installed on python2.6.x to run tests") +else: + from unittest import * diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/loader.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/loader.py new file mode 100644 index 00000000..c21188ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/loader.py @@ -0,0 +1,116 @@ +# (c) 2012-2014, Michael DeHaan +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import os + +from ansible.errors import AnsibleParserError +from ansible.parsing.dataloader import DataLoader +from ansible.module_utils._text import to_bytes, to_text + + +class DictDataLoader(DataLoader): + def __init__(self, file_mapping=None): + file_mapping = {} if file_mapping is None else file_mapping + assert type(file_mapping) == dict + + super(DictDataLoader, self).__init__() + + self._file_mapping = file_mapping + self._build_known_directories() + self._vault_secrets = None + + def load_from_file(self, path, cache=True, unsafe=False): + path = to_text(path) + if path in self._file_mapping: + return self.load(self._file_mapping[path], path) + return None + + # TODO: the real _get_file_contents returns a bytestring, so we actually convert the + # unicode/text it's created with to utf-8 + def _get_file_contents(self, path): + path = to_text(path) + if path in self._file_mapping: + return (to_bytes(self._file_mapping[path]), False) + else: + raise AnsibleParserError("file not found: %s" % path) + + def path_exists(self, path): + path = to_text(path) + return path in self._file_mapping or path in self._known_directories + + def is_file(self, path): + path = to_text(path) + return path in self._file_mapping + + def is_directory(self, path): + path = to_text(path) + return path in self._known_directories + + def list_directory(self, path): + ret = [] + path = to_text(path) + for x in list(self._file_mapping.keys()) + self._known_directories: + if x.startswith(path): + if os.path.dirname(x) == path: + ret.append(os.path.basename(x)) + return ret + + def is_executable(self, path): + # FIXME: figure out a way to make paths return true for this + return False + + def _add_known_directory(self, directory): + if directory not in self._known_directories: + self._known_directories.append(directory) + + def _build_known_directories(self): + self._known_directories = [] + for path in self._file_mapping: + dirname = os.path.dirname(path) + while dirname not in ("/", ""): + self._add_known_directory(dirname) + dirname = os.path.dirname(dirname) + + def push(self, path, content): + rebuild_dirs = False + if path not in self._file_mapping: + rebuild_dirs = True + + self._file_mapping[path] = content + + if rebuild_dirs: + self._build_known_directories() + + def pop(self, path): + if path in self._file_mapping: + del self._file_mapping[path] + self._build_known_directories() + + def clear(self): + self._file_mapping = dict() + self._known_directories = [] + + def get_basedir(self): + return os.getcwd() + + def set_vault_secrets(self, vault_secrets): + self._vault_secrets = vault_secrets diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/path.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/path.py new file mode 100644 index 00000000..8e9e368b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/path.py @@ -0,0 +1,10 @@ +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +from ansible_collections.cisco.iosxr.tests.unit.compat.mock import MagicMock +from ansible.utils.path import unfrackpath + + +mock_unfrackpath_noop = MagicMock( + spec_set=unfrackpath, side_effect=lambda x, *args, **kwargs: x +) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/procenv.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/procenv.py new file mode 100644 index 00000000..3c38a990 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/procenv.py @@ -0,0 +1,94 @@ +# (c) 2016, Matt Davis +# (c) 2016, Toshio Kuratomi +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import sys +import json + +from contextlib import contextmanager +from io import BytesIO, StringIO +from ansible_collections.cisco.iosxr.tests.unit.compat import unittest +from ansible.module_utils.six import PY3 +from ansible.module_utils._text import to_bytes + + +@contextmanager +def swap_stdin_and_argv(stdin_data="", argv_data=tuple()): + """ + context manager that temporarily masks the test runner's values for stdin and argv + """ + real_stdin = sys.stdin + real_argv = sys.argv + + if PY3: + fake_stream = StringIO(stdin_data) + fake_stream.buffer = BytesIO(to_bytes(stdin_data)) + else: + fake_stream = BytesIO(to_bytes(stdin_data)) + + try: + sys.stdin = fake_stream + sys.argv = argv_data + + yield + finally: + sys.stdin = real_stdin + sys.argv = real_argv + + +@contextmanager +def swap_stdout(): + """ + context manager that temporarily replaces stdout for tests that need to verify output + """ + old_stdout = sys.stdout + + if PY3: + fake_stream = StringIO() + else: + fake_stream = BytesIO() + + try: + sys.stdout = fake_stream + + yield fake_stream + finally: + sys.stdout = old_stdout + + +class ModuleTestCase(unittest.TestCase): + def setUp(self, module_args=None): + if module_args is None: + module_args = { + "_ansible_remote_tmp": "/tmp", + "_ansible_keep_remote_files": False, + } + + args = json.dumps(dict(ANSIBLE_MODULE_ARGS=module_args)) + + # unittest doesn't have a clean place to use a context manager, so we have to enter/exit manually + self.stdin_swap = swap_stdin_and_argv(stdin_data=args) + self.stdin_swap.__enter__() + + def tearDown(self): + # unittest doesn't have a clean place to use a context manager, so we have to enter/exit manually + self.stdin_swap.__exit__(None, None, None) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/vault_helper.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/vault_helper.py new file mode 100644 index 00000000..b34ae134 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/vault_helper.py @@ -0,0 +1,42 @@ +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible.module_utils._text import to_bytes + +from ansible.parsing.vault import VaultSecret + + +class TextVaultSecret(VaultSecret): + """A secret piece of text. ie, a password. Tracks text encoding. + + The text encoding of the text may not be the default text encoding so + we keep track of the encoding so we encode it to the same bytes.""" + + def __init__(self, text, encoding=None, errors=None, _bytes=None): + super(TextVaultSecret, self).__init__() + self.text = text + self.encoding = encoding or "utf-8" + self._bytes = _bytes + self.errors = errors or "strict" + + @property + def bytes(self): + """The text encoded with encoding, unless we specifically set _bytes.""" + return self._bytes or to_bytes( + self.text, encoding=self.encoding, errors=self.errors + ) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/yaml_helper.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/yaml_helper.py new file mode 100644 index 00000000..5df30aae --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/mock/yaml_helper.py @@ -0,0 +1,167 @@ +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +import io +import yaml + +from ansible.module_utils.six import PY3 +from ansible.parsing.yaml.loader import AnsibleLoader +from ansible.parsing.yaml.dumper import AnsibleDumper + + +class YamlTestUtils(object): + """Mixin class to combine with a unittest.TestCase subclass.""" + + def _loader(self, stream): + """Vault related tests will want to override this. + + Vault cases should setup a AnsibleLoader that has the vault password.""" + return AnsibleLoader(stream) + + def _dump_stream(self, obj, stream, dumper=None): + """Dump to a py2-unicode or py3-string stream.""" + if PY3: + return yaml.dump(obj, stream, Dumper=dumper) + else: + return yaml.dump(obj, stream, Dumper=dumper, encoding=None) + + def _dump_string(self, obj, dumper=None): + """Dump to a py2-unicode or py3-string""" + if PY3: + return yaml.dump(obj, Dumper=dumper) + else: + return yaml.dump(obj, Dumper=dumper, encoding=None) + + def _dump_load_cycle(self, obj): + # Each pass though a dump or load revs the 'generation' + # obj to yaml string + string_from_object_dump = self._dump_string(obj, dumper=AnsibleDumper) + + # wrap a stream/file like StringIO around that yaml + stream_from_object_dump = io.StringIO(string_from_object_dump) + loader = self._loader(stream_from_object_dump) + # load the yaml stream to create a new instance of the object (gen 2) + obj_2 = loader.get_data() + + # dump the gen 2 objects directory to strings + string_from_object_dump_2 = self._dump_string( + obj_2, dumper=AnsibleDumper + ) + + # The gen 1 and gen 2 yaml strings + self.assertEqual(string_from_object_dump, string_from_object_dump_2) + # the gen 1 (orig) and gen 2 py object + self.assertEqual(obj, obj_2) + + # again! gen 3... load strings into py objects + stream_3 = io.StringIO(string_from_object_dump_2) + loader_3 = self._loader(stream_3) + obj_3 = loader_3.get_data() + + string_from_object_dump_3 = self._dump_string( + obj_3, dumper=AnsibleDumper + ) + + self.assertEqual(obj, obj_3) + # should be transitive, but... + self.assertEqual(obj_2, obj_3) + self.assertEqual(string_from_object_dump, string_from_object_dump_3) + + def _old_dump_load_cycle(self, obj): + """Dump the passed in object to yaml, load it back up, dump again, compare.""" + stream = io.StringIO() + + yaml_string = self._dump_string(obj, dumper=AnsibleDumper) + self._dump_stream(obj, stream, dumper=AnsibleDumper) + + yaml_string_from_stream = stream.getvalue() + + # reset stream + stream.seek(0) + + loader = self._loader(stream) + # loader = AnsibleLoader(stream, vault_password=self.vault_password) + obj_from_stream = loader.get_data() + + stream_from_string = io.StringIO(yaml_string) + loader2 = self._loader(stream_from_string) + # loader2 = AnsibleLoader(stream_from_string, vault_password=self.vault_password) + obj_from_string = loader2.get_data() + + stream_obj_from_stream = io.StringIO() + stream_obj_from_string = io.StringIO() + + if PY3: + yaml.dump( + obj_from_stream, stream_obj_from_stream, Dumper=AnsibleDumper + ) + yaml.dump( + obj_from_stream, stream_obj_from_string, Dumper=AnsibleDumper + ) + else: + yaml.dump( + obj_from_stream, + stream_obj_from_stream, + Dumper=AnsibleDumper, + encoding=None, + ) + yaml.dump( + obj_from_stream, + stream_obj_from_string, + Dumper=AnsibleDumper, + encoding=None, + ) + + yaml_string_stream_obj_from_stream = stream_obj_from_stream.getvalue() + yaml_string_stream_obj_from_string = stream_obj_from_string.getvalue() + + stream_obj_from_stream.seek(0) + stream_obj_from_string.seek(0) + + if PY3: + yaml_string_obj_from_stream = yaml.dump( + obj_from_stream, Dumper=AnsibleDumper + ) + yaml_string_obj_from_string = yaml.dump( + obj_from_string, Dumper=AnsibleDumper + ) + else: + yaml_string_obj_from_stream = yaml.dump( + obj_from_stream, Dumper=AnsibleDumper, encoding=None + ) + yaml_string_obj_from_string = yaml.dump( + obj_from_string, Dumper=AnsibleDumper, encoding=None + ) + + assert yaml_string == yaml_string_obj_from_stream + assert ( + yaml_string + == yaml_string_obj_from_stream + == yaml_string_obj_from_string + ) + assert ( + yaml_string + == yaml_string_obj_from_stream + == yaml_string_obj_from_string + == yaml_string_stream_obj_from_stream + == yaml_string_stream_obj_from_string + ) + assert obj == obj_from_stream + assert obj == obj_from_string + assert obj == yaml_string_obj_from_stream + assert obj == yaml_string_obj_from_string + assert ( + obj + == obj_from_stream + == obj_from_string + == yaml_string_obj_from_stream + == yaml_string_obj_from_string + ) + return { + "obj": obj, + "yaml_string": yaml_string, + "yaml_string_from_stream": yaml_string_from_stream, + "obj_from_stream": obj_from_stream, + "obj_from_string": obj_from_string, + "yaml_string_obj_from_string": yaml_string_obj_from_string, + } diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/conftest.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/conftest.py new file mode 100644 index 00000000..e19a1e04 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/conftest.py @@ -0,0 +1,40 @@ +# Copyright (c) 2017 Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import json + +import pytest + +from ansible.module_utils.six import string_types +from ansible.module_utils._text import to_bytes +from ansible.module_utils.common._collections_compat import MutableMapping + + +@pytest.fixture +def patch_ansible_module(request, mocker): + if isinstance(request.param, string_types): + args = request.param + elif isinstance(request.param, MutableMapping): + if "ANSIBLE_MODULE_ARGS" not in request.param: + request.param = {"ANSIBLE_MODULE_ARGS": request.param} + if "_ansible_remote_tmp" not in request.param["ANSIBLE_MODULE_ARGS"]: + request.param["ANSIBLE_MODULE_ARGS"][ + "_ansible_remote_tmp" + ] = "/tmp" + if ( + "_ansible_keep_remote_files" + not in request.param["ANSIBLE_MODULE_ARGS"] + ): + request.param["ANSIBLE_MODULE_ARGS"][ + "_ansible_keep_remote_files" + ] = False + args = json.dumps(request.param) + else: + raise Exception( + "Malformed data to the patch_ansible_module pytest fixture" + ) + + mocker.patch("ansible.module_utils.basic._ANSIBLE_ARGS", to_bytes(args)) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/__init__.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/dir_7all b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/dir_7all new file mode 100644 index 00000000..b992498c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/dir_7all @@ -0,0 +1,6 @@ +Directory of disk0: +file1 +file2 + +Directory of flash0: +file3 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_acls_config.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_acls_config.cfg new file mode 100644 index 00000000..d9c32dd6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_acls_config.cfg @@ -0,0 +1,5 @@ +ipv4 access-list acl_2 + 10 deny ipv4 any any + 20 permit tcp host 192.168.1.100 any +ipv6 access-list acl6_1 + 10 deny icmpv6 any any diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_config_config.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_config_config.cfg new file mode 100644 index 00000000..afad9d08 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_config_config.cfg @@ -0,0 +1,12 @@ +! +hostname router +! +interface GigabitEthernet0/0 + ip address 1.2.3.4 255.255.255.0 + description test string +! +interface GigabitEthernet0/1 + ip address 6.7.8.9 255.255.255.0 + description test string + shutdown +! diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_config_src.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_config_src.cfg new file mode 100644 index 00000000..b3d8961a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_config_src.cfg @@ -0,0 +1,11 @@ +! +hostname foo +! +interface GigabitEthernet0/0 + no ip address +! +interface GigabitEthernet0/1 + ip address 6.7.8.9 255.255.255.0 + description test string + shutdown +! diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_ospf_interfaces.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_ospf_interfaces.cfg new file mode 100644 index 00000000..3f982bc1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_ospf_interfaces.cfg @@ -0,0 +1,9 @@ +router ospf LAB3 + area 0.0.0.3 + interface GigabitEthernet0/0/0/0 + cost 20 + authentication message-digest keychain cisco + ! + ! +! + diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_ospfv2.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_ospfv2.cfg new file mode 100644 index 00000000..8645482e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_ospfv2.cfg @@ -0,0 +1,8 @@ +Sun Jun 14 12:10:47.455 UTC +router ospf 30 + cost 2 + default-metric 10 + area 11 + default-cost 5 + ! +! diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_ospfv3.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_ospfv3.cfg new file mode 100644 index 00000000..b52c0ee0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_ospfv3.cfg @@ -0,0 +1,8 @@ +Sun Jun 14 12:10:47.455 UTC +router ospfv3 30 + cost 2 + default-metric 10 + area 11 + default-cost 5 + ! +! diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_static_routes_config.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_static_routes_config.cfg new file mode 100644 index 00000000..36c9eb23 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_static_routes_config.cfg @@ -0,0 +1,18 @@ +Fri Nov 29 21:10:41.896 UTC +router static + address-family ipv4 unicast + 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 + 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 + 192.0.2.32/28 192.0.2.11 100 + ! + address-family ipv6 unicast + 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC + 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 + ! + vrf DEV_SITE + address-family ipv4 unicast + 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV + 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 + ! + ! +! \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_system_config.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_system_config.cfg new file mode 100644 index 00000000..fc6fd2b7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_system_config.cfg @@ -0,0 +1,8 @@ +hostname iosxr01 +domain name eng.ansible.com +domain lookup disable +domain lookup source-interface MgmtEth0/0/CPU0/0 +domain list redhat.com +domain list cisco.com +domain name-server 8.8.8.8 +domain name-server 8.8.4.4 diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_user_config.cfg b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_user_config.cfg new file mode 100644 index 00000000..0f0ab168 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/iosxr_user_config.cfg @@ -0,0 +1,8 @@ +username admin + secret 5 $1$mdQIUxjg$3t3lzBpfKfITKvFm1uEIY. + group sysadmin +! +username ansible + secret 5 $1$3yWSXiIi$VdzV59ChiurrNdGxlDeAW/ + group sysadmin +! diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_interfaces b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_interfaces new file mode 100644 index 00000000..d68907c0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_interfaces @@ -0,0 +1,41 @@ +Loopback0 is up, line protocol is up + Interface state transitions: 1 + Hardware is Loopback interface(s) + Description: Loopback + Internet address is 192.168.0.3/32 + MTU 1500 bytes, BW 0 Kbit + reliability Unknown, txload Unknown, rxload Unknown + Encapsulation Loopback, loopback not set, + Last link flapped 12w1d + Last input Unknown, output Unknown + Last clearing of "show interface" counters Unknown + Input/output data rate is disabled. + +GigabitEthernet0/0/0/0 is up, line protocol is up + Interface state transitions: 1 + Hardware is GigabitEthernet, address is fa16.3e6c.20bd (bia fa16.3e6c.20bd) + Description: to nxos01 + Internet address is 10.0.0.5/30 + MTU 1514 bytes, BW 1000000 Kbit (Max: 1000000 Kbit) + reliability 255/255, txload 0/255, rxload 0/255 + Encapsulation ARPA, + Full-duplex, 1000Mb/s, unknown, link type is force-up + output flow control is off, input flow control is off + Carrier delay (up) is 10 msec + loopback not set, + Last link flapped 12w1d + ARP type ARPA, ARP timeout 04:00:00 + Last input 00:00:44, output 00:12:45 + Last clearing of "show interface" counters never + 5 minute input rate 0 bits/sec, 0 packets/sec + 5 minute output rate 0 bits/sec, 0 packets/sec + 150700 packets input, 36897055 bytes, 0 total input drops + 0 drops for unrecognized upper-level protocol + Received 1 broadcast packets, 150445 multicast packets + 0 runts, 0 giants, 0 throttles, 0 parity + 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort + 11691 packets output, 2904632 bytes, 0 total output drops + Output 1 broadcast packets, 11436 multicast packets + 0 output errors, 0 underruns, 0 applique, 0 resets + 0 output buffer failures, 0 output buffers swapped out + 1 carrier transitions diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_ipv6_interface b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_ipv6_interface new file mode 100644 index 00000000..971d1f65 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_ipv6_interface @@ -0,0 +1,5 @@ +Loopback0 is Up, ipv6 protocol is Up, Vrfid is default (0x60000000) + IPv6 is disabled, link-local address unassigned + No global unicast address is configured +GigabitEthernet0/0/0/0 is Up, ipv6 protocol is Up, Vrfid is default (0x60000000) + IPv6 is disabled, link-local address unassigned diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_lldp b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_lldp new file mode 100644 index 00000000..60ab287f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_lldp @@ -0,0 +1 @@ +% LLDP is not enabled diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_lldp_neighbors_detail b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_lldp_neighbors_detail new file mode 100644 index 00000000..60ab287f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_lldp_neighbors_detail @@ -0,0 +1 @@ +% LLDP is not enabled diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_memory_summary b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_memory_summary new file mode 100644 index 00000000..b26abeae --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_memory_summary @@ -0,0 +1,5 @@ +Physical Memory: 3095M total (1499M available) + Application Memory : 2893M (1499M available) + Image: 73M (bootram: 73M) + Reserved: 128M, IOMem: 0, flashfsys: 0 + Total shared window: 23M diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_running-config b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_running-config new file mode 100644 index 00000000..085baef4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_running-config @@ -0,0 +1,43 @@ +hostname iosxr01 +service timestamps log datetime msec +service timestamps debug datetime msec +telnet vrf default ipv4 server max-servers 10 +telnet vrf Mgmt-intf ipv4 server max-servers 10 +domain name eng.ansible.com +domain lookup disable +vrf Mgmt-intf + address-family ipv4 unicast + ! + address-family ipv6 unicast + ! +! +line template vty + timestamp + exec-timeout 720 0 +! +line console + exec-timeout 0 0 +! +line default + exec-timeout 720 0 +! +vty-pool default 0 50 +control-plane + management-plane + inband + interface all + allow all + ! + ! + ! +! +interface Loopback0 + description Loopback + ipv4 address 192.168.0.1 255.255.255.255 +! +interface GigabitEthernet0/0/0/0 + description to nxos01 + cdp + ipv4 address 10.0.0.1 255.255.255.252 +! +end diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_version b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_version new file mode 100644 index 00000000..faecfffd --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_version @@ -0,0 +1,84 @@ +Cisco IOS XR Software, Version 6.0.0[Default] +Copyright (c) 2015 by Cisco Systems, Inc. + +ROM: GRUB, Version 1.99(0), DEV RELEASE + +iosxr01 uptime is 11 weeks, 2 days, 5 hours, 48 minutes +System image file is "bootflash:disk0/xrvr-os-mbi-6.0.0/mbixrvr-rp.vm" + +cisco IOS XRv Series (Pentium Celeron Stepping 3) processor with 3169911K bytes of memory. +Pentium Celeron Stepping 3 processor at 3836MHz, Revision 2.174 +IOS XRv Chassis + +1 Management Ethernet +6 GigabitEthernet +97070k bytes of non-volatile configuration memory. +866M bytes of hard disk. +2321392k bytes of disk0: (Sector size 512 bytes). + +Configuration register on node 0/0/CPU0 is 0x2102 +Boot device on node 0/0/CPU0 is disk0: +Package active on node 0/0/CPU0: +iosxr-infra, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-infra-6.0.0 + Built on Thu Dec 24 08:53:49 UTC 2015 + By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie + +iosxr-fwding, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-fwding-6.0.0 + Built on Thu Dec 24 08:53:49 UTC 2015 + By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie + +iosxr-routing, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-routing-6.0.0 + Built on Thu Dec 24 08:53:49 UTC 2015 + By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie + +iosxr-ce, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-ce-6.0.0 + Built on Thu Dec 24 08:53:49 UTC 2015 + By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie + +xrvr-os-mbi, V 6.0.0[Default], Cisco Systems, at disk0:xrvr-os-mbi-6.0.0 + Built on Thu Dec 24 08:54:41 UTC 2015 + By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie + +xrvr-base, V 6.0.0[Default], Cisco Systems, at disk0:xrvr-base-6.0.0 + Built on Thu Dec 24 08:53:49 UTC 2015 + By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie + +xrvr-fwding, V 6.0.0[Default], Cisco Systems, at disk0:xrvr-fwding-6.0.0 + Built on Thu Dec 24 08:53:49 UTC 2015 + By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie + +xrvr-mgbl-x, V 6.0.0[Default], Cisco Systems, at disk0:xrvr-mgbl-x-6.0.0 + Built on Thu Dec 24 08:53:57 UTC 2015 + By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie + +iosxr-mpls, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-mpls-6.0.0 + Built on Thu Dec 24 08:53:49 UTC 2015 + By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie + +iosxr-mgbl, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-mgbl-6.0.0 + Built on Thu Dec 24 08:53:49 UTC 2015 + By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie + +iosxr-mcast, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-mcast-6.0.0 + Built on Thu Dec 24 08:53:49 UTC 2015 + By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie + +xrvr-mcast-supp, V 6.0.0[Default], Cisco Systems, at disk0:xrvr-mcast-supp-6.0.0 + Built on Thu Dec 24 08:53:49 UTC 2015 + By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie + +iosxr-bng, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-bng-6.0.0 + Built on Thu Dec 24 08:53:47 UTC 2015 + By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie + +xrvr-bng-supp, V 6.0.0[Default], Cisco Systems, at disk0:xrvr-bng-supp-6.0.0 + Built on Thu Dec 24 08:53:47 UTC 2015 + By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie + +iosxr-security, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-security-6.0.0 + Built on Thu Dec 24 08:53:41 UTC 2015 + By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie + +xrvr-fullk9-x, V 6.0.0[Default], Cisco Systems, at disk0:xrvr-fullk9-x-6.0.0 + Built on Thu Dec 24 08:55:12 UTC 2015 + By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_version___utility_head_-n_20 b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_version___utility_head_-n_20 new file mode 100644 index 00000000..7f82039f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_version___utility_head_-n_20 @@ -0,0 +1,18 @@ +Cisco IOS XR Software, Version 6.0.0[Default] +Copyright (c) 2015 by Cisco Systems, Inc. + +ROM: GRUB, Version 1.99(0), DEV RELEASE + +iosxr01 uptime is 11 weeks, 6 days, 2 hours, 2 minutes +System image file is "bootflash:disk0/xrvr-os-mbi-6.0.0/mbixrvr-rp.vm" + +cisco IOS XRv Series (Pentium Celeron Stepping 3) processor with 3169911K bytes +of memory. +Pentium Celeron Stepping 3 processor at 3836MHz, Revision 2.174 +IOS XRv Chassis + +1 Management Ethernet +6 GigabitEthernet +97070k bytes of non-volatile configuration memory. +866M bytes of hard disk. +2321392k bytes of disk0: (Sector size 512 bytes). diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_version_brief b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_version_brief new file mode 100644 index 00000000..7f82039f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_version_brief @@ -0,0 +1,18 @@ +Cisco IOS XR Software, Version 6.0.0[Default] +Copyright (c) 2015 by Cisco Systems, Inc. + +ROM: GRUB, Version 1.99(0), DEV RELEASE + +iosxr01 uptime is 11 weeks, 6 days, 2 hours, 2 minutes +System image file is "bootflash:disk0/xrvr-os-mbi-6.0.0/mbixrvr-rp.vm" + +cisco IOS XRv Series (Pentium Celeron Stepping 3) processor with 3169911K bytes +of memory. +Pentium Celeron Stepping 3 processor at 3836MHz, Revision 2.174 +IOS XRv Chassis + +1 Management Ethernet +6 GigabitEthernet +97070k bytes of non-volatile configuration memory. +866M bytes of hard disk. +2321392k bytes of disk0: (Sector size 512 bytes). diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/iosxr_module.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/iosxr_module.py new file mode 100644 index 00000000..728c071c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/iosxr_module.py @@ -0,0 +1,105 @@ +# (c) 2016 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import os +import json + +from ansible_collections.cisco.iosxr.tests.unit.modules.utils import ( + AnsibleExitJson, + AnsibleFailJson, + ModuleTestCase, +) + + +fixture_path = os.path.join(os.path.dirname(__file__), "fixtures") +fixture_data = {} + + +def load_fixture(name): + path = os.path.join(fixture_path, name) + + if path in fixture_data: + return fixture_data[path] + + with open(path) as f: + data = f.read() + + try: + data = json.loads(data) + except Exception: + pass + + fixture_data[path] = data + return data + + +class TestIosxrModule(ModuleTestCase): + def execute_module( + self, + failed=False, + changed=False, + commands=None, + sort=True, + defaults=False, + ): + + self.load_fixtures(commands) + + if failed: + result = self.failed() + self.assertTrue(result["failed"], result) + else: + result = self.changed(changed) + self.assertEqual(result["changed"], changed, result) + + if commands is not None: + if sort: + self.assertEqual( + sorted(commands), + sorted(result["commands"]), + result["commands"], + ) + else: + self.assertEqual( + commands, result["commands"], result["commands"] + ) + + return result + + def failed(self): + with self.assertRaises(AnsibleFailJson) as exc: + self.module.main() + + result = exc.exception.args[0] + self.assertTrue(result["failed"], result) + return result + + def changed(self, changed=False): + with self.assertRaises(AnsibleExitJson) as exc: + self.module.main() + + result = exc.exception.args[0] + self.assertEqual(result["changed"], changed, result) + return result + + def load_fixtures(self, commands=None): + pass diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_acls.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_acls.py new file mode 100644 index 00000000..ab265fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_acls.py @@ -0,0 +1,361 @@ +# +# (c) 2019, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch +from ansible_collections.cisco.iosxr.plugins.modules import iosxr_acls +from ansible_collections.cisco.iosxr.tests.unit.modules.utils import ( + set_module_args, +) +from .iosxr_module import TestIosxrModule, load_fixture + + +class TestIosxrAclsModule(TestIosxrModule): + module = iosxr_acls + + def setUp(self): + super(TestIosxrAclsModule, self).setUp() + + self.mock_get_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config" + ) + self.get_config = self.mock_get_config.start() + + self.mock_load_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_get_resource_connection_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection" + ) + self.get_resource_connection_config = ( + self.mock_get_resource_connection_config.start() + ) + + self.mock_get_resource_connection_facts = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + ) + self.get_resource_connection_facts = ( + self.mock_get_resource_connection_facts.start() + ) + + self.mock_execute_show_command = patch( + "ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.acls.acls.AclsFacts.get_device_data" + ) + self.execute_show_command = self.mock_execute_show_command.start() + + def tearDown(self): + super(TestIosxrAclsModule, self).tearDown() + self.mock_get_resource_connection_config.stop() + self.mock_get_resource_connection_facts.stop() + self.mock_get_config.stop() + self.mock_load_config.stop() + self.mock_execute_show_command.stop() + + def _prepare(self): + def load_from_file(*args, **kwargs): + return load_fixture("iosxr_acls_config.cfg") + + self.execute_show_command.side_effect = load_from_file + + def test_iosxr_acls_merged(self): + self._prepare() + set_module_args( + dict( + config=[ + dict( + afi="ipv4", + acls=[ + dict( + name="acl_1", + aces=[ + dict( + sequence="10", + grant="permit", + protocol="ospf", + source=dict(prefix="192.168.1.0/24"), + destination=dict(any="true"), + log="true", + ) + ], + ) + ], + ) + ], + state="merged", + ) + ) + commands = [ + "ipv4 access-list acl_1", + "10 permit ospf 192.168.1.0 0.0.0.255 any log", + ] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_acls_merged_idempotent(self): + self._prepare() + set_module_args( + dict( + config=[ + dict( + afi="ipv4", + acls=[ + dict( + name="acl_2", + aces=[ + dict( + sequence="10", + grant="deny", + protocol="ipv4", + destination=dict(any="true"), + source=dict(any="true"), + ) + ], + ) + ], + ) + ], + state="merged", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_iosxr_acls_replaced(self): + self._prepare() + set_module_args( + dict( + config=[ + dict( + afi="ipv4", + acls=[ + dict( + name="acl_2", + aces=[ + dict( + sequence="30", + grant="permit", + protocol="ospf", + source=dict(prefix="10.0.0.0/8"), + destination=dict(any="true"), + log="true", + ) + ], + ) + ], + ) + ], + state="replaced", + ) + ) + commands = [ + "ipv4 access-list acl_2", + "no 10", + "no 20", + "30 permit ospf 10.0.0.0 0.255.255.255 any log", + ] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_acls_replaced_idempotent(self): + self._prepare() + set_module_args( + dict( + config=[ + dict( + afi="ipv4", + acls=[ + dict( + name="acl_2", + aces=[ + dict( + sequence="10", + grant="deny", + protocol="ipv4", + destination=dict(any="true"), + source=dict(any="true"), + ), + dict( + sequence="20", + grant="permit", + protocol="tcp", + destination=dict(any="true"), + source=dict(host="192.168.1.100"), + ), + ], + ) + ], + ) + ], + state="replaced", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_iosxr_acls_overridden(self): + self._prepare() + set_module_args( + dict( + config=[ + dict( + afi="ipv4", + acls=[ + dict( + name="acl_2", + aces=[ + dict( + sequence="40", + grant="permit", + protocol="ospf", + source=dict(any="true"), + destination=dict(any="true"), + log="true", + ) + ], + ) + ], + ) + ], + state="overridden", + ) + ) + commands = [ + "no ipv6 access-list acl6_1", + "ipv4 access-list acl_2", + "no 10", + "no 20", + "40 permit ospf any any log", + ] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_acls_overridden_idempotent(self): + self._prepare() + set_module_args( + dict( + config=[ + dict( + afi="ipv4", + acls=[ + dict( + name="acl_2", + aces=[ + dict( + sequence="10", + grant="deny", + protocol="ipv4", + destination=dict(any="true"), + source=dict(any="true"), + ), + dict( + sequence="20", + grant="permit", + protocol="tcp", + destination=dict(any="true"), + source=dict(host="192.168.1.100"), + ), + ], + ) + ], + ), + dict( + afi="ipv6", + acls=[ + dict( + name="acl6_1", + aces=[ + dict( + sequence="10", + grant="deny", + protocol="icmpv6", + destination=dict(any="true"), + source=dict(any="true"), + ) + ], + ) + ], + ), + ], + state="overridden", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_iosxr_acls_deletedacls(self): + self._prepare() + set_module_args( + dict( + config=[dict(afi="ipv6", acls=[dict(name="acl6_1")])], + state="deleted", + ) + ) + commands = ["no ipv6 access-list acl6_1"] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_acls_deletedafis(self): + self._prepare() + set_module_args(dict(config=[dict(afi="ipv4")], state="deleted")) + commands = ["no ipv4 access-list acl_2"] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_acls_rendered(self): + self._prepare() + set_module_args( + dict( + config=[ + dict( + afi="ipv4", + acls=[ + dict( + name="acl_2", + aces=[ + dict( + grant="permit", + source=dict(any="true"), + destination=dict(any="true"), + protocol="igmp", + ) + ], + ) + ], + ) + ], + state="rendered", + ) + ) + commands = ["ipv4 access-list acl_2", "permit igmp any any"] + result = self.execute_module(changed=False) + self.assertEqual( + sorted(result["rendered"]), sorted(commands), result["rendered"] + ) + + def test_iosxr_acls_overridden_on_empty_config(self): + self.execute_show_command.return_value = "" + set_module_args( + dict( + config=[ + dict( + afi="ipv4", + acls=[ + dict( + name="acl_1", + aces=[ + dict( + sequence="10", + grant="deny", + source=dict(any=True), + destination=dict(any=True), + protocol="ip", + ) + ], + ) + ], + ) + ], + state="overridden", + ) + ) + cmds = ["ipv4 access-list acl_1", "10 deny ip any any"] + self.execute_module(changed=True, commands=cmds) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_command.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_command.py new file mode 100644 index 00000000..8b149c5c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_command.py @@ -0,0 +1,128 @@ +# (c) 2016 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch +from ansible_collections.cisco.iosxr.plugins.modules import iosxr_command +from ansible_collections.cisco.iosxr.tests.unit.modules.utils import ( + set_module_args, +) +from .iosxr_module import TestIosxrModule, load_fixture + + +class TestIosxrCommandModule(TestIosxrModule): + + module = iosxr_command + + def setUp(self): + super(TestIosxrCommandModule, self).setUp() + + self.mock_run_commands = patch( + "ansible_collections.cisco.iosxr.plugins.modules.iosxr_command.run_commands" + ) + self.run_commands = self.mock_run_commands.start() + + def tearDown(self): + super(TestIosxrCommandModule, self).tearDown() + + self.mock_run_commands.stop() + + def load_fixtures(self, commands=None): + def load_from_file(*args, **kwargs): + module, commands = args + output = list() + + for item in commands: + try: + command = item["command"] + except Exception: + command = item + filename = str(command).replace(" ", "_") + output.append(load_fixture(filename)) + return output + + self.run_commands.side_effect = load_from_file + + def test_iosxr_command_simple(self): + set_module_args(dict(commands=["show version"])) + result = self.execute_module() + self.assertEqual(len(result["stdout"]), 1) + self.assertTrue( + result["stdout"][0].startswith("Cisco IOS XR Software") + ) + + def test_iosxr_command_multiple(self): + set_module_args(dict(commands=["show version", "show version"])) + result = self.execute_module() + self.assertEqual(len(result["stdout"]), 2) + self.assertTrue( + result["stdout"][0].startswith("Cisco IOS XR Software") + ) + + def test_iosxr_command_wait_for(self): + wait_for = 'result[0] contains "Cisco IOS"' + set_module_args(dict(commands=["show version"], wait_for=wait_for)) + self.execute_module() + + def test_iosxr_command_wait_for_fails(self): + wait_for = 'result[0] contains "test string"' + set_module_args(dict(commands=["show version"], wait_for=wait_for)) + self.execute_module(failed=True) + self.assertEqual(self.run_commands.call_count, 10) + + def test_iosxr_command_retries(self): + wait_for = 'result[0] contains "test string"' + set_module_args( + dict(commands=["show version"], wait_for=wait_for, retries=2) + ) + self.execute_module(failed=True) + self.assertEqual(self.run_commands.call_count, 2) + + def test_iosxr_command_match_any(self): + wait_for = [ + 'result[0] contains "Cisco IOS"', + 'result[0] contains "test string"', + ] + set_module_args( + dict(commands=["show version"], wait_for=wait_for, match="any") + ) + self.execute_module() + + def test_iosxr_command_match_all(self): + wait_for = [ + 'result[0] contains "Cisco IOS"', + 'result[0] contains "XR Software"', + ] + set_module_args( + dict(commands=["show version"], wait_for=wait_for, match="all") + ) + self.execute_module() + + def test_iosxr_command_match_all_failure(self): + wait_for = [ + 'result[0] contains "Cisco IOS"', + 'result[0] contains "test string"', + ] + commands = ["show version", "show version"] + set_module_args( + dict(commands=commands, wait_for=wait_for, match="all") + ) + self.execute_module(failed=True) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_config.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_config.py new file mode 100644 index 00000000..ee7499b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_config.py @@ -0,0 +1,308 @@ +# +# (c) 2016 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.cisco.iosxr.tests.unit.compat.mock import ( + patch, + MagicMock, +) +from ansible_collections.cisco.iosxr.plugins.modules import iosxr_config +from ansible_collections.cisco.iosxr.plugins.cliconf.iosxr import Cliconf +from ansible_collections.cisco.iosxr.tests.unit.modules.utils import ( + set_module_args, +) +from .iosxr_module import TestIosxrModule, load_fixture + + +class TestIosxrConfigModule(TestIosxrModule): + + module = iosxr_config + + def setUp(self): + super(TestIosxrConfigModule, self).setUp() + + self.patcher_get_config = patch( + "ansible_collections.cisco.iosxr.plugins.modules.iosxr_config.get_config" + ) + self.mock_get_config = self.patcher_get_config.start() + + self.patcher_exec_command = patch( + "ansible_collections.cisco.iosxr.plugins.modules.iosxr_config.load_config" + ) + self.mock_exec_command = self.patcher_exec_command.start() + + self.mock_get_connection = patch( + "ansible_collections.cisco.iosxr.plugins.modules.iosxr_config.get_connection" + ) + self.get_connection = self.mock_get_connection.start() + + self.conn = self.get_connection() + self.conn.edit_config = MagicMock() + + self.cliconf_obj = Cliconf(MagicMock()) + self.running_config = load_fixture("iosxr_config_config.cfg") + + def tearDown(self): + super(TestIosxrConfigModule, self).tearDown() + + self.patcher_get_config.stop() + self.patcher_exec_command.stop() + self.mock_get_connection.stop() + + def load_fixtures(self, commands=None): + config_file = "iosxr_config_config.cfg" + self.mock_get_config.return_value = load_fixture(config_file) + self.mock_exec_command.return_value = "dummy diff" + + def test_iosxr_config_unchanged(self): + src = load_fixture("iosxr_config_config.cfg") + set_module_args(dict(src=src)) + self.conn.get_diff = MagicMock( + return_value=self.cliconf_obj.get_diff(src, src) + ) + self.execute_module() + + def test_iosxr_config_src(self): + src = load_fixture("iosxr_config_src.cfg") + set_module_args(dict(src=src)) + self.conn.get_diff = MagicMock( + return_value=self.cliconf_obj.get_diff(src, self.running_config) + ) + commands = [ + "hostname foo", + "interface GigabitEthernet0/0", + "no ip address", + ] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_config_backup(self): + set_module_args(dict(backup=True)) + result = self.execute_module() + self.assertIn("__backup__", result) + + def test_iosxr_config_lines_wo_parents(self): + lines = ["hostname foo"] + set_module_args(dict(lines=lines)) + self.conn.get_diff = MagicMock( + return_value=self.cliconf_obj.get_diff( + "\n".join(lines), self.running_config + ) + ) + commands = ["hostname foo"] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_config_lines_w_parents(self): + lines = ["shutdown"] + parents = ["interface GigabitEthernet0/0"] + set_module_args(dict(lines=lines, parents=parents)) + module = MagicMock() + module.params = {"lines": lines, "parents": parents, "src": None} + candidate_config = iosxr_config.get_candidate(module) + self.conn.get_diff = MagicMock( + return_value=self.cliconf_obj.get_diff( + candidate_config, self.running_config + ) + ) + commands = ["interface GigabitEthernet0/0", "shutdown"] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_config_before(self): + lines = ["hostname foo"] + set_module_args(dict(lines=lines, before=["test1", "test2"])) + commands = ["test1", "test2", "hostname foo"] + self.conn.get_diff = MagicMock( + return_value=self.cliconf_obj.get_diff( + "\n".join(lines), self.running_config + ) + ) + self.execute_module(changed=True, commands=commands, sort=False) + + def test_iosxr_config_after(self): + lines = ["hostname foo"] + set_module_args(dict(lines=lines, after=["test1", "test2"])) + commands = ["hostname foo", "test1", "test2"] + self.conn.get_diff = MagicMock( + return_value=self.cliconf_obj.get_diff( + "\n".join(lines), self.running_config + ) + ) + self.execute_module(changed=True, commands=commands, sort=False) + + def test_iosxr_config_before_after_no_change(self): + lines = ["hostname router"] + set_module_args( + dict( + lines=lines, + before=["test1", "test2"], + after=["test3", "test4"], + ) + ) + self.conn.get_diff = MagicMock( + return_value=self.cliconf_obj.get_diff( + "\n".join(lines), self.running_config + ) + ) + self.execute_module() + + def test_iosxr_config_config(self): + config = "hostname localhost" + lines = ["hostname router"] + set_module_args(dict(lines=["hostname router"], config=config)) + self.conn.get_diff = MagicMock( + return_value=self.cliconf_obj.get_diff("\n".join(lines), config) + ) + commands = ["hostname router"] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_config_replace_block(self): + lines = ["description test string", "test string"] + parents = ["interface GigabitEthernet0/0"] + set_module_args(dict(lines=lines, replace="block", parents=parents)) + commands = parents + lines + + module = MagicMock() + module.params = {"lines": lines, "parents": parents, "src": None} + candidate_config = iosxr_config.get_candidate(module) + self.conn.get_diff = MagicMock( + return_value=self.cliconf_obj.get_diff( + candidate_config, + self.running_config, + diff_replace="block", + path=parents, + ) + ) + self.execute_module(changed=True, commands=commands) + + def test_iosxr_config_force(self): + lines = ["hostname router"] + set_module_args(dict(lines=lines, force=True)) + self.conn.get_diff = MagicMock( + return_value=self.cliconf_obj.get_diff( + "\n".join(lines), self.running_config, diff_match="none" + ) + ) + self.execute_module(changed=True, commands=lines) + + def test_iosxr_config_admin(self): + lines = ["username admin", "group root-system", "secret P@ssw0rd"] + set_module_args(dict(lines=lines, admin=True)) + self.conn.get_diff = MagicMock( + return_value=self.cliconf_obj.get_diff( + "\n".join(lines), self.running_config + ) + ) + self.execute_module(changed=True, commands=lines) + + def test_iosxr_config_match_none(self): + lines = ["ip address 1.2.3.4 255.255.255.0", "description test string"] + parents = ["interface GigabitEthernet0/0"] + set_module_args(dict(lines=lines, parents=parents, match="none")) + commands = parents + lines + module = MagicMock() + module.params = {"lines": lines, "parents": parents, "src": None} + candidate_config = iosxr_config.get_candidate(module) + self.conn.get_diff = MagicMock( + return_value=self.cliconf_obj.get_diff( + candidate_config, + self.running_config, + diff_match="none", + path=parents, + ) + ) + + self.execute_module(changed=True, commands=commands, sort=False) + + def test_iosxr_config_match_strict(self): + lines = [ + "ip address 1.2.3.4 255.255.255.0", + "description test string", + "shutdown", + ] + parents = ["interface GigabitEthernet0/0"] + set_module_args(dict(lines=lines, parents=parents, match="strict")) + commands = parents + ["shutdown"] + module = MagicMock() + module.params = {"lines": lines, "parents": parents, "src": None} + candidate_config = iosxr_config.get_candidate(module) + self.conn.get_diff = MagicMock( + return_value=self.cliconf_obj.get_diff( + candidate_config, + self.running_config, + diff_match="strict", + path=parents, + ) + ) + + self.execute_module(changed=True, commands=commands, sort=False) + + def test_iosxr_config_match_exact(self): + lines = [ + "ip address 1.2.3.4 255.255.255.0", + "description test string", + "shutdown", + ] + parents = ["interface GigabitEthernet0/0"] + set_module_args(dict(lines=lines, parents=parents, match="exact")) + commands = parents + lines + module = MagicMock() + module.params = {"lines": lines, "parents": parents, "src": None} + candidate_config = iosxr_config.get_candidate(module) + self.conn.get_diff = MagicMock( + return_value=self.cliconf_obj.get_diff( + candidate_config, + self.running_config, + diff_match="exact", + path=parents, + ) + ) + + self.execute_module(changed=True, commands=commands, sort=False) + + def test_iosxr_config_src_and_lines_fails(self): + args = dict(src="foo", lines="foo") + set_module_args(args) + self.execute_module(failed=True) + + def test_iosxr_config_src_and_parents_fails(self): + args = dict(src="foo", parents="foo") + set_module_args(args) + self.execute_module(failed=True) + + def test_iosxr_config_match_exact_requires_lines(self): + args = dict(match="exact") + set_module_args(args) + self.execute_module(failed=True) + + def test_iosxr_config_match_strict_requires_lines(self): + args = dict(match="strict") + set_module_args(args) + self.execute_module(failed=True) + + def test_iosxr_config_replace_block_requires_lines(self): + args = dict(replace="block") + set_module_args(args) + self.execute_module(failed=True) + + def test_iosxr_config_replace_config_requires_src(self): + args = dict(replace="config") + set_module_args(args) + self.execute_module(failed=True) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_facts.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_facts.py new file mode 100644 index 00000000..95951850 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_facts.py @@ -0,0 +1,117 @@ +# (c) 2016 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import json + +from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch +from ansible_collections.cisco.iosxr.tests.unit.modules.utils import ( + set_module_args, +) +from .iosxr_module import TestIosxrModule, load_fixture +from ansible_collections.cisco.iosxr.plugins.modules import iosxr_facts + + +class TestIosxrFacts(TestIosxrModule): + + module = iosxr_facts + + def setUp(self): + super(TestIosxrFacts, self).setUp() + + self.mock_run_commands = patch( + "ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.legacy.base.run_commands" + ) + self.run_commands = self.mock_run_commands.start() + + self.mock_get_resource_connection = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + ) + self.get_resource_connection = ( + self.mock_get_resource_connection.start() + ) + + self.mock_get_capabilities = patch( + "ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.legacy.base.get_capabilities" + ) + self.get_capabilities = self.mock_get_capabilities.start() + self.get_capabilities.return_value = { + "device_info": { + "network_os": "iosxr", + "network_os_hostname": "iosxr01", + "network_os_image": "bootflash:disk0/xrvr-os-mbi-6.1.3/mbixrvr-rp.vm", + "network_os_version": "6.1.3[Default]", + }, + "network_api": "cliconf", + } + + def tearDown(self): + super(TestIosxrFacts, self).tearDown() + + self.mock_run_commands.stop() + self.mock_get_capabilities.stop() + self.mock_get_resource_connection.stop() + + def load_fixtures(self, commands=None): + def load_from_file(*args, **kwargs): + module, commands = args + output = list() + + for item in commands: + try: + obj = json.loads(item) + command = obj["command"] + except ValueError: + command = item + filename = str(command).replace(" ", "_") + filename = filename.replace("/", "7") + filename = filename.replace("|", "_") + output.append(load_fixture(filename)) + return output + + self.run_commands.side_effect = load_from_file + + def test_iosxr_facts_gather_subset_default(self): + set_module_args(dict()) + result = self.execute_module() + ansible_facts = result["ansible_facts"] + self.assertIn("hardware", ansible_facts["ansible_net_gather_subset"]) + self.assertIn("default", ansible_facts["ansible_net_gather_subset"]) + self.assertIn("interfaces", ansible_facts["ansible_net_gather_subset"]) + self.assertEqual("iosxr01", ansible_facts["ansible_net_hostname"]) + self.assertEqual( + ["disk0:", "flash0:"], ansible_facts["ansible_net_filesystems"] + ) + self.assertIn( + "GigabitEthernet0/0/0/0", + ansible_facts["ansible_net_interfaces"].keys(), + ) + self.assertEqual("3095", ansible_facts["ansible_net_memtotal_mb"]) + self.assertEqual("1499", ansible_facts["ansible_net_memfree_mb"]) + + def test_iosxr_facts_gather_subset_config(self): + set_module_args({"gather_subset": "config"}) + result = self.execute_module() + ansible_facts = result["ansible_facts"] + self.assertIn("default", ansible_facts["ansible_net_gather_subset"]) + self.assertIn("config", ansible_facts["ansible_net_gather_subset"]) + self.assertEqual("iosxr01", ansible_facts["ansible_net_hostname"]) + self.assertIn("ansible_net_config", ansible_facts) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_netconf.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_netconf.py new file mode 100644 index 00000000..3e8a3473 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_netconf.py @@ -0,0 +1,114 @@ +# (c) 2017 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch +from ansible_collections.cisco.iosxr.plugins.modules import iosxr_netconf +from ansible_collections.cisco.iosxr.tests.unit.modules.utils import ( + set_module_args, +) +from .iosxr_module import TestIosxrModule + + +class TestIosxrNetconfModule(TestIosxrModule): + + module = iosxr_netconf + + def setUp(self): + super(TestIosxrNetconfModule, self).setUp() + + self.mock_get_config = patch( + "ansible_collections.cisco.iosxr.plugins.modules.iosxr_netconf.get_config" + ) + self.get_config = self.mock_get_config.start() + + self.mock_load_config = patch( + "ansible_collections.cisco.iosxr.plugins.modules.iosxr_netconf.load_config" + ) + self.load_config = self.mock_load_config.start() + + def tearDown(self): + super(TestIosxrNetconfModule, self).tearDown() + self.mock_get_config.stop() + self.mock_load_config.stop() + + def test_iosxr_disable_netconf_service(self): + self.get_config.return_value = """ + netconf-yang agent + ssh + ! + ssh server netconf vrf default + """ + self.load_config.return_value = "dummy diff" + set_module_args( + dict(netconf_port=830, netconf_vrf="default", state="absent") + ) + result = self.execute_module(changed=True) + self.assertEqual( + result["commands"], + [ + "no netconf-yang agent ssh", + "no ssh server netconf port 830", + "no ssh server netconf vrf default", + ], + ) + + def test_iosxr_enable_netconf_service(self): + self.get_config.return_value = "" + self.load_config.return_value = "dummy diff" + set_module_args( + dict(netconf_port=830, netconf_vrf="default", state="present") + ) + result = self.execute_module(changed=True) + self.assertEqual( + result["commands"], + [ + "netconf-yang agent ssh", + "ssh server netconf port 830", + "ssh server netconf vrf default", + ], + ) + + def test_iosxr_change_netconf_port(self): + self.get_config.return_value = """ + netconf-yang agent + ssh + ! + ssh server netconf vrf default + """ + self.load_config.return_value = "dummy diff" + set_module_args(dict(netconf_port=9000, state="present")) + result = self.execute_module(changed=True) + self.assertEqual(result["commands"], ["ssh server netconf port 9000"]) + + def test_iosxr_change_netconf_vrf(self): + self.get_config.return_value = """ + netconf-yang agent + ssh + ! + ssh server netconf vrf default + """ + self.load_config.return_value = "dummy diff" + set_module_args(dict(netconf_vrf="new_default", state="present")) + result = self.execute_module(changed=True) + self.assertEqual( + result["commands"], ["ssh server netconf vrf new_default"] + ) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospf_interfaces.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospf_interfaces.py new file mode 100644 index 00000000..e5cc74ae --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospf_interfaces.py @@ -0,0 +1,358 @@ +# +# (c) 2019, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch +from ansible_collections.cisco.iosxr.plugins.modules import ( + iosxr_ospf_interfaces, +) +from ansible_collections.cisco.iosxr.tests.unit.modules.utils import ( + set_module_args, +) +from .iosxr_module import TestIosxrModule, load_fixture + + +class TestIosxrOspf_InterfacesModule(TestIosxrModule): + module = iosxr_ospf_interfaces + + def setUp(self): + super(TestIosxrOspf_InterfacesModule, self).setUp() + + self.mock_get_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config" + ) + self.get_config = self.mock_get_config.start() + + self.mock_load_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_get_resource_connection_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base." + "get_resource_connection" + ) + self.get_resource_connection_config = ( + self.mock_get_resource_connection_config.start() + ) + + self.mock_get_resource_connection_facts = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.resource_module." + "get_resource_connection" + ) + self.get_resource_connection_facts = ( + self.mock_get_resource_connection_facts.start() + ) + + self.mock_edit_config = patch( + "ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.providers.providers.CliProvider.edit_config" + ) + self.edit_config = self.mock_edit_config.start() + + self.mock_execute_show_command = patch( + "ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.ospf_interfaces.ospf_interfaces." + "Ospf_interfacesFacts.get_ospf_interfaces" + ) + self.execute_show_command = self.mock_execute_show_command.start() + + def tearDown(self): + super(TestIosxrOspf_InterfacesModule, self).tearDown() + self.mock_get_resource_connection_config.stop() + self.mock_get_resource_connection_facts.stop() + self.mock_edit_config.stop() + self.mock_get_config.stop() + self.mock_load_config.stop() + self.mock_execute_show_command.stop() + + def load_fixtures(self, commands=None): + def load_from_file(*args, **kwargs): + return load_fixture("iosxr_ospf_interfaces.cfg") + + self.execute_show_command.side_effect = load_from_file + + def test_iosxr_ospf_interfaces_merged(self): + set_module_args( + dict( + config=[ + dict( + name="GigabitEthernet0/0/0/1", + type="gigabitethernet", + address_family=[ + dict( + afi="ipv4", + processes=[ + dict( + process_id="LAB1", + area=dict(area_id="0.0.0.3"), + ) + ], + cost=10, + authentication=dict( + message_digest=dict(keychain="iosxr") + ), + ) + ], + ) + ], + state="merged", + ) + ) + commands = [ + "router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 cost 10", + "router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 authentication message-digest", + "router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 authentication message-digest keychain iosxr", + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_iosxr_ospf_interfaces_merged_idempotent(self): + set_module_args( + dict( + config=[ + dict( + name="GigabitEthernet0/0/0/0", + type="gigabitethernet", + address_family=[ + dict( + afi="ipv4", + processes=[ + dict( + process_id="LAB3", + area=dict(area_id="0.0.0.3"), + ) + ], + cost=20, + authentication=dict( + message_digest=dict(keychain="cisco") + ), + ) + ], + ) + ], + state="merged", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_iosxr_ospf_interfaces_replaced(self): + set_module_args( + dict( + config=[ + dict( + name="GigabitEthernet0/0/0/0", + type="gigabitethernet", + address_family=[ + dict( + afi="ipv4", + processes=[ + dict( + process_id="LAB3", + area=dict(area_id="0.0.0.3"), + ) + ], + cost=40, + authentication=dict( + message_digest=dict(keychain="ciscoiosxr") + ), + ) + ], + ) + ], + state="replaced", + ) + ) + commands = [ + "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 cost 40", + "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest", + "router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0 authentication message-digest keychain ciscoiosxr", + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_iosxr_ospf_interfaces_replaced_idempotent(self): + set_module_args( + dict( + config=[ + dict( + name="GigabitEthernet0/0/0/0", + type="gigabitethernet", + address_family=[ + dict( + afi="ipv4", + processes=[ + dict( + process_id="LAB3", + area=dict(area_id="0.0.0.3"), + ) + ], + cost=20, + authentication=dict( + message_digest=dict(keychain="cisco") + ), + ) + ], + ) + ], + state="replaced", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_iosxr_ospf_interfaces_overridden(self): + set_module_args( + dict( + config=[ + dict( + name="GigabitEthernet0/0/0/4", + type="gigabitethernet", + address_family=[ + dict( + afi="ipv4", + processes=[ + dict( + process_id="LAB4", + area=dict(area_id="0.0.0.4"), + ) + ], + cost=40, + authentication=dict( + message_digest=dict(keychain="iosxr") + ), + ) + ], + ) + ], + state="overridden", + ) + ) + + commands = [ + "no router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0", + "router ospf LAB4 area 0.0.0.4 interface GigabitEthernet 0/0/0/4 cost 40", + "router ospf LAB4 area 0.0.0.4 interface GigabitEthernet 0/0/0/4 authentication message-digest", + "router ospf LAB4 area 0.0.0.4 interface GigabitEthernet 0/0/0/4 authentication message-digest keychain iosxr", + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_iosxr_ospf_interfaces_overridden_idempotent(self): + set_module_args( + dict( + config=[ + dict( + name="GigabitEthernet0/0/0/0", + type="gigabitethernet", + address_family=[ + dict( + afi="ipv4", + processes=[ + dict( + process_id="LAB3", + area=dict(area_id="0.0.0.3"), + ) + ], + cost=20, + authentication=dict( + message_digest=dict(keychain="cisco") + ), + ) + ], + ) + ], + state="overridden", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_iosxr_ospf_interfaces_deleted(self): + set_module_args( + dict( + config=[ + dict(name="GigabitEthernet0/0/0/0", type="gigabitethernet") + ], + state="deleted", + ) + ) + commands = [ + "no router ospf LAB3 area 0.0.0.3 interface GigabitEthernet 0/0/0/0" + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_iosxr_ospf_interfaces_deleted_idempotent(self): + set_module_args( + dict( + config=[ + dict(name="GigabitEthernet0/0/0/1", type="gigabitethernet") + ], + state="deleted", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_iosxr_ospf_interfaces_parsed(self): + set_module_args( + dict( + running_config="router ospf LAB3\n area 0.0.0.3\n interface GigabitEthernet0/0/0/0\n cost 20\n !\n !\n!", + state="parsed", + ) + ) + result = self.execute_module(changed=False) + parsed_list = [ + dict( + name="GigabitEthernet0/0/0/0", + type="gigabitethernet", + address_family=[ + dict( + afi="ipv4", + processes=[ + dict( + process_id="LAB3", area=dict(area_id="0.0.0.3") + ) + ], + cost=20, + ) + ], + ) + ] + self.assertEqual(parsed_list, result["parsed"]) + + def test_iosxr_ospf_interfaces_rendered(self): + set_module_args( + dict( + config=[ + dict( + name="GigabitEthernet0/0/0/1", + type="gigabitethernet", + address_family=[ + dict( + afi="ipv4", + processes=[ + dict( + process_id="LAB1", + area=dict(area_id="0.0.0.3"), + ) + ], + cost=10, + authentication=dict( + message_digest=dict(keychain="iosxr") + ), + ) + ], + ) + ], + state="rendered", + ) + ) + commands = [ + "router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 cost 10", + "router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 authentication message-digest", + "router ospf LAB1 area 0.0.0.3 interface GigabitEthernet 0/0/0/1 authentication message-digest keychain iosxr", + ] + result = self.execute_module(changed=False) + self.assertEqual(sorted(result["rendered"]), sorted(commands)) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospfv2.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospfv2.py new file mode 100644 index 00000000..876cd3e2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospfv2.py @@ -0,0 +1,275 @@ +# +# (c) 2019, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch +from ansible_collections.cisco.iosxr.plugins.modules import iosxr_ospfv2 +from ansible_collections.cisco.iosxr.tests.unit.modules.utils import ( + set_module_args, +) +from .iosxr_module import TestIosxrModule, load_fixture + + +class TestIosxrOspfV2Module(TestIosxrModule): + module = iosxr_ospfv2 + + def setUp(self): + super(TestIosxrOspfV2Module, self).setUp() + + self.mock_get_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config" + ) + self.get_config = self.mock_get_config.start() + + self.mock_load_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_get_resource_connection_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base." + "get_resource_connection" + ) + self.get_resource_connection_config = ( + self.mock_get_resource_connection_config.start() + ) + + self.mock_get_resource_connection_facts = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.resource_module." + "get_resource_connection" + ) + self.get_resource_connection_facts = ( + self.mock_get_resource_connection_facts.start() + ) + + self.mock_edit_config = patch( + "ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.providers.providers.CliProvider.edit_config" + ) + self.edit_config = self.mock_edit_config.start() + + self.mock_execute_show_command = patch( + "ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.ospfv2.ospfv2." + "Ospfv2Facts.get_ospfv2_data" + ) + self.execute_show_command = self.mock_execute_show_command.start() + + def tearDown(self): + super(TestIosxrOspfV2Module, self).tearDown() + self.mock_get_resource_connection_config.stop() + self.mock_get_resource_connection_facts.stop() + self.mock_edit_config.stop() + self.mock_get_config.stop() + self.mock_load_config.stop() + self.mock_execute_show_command.stop() + + def load_fixtures(self, commands=None): + def load_from_file(*args, **kwargs): + return load_fixture("iosxr_ospfv2.cfg") + + self.execute_show_command.side_effect = load_from_file + + def test_iosxr_ospfv2_merged(self): + set_module_args( + dict( + config=dict( + processes=[ + dict( + process_id="300", + default_metric=10, + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ) + ] + ), + state="merged", + ) + ) + commands = [ + "router ospf 300", + "cost 2", + "default-metric 10", + "area 11 default-cost 5", + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_iosxr_ospfv2_merged_idempotent(self): + set_module_args( + dict( + config=dict( + processes=[ + dict( + process_id="30", + default_metric=10, + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ) + ] + ), + state="merged", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_iosxr_ospfv2_replaced(self): + set_module_args( + dict( + config=dict( + processes=[ + dict( + process_id="30", + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ), + dict( + process_id="40", + default_metric=10, + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ), + ] + ), + state="replaced", + ) + ) + commands = [ + "router ospf 30", + "no default-metric 10", + "router ospf 40", + "cost 2", + "default-metric 10", + "area 11 default-cost 5", + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_iosxr_ospfv2_replaced_idempotent(self): + set_module_args( + dict( + config=dict( + processes=[ + dict( + process_id="30", + default_metric=10, + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ) + ] + ), + state="replaced", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_iosxr_ospfv2_overridden(self): + set_module_args( + dict( + config=dict( + processes=[ + dict( + process_id="40", + default_metric=10, + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ) + ] + ), + state="overridden", + ) + ) + + commands = [ + "router ospf 30", + "no cost 2", + "no default-metric 10", + "no area 11 default-cost 5", + "router ospf 40", + "cost 2", + "default-metric 10", + "area 11 default-cost 5", + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_iosxr_ospfv2_overridden_idempotent(self): + set_module_args( + dict( + config=dict( + processes=[ + dict( + process_id="30", + default_metric=10, + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ) + ] + ), + state="overridden", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_iosxr_ospfv2_deleted(self): + set_module_args( + dict( + config=dict(processes=[dict(process_id="30", cost=2)]), + state="deleted", + ) + ) + commands = [ + "router ospf 30", + "no cost 2", + "no default-metric 10", + "no area 11 default-cost 5", + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_iosxr_ospfv2_parsed(self): + set_module_args( + dict( + running_config="router ospf 50\n cost 2\n area 11\n default-cost 5\n !\n!", + state="parsed", + ) + ) + result = self.execute_module(changed=False) + parsed_list = { + "processes": [ + dict( + process_id="50", + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ) + ] + } + self.assertEqual(parsed_list, result["parsed"]) + + def test_iosxr_ospfv2_rendered(self): + set_module_args( + dict( + config=dict( + processes=[ + dict( + process_id="60", + default_metric=10, + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ) + ] + ), + state="rendered", + ) + ) + commands = [ + "area 11 default-cost 5", + "cost 2", + "default-metric 10", + "router ospf 60", + ] + result = self.execute_module(changed=False) + self.assertEqual(sorted(result["rendered"]), commands) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospfv3.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospfv3.py new file mode 100644 index 00000000..229fe68a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospfv3.py @@ -0,0 +1,275 @@ +# +# (c) 2019, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch +from ansible_collections.cisco.iosxr.plugins.modules import iosxr_ospfv3 +from ansible_collections.cisco.iosxr.tests.unit.modules.utils import ( + set_module_args, +) +from .iosxr_module import TestIosxrModule, load_fixture + + +class TestIosxrOspfV3Module(TestIosxrModule): + module = iosxr_ospfv3 + + def setUp(self): + super(TestIosxrOspfV3Module, self).setUp() + + self.mock_get_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config" + ) + self.get_config = self.mock_get_config.start() + + self.mock_load_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_get_resource_connection_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base." + "get_resource_connection" + ) + self.get_resource_connection_config = ( + self.mock_get_resource_connection_config.start() + ) + + self.mock_get_resource_connection_facts = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.resource_module." + "get_resource_connection" + ) + self.get_resource_connection_facts = ( + self.mock_get_resource_connection_facts.start() + ) + + self.mock_edit_config = patch( + "ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.providers.providers.CliProvider.edit_config" + ) + self.edit_config = self.mock_edit_config.start() + + self.mock_execute_show_command = patch( + "ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.ospfv3.ospfv3." + "Ospfv3Facts.get_ospfv3_data" + ) + self.execute_show_command = self.mock_execute_show_command.start() + + def tearDown(self): + super(TestIosxrOspfV3Module, self).tearDown() + self.mock_get_resource_connection_config.stop() + self.mock_get_resource_connection_facts.stop() + self.mock_edit_config.stop() + self.mock_get_config.stop() + self.mock_load_config.stop() + self.mock_execute_show_command.stop() + + def load_fixtures(self, commands=None): + def load_from_file(*args, **kwargs): + return load_fixture("iosxr_ospfv3.cfg") + + self.execute_show_command.side_effect = load_from_file + + def test_iosxr_ospfv3_merged(self): + set_module_args( + dict( + config=dict( + processes=[ + dict( + process_id="300", + default_metric=10, + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ) + ] + ), + state="merged", + ) + ) + commands = [ + "router ospfv3 300", + "cost 2", + "default-metric 10", + "area 11 default-cost 5", + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_iosxr_ospfv3_merged_idempotent(self): + set_module_args( + dict( + config=dict( + processes=[ + dict( + process_id="30", + default_metric=10, + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ) + ] + ), + state="merged", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_iosxr_ospfv3_replaced(self): + set_module_args( + dict( + config=dict( + processes=[ + dict( + process_id="30", + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ), + dict( + process_id="40", + default_metric=10, + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ), + ] + ), + state="replaced", + ) + ) + commands = [ + "router ospfv3 30", + "no default-metric 10", + "router ospfv3 40", + "cost 2", + "default-metric 10", + "area 11 default-cost 5", + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_iosxr_ospfv3_replaced_idempotent(self): + set_module_args( + dict( + config=dict( + processes=[ + dict( + process_id="30", + default_metric=10, + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ) + ] + ), + state="replaced", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_iosxr_ospfv3_overridden(self): + set_module_args( + dict( + config=dict( + processes=[ + dict( + process_id="40", + default_metric=10, + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ) + ] + ), + state="overridden", + ) + ) + + commands = [ + "router ospfv3 30", + "no cost 2", + "no default-metric 10", + "no area 11 default-cost 5", + "router ospfv3 40", + "cost 2", + "default-metric 10", + "area 11 default-cost 5", + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_iosxr_ospfv3_overridden_idempotent(self): + set_module_args( + dict( + config=dict( + processes=[ + dict( + process_id="30", + default_metric=10, + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ) + ] + ), + state="overridden", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_iosxr_ospfv3_deleted(self): + set_module_args( + dict( + config=dict(processes=[dict(process_id="30", cost=2)]), + state="deleted", + ) + ) + commands = [ + "router ospfv3 30", + "no cost 2", + "no default-metric 10", + "no area 11 default-cost 5", + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_iosxr_ospfv3_parsed(self): + set_module_args( + dict( + running_config="router ospfv3 50\n cost 2\n area 11\n default-cost 5\n !\n!", + state="parsed", + ) + ) + result = self.execute_module(changed=False) + parsed_list = { + "processes": [ + dict( + process_id="50", + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ) + ] + } + self.assertEqual(parsed_list, result["parsed"]) + + def test_iosxr_ospfv3_rendered(self): + set_module_args( + dict( + config=dict( + processes=[ + dict( + process_id="60", + default_metric=10, + cost=2, + areas=[dict(area_id="11", default_cost=5)], + ) + ] + ), + state="rendered", + ) + ) + commands = [ + "area 11 default-cost 5", + "cost 2", + "default-metric 10", + "router ospfv3 60", + ] + result = self.execute_module(changed=False) + self.assertEqual(sorted(result["rendered"]), commands) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_static_routes.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_static_routes.py new file mode 100644 index 00000000..448078be --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_static_routes.py @@ -0,0 +1,338 @@ +# +# (c) 2019, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch +from ansible_collections.cisco.iosxr.plugins.modules import iosxr_static_routes +from ansible_collections.cisco.iosxr.tests.unit.modules.utils import ( + set_module_args, +) +from .iosxr_module import TestIosxrModule, load_fixture + + +class TestIosxrStaticRoutesModule(TestIosxrModule): + module = iosxr_static_routes + + def setUp(self): + super(TestIosxrStaticRoutesModule, self).setUp() + + self.mock_get_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config" + ) + self.get_config = self.mock_get_config.start() + + self.mock_load_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_get_resource_connection_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection" + ) + self.get_resource_connection_config = ( + self.mock_get_resource_connection_config.start() + ) + + self.mock_get_resource_connection_facts = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + ) + self.get_resource_connection_facts = ( + self.mock_get_resource_connection_facts.start() + ) + + self.mock_execute_show_command = patch( + "ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.facts.static_routes.static_routes.Static_routesFacts.get_device_data" + ) + self.execute_show_command = self.mock_execute_show_command.start() + + def tearDown(self): + super(TestIosxrStaticRoutesModule, self).tearDown() + self.mock_get_resource_connection_config.stop() + self.mock_get_resource_connection_facts.stop() + self.mock_get_config.stop() + self.mock_load_config.stop() + self.mock_execute_show_command.stop() + + def load_fixtures(self, commands=None): + def load_from_file(*args, **kwargs): + return load_fixture("iosxr_static_routes_config.cfg") + + self.execute_show_command.side_effect = load_from_file + + def test_iosxr_static_routes_merged(self): + set_module_args( + dict( + config=[ + dict( + vrf="dev_site", + address_families=[ + dict( + afi="ipv6", + safi="unicast", + routes=[ + dict( + dest="1200:10::/64", + next_hops=[ + dict( + interface="GigabitEthernet0/0/0/1", + admin_distance=55, + ) + ], + ) + ], + ) + ], + ) + ], + state="merged", + ) + ) + commands = [ + "router static", + "vrf dev_site", + "address-family ipv6 unicast", + "1200:10::/64 GigabitEthernet0/0/0/1 55", + ] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_static_routes_merged_idempotent(self): + set_module_args( + dict( + config=[ + dict( + vrf="DEV_SITE", + address_families=[ + dict( + afi="ipv4", + safi="unicast", + routes=[ + dict( + dest="192.0.2.48/28", + next_hops=[ + dict( + interface="192.0.2.12", + description="DEV", + dest_vrf="test_1", + ) + ], + ) + ], + ) + ], + ) + ], + state="merged", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_iosxr_static_routes_default(self): + set_module_args( + dict( + config=[ + dict( + address_families=[ + dict( + afi="ipv4", + safi="unicast", + routes=[ + dict( + dest="192.168.1.0/24", + next_hops=[ + dict( + interface="GigabitEthernet0/0/0/2", + track="ip_sla_2", + vrflabel=1200, + ) + ], + ) + ], + ) + ] + ) + ] + ) + ) + commands = [ + "router static", + "address-family ipv4 unicast", + "192.168.1.0/24 GigabitEthernet0/0/0/2 track ip_sla_2 vrflabel 1200", + ] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_static_routes_default_idempotent(self): + set_module_args( + dict( + config=[ + dict( + address_families=[ + dict( + afi="ipv4", + safi="unicast", + routes=[ + dict( + dest="192.0.2.32/28", + next_hops=[ + dict( + forward_router_address="192.0.2.11", + admin_distance=100, + ) + ], + ) + ], + ) + ] + ) + ] + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_iosxr_static_routes_replaced(self): + set_module_args( + dict( + config=[ + dict( + address_families=[ + dict( + afi="ipv4", + safi="unicast", + routes=[ + dict( + dest="192.0.2.16/28", + next_hops=[ + dict( + forward_router_address="192.0.2.11", + admin_distance=100, + ) + ], + ) + ], + ) + ] + ) + ], + state="replaced", + ) + ) + commands = [ + "router static", + "address-family ipv4 unicast", + "no 192.0.2.16/28 192.0.2.10 FastEthernet0/0/0/1", + "no 192.0.2.16/28 FastEthernet0/0/0/5", + "192.0.2.16/28 192.0.2.11 100", + ] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_static_routes_replaced_idempotent(self): + set_module_args( + dict( + config=[ + dict( + address_families=[ + dict( + afi="ipv4", + safi="unicast", + routes=[ + dict( + dest="192.0.2.16/28", + next_hops=[ + dict( + interface="FastEthernet0/0/0/5", + track="ip_sla_1", + ), + dict( + interface="FastEthernet0/0/0/1", + forward_router_address="192.0.2.10", + tag=10, + description="LAB", + metric=120, + ), + ], + ) + ], + ) + ] + ) + ], + state="replaced", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_iosxr_static_routes_overridden(self): + set_module_args( + dict( + config=[ + dict( + vrf="DEV_SITE_NEW", + address_families=[ + dict( + afi="ipv4", + safi="unicast", + routes=[ + dict( + dest="192.0.4.16/28", + next_hops=[ + dict( + interface="FastEthernet0/0/0/5", + track="ip_sla_1", + ), + dict( + interface="FastEthernet0/0/0/1", + forward_router_address="192.0.2.10", + tag=10, + description="LAB", + metric=120, + ), + ], + ) + ], + ) + ], + ) + ], + state="overridden", + ) + ) + commands = [ + "router static", + "no address-family ipv4 unicast", + "no address-family ipv6 unicast", + "no vrf DEV_SITE", + "vrf DEV_SITE_NEW", + "address-family ipv4 unicast", + "192.0.4.16/28 192.0.2.10 FastEthernet0/0/0/1 description LAB metric 120 tag 10", + "192.0.4.16/28 FastEthernet0/0/0/5 track ip_sla_1", + ] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_static_routes_deleted_afi(self): + set_module_args( + dict( + config=[ + dict(address_families=[dict(afi="ipv4", safi="unicast")]) + ], + state="deleted", + ) + ) + + commands = ["router static", "no address-family ipv4 unicast"] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_static_routes_deleted_vrf(self): + set_module_args(dict(config=[dict(vrf="DEV_SITE")], state="deleted")) + + commands = ["router static", "no vrf DEV_SITE"] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_static_routes_deleted_all(self): + set_module_args(dict(state="deleted")) + + commands = ["no router static"] + self.execute_module(changed=True, commands=commands) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_system.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_system.py new file mode 100644 index 00000000..60bdee83 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_system.py @@ -0,0 +1,123 @@ +# (c) 2016 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch +from ansible_collections.cisco.iosxr.tests.unit.modules.utils import ( + set_module_args, +) +from .iosxr_module import TestIosxrModule, load_fixture +from ansible_collections.cisco.iosxr.plugins.modules import iosxr_system + + +class TestIosxrSystemModule(TestIosxrModule): + + module = iosxr_system + + def setUp(self): + super(TestIosxrSystemModule, self).setUp() + + self.mock_get_config = patch( + "ansible_collections.cisco.iosxr.plugins.modules.iosxr_system.get_config" + ) + self.get_config = self.mock_get_config.start() + + self.mock_load_config = patch( + "ansible_collections.cisco.iosxr.plugins.modules.iosxr_system.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_is_cliconf = patch( + "ansible_collections.cisco.iosxr.plugins.modules.iosxr_system.is_cliconf" + ) + self.is_cliconf = self.mock_is_cliconf.start() + + def tearDown(self): + super(TestIosxrSystemModule, self).tearDown() + + self.mock_get_config.stop() + self.mock_load_config.stop() + + def load_fixtures(self, commands=None): + self.get_config.return_value = load_fixture("iosxr_system_config.cfg") + self.load_config.return_value = dict(diff=None, session="session") + self.is_cliconf.return_value = True + + def test_iosxr_system_hostname_changed(self): + set_module_args(dict(hostname="foo")) + commands = ["hostname foo", "no domain lookup disable"] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_system_domain_name(self): + set_module_args(dict(domain_name="test.com")) + commands = ["domain name test.com", "no domain lookup disable"] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_system_domain_search(self): + set_module_args(dict(domain_search=["ansible.com", "redhat.com"])) + commands = [ + "domain list ansible.com", + "no domain list cisco.com", + "no domain lookup disable", + ] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_system_lookup_source(self): + set_module_args(dict(lookup_source="Ethernet1")) + commands = [ + "domain lookup source-interface Ethernet1", + "no domain lookup disable", + ] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_system_lookup_enabled(self): + set_module_args(dict(lookup_enabled=True)) + commands = ["no domain lookup disable"] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_system_name_servers(self): + name_servers = ["8.8.8.8", "8.8.4.4", "1.1.1.1"] + set_module_args(dict(name_servers=name_servers)) + self.execute_module(changed=True) + + def test_iosxr_system_state_absent(self): + set_module_args(dict(state="absent")) + commands = [ + "no hostname", + "no domain name", + "no domain lookup disable", + "no domain lookup source-interface MgmtEth0/0/CPU0/0", + "no domain list redhat.com", + "no domain list cisco.com", + "no domain name-server 8.8.8.8", + "no domain name-server 8.8.4.4", + ] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_system_no_change(self): + set_module_args( + dict( + hostname="iosxr01", + domain_name="eng.ansible.com", + lookup_enabled=False, + ) + ) + self.execute_module() diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_user.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_user.py new file mode 100644 index 00000000..1f546c9d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_user.py @@ -0,0 +1,129 @@ +# (c) 2016 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch +from ansible_collections.cisco.iosxr.plugins.modules import iosxr_user +from ansible_collections.cisco.iosxr.tests.unit.modules.utils import ( + set_module_args, +) +from .iosxr_module import TestIosxrModule, load_fixture + + +class TestIosxrUserModule(TestIosxrModule): + + module = iosxr_user + + def setUp(self): + super(TestIosxrUserModule, self).setUp() + + self.mock_get_config = patch( + "ansible_collections.cisco.iosxr.plugins.modules.iosxr_user.get_config" + ) + self.get_config = self.mock_get_config.start() + + self.mock_load_config = patch( + "ansible_collections.cisco.iosxr.plugins.modules.iosxr_user.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_is_cliconf = patch( + "ansible_collections.cisco.iosxr.plugins.modules.iosxr_user.is_cliconf" + ) + self.is_cliconf = self.mock_is_cliconf.start() + + def tearDown(self): + super(TestIosxrUserModule, self).tearDown() + + self.mock_get_config.stop() + self.mock_load_config.stop() + self.mock_is_cliconf.stop() + + def load_fixtures(self, commands=None, transport="cli"): + self.get_config.return_value = load_fixture("iosxr_user_config.cfg") + self.load_config.return_value = dict(diff=None, session="session") + self.is_cliconf.return_value = True + + def test_iosxr_user_delete(self): + set_module_args(dict(name="ansible", state="absent")) + result = self.execute_module(changed=True) + self.assertEqual(result["commands"], ["no username ansible"]) + + def test_iosxr_user_password(self): + set_module_args(dict(name="ansible", configured_password="test")) + result = self.execute_module(changed=True) + self.assertEqual(result["commands"], ["username ansible secret test"]) + + def test_iosxr_user_purge(self): + set_module_args(dict(purge=True)) + result = self.execute_module(changed=True) + self.assertEqual(result["commands"], ["no username ansible"]) + + def test_iosxr_user_group(self): + set_module_args(dict(name="ansible", group="sysadmin")) + result = self.execute_module(changed=True) + self.assertEqual( + result["commands"], ["username ansible group sysadmin"] + ) + + def test_iosxr_user_update_password_changed(self): + set_module_args( + dict( + name="test", + configured_password="test", + update_password="on_create", + ) + ) + result = self.execute_module(changed=True) + self.assertEqual( + result["commands"], ["username test", "username test secret test"] + ) + + def test_iosxr_user_update_password_on_create_ok(self): + set_module_args( + dict( + name="ansible", + configured_password="test", + update_password="on_create", + ) + ) + self.execute_module() + + def test_iosxr_user_update_password_always(self): + set_module_args( + dict( + name="ansible", + configured_password="test", + update_password="always", + ) + ) + result = self.execute_module(changed=True) + self.assertEqual(result["commands"], ["username ansible secret test"]) + + def test_iosxr_user_admin_mode(self): + set_module_args( + dict(name="ansible-2", configured_password="test-2", admin=True) + ) + result = self.execute_module(changed=True) + self.assertEqual( + result["commands"], + ["username ansible-2", "username ansible-2 secret test-2"], + ) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/utils.py b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/utils.py new file mode 100644 index 00000000..f6edc4b0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/modules/utils.py @@ -0,0 +1,51 @@ +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +import json + +from ansible_collections.cisco.iosxr.tests.unit.compat import unittest +from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch +from ansible.module_utils import basic +from ansible.module_utils._text import to_bytes + + +def set_module_args(args): + if "_ansible_remote_tmp" not in args: + args["_ansible_remote_tmp"] = "/tmp" + if "_ansible_keep_remote_files" not in args: + args["_ansible_keep_remote_files"] = False + + args = json.dumps({"ANSIBLE_MODULE_ARGS": args}) + basic._ANSIBLE_ARGS = to_bytes(args) + + +class AnsibleExitJson(Exception): + pass + + +class AnsibleFailJson(Exception): + pass + + +def exit_json(*args, **kwargs): + if "changed" not in kwargs: + kwargs["changed"] = False + raise AnsibleExitJson(kwargs) + + +def fail_json(*args, **kwargs): + kwargs["failed"] = True + raise AnsibleFailJson(kwargs) + + +class ModuleTestCase(unittest.TestCase): + def setUp(self): + self.mock_module = patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) + self.mock_module.start() + self.mock_sleep = patch("time.sleep") + self.mock_sleep.start() + set_module_args({}) + self.addCleanup(self.mock_module.stop) + self.addCleanup(self.mock_sleep.stop) diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/requirements.txt b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/requirements.txt new file mode 100644 index 00000000..a9772bea --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tests/unit/requirements.txt @@ -0,0 +1,42 @@ +boto3 +placebo +pycrypto +passlib +pypsrp +python-memcached +pytz +pyvmomi +redis +requests +setuptools > 0.6 # pytest-xdist installed via requirements does not work with very old setuptools (sanity_ok) +unittest2 ; python_version < '2.7' +importlib ; python_version < '2.7' +netaddr +ipaddress +netapp-lib +solidfire-sdk-python + +# requirements for F5 specific modules +f5-sdk ; python_version >= '2.7' +f5-icontrol-rest ; python_version >= '2.7' +deepdiff + +# requirement for Fortinet specific modules +pyFMG + +# requirement for aci_rest module +xmljson + +# requirement for winrm connection plugin tests +pexpect + +# requirement for the linode module +linode-python # APIv3 +linode_api4 ; python_version > '2.6' # APIv4 + +# requirement for the gitlab module +python-gitlab +httmock + +# requirment for kubevirt modules +openshift ; python_version >= '2.7' diff --git a/collections-debian-merged/ansible_collections/cisco/iosxr/tox.ini b/collections-debian-merged/ansible_collections/cisco/iosxr/tox.ini new file mode 100644 index 00000000..3da0118f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/iosxr/tox.ini @@ -0,0 +1,32 @@ +[tox] +minversion = 1.4.2 +envlist = linters +skipsdist = True + +[testenv] +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +[testenv:black] +install_command = pip install {opts} {packages} +commands = + black -v -l79 {toxinidir} + +[testenv:linters] +install_command = pip install {opts} {packages} +commands = + black -v -l79 --diff --check {toxinidir} + flake8 {posargs} + yamllint -s . + +[testenv:venv] +commands = {posargs} + +[flake8] +# E123, E125 skipped as they are invalid PEP-8. + +show-source = True +ignore = E123,E125,E402,W503 +max-line-length = 160 +builtins = _ +exclude = .git,.tox,tests/unit/compat/ -- cgit v1.2.3